From ff9704f2b98b7d3d268618be73ac7025c0a006ad Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Wed, 20 Dec 2017 14:50:08 +0530 Subject: [PATCH] course details changes done --- .../application/models/Fees_status_model.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index 6e9d4aba..90e6eb71 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -155,11 +155,13 @@ class Fees_status_model extends CI_Model * */ public function existStudentFeesDetails($student=null){ - $this->db->select('SFS.FeesID,SFS.FeesType,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,CU.CourseName,CU.CourseID,CF.Sem_Year'); + $this->db->select('SFS.FeesID,SFS.FeesType,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->from(STUDENTS_FEES_STATUS.' as SFS'); $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'); + $this->db->join(STUDENTCOURSE.' as STC', 'STC.CourseID = CU.CourseID'); + $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = STC.UniversityID'); $this->db->where('SFS.CourseID', $student['CourseID']); $this->db->where('SFS.StudentID', $student['StudentID']); $getFeeDetails = $this->db->get(); @@ -173,13 +175,25 @@ class Fees_status_model extends CI_Model $storePaidDetails['Others'] = $feeRow->Others; $storePaidDetails['PayableAmount'] = $feeRow->CourseFees+$feeRow->STFOrWR+$feeRow->Others-$feeRow->Waiver; $storePaidDetails['Firstname'] = $feeRow->Firstname; + $storePaidDetails['MobileNumber'] = $feeRow->MobileNumber; + $storePaidDetails['Fathername'] = $feeRow->Fathername; + $storePaidDetails['EnrollmentID'] = $feeRow->EnrollmentID; $storePaidDetails['CourseName'] = $feeRow->CourseName; + $storePaidDetails['UniversityName'] = $feeRow->UniversityName; $this->db->select('ifnull(SUM((BillAmount)),0) as PaidBillAmount'); $this->db->where('FeesId',$feeRow->FeesID); $paidBillAmount = $this->db->get(STUDENTS_FEES_PAID)->result(); $storePaidDetails['PaidBillAmount']=$paidBillAmount[0]->PaidBillAmount; + if($paidBillAmount[0]->PaidBillAmount > $storePaidDetails['PayableAmount']){ + $storePaidDetails['BalanceAmount']=0; + + } + else{ + $storePaidDetails['BalanceAmount']=$storePaidDetails['PayableAmount'] - $paidBillAmount[0]->PaidBillAmount; + } + // for get paid bill details - $this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO'); + $this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,SessionID,ModeOfPayment'); $this->db->where('FeesId',$feeRow->FeesID); $this->db->group_by('BillNO'); $storePaidDetails['paidDetails']=$this->db->get(STUDENTS_FEES_PAID)->result();