From b74ef4bff1f1780b0d1bfb2bf0634016c3a6ed65 Mon Sep 17 00:00:00 2001 From: yarzar_code Date: Wed, 29 Jul 2020 11:36:43 +0630 Subject: [PATCH] move table & order item actioncable added --- app/models/printer/order_queue_printer.rb | 12 ++++++++++++ app/models/printer/receipt_printer.rb | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 951783cb..14cc3c67 100755 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -13,7 +13,19 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # check for item not to show # if order_item[0].price != 0 pdf = print_settings.unique_code.constantize.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty) + booking_id = Booking.get_booking_id(order_id) # end + ActionCable.server.broadcast("print_channel", + queue: oqs.station_name, + unique_code: print_settings.unique_code, + print_copies: print_settings.print_copies, + data: { + order_item: order_item[0].as_json(methods: :type), + print_status: print_status.gsub(/[()]/, ""), + booking_id: booking_id, + precision: print_settings.precision + } + ) shop = Shop.current_shop directory_name = 'public/orders_'+shop.shop_code diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index b9828dec..ff6cc8e6 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -211,6 +211,21 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #no print in cloud server self.print("tmp/print_move_table.pdf", oqs.printer_name) end + ActionCable.server.broadcast("print_channel", + queue: oqs.station_name, + unique_code: print_settings.unique_code, + print_copies: print_settings.print_copies, + data: { + type: type, + body: { + to: to, + from: from, + date: date, + moved_by: moved_by, + order_items: order_items.as_json, + }, + } + ) end #Bill Receipt Print