Sale Item Pdf added

This commit is contained in:
Zoey
2019-05-22 17:34:12 +06:30
12 changed files with 1115 additions and 197 deletions

View File

@@ -9,7 +9,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
pdf = CashierStationOpening.new
pdf.render_file "tmp/cashier_station_#{order_id}_closing_#{time}.pdf"
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/cashier_station_#{order_id}_closing_#{time}.pdf")
end
end
@@ -33,10 +33,11 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
# 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"
# filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
# pdf.render_file filename
# self.print(filename, cashier_terminal.printer_name)
# end
# <<<<<<< HEAD
def print_close_cashier(printer_settings,cashier_terminal,shift_sale, sale_items,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
@@ -46,12 +47,16 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
@menu_cate_count = Hash.new {|hash, key| hash[key] = 0}
sale_items.each {|cate| @menu_cate_count[cate.account_id] += 1}
sale_items.each {|cate| @menu_cate_count[cate.menu_category_id] += 1}
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
sale_items.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
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,total_waste,total_spoile,total_credit_payments)
# >>>>>>> 6c45e8f0a32a9e71992bde41d20ef993b668c42d
#Use CUPS service
#Generate PDF
@@ -61,14 +66,14 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
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,total_waste,total_spoile,total_credit_payments)
else
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
end
end
end
@@ -76,9 +81,22 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
pdf.render_file filename
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, cashier_terminal.printer_name)
end
end
def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, menu_cate_count)
filename = "tmp/reports_sale_items.pdf"
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, menu_cate_count, nil)
pdf.render_file filename
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, print_settings.printer_name)
end
end
#sqa
end