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

@@ -114,7 +114,7 @@
</div>
<input type="hidden" id="sale_id" value="<%= @sale_id %>">
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default 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 btn-default btn-block" id="back"> <i class="material-icons m-t--5">reply</i>Back </button>
</div>
</div>
</div>
@@ -142,7 +142,11 @@ var cashier_type = "<%= @cashier_type %>";
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";
});
}
}
@@ -177,8 +181,8 @@ $(document).on('click', '.cashier_number', function(event){
$('#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();
@@ -220,8 +224,14 @@ $('#jcb_pay').on('click',function(){
$("#reference_no").val("");
pay_withBank("SALE", "jcb", amount, sale_id, receipt_no,cashier_type);
}else{
if(location.pathname.includes("credit_payment")){
var url = "<%= origami_credit_payment_jcb_path %>";
}else{
var url = "<%= origami_payment_jcb_path %>";
}
$.ajax({type: "POST",
url: "<%= origami_payment_jcb_path %>",
url: url,
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
@@ -233,7 +243,11 @@ $('#jcb_pay').on('click',function(){
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;
});
}
}
@@ -246,5 +260,14 @@ $('#jcb_pay').on('click',function(){
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
})
});
$('#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>