From cf322c8fc060118ab8d8c81a26c0171cae88474f Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Sat, 8 Sep 2018 20:04:26 +0530 Subject: [PATCH] Merge branch 'master' of https://bitbucket.org/venbainformationtechnology/apollodec # Conflicts: # Apollo/api/application/config/routes.php # Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php # Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php --- Apollo/api/application/config/routes.php | 2 + ...Receive_Enrolment_Fees_Univ_Controller.php | 34 +++++++ .../Receive_Enrolment_Fees_Univ_model.php | 91 +++++++++++++++++++ 3 files changed, 127 insertions(+) diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index c2bf3a6c..0465bb22 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -378,3 +378,5 @@ $route['paymentVerficationDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/pa $route['getUniversityCodeForFormDetailsGet'] = 'Receive_Enrolment_Fees_Univ_Controller/getUniversityCodeForFormDetailsGet'; $route['getUnmatchedFormIdFeesDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/getUnmatchedFormIdFeesDetails'; $route['addToAccountStateList'] = 'Receive_Enrolment_Fees_Univ_Controller/addToAccountStateList'; +$route['addUniversityPaymentDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/addUniversityPaymentDetails'; + diff --git a/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php b/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php index ba1705fd..94dc8585 100644 --- a/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php +++ b/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php @@ -37,6 +37,7 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { $this->methods['getExistStudentEnrolmentDetails_post']['limit'] = 1000; $this->methods['addManualEnrolmentDetails_post']['limit'] = 1000; + $this->methods['addUniversityPaymentDetails_post']['limit'] = 1000; // load the model $this->load->model('Receive_Enrolment_Fees_Univ_model', 'receive_model'); @@ -445,6 +446,39 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + /* + * add university payment details + * created by kms + * */ + public function addUniversityPaymentDetails_post(){ + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details=$this->post('details'); + $localData=$this->post('localDetails'); + $fromDetails['BillNo']=$details['billNo']; + $fromDetails['ReceiptNo']=$details['receiptNo']; + $fromDetails['Amount']=$details['billAmount']; + $fromDetails['ApprovedDate']=$details['date']; + $fromDetails['UniversityCode']=$details['universityCode']; + $fromDetails['UniversityName']=$details['universityName']; + $fromDetails['Remarks']=$details['comments']; + $fromDetails['BranchCode']=$localData['localBranchID']; + $fromDetails['CreatedBy']=$localData['localUserID']; + $fromDetails['CreatedOn']=$now->format('Y-m-d H:i:s'); + $addPaymentDetails=$this->receive_model->addPaymentDetails($fromDetails); + if($addPaymentDetails['status']==true){ + $this->response($addPaymentDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } + else if($addPaymentDetails['status']==false){ + $this->response($addPaymentDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } + else{ + $this->response(['message' => 'Try again', 'status' => false], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + + } + } } \ No newline at end of file diff --git a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php index caf68bed..d1bddd1d 100644 --- a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php +++ b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php @@ -1328,4 +1328,95 @@ $result['updatedraftStatus'] = false; // return $resultArr; // } + /* + * add payment details + * created by kms + * */ + public function addPaymentDetails($fromDetails=null){ + $resultArray=array(); + $this->db->select('UNP.BillNo'); + $this->db->from(UNIVERSITYPAYMENT.' as UNP'); + $this->db->where('UNP.BillNo', $fromDetails['BillNo']); + $billExist = $this->db->get(); + if($billExist->num_rows()<=0){ + + if($fromDetails['ReceiptNo']!='' AND $fromDetails['ReceiptNo']!=null){ + $this->db->select('UNP1.ReceiptNo'); + $this->db->from(UNIVERSITYPAYMENT.' as UNP1'); + $this->db->where('UNP1.ReceiptNo', $fromDetails['ReceiptNo']); + $receiptExist = $this->db->get(); + if($receiptExist->num_rows()<=0){ + $this->db->insert(UNIVERSITYPAYMENT, $fromDetails); + if ($this->db->affected_rows() > 0) { + $updateDebitTable['PaymentMapID']=$this->db->insert_id(); + $updateDebitTable['DebitAmount']=$fromDetails['Amount']; + $updateDebitTable['ApprovedDate']=$fromDetails['ApprovedDate']; + $updateDebitTable['TypeID']=0; + $updateDebitTable['TypeName']="Debit"; + $updateDebitTable['UniversityCode']=$fromDetails['UniversityCode']; + $updateDebitTable['UniversityName']=$fromDetails['UniversityName']; + $updateDebitTable['BranchCode']=$fromDetails['BranchCode']; + $updateDebitTable['CreatedBy']=$fromDetails['CreatedBy']; + $updateDebitTable['CreatedOn']=$fromDetails['CreatedOn']; + $this->db->insert(UNIVERSITYCREDITDEBIY, $updateDebitTable); + if ($this->db->affected_rows() > 0) { + $resultArray['status']=true; + $resultArray['message']="Payment added successfully"; + } + else{ + $this->db->delete(UNIVERSITYPAYMENT); + $this->db->where('PID',$updateDebitTable['PaymentMapID']); + $resultArray['status']=false; + $resultArray['message']="Payment failed.try again"; + } + + } else { + $resultArray['status']=false; + $resultArray['message']="Payment failed.Try again"; + } + } + else{ + $resultArray['status']=false; + $resultArray['message']="Receipt no is already exist.."; + } + } + else{ + $this->db->insert(UNIVERSITYPAYMENT, $fromDetails); + if ($this->db->affected_rows() > 0) { + $updateDebitTable['PaymentMapID']=$this->db->insert_id(); + $updateDebitTable['DebitAmount']=$fromDetails['Amount']; + $updateDebitTable['ApprovedDate']=$fromDetails['ApprovedDate']; + $updateDebitTable['TypeID']=0; + $updateDebitTable['TypeName']="Debit"; + $updateDebitTable['UniversityCode']=$fromDetails['UniversityCode']; + $updateDebitTable['UniversityName']=$fromDetails['UniversityName']; + $updateDebitTable['BranchCode']=$fromDetails['BranchCode']; + $updateDebitTable['CreatedBy']=$fromDetails['CreatedBy']; + $updateDebitTable['CreatedOn']=$fromDetails['CreatedOn']; + $this->db->insert(UNIVERSITYCREDITDEBIY, $updateDebitTable); + if ($this->db->affected_rows() > 0) { + $resultArray['status']=true; + $resultArray['message']="Payment added successfully"; + } + else{ + $this->db->delete(UNIVERSITYPAYMENT); + $this->db->where('PID',$updateDebitTable['PaymentMapID']); + $resultArray['status']=false; + $resultArray['message']="Payment failed.try again"; + } + + } else { + $resultArray['status']=false; + $resultArray['message']="Payment failed.Try again"; + } + + } + } + else { + $resultArray['status']=false; + $resultArray['message']="Bill no is already exist.."; + } + return $resultArray; + + } } \ No newline at end of file