From 0993b710b6970f7c6d225e8ca2c1c0e936a1a460 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 21 Aug 2018 12:10:04 +0530 Subject: [PATCH] fees status changes --- .../application/models/Fees_status_model.php | 94 +++++++++++++++---- 1 file changed, 76 insertions(+), 18 deletions(-) diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index 326dcfb1..c800e9cd 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -1759,29 +1759,79 @@ class Fees_status_model extends CI_Model 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); + // check study material status exist or not + $this->db->select('CourseID'); + $this->db->where('CourseID',$row->FeesType); + $this->db->where('Sem',$Fees); + $this->db->where('BranchCode',$feesDetails['UpdatedBy']); + $this->db->where('StudentID',$feesDetails['StudentID']); + $existStudyMaterialDetails = $this->db->get(STUDY_MATERIAL_STATUS); + if($existStudyMaterialDetails->num_rows()<1){ - // insert mark card details - $insertMark['Sem']=$Fees; - $this->db->insert(CERTIFICATION_STATUS, $insertMark); + // insert study material details + $this->db->insert(STUDY_MATERIAL_STATUS, $insertStudyBook); + } + // check answer book;et exist or not + + $this->db->select('CourseID'); + $this->db->where('CourseID',$row->FeesType); + $this->db->where('BranchCode',$feesDetails['UpdatedBy']); + $this->db->where('StudentID',$feesDetails['StudentID']); + $existAnsBookDetails = $this->db->get(ANSWER_BOOKLET); + if($existAnsBookDetails->num_rows()<1) { + // insert answer booklet details + $this->db->insert(ANSWER_BOOKLET, $insertStudyBook); + } + // check certificate exist or not + $this->db->select('CourseID'); + $this->db->where('CourseID',$row->FeesType); + $this->db->where('Sem',$row->Sem_Year); + $this->db->where('BranchCode',$feesDetails['UpdatedBy']); + $this->db->where('StudentID',$feesDetails['StudentID']); + $existAnsBookDetails = $this->db->get(CERTIFICATION_STATUS); + if($existAnsBookDetails->num_rows()<1) { + // insert mark card details + $insertMark['Sem'] = $row->Sem_Year; + $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); + $insertStudyBook['Sem'] = $row->Sem_Year; + $this->db->select('CourseID'); + $this->db->where('CourseID',$row->FeesType); + $this->db->where('BranchCode',$feesDetails['UpdatedBy']); + $this->db->where('StudentID',$feesDetails['StudentID']); + $existStudyMaterialDetails = $this->db->get(STUDY_MATERIAL_STATUS); + if($existStudyMaterialDetails->num_rows()<1) { + + // insert study material details + $this->db->insert(STUDY_MATERIAL_STATUS, $insertStudyBook); + } + // check answer book;et exist or not + $this->db->select('CourseID'); + $this->db->where('CourseID',$row->FeesType); + $this->db->where('BranchCode',$feesDetails['UpdatedBy']); + $this->db->where('StudentID',$feesDetails['StudentID']); + $existAnsBookDetails = $this->db->get(ANSWER_BOOKLET); + if($existAnsBookDetails->num_rows()<1) { + // insert answer booklet details + $this->db->insert(ANSWER_BOOKLET, $insertStudyBook); + } + // check certificate exist or not + $this->db->select('CourseID'); + $this->db->where('CourseID',$row->FeesType); + $this->db->where('BranchCode',$feesDetails['UpdatedBy']); + $this->db->where('StudentID',$feesDetails['StudentID']); + $existAnsBookDetails = $this->db->get(CERTIFICATION_STATUS); + if($existAnsBookDetails->num_rows()<1) { + // insert mark card details + $insertMark['Sem'] = $row->Sem_Year; + $this->db->insert(CERTIFICATION_STATUS, $insertMark); + } } @@ -1805,8 +1855,16 @@ class Fees_status_model extends CI_Model $insertDocs['CreatedBy']=$feesDetails['CreatedBy']; $insertDocs['CreatedOn']=$feesDetails['CreatedOn']; $insertDocs['CertificationType']=$getEndFeesDetails->CertificationID; - // insert application details - $this->db->insert(APPLICATION_STATUS,$insertDocs); + $this->db->select('CourseID'); + $this->db->where('CourseID',$courseID); + $this->db->where('BranchCode',$feesDetails['UpdatedBy']); + $this->db->where('StudentID',$feesDetails['StudentID']); + $this->db->where('CertificationType',$getEndFeesDetails->CertificationID); + $existAnsBookDetails = $this->db->get(CERTIFICATION_STATUS); + if($existAnsBookDetails->num_rows()<1) { + // insert application details + $this->db->insert(APPLICATION_STATUS, $insertDocs); + } }