# 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
This commit is contained in:
gandhimathi 2018-09-08 20:04:26 +05:30
parent a562819967
commit cf322c8fc0
3 changed files with 127 additions and 0 deletions

View File

@ -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';

View File

@ -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
}
}
}

View File

@ -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;
}
}