fixed receipt bill pdf with action cable

This commit is contained in:
NyanLinHtut
2020-08-21 11:24:10 +06:30
parent 5dfdc7353e
commit b3ab999962
5 changed files with 112 additions and 151 deletions

View File

@@ -726,6 +726,7 @@ $(document).ready(function(){
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz,
success:function(result){
/* start delete receipt no in first bill*/
console.log(result);
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
@@ -740,33 +741,29 @@ $(document).ready(function(){
var msg = '';
}
$("#loading_wrapper" ).hide();
if(location.pathname.includes("credit_payment")){
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
if(location.pathname.includes("credit_payment") || pdf_view != 1){
payment_success_alert();
}else{
//PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
} else {
//PDF lightbox data;
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6)
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", pdfPath);
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
if (pdf_view == 1) {
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}else{
//PDF lightbox data
print_receipt();
}
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}
$("#loading_wrapper").hide();
}
});
}
@@ -1010,6 +1007,7 @@ $(document).ready(function(){
if($('#pay').is(":visible")) {
$('#pay').prop("disabled",true);
}
$("#loading_wrapper" ).show();
var sale_id = $('#sale_id').text();
var filename = $("#filename").val();
@@ -1048,6 +1046,8 @@ $(document).ready(function(){
}else{
payment_success_alert();
}
$("#loading_wrapper" ).hide();
}
});
}