Cloud mode in reprint
This commit is contained in:
@@ -452,7 +452,16 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance,card_data)
|
||||
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance,card_data)
|
||||
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -776,7 +776,6 @@
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
var server_mode =
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -788,6 +787,7 @@
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
alert("Hello");
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
location.reload();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<!-- Nav tabs - End -->
|
||||
<div id="custom-slimscroll">
|
||||
<div class="tab-content">
|
||||
@@ -423,8 +424,18 @@ $(document).on('click', '.access_modal', function(event){
|
||||
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
var ajax_url = '/origami/'+ sale_id + "/reprint"
|
||||
// return false;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user