dashboard changes

This commit is contained in:
gandhimathi 2018-08-21 14:21:26 +05:30
parent ab7c53599b
commit 67e4b13149

View File

@ -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;
}
}
}