From 67e4b13149f55b631ce2fbdf6890332e24757590 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 21 Aug 2018 14:21:26 +0530 Subject: [PATCH] dashboard changes --- .../application/models/Dashboard_model.php | 66 ++++++++++++++++++- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/Apollo/api/application/models/Dashboard_model.php b/Apollo/api/application/models/Dashboard_model.php index 0c4b2b77..9393025c 100755 --- a/Apollo/api/application/models/Dashboard_model.php +++ b/Apollo/api/application/models/Dashboard_model.php @@ -81,7 +81,6 @@ class Dashboard_model extends CI_Model $this->db->where('BranchCode',$details['localBranchID']); $getUnivDetails = $this->db->get(); if($getUnivDetails->result()){ - $resultDetails['resultStatus']=true; foreach ($getUnivDetails->result() as $rows){ $fetchDetails['UniversityID']=$rows->UniversityID; $fetchDetails['UniversityName']=$rows->UniversityName; @@ -103,9 +102,12 @@ class Dashboard_model extends CI_Model $resultDetails['universityFeesDetails']=$getFeesArray; } else{ - $resultDetails['resultStatus']=false; + $resultDetails['details']=false; $resultDetails['Message']="No records found!"; + $resultDetails['universityFeesDetails']=false; } + $resultDetails['batchFeesDetails']=$this->getBatchPendingFees($details['localBranchID']); + return $resultDetails; } /* @@ -116,7 +118,6 @@ class Dashboard_model extends CI_Model $feesDetails=array(); $feesDetails['UniversityID']=$universityID; $feesDetails['UniversityName']=$universityName; - $this->db->select("SUM(SFS.CourseFees) as PayableFees"); $this->db->from( STUDENTS_FEES_STATUS . ' as SFS'); $this->db->join( COURSE . ' as CU', 'CU.CourseID = SFS.CourseID'); @@ -138,6 +139,7 @@ class Dashboard_model extends CI_Model $this->db->join( COURSE . ' as CU', 'CU.CourseID = SFS.CourseID'); $this->db->where('CU.UniversityID',$universityID); $this->db->where('CU.BranchCode',$branchCode); + $this->db->where('SFP.IsActive','1'); $this->db->order_by('CU.CourseID','DESC'); $getUnivPaidFeesDetails = $this->db->get(); if($getUnivPaidFeesDetails->result()){ @@ -153,6 +155,64 @@ class Dashboard_model extends CI_Model } + /* + * get batch pending fees details + * created by kms + * */ + public function getBatchPendingFees($branchCode=null){ + $this->db->distinct(); + $this->db->select('BatchCode,BatchName'); + $this->db->from(BATCH); + $this->db->order_by('BatchID','DESC'); + $this->db->where('BranchCode',$branchCode); + $getBatchDetails = $this->db->get(); + if($getBatchDetails->result()){ + foreach ($getBatchDetails->result() as $bRows){ + $batchFeesDetails['BatchCode']=$bRows->BatchCode; + $batchFeesDetails['BatchName']=$bRows->BatchName; + $this->db->select("SUM(SFS.CourseFees) as PayableFees"); + $this->db->from( STUDENTS_FEES_STATUS . ' as SFS'); + $this->db->where('SFS.BatchCode',$bRows->BatchCode); + $this->db->where('SFS.BranchCode',$branchCode); + $getBatchFeesDetails = $this->db->get(); + if($getBatchFeesDetails->result()){ + foreach ($getBatchFeesDetails->result() as $bpayableRow){ + $batchFeesDetails['PayableFees']=$bpayableRow->PayableFees; + } + } + else{ + $batchFeesDetails['PayableFees']=0; + } + // get paid details + $this->db->select("SUM(SFP.BillAmount) as PaidFees"); + $this->db->from( STUDENTS_FEES_PAID . ' as SFP'); + $this->db->join( STUDENTS_FEES_STATUS . ' as SFS', 'SFS.FeesID = SFP.FeesId'); + $this->db->where('SFP.IsActive','1'); + $this->db->where('SFS.BatchCode',$bRows->BatchCode); + $this->db->where('SFS.BranchCode',$branchCode); + $getBatchPaidFeesDetails = $this->db->get(); + if($getBatchPaidFeesDetails->result()){ + foreach ($getBatchPaidFeesDetails->result() as $bpaidRow){ + $batchFeesDetails['PaidFees']=$bpaidRow->PaidFees; + } + } + else{ + $batchFeesDetails['PaidFees']=0; + } + $fetchBatchFees[]=$batchFeesDetails; + + } + + return $fetchBatchFees; + } + else{ + return false; + } + + + + } + } \ No newline at end of file