course details changes done

This commit is contained in:
gandhimathi 2018-01-11 13:57:57 +05:30
parent 5dcca7b44c
commit a3990d58f8

View File

@ -266,7 +266,7 @@ class Fees_status_model extends CI_Model
}
// for get paid bill details
$this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,ModeOfPayment,BR.BranchName');
$this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,ModeOfPayment,ReceiptNo,BR.BranchName');
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
$this->db->join(BRANCH.' as BR','BR.BranchCode = SFP.UpdatedBy','left');
$this->db->where('FeesId',$feeRow->FeesID);
@ -344,7 +344,7 @@ class Fees_status_model extends CI_Model
}
// for get paid bill details
$this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,ModeOfPayment,BR.BranchName');
$this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,ModeOfPayment,ReceiptNo,BR.BranchName');
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
$this->db->join(BRANCH.' as BR','BR.BranchCode = SFP.UpdatedBy','left');
$this->db->where('FeesId',$feeRow->FeesID);
@ -370,6 +370,33 @@ class Fees_status_model extends CI_Model
public function updateFees($feesPaidDetails=null)
{
if($feesPaidDetails['UpdatedBy']=='All'){
$this->db->select('BranchID');
$this->db->where('FeesID', $feesPaidDetails['FeesId']);
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(STUDENTCOURSE.' as SC', 'SC.CourseID = SFS.CourseID');
$getStudentBranch=$this->db->get()->result();
$feesPaidDetails['UpdatedBy'] = $getStudentBranch[0]->BranchID;
}
$this->db->select('BillNO');
$this->db->where('UpdatedBy', $feesPaidDetails['UpdatedBy']);
$getLastBillNo=$this->db->get(STUDENTS_FEES_PAID)->last_row();
if($getLastBillNo){
$strExplode= explode("-", $getLastBillNo->BillNO);
$n=$strExplode[1];
$n2 = str_pad($n + 1, 5, 0, STR_PAD_LEFT);
$splitString = substr($feesPaidDetails['UpdatedBy'], 0, 3);
$feesPaidDetails['BillNO']=$splitString.'-'.$n2;
}
else{
$n='00000';
$n2 = str_pad($n + 1, 5, 0, STR_PAD_LEFT);
$splitString = substr($feesPaidDetails['UpdatedBy'], 0, 3);
$feesPaidDetails['BillNO']=$splitString.'-'.$n2;
}
$this->db->select('BillNO');
$this->db->where('BillNO', $feesPaidDetails['BillNO']);
if($this->db->get(STUDENTS_FEES_PAID)->first_row()){
@ -381,6 +408,11 @@ class Fees_status_model extends CI_Model
$result['paidStatus'] = true;
$result['message'] = "Successfully fees details added";
// $entryOfCallTrack = $this->updateInCallTrack($trackDetails);
// day book entry
if($feesPaidDetails['ModeOfPayment']=='CASH' AND $feesPaidDetails['BillAmount']!='0'){
$dayBookEntry = $this->insertDayBookMaster($feesPaidDetails);
}
}
else{
@ -875,6 +907,36 @@ class Fees_status_model extends CI_Model
return $result;
}
/*
* insert day book master while fees update
* created by kms
* */
public function insertDayBookMaster($data=null){
$insertArray['Date'] = $data['BillDate'];
$insertArray['CreatedBy'] = $data['CreatedBy'];
$insertArray['CreatedOn'] = $data['CreatedOn'];
$insertArray['Description'] = $data['InternalComments'];
$insertArray['Amount'] = $data['BillAmount'];
$insertArray['Status'] = 'Pending';
$insertArray['BranchCode'] = $data['UpdatedBy'];
$this->db->select('ID,TypeID');
$this->db->where('TypeID', 'I002');
$this->db->where('TypeName', 'FEES');
$getIncome=$this->db->get(INCOMEOUTCOMEMASTER)->last_row();
if($getIncome){
$insertArray['Name'] = $getIncome->TypeID;
$insertArray['Type'] = $getIncome->ID;
$this->db->insert(DAYBOOKMASTER, $insertArray);
return true;
}
else{
return true;
}
}
}