diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index 90e6eb71..45f8a011 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -155,15 +155,17 @@ class Fees_status_model extends CI_Model * */ public function existStudentFeesDetails($student=null){ + $this->db->distinct(); $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(STUDENTCOURSE.' as STC', 'STC.CourseID = SFS.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']); + $this->db->where('STC.StudentID', $student['StudentID']); $getFeeDetails = $this->db->get(); if($getFeeDetails->result()){ foreach ($getFeeDetails->result() as $feeRow){ @@ -195,6 +197,7 @@ class Fees_status_model extends CI_Model // for get paid bill details $this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,SessionID,ModeOfPayment'); $this->db->where('FeesId',$feeRow->FeesID); + $this->db->order_by('ID',"ASC"); $this->db->group_by('BillNO'); $storePaidDetails['paidDetails']=$this->db->get(STUDENTS_FEES_PAID)->result(); $mergeResult[]=$storePaidDetails;