From 89ec974388b46ea031fe0b507cff62094735ac4b Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 6 Mar 2018 18:40:35 +0530 Subject: [PATCH] course details changes done --- .../application/models/Fees_status_model.php | 102 +++++++++++++++--- 1 file changed, 89 insertions(+), 13 deletions(-) diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index bd26f2d8..5f2e753e 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -17,11 +17,11 @@ class Fees_status_model extends CI_Model public function getStudentList($search=null) { if($search['MobileNumber']!='' OR $search['Firstname']!='' OR $search['UniversityID']!='' OR $search['CourseID']!=''){ - $this->db->select('ST.StudentID,ST.MobileNumber,ST.Firstname,ST.Fathername,ST.EmailID,STC.ID,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,SM.SessionID,SM.SessionName'); + $this->db->select('ST.StudentID,ST.MobileNumber,ST.Firstname,ST.Fathername,ST.EmailID,STC.ID,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName'); $this->db->from(STUDENTS.' as ST'); $this->db->join(STUDENTCOURSE.' as STC', 'STC.StudentID = ST.StudentID'); $this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID'); - $this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = STC.SessionID'); + // $this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = STC.SessionID'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID'); $this->db->where('ST.IsActive','1'); $this->db->where('STC.IsActive','1'); @@ -80,8 +80,10 @@ class Fees_status_model extends CI_Model public function getStudentFeesStructure($student=null){ - $this->db->select('CF.ID,CF.Sem_Year,SFS.FeesID,SFS.CourseID,SFS.CourseFees,SFS.STFOrWR,SFS.Waiver,SFS.Others,SFS.SessionName,SFS.RollNo,CU.PC,CU.TC,CU.DC,CU.MC,CU.OtherFees'); + $this->db->select('CF.ID,CF.Sem_Year,SFS.FeesID,SFS.CourseID,SFS.CourseFees,SFS.STFOrWR,SFS.Waiver,SFS.Others,SFS.RollNo,CU.PC,CU.TC,CU.DC,CU.MC,CU.OtherFees,SM.SessionName as SessionName,SM1.SessionName as ToSessionName'); $this->db->from(STUDENTS_FEES_STATUS.' as SFS'); + $this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = SFS.SessionName'); + $this->db->join(SESSIONMASTER.' as SM1', 'SM1.SessionID = SFS.ToSessionName','left'); $this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType'); $this->db->join(COURSE.' as CU', 'CU.CourseID = CF.CourseID'); $this->db->where('SFS.CourseID',$student['CourseID']); @@ -99,6 +101,13 @@ class Fees_status_model extends CI_Model $fetchData['Waiver'] = $row->Waiver; $fetchData['Others'] = $row->Others; $fetchData['SessionName'] = $row->SessionName; + if($row->ToSessionName=='' OR $row->ToSessionName==null){ + $fetchData['ToSessionName'] = "Not Applicable"; + } + else{ + $fetchData['ToSessionName'] = $row->ToSessionName; + } + $fetchData['RollNo'] = $row->RollNo; $fetchData['PayableFees']=$row->CourseFees+$row->STFOrWR+$row->Others-$row->Waiver; @@ -187,7 +196,8 @@ class Fees_status_model extends CI_Model $fetchData['STFOrWR'] = $row->STFOrWR; $fetchData['Waiver'] = $row->Waiver; $fetchData['Others'] = $row->Others; - $fetchData['SessionName'] = $row->SessionName; + $fetchData['SessionName'] = "Not Applicable"; + $fetchData['ToSessionName'] = "Not Applicable"; $fetchData['RollNo'] = $row->RollNo; $fetchData['PayableFees'] = $row->CourseFees + $row->STFOrWR + $row->Others - $row->Waiver; @@ -225,9 +235,11 @@ class Fees_status_model extends CI_Model public function existStudentFeesDetails($student=null){ $this->db->distinct(); - $this->db->select('SFS.FeesID,SFS.FeesType,SFS.SessionName,SFS.RollNo,ifnull(SFS.CourseFees,0) as CourseFees,ifnull(SFS.STFOrWR,0) as STFOrWR,ifnull(SFS.Waiver,0) as Waiver,ifnull(SFS.Others,0) as Others,ST.Firstname,ST.MobileNumber,ST.Fathername,CU.CourseName,CU.CourseID,CF.Sem_Year,STC.EnrollmentID,US.UniversityName'); + $this->db->select('SFS.FeesID,SFS.FeesType,SFS.RollNo,ifnull(SFS.CourseFees,0) as CourseFees,ifnull(SFS.STFOrWR,0) as STFOrWR,ifnull(SFS.Waiver,0) as Waiver,ifnull(SFS.Others,0) as Others,ST.Firstname,ST.MobileNumber,ST.Fathername,CU.CourseName,CU.CourseID,CF.Sem_Year,STC.EnrollmentID,US.UniversityName,SM.SessionName,SM1.SessionName as ToSessionName'); $this->db->from(STUDENTS_FEES_PAID.' as SFP'); $this->db->join(STUDENTS_FEES_STATUS.' as SFS','SFP.FeesId = SFS.FeesID'); + $this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = SFS.SessionName'); + $this->db->join(SESSIONMASTER.' as SM1', 'SM1.SessionID = SFS.ToSessionName','left'); $this->db->join(STUDENTS.' as ST', 'ST.StudentID = SFS.StudentID'); $this->db->join(COURSE.' as CU', 'CU.CourseID = SFS.CourseID'); $this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType'); @@ -245,6 +257,13 @@ class Fees_status_model extends CI_Model $storePaidDetails['FeesName'] = $feeRow->Sem_Year; $storePaidDetails['CourseFees'] = $feeRow->CourseFees; $storePaidDetails['SessionName'] = $feeRow->SessionName; + if($feeRow->ToSessionName=='' OR $feeRow->ToSessionName==null){ + $storePaidDetails['ToSessionName'] = "Not Applicable"; + } + else{ + $storePaidDetails['ToSessionName'] = $feeRow->ToSessionName; + } + $storePaidDetails['RollNo'] = $feeRow->RollNo; $storePaidDetails['STFOrWR'] = $feeRow->STFOrWR; $storePaidDetails['Waiver'] = $feeRow->Waiver; @@ -302,7 +321,7 @@ class Fees_status_model extends CI_Model public function existStudentCourseDefaultFees($student=null){ $serachArray = ["PC","TC","DC","MC","OTHER"]; $this->db->distinct(); - $this->db->select('SFS.FeesID,SFS.FeesType,SFS.SessionName,SFS.RollNo,ifnull(SFS.CourseFees,0) as CourseFees,ifnull(SFS.STFOrWR,0) as STFOrWR,ifnull(SFS.Waiver,0) as Waiver,ifnull(SFS.Others,0) as Others,ST.Firstname,ST.MobileNumber,ST.Fathername,CU.CourseName,CU.CourseID,STC.EnrollmentID,US.UniversityName'); + $this->db->select('SFS.FeesID,SFS.FeesType,SFS.SessionName,SFS.ToSessionName,SFS.RollNo,ifnull(SFS.CourseFees,0) as CourseFees,ifnull(SFS.STFOrWR,0) as STFOrWR,ifnull(SFS.Waiver,0) as Waiver,ifnull(SFS.Others,0) as Others,ST.Firstname,ST.MobileNumber,ST.Fathername,CU.CourseName,CU.CourseID,STC.EnrollmentID,US.UniversityName'); $this->db->from(STUDENTS_FEES_PAID.' as SFP'); $this->db->join(STUDENTS_FEES_STATUS.' as SFS','SFP.FeesId = SFS.FeesID'); $this->db->join(STUDENTS.' as ST', 'ST.StudentID = SFS.StudentID'); @@ -322,7 +341,8 @@ class Fees_status_model extends CI_Model $storePaidDetails['FeesID'] = $feeRow->FeesID; $storePaidDetails['FeesName'] = $feeRow->FeesType; $storePaidDetails['CourseFees'] = $feeRow->CourseFees; - $storePaidDetails['SessionName'] = $feeRow->SessionName; + $storePaidDetails['SessionName'] = "Not Applicable"; + $storePaidDetails['ToSessionName'] = "Not Applicable"; $storePaidDetails['RollNo'] = $feeRow->RollNo; $storePaidDetails['STFOrWR'] = $feeRow->STFOrWR; $storePaidDetails['Waiver'] = $feeRow->Waiver; @@ -639,20 +659,26 @@ class Fees_status_model extends CI_Model $this->db->where('CourseID',$student['CourseID']); $this->db->order_by('ProgramType'); $feesDetails = $this->db->get(COURSE_FEES); + $SNoValue=0; if($feesDetails->result()){ $result_array['feesStatus']=true; foreach ($feesDetails->result() as $row){ - $this->db->select('FeesID,CourseFees, STFOrWR,Waiver,Others,SessionName,RollNo,BatchCode'); - + $SNoValue=$SNoValue+1; + $this->db->select('SFS.FeesID,SFS.CourseFees,SFS.STFOrWR,SFS.Waiver,SFS.Others,SFS.SessionName,SFS.ToSessionName,SFS.RollNo,SFS.BatchCode,SM.SessionName as MasterSessionName,SM1.SessionName as MasterToSessionName'); + $this->db->from(STUDENTS_FEES_STATUS.' as SFS'); + $this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = SFS.SessionName'); + $this->db->join(SESSIONMASTER.' as SM1', 'SM1.SessionID = SFS.ToSessionName','left'); $this->db->where('StudentID',$student['StudentID']); $this->db->where('CourseID',$student['CourseID']); $this->db->where('FeesType',$row->ID); - $existFeesDetails = $this->db->get(STUDENTS_FEES_STATUS); + $existFeesDetails = $this->db->get(); if($existData=$existFeesDetails->result()){ + $fetchData['SNo']=$SNoValue; $fetchData['ExistValue']=1; $fetchData['ID']=$row->ID; $fetchData['CourseID']=$row->CourseID; + $fetchData['ProgramType']=$row->ProgramType; $fetchData['Sem_Year']=$row->Sem_Year; $fetchData['ActualFees']=$existData[0]->CourseFees; $fetchData['BatchCode']=$existData[0]->BatchCode; @@ -660,6 +686,15 @@ class Fees_status_model extends CI_Model $fetchData['Waiver']=$existData[0]->Waiver; $fetchData['Others']=$existData[0]->Others; $fetchData['SessionName']=$existData[0]->SessionName; + $fetchData['ToSessionName']=$existData[0]->ToSessionName; + $fetchData['MasterSessionName']=$existData[0]->MasterSessionName; + if($existData[0]->MasterToSessionName=='' OR $existData[0]->MasterToSessionName==null){ + $fetchData['MasterToSessionName']="Not Applicable"; + } + else{ + $fetchData['MasterToSessionName']=$existData[0]->MasterToSessionName; + } + $fetchData['RollNo']=$existData[0]->RollNo; $fetchData['PayableFees']=$existData[0]->CourseFees+$existData[0]->STFOrWR+$existData[0]->Others-$existData[0]->Waiver; // for installment details @@ -686,10 +721,11 @@ class Fees_status_model extends CI_Model } else{ + $fetchData['SNo']=$SNoValue; $fetchData['ExistValue']=0; $fetchData['ID']=$row->ID; $fetchData['CourseID']=$row->CourseID; - + $fetchData['ProgramType']=$row->ProgramType; $fetchData['Sem_Year']=$row->Sem_Year; $fetchData['ActualFees']=$row->FeesAmount; $fetchData['BatchCode']=""; @@ -697,6 +733,9 @@ class Fees_status_model extends CI_Model $fetchData['Waiver']=""; $fetchData['Others']=""; $fetchData['SessionName']=""; + $fetchData['ToSessionName']=""; + $fetchData['MasterSessionName']="Not Applicable"; + $fetchData['MasterToSessionName']="Not Applicable"; $fetchData['RollNo']=""; $fetchData['PayableFees']=$row->FeesAmount; // for installment details @@ -731,6 +770,8 @@ class Fees_status_model extends CI_Model $result_array['feesStatus']=false; } + $result_array['sessionDetails'] = $this->getSession($student); + return $result_array; } @@ -859,7 +900,7 @@ class Fees_status_model extends CI_Model // default course fees details in student status foreach ($myArray as $row1){ - $this->db->select('FeesID,CourseFees,STFOrWR,Waiver,Others,SessionName,RollNo'); + $this->db->select('FeesID,CourseFees,STFOrWR,Waiver,Others,SessionName,ToSessionName,RollNo'); $this->db->where('StudentID',$student['StudentID']); $this->db->where('CourseID',$student['CourseID']); $this->db->where('FeesType',$row1['Sem_Year']); @@ -869,12 +910,16 @@ class Fees_status_model extends CI_Model $fetchData['ExistValue']=1; $fetchData['ID']=$row1['Sem_Year']; $fetchData['CourseID']=$row1['CourseID']; + $fetchData['ProgramType']=$row1['Sem_Year']; $fetchData['Sem_Year']=$row1['Sem_Year']; $fetchData['ActualFees']=$existData[0]->CourseFees; $fetchData['STFOrWR']=$existData[0]->STFOrWR; $fetchData['Waiver']=$existData[0]->Waiver; $fetchData['Others']=$existData[0]->Others; $fetchData['SessionName']=$existData[0]->SessionName; + $fetchData['ToSessionName']=$existData[0]->ToSessionName; + $fetchData['MasterSessionName']="Not applicable"; + $fetchData['MasterToSessionName']="Not applicable"; $fetchData['RollNo']=$existData[0]->RollNo; $fetchData['PayableFees']=$existData[0]->CourseFees+$existData[0]->STFOrWR+$existData[0]->Others-$existData[0]->Waiver; // for installment details @@ -904,7 +949,10 @@ class Fees_status_model extends CI_Model $fetchData['STFOrWR']=""; $fetchData['Waiver']=""; $fetchData['Others']=""; - $fetchData['SessionName']="Nill"; + $fetchData['SessionName']="Not applicable"; + $fetchData['ToSessionName']="Not applicable"; + $fetchData['MasterSessionName']="Not applicable"; + $fetchData['MasterToSessionName']="Not applicable"; $fetchData['RollNo']=""; $fetchData['PayableFees']=$row1['ActualFees']; $fetchData['InstallmentDetails']=""; @@ -941,6 +989,7 @@ class Fees_status_model extends CI_Model if($checkExist->result()){ $feesId = $checkExist->result(); $updateDetails['SessionName'] = $details['SessionName']; + $updateDetails['ToSessionName'] = $details['ToSessionName']; $updateDetails['BatchCode'] = $details['BatchCode']; $updateDetails['RollNo'] = $details['RollNo']; $updateDetails['STFOrWR'] = $details['STFOrWR']; @@ -1439,5 +1488,32 @@ class Fees_status_model extends CI_Model } + /* + * Get session master details + * created by kms + * */ + + public function getSession($details=null) + { + $this->db->select('SM.SessionID,SM.SessionDate,SM.SessionName,SM.IsActive'); + $this->db->from(SESSIONMASTER.' as SM'); + $this->db->join(SESSIONDETAILS.' as SD', 'SM.SessionID = SD.SessionID'); + $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = SD.UniversityID'); + $this->db->join(COURSE.' as CU', 'CU.UniversityID = US.UniversityID'); + // $this->db->where('SD.IsActive','1'); + $this->db->order_by('CU.CreatedOn','DESC'); + $this->db->where('CU.CourseID',$details['CourseID']); + // $this->db->group_by('SM.SessionName','DESC'); + $sessionDetails = $this->db->get(); + if($sessionDetails->result()){ + + return $sessionDetails->result(); + } + else { + return false; + } + + } + } \ No newline at end of file