From f074806d1795a1b9a91ea0c8e2cf509198b6fb5b Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 29 Dec 2017 16:23:33 +0530 Subject: [PATCH] course details changes done --- .../application/models/Studentview_model.php | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/Apollo/api/application/models/Studentview_model.php b/Apollo/api/application/models/Studentview_model.php index 8ecd4828..f7c4ff1e 100755 --- a/Apollo/api/application/models/Studentview_model.php +++ b/Apollo/api/application/models/Studentview_model.php @@ -128,14 +128,78 @@ class Studentview_model extends CI_Model } + $getStudentDefaultFees = $this->getDefaultCourseFees($studentID,$courseID); + if($getStudentDefaultFees != false){ + return array_merge($mergeResult,$getStudentDefaultFees); + } + else{ + return$mergeResult; + } - return $mergeResult; } else { return false; } } + /* + * get default course details + * created by kms + * */ + public function getDefaultCourseFees($studentID=null,$courseID=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'); + $this->db->from(STUDENTS_FEES_STATUS.' as SFS'); + $this->db->join(STUDENTS_FEES_PAID.' as SFP','SFP.FeesId = SFS.FeesID','left'); + //$this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType'); + $this->db->where('SFS.CourseID', $courseID); + $this->db->where('SFS.StudentID', $studentID); + $this->db->where_in('SFS.FeesType', $serachArray); + $this->db->order_by('SFS.FeesID', 'ASC'); + $getFeeDetails = $this->db->get(); + if($getFeeDetails->result()){ + foreach ($getFeeDetails->result() as $feeRow){ + $storePaidDetails['FeesID'] = $feeRow->FeesID; + $storePaidDetails['FeesName'] = $feeRow->FeesType; + $storePaidDetails['CourseFees'] = $feeRow->CourseFees; + $storePaidDetails['SessionName'] = $feeRow->SessionName; + $storePaidDetails['RollNo'] = $feeRow->RollNo; + $storePaidDetails['STFOrWR'] = $feeRow->STFOrWR; + $storePaidDetails['Waiver'] = $feeRow->Waiver; + $storePaidDetails['Others'] = $feeRow->Others; + $storePaidDetails['PayableAmount'] = $feeRow->CourseFees+$feeRow->STFOrWR+$feeRow->Others-$feeRow->Waiver; + + $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,BillDate,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; + + } + + return $mergeResult; + } + else { + return false; + } + + } + /* * get student study material details * created by kms