edit university payment details changes
This commit is contained in:
parent
75709262e4
commit
2cbb4d7ffa
@ -379,4 +379,6 @@ $route['getUniversityCodeForFormDetailsGet'] = 'Receive_Enrolment_Fees_Univ_Cont
|
||||
$route['getUnmatchedFormIdFeesDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/getUnmatchedFormIdFeesDetails';
|
||||
$route['addToAccountStateList'] = 'Receive_Enrolment_Fees_Univ_Controller/addToAccountStateList';
|
||||
$route['addUniversityPaymentDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/addUniversityPaymentDetails';
|
||||
$route['updateUniversityPaymentDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/updateUniversityPaymentDetails';
|
||||
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller {
|
||||
|
||||
$this->methods['addManualEnrolmentDetails_post']['limit'] = 1000;
|
||||
$this->methods['addUniversityPaymentDetails_post']['limit'] = 1000;
|
||||
$this->methods['updateUniversityPaymentDetails_post']['limit'] = 1000;
|
||||
|
||||
// load the model
|
||||
$this->load->model('Receive_Enrolment_Fees_Univ_model', 'receive_model');
|
||||
@ -517,6 +518,42 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller {
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
* update university payment details*/
|
||||
public function updateUniversityPaymentDetails_post(){
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$details=$this->post('details');
|
||||
$localData=$this->post('localDetails');
|
||||
$update['ID']=$details['ID'];
|
||||
$update['PaymentID']=$details['paymentID'];
|
||||
$payment['BillNo']=$details['billNo'];
|
||||
$payment['ReceiptNo']=$details['receiptNo'];
|
||||
$payment['Amount']=$details['billAmount'];
|
||||
$payment['ApprovedDate']=$details['date'];
|
||||
$payment['Remarks']=$details['comments'];
|
||||
$payment['BranchCode']=$localData['localBranchID'];
|
||||
$payment['updatedBy']=$localData['localUserID'];
|
||||
$payment['updatedOn']=$now->format('Y-m-d H:i:s');
|
||||
// debit array
|
||||
$debit['DebitAmount']=$details['billAmount'];
|
||||
$debit['ApprovedDate']=$details['date'];
|
||||
$debit['BranchCode']=$localData['localBranchID'];
|
||||
$debit['updatedBy']=$localData['localUserID'];
|
||||
$debit['updatedOn']=$now->format('Y-m-d H:i:s');
|
||||
$updatePaymentDetails=$this->receive_model->updatePaymentDetails($update,$payment,$debit);
|
||||
if($updatePaymentDetails['status']==true){
|
||||
$this->response($updatePaymentDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
|
||||
}
|
||||
else if($updatePaymentDetails['status']==false){
|
||||
$this->response($updatePaymentDetails, 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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1352,7 +1352,7 @@ $result['updatedraftStatus'] = false;
|
||||
* created by kms
|
||||
* */
|
||||
public function getPaymentVerificationDetails($search){
|
||||
$this->db->select('UNCD.ID,UNCD.FormMapID,UNCD.PaymentMapID,UNCD.FormID,UNCD.CreditAmount,UNCD.DebitAmount,UNCD.ApprovedDate,UNCD.UniversityCode,UNCD.UniversityName,UNCD.TypeID,ENU.EnrolmentNo,UNP.BillNo,UNP.PID as PaymentID');
|
||||
$this->db->select('UNCD.ID,UNCD.FormMapID,UNCD.PaymentMapID,UNCD.FormID,UNCD.CreditAmount,UNCD.DebitAmount,DATE_FORMAT(UNCD.ApprovedDate, "%d-%m-%Y") as FormatDate,UNCD.ApprovedDate,UNCD.UniversityCode,UNCD.UniversityName,UNCD.TypeID,ENU.EnrolmentNo,UNP.BillNo,UNP.PID as PaymentID,UNP.Amount,UNP.ReceiptNo,UNP.Remarks');
|
||||
$this->db->from(UNIVERSITYCREDITDEBIY.' as UNCD');
|
||||
$this->db->join(FORMFEESRECEIVEDFROMUNIV.' as UNFR', 'UNFR.ID = UNCD.FormMapID','left');
|
||||
$this->db->join(UNIVERSITYPAYMENT.' as UNP', 'UNP.PID = UNCD.PaymentMapID','left');
|
||||
@ -1467,4 +1467,77 @@ $result['updatedraftStatus'] = false;
|
||||
return $resultArray;
|
||||
|
||||
}
|
||||
/*
|
||||
* update payment details
|
||||
* created by kms
|
||||
* */
|
||||
public function updatePaymentDetails($update=null,$payment=null,$debit=null){
|
||||
$resultArray=array();
|
||||
$this->db->where('UNP.BillNo', $payment['BillNo']);
|
||||
$this->db->where('UNP.PID != ', $update['PaymentID']);
|
||||
$this->db->select('UNP.BillNo');
|
||||
$this->db->from(UNIVERSITYPAYMENT.' as UNP');
|
||||
$billExist = $this->db->get();
|
||||
if($billExist->num_rows()<=0){
|
||||
if($payment['ReceiptNo']!='' AND $payment['ReceiptNo']!=null){
|
||||
$this->db->where('UNP1.ReceiptNo', $payment['ReceiptNo']);
|
||||
$this->db->where('UNP1.PID != ', $update['PaymentID']);
|
||||
$this->db->select('UNP1.ReceiptNo');
|
||||
$this->db->from(UNIVERSITYPAYMENT.' as UNP1');
|
||||
$receiptExist = $this->db->get();
|
||||
if($receiptExist->num_rows()<=0){
|
||||
$this->db->where('PID', $update['PaymentID']);
|
||||
$this->db->update(UNIVERSITYPAYMENT, $payment);
|
||||
if ($this->db->affected_rows() > 0) {
|
||||
$this->db->where('ID', $update['ID']);
|
||||
$this->db->update(UNIVERSITYCREDITDEBIY, $debit);
|
||||
if ($this->db->affected_rows() > 0) {
|
||||
$resultArray['status']=true;
|
||||
$resultArray['message']="Payment update successfully";
|
||||
}
|
||||
else{
|
||||
$resultArray['status']=false;
|
||||
$resultArray['message']="Payment update 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->where('PID', $update['PaymentID']);
|
||||
$this->db->update(UNIVERSITYPAYMENT, $payment);
|
||||
if ($this->db->affected_rows() > 0) {
|
||||
$this->db->where('ID', $update['ID']);
|
||||
$this->db->update(UNIVERSITYCREDITDEBIY, $debit);
|
||||
if ($this->db->affected_rows() > 0) {
|
||||
$resultArray['status']=true;
|
||||
$resultArray['message']="Payment update successfully";
|
||||
}
|
||||
else{
|
||||
$resultArray['status']=false;
|
||||
$resultArray['message']="Payment update 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;
|
||||
|
||||
}
|
||||
}
|
||||
@ -176,6 +176,152 @@ app.controller('univFormPaymentCtrl', ["$scope","$rootScope","$filter", "ngTable
|
||||
};
|
||||
$rootScope.addError="";
|
||||
};
|
||||
/*
|
||||
* update university payment details
|
||||
* created by kms
|
||||
* */
|
||||
$rootScope.updatePaymentModel = {
|
||||
'ID':"",
|
||||
'billNo':"",
|
||||
'date':"",
|
||||
'billAmount':"",
|
||||
'receiptNo':"",
|
||||
'comments':"",
|
||||
'universityCode':"",
|
||||
'universityName':"",
|
||||
'paymentID':""
|
||||
|
||||
};
|
||||
$rootScope.viewPayment = function (values) {
|
||||
var updateDate=new Date(values.ApprovedDate).toDateString();
|
||||
$rootScope.updateError="";
|
||||
$rootScope.updatePaymentModel = {
|
||||
'ID': values.ID,
|
||||
'billNo':values.BillNo,
|
||||
'date':$filter('date')(new Date(updateDate), 'yyyy-MM-dd'),
|
||||
'billAmount':values.DebitAmount,
|
||||
'receiptNo':values.ReceiptNo,
|
||||
'comments':values.Remarks,
|
||||
'universityCode':values.UniversityCode,
|
||||
'universityName':values.UniversityName,
|
||||
'paymentID':values.PaymentID
|
||||
};
|
||||
$rootScope.updatePaymentModal = $modal.open({
|
||||
templateUrl: 'assets/views/student/updateUniversityPaymentModal.html',
|
||||
// controller: 'univFormPaymentCtrl',
|
||||
// size: size,
|
||||
resolve: {
|
||||
items: function () {
|
||||
return $rootScope.updatePaymentModel;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.updatePaymentModal.result.then(function (selectedItem) {
|
||||
}, function () {
|
||||
$rootScope.updatePaymentModal.close();
|
||||
$rootScope.updatePaymentModel = {
|
||||
'ID':"",
|
||||
'billNo':"",
|
||||
'date':"",
|
||||
'billAmount':"",
|
||||
'receiptNo':"",
|
||||
'comments':"",
|
||||
'universityCode':"",
|
||||
'universityName':"",
|
||||
'paymentID':""
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$rootScope.updateError="";
|
||||
$rootScope.updateUnivPayment = function (form,updateDetails) {
|
||||
$rootScope.updateError="";
|
||||
var firstError = null;
|
||||
if (form.$invalid) {
|
||||
|
||||
var field = null, firstError = null;
|
||||
for (field in form) {
|
||||
if (field[0] != '$') {
|
||||
if (firstError === null && !form[field].$valid) {
|
||||
firstError = form[field].$name;
|
||||
}
|
||||
if (form[field].$pristine) {
|
||||
form[field].$dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
||||
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
||||
}
|
||||
else{
|
||||
var changeDate;
|
||||
if(angular.isObject(updateDetails.date)){
|
||||
var saveDate=new Date(updateDetails.date).toDateString();
|
||||
changeDate=$filter('date')(new Date(saveDate), 'yyyy-MM-dd');
|
||||
}
|
||||
else{
|
||||
changeDate=updateDetails.date;
|
||||
|
||||
}
|
||||
$scope.univUpdateData = {
|
||||
"universityCode":updateDetails.universityCode,
|
||||
"universityName":updateDetails.universityName,
|
||||
"billNo":updateDetails.billNo,
|
||||
"billAmount":updateDetails.billAmount,
|
||||
"date":changeDate,
|
||||
"receiptNo":updateDetails.receiptNo,
|
||||
"comments":updateDetails.comments,
|
||||
"ID":updateDetails.ID,
|
||||
"paymentID":updateDetails.paymentID,
|
||||
}
|
||||
|
||||
var updatePayment = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'updateUniversityPaymentDetails/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
localDetails: localDetail,
|
||||
details: $scope.univUpdateData,
|
||||
}
|
||||
};
|
||||
$http(updatePayment).then(function (response) {
|
||||
if (response.data.status==true) {
|
||||
swal(" ", response.data.message, "success");
|
||||
$rootScope.updatePaymentModal.close();
|
||||
$rootScope.updatePaymentModel = {
|
||||
'ID':"",
|
||||
'billNo':"",
|
||||
'date':"",
|
||||
'billAmount':"",
|
||||
'receiptNo':"",
|
||||
'comments':"",
|
||||
'universityCode':"",
|
||||
'universityName':"",
|
||||
'paymentID':""
|
||||
|
||||
};
|
||||
$rootScope.getPaymentVerificationDetails($scope.paymentVerficationModel);
|
||||
|
||||
|
||||
} else {
|
||||
$rootScope.updateError=response.data.message;
|
||||
$timeout(function () {
|
||||
$rootScope.updateError="";
|
||||
}, 4000);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -233,4 +379,24 @@ app.controller('univFormPaymentCtrl', ["$scope","$rootScope","$filter", "ngTable
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* cancel update modal
|
||||
* */
|
||||
$rootScope.cancelUpdatePaymentModal=function () {
|
||||
$rootScope.updatePaymentModal.close();
|
||||
/* $rootScope.updatePaymentModel = {
|
||||
'ID':"",
|
||||
'billNo':"",
|
||||
'date':"",
|
||||
'billAmount':"",
|
||||
'receiptNo':"",
|
||||
'comments':"",
|
||||
'universityCode':"",
|
||||
'universityName':"",
|
||||
'paymentID':""
|
||||
|
||||
};*/
|
||||
$rootScope.updateError="";
|
||||
};
|
||||
|
||||
}]);
|
||||
@ -2,6 +2,10 @@
|
||||
.universityPaid {
|
||||
background: #f4f4f7 !important;
|
||||
}
|
||||
.spanCursor{
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
</style>
|
||||
<section id="page-title">
|
||||
<div class="row">
|
||||
@ -65,6 +69,7 @@
|
||||
<th> Form ID</th>
|
||||
<th> Enrolment No</th>
|
||||
<th> Bill No</th>
|
||||
<th> Date</th>
|
||||
<th> Payable</th>
|
||||
<th> Paid </th>
|
||||
<th> Balance</th>
|
||||
@ -75,7 +80,9 @@
|
||||
<tr ng-class="{universityPaid:p.TypeID==0}">
|
||||
<td>{{p.FormID}}</td>
|
||||
<td>{{p.EnrolmentNo}}</td>
|
||||
<td>{{p.BillNo}}</td>
|
||||
<td><span class="spanCursor" tooltip="Click to edit/view bill" ng-click="viewPayment(p)">{{p.BillNo}}</span></td>
|
||||
<td>{{p.FormatDate}}</td>
|
||||
|
||||
<td ng-if="p.CreditAmount==0"></td>
|
||||
<td ng-if="p.CreditAmount>0"><span style="float:right;">{{p.CreditAmount}}</span></td>
|
||||
<td ng-if="p.DebitAmount==0"></td>
|
||||
|
||||
103
Apollo/assets/views/student/updateUniversityPaymentModal.html
Normal file
103
Apollo/assets/views/student/updateUniversityPaymentModal.html
Normal file
@ -0,0 +1,103 @@
|
||||
<div class="container-fluid container-fullw bg-white">
|
||||
<fieldset>
|
||||
|
||||
<legend>Payment for : {{updatePaymentModel.universityName}}</legend>
|
||||
<form name="UpdateFormPayment" id="form" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-group"
|
||||
ng-class="{'has-error':UpdateFormPayment.billno.$dirty && UpdateFormPayment.billno.$invalid, 'has-success':UpdateFormPayment.billno.$valid}">
|
||||
<label>
|
||||
Bill No <span
|
||||
class="symbol required"></span>
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="Enter Bill No"
|
||||
tabindex="1" class="form-control" name="billno"
|
||||
ng-model="updatePaymentModel.billNo" capitalize disallow-spaces required/>
|
||||
<span class="error text-small block"
|
||||
ng-if="UpdateFormPayment.billno.$dirty && UpdateFormPayment.billno.$error.required">Bill no is required</span>
|
||||
</div>
|
||||
<div class="col-md-4 form-group"
|
||||
ng-class="{'has-error':UpdateFormPayment.billAmount.$dirty && UpdateFormPayment.billAmount.$invalid,'has-success':UpdateFormPayment.billAmount.$valid}">
|
||||
<label>
|
||||
Bill Amount <span class="symbol required"></span>
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="Enter Bill Amount"
|
||||
autofocus tabindex="2" class="form-control" name="billAmount" id="billAmount" ng-maxlength="9"
|
||||
ng-model="updatePaymentModel.billAmount" ng-pattern="/^[0-9]*$/" required/>
|
||||
<span class="error text-small block"
|
||||
ng-if="UpdateFormPayment.billAmount.$dirty && UpdateFormPayment.billAmount.$invalid"
|
||||
ng-hide="UpdateFormPayment.billAmount.$error.maxlength || UpdateFormPayment.billAmount.$error.pattern">Bill amount is required</span>
|
||||
<span class="error text-small block"
|
||||
ng-if="UpdateFormPayment.billAmount.$error.maxlength || UpdateFormPayment.billAmount.$error.pattern">Enter a valid amount</span>
|
||||
|
||||
</div>
|
||||
<div data-ng-controller="DatepickerDemoCtrl">
|
||||
<div class="col-md-4 form-group"
|
||||
ng-class="{'has-error':UpdateFormPayment.date.$dirty && UpdateFormPayment.date.$invalid, 'has-success':UpdateFormPayment.date.$valid}">
|
||||
<label>
|
||||
Bill Date <span
|
||||
class="symbol required"></span>
|
||||
</label>
|
||||
<input type="text"
|
||||
class="form-control "
|
||||
ng-click="startOpen = !startOpen"
|
||||
datepicker-popup="dd-MM-yyyy"
|
||||
ng-model="updatePaymentModel.date"
|
||||
is-open="startOpen"
|
||||
ng-init="startOpen = false"
|
||||
name="date"
|
||||
datepicker-options="dateOptions"
|
||||
placeholder="Select Date"
|
||||
min-date="currentDate"
|
||||
max-date="futureDate"
|
||||
close-text="Close" required="required" ng-readonly="true"/>
|
||||
<span class="error text-small block"
|
||||
ng-if="UpdateFormPayment.date.$dirty && UpdateFormPayment.date.$error.required">Date is required.</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-group"
|
||||
ng-class="{'has-error':UpdateFormPayment.receiptNo.$dirty && UpdateFormPayment.receiptNo.$invalid}">
|
||||
<label>
|
||||
Receipt No
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="Enter Receipt No"
|
||||
tabindex="3" class="form-control" name="receiptNo"
|
||||
ng-model="updatePaymentModel.receiptNo" disallow-spaces/>
|
||||
</div>
|
||||
<div class="col-md-8 form-group"
|
||||
ng-class="{'has-error':UpdateFormPayment.comments.$dirty && UpdateFormPayment.comments.$invalid}">
|
||||
<label>
|
||||
Comments
|
||||
</label>
|
||||
<textarea placeholder="Enter Comments" tabindex="4"
|
||||
class="form-control textdsc" name="comments"
|
||||
ng-model="updatePaymentModel.comments"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<span style="color:red;">{{updateError}}</span>
|
||||
<button type="submit" tabindex="5" class="btn btn-wide btn-success" ng-click="updateUnivPayment(UpdateFormPayment,updatePaymentModel)">
|
||||
Update
|
||||
</button>
|
||||
|
||||
<input type="button" class="btn btn-warning btn-wide" tabindex="6" value="Cancel"
|
||||
ng-click="cancelUpdatePaymentModal();">
|
||||
|
||||
</input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user