From 0b1800e29b40602cb39b42ee376fc6923d09483f Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 15 May 2018 11:46:17 +0530 Subject: [PATCH] set fees delete options changes --- .../application/models/Fees_status_model.php | 52 ++++++++++++++----- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index 70705f64..0ed74255 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -739,17 +739,20 @@ 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'); + $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->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->where('StudentID',$student['StudentID']); - $this->db->where('CourseID',$student['CourseID']); - $this->db->where('FeesType',$row->ID); + $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()){ $fetchData['SNo']=$SNoValue; $fetchData['ExistValue']=1; + $fetchData['FeesPaidID']=$existData[0]->FeesPaidID; + $fetchData['FeesAssignID']=$existData[0]->FeesID; $fetchData['ID']=$row->ID; $fetchData['CourseID']=$row->CourseID; $fetchData['ProgramType']=$row->ProgramType; @@ -798,6 +801,8 @@ class Fees_status_model extends CI_Model else{ $fetchData['SNo']=$SNoValue; $fetchData['ExistValue']=0; + $fetchData['FeesPaidID']=""; + $fetchData['FeesAssignID']=""; $fetchData['ID']=$row->ID; $fetchData['CourseID']=$row->CourseID; $fetchData['ProgramType']=$row->ProgramType; @@ -1005,15 +1010,18 @@ class Fees_status_model extends CI_Model // default course fees details in student status foreach ($myArray as $row1){ - $this->db->select('FeesID,CourseFees,STFOrWR,Waiver,Comments,Others,SessionName,ToSessionName,RollNo'); - $this->db->where('StudentID',$student['StudentID']); - $this->db->where('CourseID',$student['CourseID']); - $this->db->where('FeesType',$row1['Sem_Year']); - $existFeesDetails = $this->db->get(STUDENTS_FEES_STATUS); - + $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->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'); + $existFeesDetails = $this->db->get(); if($existData=$existFeesDetails->result()){ $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']; $fetchData['ProgramType']=$row1['Sem_Year']; @@ -1049,9 +1057,9 @@ class Fees_status_model extends CI_Model $fetchData['Valid']=$valid; $fetchData['ExistValue']=0; - + $fetchData['FeesPaidID']=""; + $fetchData['FeesAssignID']=""; $fetchData['ID']=$row1['Sem_Year']; - $fetchData['CourseID']=$row1['CourseID']; $fetchData['Sem_Year']=$row1['Sem_Year']; $fetchData['ActualFees']=$row1['ActualFees']; @@ -1741,6 +1749,26 @@ class Fees_status_model extends CI_Model } return $result; } + /*delete set fees details + created by kms + */ + public function deleteSetFees($details=null){ + $this->db->where('FeesID', $details['FeesID']); + $this->db->delete(FEES_INSTALLMENT); + if ($this->db->affected_rows() >= '1') { + $this->db->where('FeesID', $details['FeesID']); + $this->db->delete(STUDENTS_FEES_STATUS); + $result['deleteStatus']=true; + $result['message']="Successfully Fees Details Deleted"; + } + else{ + $result['deleteStatus']=false; + $result['message']="Something went wrong.please try again"; + } + return $result; + + + } } \ No newline at end of file