fees updates done

This commit is contained in:
gandhimathi 2018-03-10 15:17:21 +05:30
parent e1391ce03d
commit e693817c26

View File

@ -406,10 +406,6 @@ class Fees_status_model extends CI_Model
$feesPaidDetails['UpdatedBy'] = $getStudentBranch[0]->BranchID;
}
// $this->entryForAllStatus($feesPaidDetails,$courseID);
// die();
$this->db->select('BillNO');
$this->db->where('UpdatedBy', $feesPaidDetails['UpdatedBy']);
@ -457,6 +453,7 @@ class Fees_status_model extends CI_Model
}
// Entry for all status screen except fees
$this->entryForAllStatus($feesPaidDetails,$courseID);
@ -1565,37 +1562,126 @@ class Fees_status_model extends CI_Model
* */
public function entryForAllStatus($feesDetails=null,$courseID=null){
$singleFeesDetails=["SEM1","SEM2","SEM3","SEM4","SEM5","SEM6","SEM7","SEM8"];
$this->db->select('SFS.FeesID');
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'SFS.FeesID = SFP.FeesId');
$this->db->where('SFS.CourseID',$courseID);
$this->db->where('SFS.StudentID',$feesDetails['StudentID']);
$existDetails = $this->db->get();
if($existDetails->result()){
return true;
}
else{
$this->db->select('ID,FeesType,ProgramType');
$this->db->where('CourseID',$courseID);
$getFeesTypeDetails = $this->db->get(COURSE_FEES);
// get pick list expected status
$this->db->select('ListCode,ListName');
$this->db->where('ListName','EXPECTED');
$this->db->where('IsActive','1');
$existStatusDetails = $this->db->get(PICK_LIST_DETAILS)->last_row();
if($existStatusDetails){
//check if exist
$this->db->select('SFS.FeesID,SFS.FeesType');
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'SFS.FeesID = SFP.FeesId');
$this->db->where('SFS.CourseID',$courseID);
$this->db->where('SFS.StudentID',$feesDetails['StudentID']);
$this->db->where('SFP.FeesId',$feesDetails['FeesId']);
$existDetails = $this->db->get();
if($existDetails->num_rows()>1){
return true;
}
else{
$fetchData = $existDetails->result();
if($fetchData[0]->FeesType!=PC AND $fetchData[0]->FeesType!=DC AND $fetchData[0]->FeesType!=TC AND $fetchData[0]->FeesType!=MC AND $fetchData[0]->FeesType!=OTHER) {
$this->db->select('SFS.FeesType,CF.Sem_Year,CF.ProgramType');
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType');
$this->db->where('SFS.CourseID',$courseID);
$this->db->where('SFS.StudentID',$feesDetails['StudentID']);
$this->db->where('SFS.FeesID',$feesDetails['FeesId']);
$getFeesTypeDetails = $this->db->get();
if($getFeesTypeDetails->result()){
$insertDetails=array();
foreach ($getFeesTypeDetails->result() as $row){
// this array for study material and answer booklet update
$insertStudyBook['StudentID']=$feesDetails['StudentID'];
$insertStudyBook['CourseID']=$row->FeesType;
$insertStudyBook['BranchCode']=$feesDetails['UpdatedBy'];
$insertStudyBook['ListCode']=$existStatusDetails->ListCode;
$insertStudyBook['Comments']=$feesDetails['CommentsForStudent'];
$insertStudyBook['Coursedetail']=$feesDetails['StudentID'];
$insertStudyBook['CreatedBy']=$feesDetails['CreatedBy'];
$insertStudyBook['CreatedOn']=$feesDetails['CreatedOn'];
// this array for mark card updates
$insertMark['StudentID']=$feesDetails['StudentID'];
$insertMark['CourseID']=$row->FeesType;
$insertMark['BranchCode']=$feesDetails['UpdatedBy'];
$insertMark['ListCode']=$existStatusDetails->ListCode;
$insertMark['Comments']=$feesDetails['CommentsForStudent'];
$insertMark['Coursedetail']=$feesDetails['StudentID'];
$insertMark['CreatedBy']=$feesDetails['CreatedBy'];
$insertMark['CreatedOn']=$feesDetails['CreatedOn'];
$insertMark['CertificationType']="MARK CARD";
if($row->ProgramType==REGULARFEES OR $row->ProgramType==LATERALFEES){
foreach ($singleFeesDetails as $Fees){
$insertStudyBook['Sem']=$Fees;
// insert study material details
$this->db->insert(STUDY_MATERIAL_STATUS, $insertStudyBook);
// insert answer booklet details
$this->db->insert(ANSWER_BOOKLET, $insertStudyBook);
// insert mark card details
$insertMark['Sem']=$Fees;
$this->db->insert(CERTIFICATION_STATUS, $insertMark);
}
}
else{
$insertStudyBook['Sem']=$row->Sem_Year;
// insert study material details
$this->db->insert(STUDY_MATERIAL_STATUS, $insertStudyBook);
// insert answer booklet details
$this->db->insert(ANSWER_BOOKLET, $insertStudyBook);
// insert mark card details
$insertMark['Sem']=$row->Sem_Year;
$this->db->insert(CERTIFICATION_STATUS, $insertMark);
}
}
}
}
else{
$this->db->select('CertificationID');
$this->db->where('CertificateName',$fetchData[0]->FeesType);
$this->db->where('IsActive','1');
$getEndFeesDetails = $this->db->get(CERTIFICATION_MASTER)->last_row();
if($getEndFeesDetails){
// this array for document update
$insertDocs['StudentID']=$feesDetails['StudentID'];
$insertDocs['CourseID']=$courseID;
$insertDocs['BranchCode']=$feesDetails['UpdatedBy'];
$insertDocs['ListCode']=$existStatusDetails->ListCode;
$insertDocs['Comments']=$feesDetails['CommentsForStudent'];
$insertDocs['CreatedBy']=$feesDetails['CreatedBy'];
$insertDocs['CreatedOn']=$feesDetails['CreatedOn'];
$insertDocs['CertificationType']=$getEndFeesDetails->CertificationID;
// insert application details
$this->db->insert(APPLICATION_STATUS,$insertDocs);
}
if($getFeesTypeDetails->result()){
foreach ($getFeesTypeDetails->result() as $row){
if($row->ProgramType==REGULARFEES OR $row->ProgramType==LATERALFEES){
$insertDetails['StudentID']=$feesDetails['StudentID'];
$insertDetails['CourseID']=$row->ID;
$insertDetails['BranchCode']="";
$insertDetails['ListCode']="";
$insertDetails['StudentID']="";
}
}
}
return true;
}
else{
return false;
}
}