67 lines
2.8 KiB
Ruby
Executable File
67 lines
2.8 KiB
Ruby
Executable File
class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|
|
|
def print_open_cashier(receipt_no)
|
|
time = DateTime.now
|
|
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
pdf = CashierStationOpening.new
|
|
pdf.render_file "tmp/cashier_station_#{order_id}_closing_#{time}.pdf"
|
|
self.print("tmp/cashier_station_#{order_id}_closing_#{time}.pdf")
|
|
end
|
|
|
|
# def print_close_cashier(receipt_no)
|
|
# #Use CUPS service
|
|
# #Generate PDF
|
|
# time = DateTime.now
|
|
# #Print
|
|
# pdf = CashierStationClosing.new
|
|
# pdf.render_file "tmp/cashier_station_#{order_id}_closing_#{time}.pdf"
|
|
# self.print("tmp/receipt.pdf")
|
|
# end
|
|
|
|
#Bill Receipt Print
|
|
# def print_close_cashier(printer_settings,cashier_terminal,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
|
|
# #Use CUPS service
|
|
# #Generate PDF
|
|
# #Print
|
|
# cashier = shift_sale.employee.name
|
|
# shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
|
|
|
# pdf = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
|
|
# filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
|
# pdf.render_file filename
|
|
# self.print(filename, cashier_terminal.printer_name)
|
|
# end
|
|
|
|
def print_close_cashier(printer_settings,cashier_terminal,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
|
|
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
cashier = shift_sale.employee.name
|
|
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
|
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
|
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
|
|
close_cashier_pdf = Lookup.collection_of("print_settings") #print_settings with name:CloseCashierPdf
|
|
|
|
if !close_cashier_pdf.empty?
|
|
close_cashier_pdf.each do |close_cashier|
|
|
if close_cashier[0] == 'CloseCashierCustomisePdf'
|
|
if close_cashier[1] == '1'
|
|
pdf = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
|
|
else
|
|
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
pdf.render_file filename
|
|
|
|
self.print(filename, cashier_terminal.printer_name)
|
|
end
|
|
|
|
|
|
end
|