117 lines
3.4 KiB
Ruby
Executable File
117 lines
3.4 KiB
Ruby
Executable File
class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|
|
|
def print_receipt(receipt_no)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
pdf = OrderItemPdf.new
|
|
pdf.render_file "tmp/order_item_queue_#{order_id}_#{order_item_id}" + ".pdf"
|
|
self.print("tmp/receipt.pdf")
|
|
end
|
|
|
|
def print_receipt_payment_by_card(booking_id)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
|
pdf = OrderSummaryPdf.new
|
|
pdf.render_file filename
|
|
|
|
self.print(filename)
|
|
end
|
|
|
|
def print_receipt_payment_by_account(sale_id)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
|
pdf = OrderSummaryPdf.new
|
|
pdf.render_file filename
|
|
|
|
self.print(filename)
|
|
end
|
|
|
|
def print_receipt_payment_by_vochure(sale_id)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
|
pdf = OrderSummaryPdf.new
|
|
pdf.render_file filename
|
|
|
|
self.print(filename)
|
|
end
|
|
|
|
def print_receipt_payment_by_giftcard(sale_id)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
|
pdf = OrderSummaryPdf.new
|
|
pdf.render_file filename
|
|
|
|
self.print(filename)
|
|
end
|
|
|
|
def print_receipt_payment_by_foc(sale_id)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
|
pdf = OrderSummaryPdf.new
|
|
pdf.render_file filename
|
|
|
|
self.print(filename)
|
|
end
|
|
|
|
#Bill Receipt Print
|
|
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
|
|
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status)
|
|
|
|
# print as print copies in printer setting
|
|
count = printer_settings.print_copies
|
|
begin
|
|
if count == 1
|
|
pdf.render_file "tmp/receipt_bill_#{sale_data.receipt_no}.pdf"
|
|
self.print("tmp/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name)
|
|
else
|
|
pdf.render_file "tmp/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf"
|
|
self.print("tmp/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name)
|
|
end
|
|
|
|
count -= 1
|
|
end until count == 0
|
|
end
|
|
|
|
# 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.render_file "tmp/print_stock_check_result.pdf"
|
|
self.print("tmp/print_stock_check_result.pdf")
|
|
end
|
|
|
|
#Queue No Print
|
|
def print_queue_no(printer_settings,queue)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
pdf = QueueNoPdf.new(printer_settings,queue)
|
|
pdf.render_file "tmp/print_queue_no.pdf"
|
|
self.print("tmp/print_queue_no.pdf")
|
|
end
|
|
|
|
#Bill Receipt Print
|
|
def print_crm_order(booking,order_items,setting)
|
|
#Use CUPS service
|
|
#Generate PDF
|
|
#Print
|
|
pdf = CrmOrderPdf.new(booking,order_items,setting)
|
|
pdf.render_file "tmp/print_crm_order.pdf"
|
|
self.print("tmp/print_crm_order.pdf")
|
|
end
|
|
end
|