credit payment function

This commit is contained in:
phyusin
2018-07-10 18:12:25 +06:30
parent d0118d2cfc
commit bf0f76ebc7
29 changed files with 879 additions and 462 deletions

View File

@@ -115,7 +115,7 @@
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default m-t-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
<button type="button" class="btn bg-default m-t-10 btn-block" id="back"><i class="material-icons m-t--5">reply</i> Back </button>
</div>
</div>
</div>
@@ -146,7 +146,11 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment";
var url_param = "payment";
if(location.pathname.includes("credit_payment")){
url_param = "credit_payment";
}
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/"+url_param+"/others_payment";
});
}
}
@@ -181,8 +185,8 @@
$('#amount').html("0.0");
break;
case 'del' :
var cash=$('#amount').text();
$('#amount').text(cash.substr(0,cash.length-1));
var cash=$('#amount').text() > 0 ? $('#amount').text() : 0;
$('#amount').text((cash > 0 && cash.substr(0,cash.length-1) > 0) ? cash.substr(0,cash.length-1) : 0);
break;
case 'nett':
var remain_amount = $('#validamount').val();
@@ -200,8 +204,8 @@
var reference_no = $('#reference_no').val();
var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>";
console.log(amount);
console.log($("#validamount").attr("value"));
// console.log(amount);
// console.log($("#validamount").attr("value"));
$("#reference_no_Err").html("");
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
@@ -224,8 +228,13 @@
pay_withBank("SALE", "visa", amount, sale_id, receipt_no,cashier_type);
}
else{
if(location.pathname.includes("credit_payment")){
var url = "<%= origami_credit_payment_visa_path %>";
}else{
var url = "<%= origami_payment_visa_path %>";
}
$.ajax({type: "POST",
url: "<%= origami_payment_visa_path %>",
url: url,
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
@@ -237,7 +246,11 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
var url_param = "payment";
if(location.pathname.includes("credit_payment")){
url_param = "credit_payment";
}
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/"+url_param;
});
}
}
@@ -251,4 +264,13 @@
}
}
});
$('#back').on('click',function(){
var url_param = "payment";
if(location.pathname.includes("credit_payment")){
url_param = "credit_payment";
}
window.location.href = '/origami/sale/'+'<%= @sale_id %>'+'/<%= @cashier_type %>/'+url_param;
// window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
});
</script>