fix foodcourt sales transaction

This commit is contained in:
Thein Lin Kyaw
2023-08-24 10:40:31 +06:30
parent 5503852217
commit a97b6bff3f
22 changed files with 361 additions and 453 deletions

View File

@@ -757,53 +757,32 @@ $(document).ready(function(){
var sale_id = $('#sale_id').text();
// var item_row = $('.is_card');
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
var kbz_amt = "<%= @kbz_pay_amount %>";
var is_kbz = false;
if (kbz_amt > 0) {
is_kbz = true
}
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
// calculate_member_discount(sale_id,tax_type);
/* check credit payment or not*/
var url = "<%= foodcourt_payment_cash_path %>";
$.ajax({type: "POST",
url: url,
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz+"&account_no="+customer_mamber_card_no,
success:function(result) {
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
swal({
title: "Payment Successful!",
text: "Thank You !",
type: 'success',
html: true,
closeOnConfirm: true,
closeOnCancel: false,
allowOutsideClick: false
},
function (isConfirm) {
$("#loading_wrapper").show();
$('.confirm').attr("disabled","disabled");
window.location.href = "<%= foodcourt_food_court_path %>";
});
$("#loading_wrapper").hide();
}
});
$("#loading_wrapper").hide();
var second_display_lookup = $("#display_type").val();
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
customer_display_view(null,"reload");
}
swal({
title: "Payment Successful!",
text: "Thank You !",
type: 'success',
html: true,
closeOnConfirm: true,
closeOnCancel: false,
allowOutsideClick: false
},
function (isConfirm) {
$("#loading_wrapper").show();
$('.confirm').attr("disabled","disabled");
window.location.href = "<%= foodcourt_food_court_path %>";
});
} else {
var insufficient_message = result.message + '<br> Card balance : ' + customer_card_balance
swal({
@@ -815,7 +794,7 @@ $(document).ready(function(){
closeOnCancel: false,
allowOutsideClick: false
}, function () {
location.reload();
window.location.href = '/foodcourt/food_court';
});
$("#loading_wrapper").hide();
}