add action cable for call waiter,stock check & check in out

This commit is contained in:
yarzar_code
2020-08-25 14:18:51 +06:30
parent bd65edcba3
commit c7cd353ba2
4 changed files with 45 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
class Api::CallWaitersController < ActionController::API
class Api::CallWaitersController < Api::ApiController
#List all active customers by name
def index

View File

@@ -177,6 +177,16 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
filename = "tmp/check_in_out_#{sale_id}" + ".pdf"
pdf = CheckInOutPdf.new(print_settings,booking, table)
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: cashier_terminal.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
booking: booking,
table: table,
table_type: table.type,
}
)
print_setting = PrintSetting.all
# if order_item[0].price != 0

View File

@@ -167,7 +167,28 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
# stock check
def print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker_name, shop_details)
pdf = StockResultPdf.new(print_settings,stockcheck, stockcheck_items,checker_name, shop_details)
pdf = StockCheckPdf.new(print_settings,stockcheck, stockcheck_items,checker_name, shop_details)
stock_items= []
if stockcheck_items.length > 0
stockcheck_items.each do |sc|
stock_item= {
count: sc.stock_count.to_s,
item_name: MenuItemInstance.get_item_name(sc.item_code)
}
stock_items.push(stock_item)
end
end
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: print_settings.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
stockcheck: stockcheck,
stockcheck_items: stock_items,
checker_name: checker_name,
shop_details: shop_details,
}
)
pdf.render_file "tmp/print_stock_check_result.pdf"
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
@@ -245,6 +266,17 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#Generate PDF
#Print
pdf = CallWaiterPdf.new(printer_settings,table,time,shop_detail)
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: print_settings.printer_name,
unique_code: print_settings.unique_code,
print_copies: print_settings.print_copies,
data: {
shop_name: shop_detail.name,
name: print_settings.name,
table: table.name,
time: time,
}
)
pdf.render_file "tmp/print_call_waiter.pdf"
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"

View File

@@ -1,4 +1,4 @@
class StockResultPdf < Prawn::Document
class StockCheckPdf < Prawn::Document
attr_accessor :label_width, :price_column_width, :page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size, :item_height, :qty_width, :total_width, :item_description_width, :text_width
def initialize(printer_settings, stockcheck, stockcheck_items, checker_name, shop_details)