use print_settings ActionCable fro call waiter, stock check, check in out
This commit is contained in:
@@ -39,7 +39,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
return filename, order_id, oqs.printer_name
|
||||
end
|
||||
|
||||
@@ -170,47 +170,51 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# Check in-out time
|
||||
def print_check_in_out(print_settings, cashier_terminal, booking, table)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
sale_id = booking.sale_id
|
||||
filename = "tmp/check_in_out_#{sale_id}" + ".pdf"
|
||||
if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
sale_id = booking.sale_id
|
||||
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
|
||||
pdf = CheckInOutPdf.new(print_settings,booking, table)
|
||||
|
||||
# if order_item[0].price != 0
|
||||
if !print_setting.empty?
|
||||
print_setting.each do |print_settings|
|
||||
if print_settings.unique_code == 'CheckInOutPdf'
|
||||
pdf = CheckInOutPdf.new(print_settings,booking, table)
|
||||
print_setting = PrintSetting.all
|
||||
|
||||
# if order_item[0].price != 0
|
||||
if !print_setting.empty?
|
||||
print_setting.each do |print_settings|
|
||||
if print_settings.unique_code == 'CheckInOutPdf'
|
||||
pdf = CheckInOutPdf.new(print_settings,booking, table)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pdf.render_file filename
|
||||
pdf.render_file filename
|
||||
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
# print_settings.print_copies = 1
|
||||
# print_settings.save!
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
# print_settings.print_copies = 1
|
||||
# print_settings.save!
|
||||
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, print_settings.printer_name)
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, print_settings.printer_name)
|
||||
end
|
||||
else
|
||||
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,
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user