21 lines
466 B
Ruby
21 lines
466 B
Ruby
require 'cups'
|
|
|
|
class PrintWorker
|
|
def self.printers()
|
|
Cups.show_destinations
|
|
end
|
|
|
|
def self.default_printer()
|
|
Cups.default_printer
|
|
end
|
|
|
|
def self.print_receipt_cashgo(sale,receipt_setting, printer_destination,order_id)
|
|
|
|
pdf = CashPdf.new(sale,receipt_setting,order_id)
|
|
pdf.render_file "tmp/receipt_#{sale.receipt_no}" + ".pdf"
|
|
|
|
page = Cups::PrintJob.new("tmp/receipt_#{sale.receipt_no}.pdf", printer_destination)
|
|
page.print
|
|
end
|
|
end
|