session master changes done

This commit is contained in:
gandhimathi 2018-04-20 13:08:58 +05:30
parent 5ce3062f08
commit 870625412f

View File

@ -20,6 +20,7 @@ class SeesionMaster_model extends CI_Model {
$this->db->select('SessionName'); $this->db->select('SessionName');
$this->db->where('SessionName', $arrayDetails['SessionName']); $this->db->where('SessionName', $arrayDetails['SessionName']);
$this->db->where('BranchCode', $arrayDetails['BranchCode']);
if($this->db->get(SESSIONMASTER)->first_row()){ if($this->db->get(SESSIONMASTER)->first_row()){
$result['sessionStatus'] = false; $result['sessionStatus'] = false;
$result['message'] ="This sessions is already exist."; $result['message'] ="This sessions is already exist.";
@ -30,6 +31,7 @@ class SeesionMaster_model extends CI_Model {
$insertMaster['CreatedBy']=$arrayDetails['CreatedBy']; $insertMaster['CreatedBy']=$arrayDetails['CreatedBy'];
$insertMaster['IsActive']=$arrayDetails['IsActive']; $insertMaster['IsActive']=$arrayDetails['IsActive'];
$insertMaster['CreatedOn']=$arrayDetails['CreatedOn']; $insertMaster['CreatedOn']=$arrayDetails['CreatedOn'];
$insertMaster['BranchCode']=$arrayDetails['BranchCode'];
$this->db->insert(SESSIONMASTER, $insertMaster); $this->db->insert(SESSIONMASTER, $insertMaster);
@ -66,13 +68,15 @@ class SeesionMaster_model extends CI_Model {
* created by kms * created by kms
* */ * */
public function getSession() public function getSession($requestedBy=null,$branchCode=null)
{ {
$this->db->select('SM.SessionID,SM.SessionDate,SM.SessionName,GROUP_CONCAT(SD.UniversityID) as UniversityID,GROUP_CONCAT(SM.SessionID) as GrpID,SM.IsActive,GROUP_CONCAT(US.UniversityName) as UniversityName'); $this->db->select('SM.SessionID,SM.SessionDate,SM.SessionName,GROUP_CONCAT(SD.UniversityID) as UniversityID,GROUP_CONCAT(SM.SessionID) as GrpID,SM.IsActive,GROUP_CONCAT(US.UniversityName) as UniversityName');
$this->db->from(SESSIONMASTER.' as SM'); $this->db->from(SESSIONMASTER.' as SM');
$this->db->join(SESSIONDETAILS.' as SD', 'SM.SessionID = SD.SessionID'); $this->db->join(SESSIONDETAILS.' as SD', 'SM.SessionID = SD.SessionID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = SD.UniversityID'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = SD.UniversityID');
$this->db->where('SD.IsActive','1'); $this->db->where('SD.IsActive','1');
$this->db->where('SM.BranchCode',$branchCode);
$this->db->where('US.BranchCode',$branchCode);
$this->db->order_by('SM.SessionID','DESC'); $this->db->order_by('SM.SessionID','DESC');
$this->db->group_by('SM.SessionID','DESC'); $this->db->group_by('SM.SessionID','DESC');
$sessionDetails = $this->db->get(); $sessionDetails = $this->db->get();
@ -87,7 +91,7 @@ class SeesionMaster_model extends CI_Model {
} }
// load batch model for get university details // load batch model for get university details
$this->load->model('Batch_model', 'batch'); $this->load->model('Batch_model', 'batch');
$result['universityDetails'] = $this->batch->getUniversityDetails(); $result['universityDetails'] = $this->batch->getUniversityDetails($requestedBy,$branchCode);
return $result; return $result;
@ -102,6 +106,7 @@ class SeesionMaster_model extends CI_Model {
{ {
$this->db->select('SessionName'); $this->db->select('SessionName');
$this->db->where('SessionName', $arrayDetails['SessionName']); $this->db->where('SessionName', $arrayDetails['SessionName']);
$this->db->where('BranchCode', $arrayDetails['BranchCode']);
$this->db->where('SessionID !=', $arrayDetails['SessionID']); $this->db->where('SessionID !=', $arrayDetails['SessionID']);
if($this->db->get(SESSIONMASTER)->first_row()){ if($this->db->get(SESSIONMASTER)->first_row()){
$result['sessionStatus'] = false; $result['sessionStatus'] = false;
@ -109,6 +114,7 @@ class SeesionMaster_model extends CI_Model {
} }
else{ else{
$this->db->where('SessionID', $arrayDetails['SessionID']); $this->db->where('SessionID', $arrayDetails['SessionID']);
$this->db->where('BranchCode', $arrayDetails['BranchCode']);
$upateStatus=$this->db->update(SESSIONMASTER, $arrayDetails); $upateStatus=$this->db->update(SESSIONMASTER, $arrayDetails);
if($upateStatus){ if($upateStatus){
@ -174,11 +180,12 @@ class SeesionMaster_model extends CI_Model {
* Get university details * Get university details
* created by kms * created by kms
* */ * */
public function getUniversityDetails()//doubt public function getUniversityDetails($requestedBy,$branchCode)
{ {
$this->db->select('UniversityID,UniversityName'); $this->db->select('UniversityID,UniversityName');
$this->db->order_by('UniversityID','ASC'); $this->db->order_by('UniversityID','ASC');
$this->db->where('IsActive','1'); $this->db->where('IsActive','1');
$this->db->where('BranchCode',$branchCode);
// $this->db->where_not_in('ID', $id); // $this->db->where_not_in('ID', $id);
$universityDetails = $this->db->get(UNIVERSITY); $universityDetails = $this->db->get(UNIVERSITY);
return $universityDetails->result(); return $universityDetails->result();