From 9a96f066e9fddbe3f3f4433e2c488eff30ad82e0 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 9 Mar 2018 14:17:40 +0630 Subject: [PATCH] change print popup function --- app/models/printer/receipt_printer.rb | 8 +- app/views/origami/payments/show.html.erb | 100 +++++++++++------------ 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index 4b70f0b6..d544c908 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -204,15 +204,15 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker if count == 1 filename = "/receipts/receipt_bill_#{sale_data.receipt_no}.pdf" pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf" - # if printed_status != 'Paid' + if printed_status != 'Paid' self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name) - # end + end else filename = "/receipts/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf" pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf" - # if printed_status != 'Paid' + if printed_status != 'Paid' self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name) - # end + end end count -= 1 diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index eade87e1..8dc9fe02 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -462,11 +462,11 @@ var customer_id = "<%= @customer.id %>"; var customer_name = "<%= @customer.name %>"; $(document).ready(function(){ //start customer modal popup - // if((customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){ - // if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){ - // $("#is_memberModal").modal({show : true, backdrop: false, keyboard : false}); - // } - // } + if((customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){ + if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){ + $("#is_memberModal").modal({show : true, backdrop: false, keyboard : false}); + } + } /* start check first bill or not*/ var member_id = $('#membership_id').text(); @@ -594,53 +594,53 @@ var customer_name = "<%= @customer.name %>"; $("#loading_wrapper" ).hide(); //PDF lightbox data - // $("#sale_receipt_no").val(result.receipt_no); - // $("#filename").val(result.filename); - // $("#printer_name").val(result.printer_name); - // $("#receipt_pdf").attr("src", result.filename); - // $("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); - // $("#pdfModalLabel").text("Payment Successful!"); - // $("#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 %> - // } - //PDF lightbox data + $("#sale_receipt_no").val(result.receipt_no); + $("#filename").val(result.filename); + $("#printer_name").val(result.printer_name); + $("#receipt_pdf").attr("src", result.filename); + $("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); + $("#pdfModalLabel").text("Payment Successful!"); + $("#changed_amount").text(""); if($('#balance').text() < 0){ - swal({ - title: "Payment Successful!", - text: 'Changed amount ' + $('#balance').text() * (-1), - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function () { - if (cashier_type=="cashier") { - window.location.href = '/origami'; - }else{ - window.location.href = '/origami/quick_service'; - } - }); - }else{ - $('#pay').text("Pay"); - swal({ - title: "Payment Successful!", - text: 'Thank You !', - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function () { - if (cashier_type=="cashier") { - window.location.href = '/origami'; - }else{ - window.location.href = '/origami/quick_service'; - } - }); + <% 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 %> } + //PDF lightbox data + // if($('#balance').text() < 0){ + // swal({ + // title: "Payment Successful!", + // text: 'Changed amount ' + $('#balance').text() * (-1), + // html: true, + // closeOnConfirm: false, + // closeOnCancel: false, + // allowOutsideClick: false + // }, function () { + // if (cashier_type=="cashier") { + // window.location.href = '/origami'; + // }else{ + // window.location.href = '/origami/quick_service'; + // } + // }); + // }else{ + // $('#pay').text("Pay"); + // swal({ + // title: "Payment Successful!", + // text: 'Thank You !', + // html: true, + // closeOnConfirm: false, + // closeOnCancel: false, + // allowOutsideClick: false + // }, function () { + // if (cashier_type=="cashier") { + // window.location.href = '/origami'; + // }else{ + // window.location.href = '/origami/quick_service'; + // } + // }); + // } } }); }