fees changes in set fees

This commit is contained in:
gandhimathi 2018-05-16 18:40:51 +05:30
parent ab5a4ca7c6
commit 98b5a2073d

View File

@ -739,19 +739,30 @@ class Fees_status_model extends CI_Model
$result_array['feesStatus']=true;
foreach ($feesDetails->result() as $row){
$SNoValue=$SNoValue+1;
$this->db->select('SFS.FeesID,SFS.CourseFees,SFS.Comments,SFS.STFOrWR,SFS.Waiver,SFS.Others,SFS.SessionName,SFS.ToSessionName,SFS.RollNo,SFS.BatchCode,SM.SessionName as MasterSessionName,SM1.SessionName as MasterToSessionName,SFP.ID as FeesPaidID');
$this->db->select('SFS.FeesID,SFS.CourseFees,SFS.Comments,SFS.STFOrWR,SFS.Waiver,SFS.Others,SFS.SessionName,SFS.ToSessionName,SFS.RollNo,SFS.BatchCode,SM.SessionName as MasterSessionName,SM1.SessionName as MasterToSessionName');
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = SFS.SessionName');
$this->db->join(SESSIONMASTER.' as SM1', 'SM1.SessionID = SFS.ToSessionName','left');
$this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = SFS.FeesID','left');
// $this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = SFS.FeesID','left');
$this->db->where('SFS.StudentID',$student['StudentID']);
$this->db->where('SFS.CourseID',$student['CourseID']);
$this->db->where('SFS.FeesType',$row->ID);
$existFeesDetails = $this->db->get();
if($existData=$existFeesDetails->result()){
// count the total paid fees details
$this->db->select('FeesId');
$this->db->where('FeesId',$existData[0]->FeesID);
$this->db->where('IsActive','1');
$countExistPaid = $this->db->get(STUDENTS_FEES_PAID);
if($countExistPaid->num_rows()<=0){
$fetchData['PaidStatus']=0;
}
else{
$fetchData['PaidStatus']=1;
}
// end
$fetchData['SNo']=$SNoValue;
$fetchData['ExistValue']=1;
$fetchData['FeesPaidID']=$existData[0]->FeesPaidID;
$fetchData['FeesAssignID']=$existData[0]->FeesID;
$fetchData['ID']=$row->ID;
$fetchData['CourseID']=$row->CourseID;
@ -799,9 +810,9 @@ class Fees_status_model extends CI_Model
}
else{
$fetchData['PaidStatus']=0;
$fetchData['SNo']=$SNoValue;
$fetchData['ExistValue']=0;
$fetchData['FeesPaidID']="";
$fetchData['FeesAssignID']="";
$fetchData['ID']=$row->ID;
$fetchData['CourseID']=$row->CourseID;
@ -1010,17 +1021,27 @@ class Fees_status_model extends CI_Model
// default course fees details in student status
foreach ($myArray as $row1){
$this->db->select('SFS.FeesID,SFS.CourseFees,SFS.STFOrWR,SFS.Waiver,SFS.Comments,SFS.Others,SFS.SessionName,SFS.ToSessionName,SFS.RollNo,SFP.ID as FeesPaidID');
$this->db->select('SFS.FeesID,SFS.CourseFees,SFS.STFOrWR,SFS.Waiver,SFS.Comments,SFS.Others,SFS.SessionName,SFS.ToSessionName,SFS.RollNo');
$this->db->where('SFS.StudentID',$student['StudentID']);
$this->db->where('SFS.CourseID',$student['CourseID']);
$this->db->where('SFS.FeesType',$row1['Sem_Year']);
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = SFS.FeesID','left');
// $this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = SFS.FeesID','left');
$existFeesDetails = $this->db->get();
if($existData=$existFeesDetails->result()){
// count the total paid fees details
$this->db->select('FeesId');
$this->db->where('FeesId',$existData[0]->FeesID);
$this->db->where('IsActive','1');
$countExistPaid = $this->db->get(STUDENTS_FEES_PAID);
if($countExistPaid->num_rows()<=0){
$fetchData['PaidStatus']=0;
}
else{
$fetchData['PaidStatus']=1;
}
$fetchData['Valid']=$valid;
$fetchData['ExistValue']=1;
$fetchData['FeesPaidID']=$existData[0]->FeesPaidID;
$fetchData['FeesAssignID']=$existData[0]->FeesID;
$fetchData['ID']=$row1['Sem_Year'];
$fetchData['CourseID']=$row1['CourseID'];
@ -1053,11 +1074,9 @@ class Fees_status_model extends CI_Model
}
else{
$fetchData['PaidStatus']=0;
$fetchData['Valid']=$valid;
$fetchData['ExistValue']=0;
$fetchData['FeesPaidID']="";
$fetchData['FeesAssignID']="";
$fetchData['ID']=$row1['Sem_Year'];
$fetchData['CourseID']=$row1['CourseID'];
@ -1282,11 +1301,6 @@ class Fees_status_model extends CI_Model
else{
return false;
}
}
/*
* send notification for student
@ -1593,6 +1607,7 @@ class Fees_status_model extends CI_Model
// get pick list expected status
$this->db->select('ListCode,ListName');
$this->db->where('ListName','EXPECTED');
$this->db->where('BranchCode',$feesDetails['UpdatedBy']);
$this->db->where('IsActive','1');
$existStatusDetails = $this->db->get(PICK_LIST_DETAILS)->last_row();
if($existStatusDetails){
@ -1603,6 +1618,7 @@ class Fees_status_model extends CI_Model
$this->db->where('SFS.CourseID',$courseID);
$this->db->where('SFS.StudentID',$feesDetails['StudentID']);
$this->db->where('SFP.FeesId',$feesDetails['FeesId']);
$this->db->where('SFP.IsActive','1');
$existDetails = $this->db->get();
if($existDetails->num_rows()>1){
return true;
@ -1769,6 +1785,103 @@ class Fees_status_model extends CI_Model
return $result;
}
/*
* delete student status while cancel bill from day book
* created by kms
* */
public function deleteStudentStatusEntry($paymentID=null){
if($paymentID!='' AND $paymentID!=null){
$this->db->select('SFP.FeesId,SFS.StudentID,SFS.FeesType,CF.Sem_Year,CF.ProgramType');
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'SFS.FeesID = SFP.FeesId');
$this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType');
$this->db->where('SFP.ID',$paymentID);
$this->db->group_by('SFS.FeesType');
$getPaidRow = $this->db->get()->last_row();
if($getPaidRow AND $getPaidRow->FeesType!=PC AND $getPaidRow->FeesType!=DC AND $getPaidRow->FeesType!=TC AND $getPaidRow->FeesType!=MC AND $getPaidRow->FeesType!=OTHER){
$this->db->select('FeesId');
$this->db->where('FeesId',$getPaidRow->FeesId);
$this->db->where('IsActive','1');
$getCountOfFeesType = $this->db->get(STUDENTS_FEES_PAID);
if($getCountOfFeesType->num_rows() ==1){
if($getPaidRow->ProgramType==SEMYEARFEES){
// delete certificate status
$this->db->where('StudentID', $getPaidRow->StudentID);
$this->db->where('CourseID', $getPaidRow->FeesType);
$this->db->where('Sem', $getPaidRow->Sem_Year);
$this->db->delete(CERTIFICATION_STATUS);
// delete answer booklet status
$this->db->where('StudentID', $getPaidRow->StudentID);
$this->db->where('CourseID', $getPaidRow->FeesType);
$this->db->where('Sem', $getPaidRow->Sem_Year);
$this->db->delete(ANSWER_BOOKLET);
// delete study material status
$this->db->where('StudentID', $getPaidRow->StudentID);
$this->db->where('CourseID', $getPaidRow->FeesType);
$this->db->where('Sem', $getPaidRow->Sem_Year);
$this->db->delete(STUDY_MATERIAL_STATUS);
}
else{
// delete certificate status
$this->db->where('StudentID', $getPaidRow->StudentID);
$this->db->where('CourseID', $getPaidRow->FeesType);
$this->db->delete(CERTIFICATION_STATUS);
// delete answer booklet status
$this->db->where('StudentID', $getPaidRow->StudentID);
$this->db->where('CourseID', $getPaidRow->FeesType);
$this->db->delete(ANSWER_BOOKLET);
// delete study material status
$this->db->where('StudentID', $getPaidRow->StudentID);
$this->db->where('CourseID', $getPaidRow->FeesType);
$this->db->delete(STUDY_MATERIAL_STATUS);
}
}
}
else{
$this->db->select('SFP.FeesId,SFS.StudentID,SFS.FeesType,SFS.CourseID,SFS.BranchCode');
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'SFS.FeesID = SFP.FeesId');
$this->db->where('SFP.ID',$paymentID);
$this->db->group_by('SFS.FeesType');
$getPaidRow = $this->db->get()->last_row();
if($getPaidRow AND $getPaidRow->FeesType==PC OR $getPaidRow->FeesType==DC OR $getPaidRow->FeesType==TC OR $getPaidRow->FeesType==MC OR $getPaidRow->FeesType==OTHER){
$this->db->select('FeesId');
$this->db->where('FeesId',$getPaidRow->FeesId);
$this->db->where('IsActive','1');
$getCountOfFeesType = $this->db->get(STUDENTS_FEES_PAID);
if($getCountOfFeesType->num_rows() ==1){
$this->db->select('CertificationID');
$this->db->where('CertificateName',$getPaidRow->FeesType);
$this->db->where('BranchCode',$getPaidRow->BranchCode);
$getCertificateDetails = $this->db->get(CERTIFICATION_MASTER)->last_row();
if($getCertificateDetails){
// delete application status
$this->db->where('StudentID', $getPaidRow->StudentID);
$this->db->where('CourseID', $getPaidRow->CourseID);
$this->db->where('CertificationType', $getCertificateDetails->CertificationID);
$this->db->delete(APPLICATION_STATUS);
}
}
}
}
}
return true;
}
}