update close cashier pdf
This commit is contained in:
@@ -87,13 +87,11 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
shop_details = shop_detail
|
shop_details = shop_detail
|
||||||
#get tax
|
#get tax
|
||||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
shift_obj = ShiftSale.where('id = ?', @shift.id)
|
||||||
sale_items = ''
|
|
||||||
@lookup = Lookup.shift_sale_items_lookup_value
|
@lookup = Lookup.shift_sale_items_lookup_value
|
||||||
if @lookup.to_i == 1
|
if @lookup.to_i == 1
|
||||||
@sale_items = Sale.get_shift_sale_items(@shift.id)
|
@sale_items = Sale.get_shift_sale_items(@shift.id)
|
||||||
other_charges = Sale.get_other_charges()
|
@total_other_charges_info = ShiftSale.get_other_charges(@shift)
|
||||||
@total_other_charges_info = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",@shift)
|
|
||||||
end
|
end
|
||||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||||
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
|
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
|
||||||
@@ -108,7 +106,6 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
@total_dinein = ShiftSale.get_total_dinein(@shift).total_dinein_amount
|
@total_dinein = ShiftSale.get_total_dinein(@shift).total_dinein_amount
|
||||||
@total_takeway = ShiftSale.get_total_takeway(@shift).total_takeway_amount
|
@total_takeway = ShiftSale.get_total_takeway(@shift).total_takeway_amount
|
||||||
@total_other_charges = ShiftSale.get_total_other_charges(@shift).total_other_charges_amount
|
@total_other_charges = ShiftSale.get_total_other_charges(@shift).total_other_charges_amount
|
||||||
@other_charges = ShiftSale.get_other_charges(@shift)
|
|
||||||
@total_credit_payments = ShiftSale.get_shift_sales_with_credit_payment(shift_id).total_credit_payments
|
@total_credit_payments = ShiftSale.get_shift_sales_with_credit_payment(shift_id).total_credit_payments
|
||||||
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
|
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
|
||||||
# get printer info
|
# get printer info
|
||||||
@@ -116,14 +113,8 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||||
|
|
||||||
# print close cashier setting
|
# print close cashier setting
|
||||||
close_cashier_print = Lookup.collection_of('close_cashier_print')
|
if Lookup.collection_of('close_cashier_print').any? { |l| l == ['CloseCashierPrint', '1'] }
|
||||||
if close_cashier_print.empty?
|
printer.print_close_cashier(print_settings, cashier_terminal, @shift, @sale_items, @total_other_charges_info, shop_details, @sale_taxes, @other_payment, @total_amount_by_account, @total_discount_by_account, @total_member_discount, @total_dinein, @total_takeway, @total_other_charges, @total_waste, @total_spoile, @total_credit_payments, @payment_methods)
|
||||||
@settings_lookup = Lookup.new(lookup_type: "close_cashier_print", name: "CloseCashierPrint", value: "1")
|
|
||||||
@settings_lookup.save
|
|
||||||
end
|
|
||||||
find_close_cashier_print = Lookup.collection_of('close_cashier_print')
|
|
||||||
if find_close_cashier_print[0][1].to_i > 0
|
|
||||||
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments,@payment_methods,@other_charges)
|
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,6 @@ class Reports::ShiftsaleController < BaseReportController
|
|||||||
@shift = ShiftSale.find_by_id(shift_id)
|
@shift = ShiftSale.find_by_id(shift_id)
|
||||||
shift_obj = ShiftSale.where('id =?',shift_id)
|
shift_obj = ShiftSale.where('id =?',shift_id)
|
||||||
|
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
|
||||||
|
|
||||||
close_cashier_pdf = Lookup.collection_of("print_settings")
|
close_cashier_pdf = Lookup.collection_of("print_settings")
|
||||||
|
|
||||||
unique_code = "CloseCashierPdf"
|
unique_code = "CloseCashierPdf"
|
||||||
@@ -72,9 +69,15 @@ class Reports::ShiftsaleController < BaseReportController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
shop_details = shop_detail
|
shop_details = shop_detail
|
||||||
cashier_terminal = @shift.cashier_terminal
|
cashier_terminal = @shift.cashier_terminal
|
||||||
|
|
||||||
|
@lookup = Lookup.shift_sale_items_lookup_value
|
||||||
|
if @lookup.to_i == 1
|
||||||
|
@sale_items = Sale.get_shift_sale_items(@shift.id)
|
||||||
|
@total_other_charges_info = ShiftSale.get_other_charges(@shift)
|
||||||
|
end
|
||||||
|
|
||||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||||
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
|
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
|
||||||
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
|
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
|
||||||
@@ -96,14 +99,10 @@ class Reports::ShiftsaleController < BaseReportController
|
|||||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||||
|
|
||||||
# printer.print_close_cashier(print_settings,cashier_terminal,@shift, nil, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
|
# printer.print_close_cashier(print_settings,cashier_terminal,@shift, nil, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
|
||||||
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments,@payment_methods)
|
printer.print_close_cashier(print_settings, cashier_terminal, @shift, @sale_items, @total_other_charges_info, shop_details, @sale_taxes, @other_payment, @total_amount_by_account, @total_discount_by_account, @total_member_discount, @total_dinein, @total_takeway, @total_other_charges, @total_waste, @total_spoile, @total_credit_payments, @payment_methods)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to '/en/reports/shiftsale/', notice: 'Printing Completed.'}
|
format.html { redirect_to '/en/reports/shiftsale/', notice: 'Printing Completed.'}
|
||||||
format
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|||||||
# self.print(filename, cashier_terminal.printer_name)
|
# self.print(filename, cashier_terminal.printer_name)
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def print_close_cashier(printer_settings, cashier_terminal, shift_sale, sale_items, total_other_charges_info, shop_details, sale_taxes, other_payment, amount, discount, member_discount, total_dinein, total_takeway, total_other_charges, total_waste, total_spoile, total_credit_payments, payment_methods, other_charges)
|
def print_close_cashier(printer_settings, cashier_terminal, shift_sale, sale_items, total_other_charges_info, shop_details, sale_taxes, other_payment, amount, discount, member_discount, total_dinein, total_takeway, total_other_charges, total_waste, total_spoile, total_credit_payments, payment_methods)
|
||||||
if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
|
if Lookup.collection_of('print_settings').none? { |x| x == ["ActionCable", "1"] }
|
||||||
if !sale_items.blank? or !sale_items.nil?
|
if !sale_items.blank? or !sale_items.nil?
|
||||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||||
@@ -71,6 +71,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
#no print in cloud server
|
#no print in cloud server
|
||||||
if ENV["SERVER_MODE"] != "cloud"
|
if ENV["SERVER_MODE"] != "cloud"
|
||||||
@@ -87,6 +88,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|||||||
cashier_terminal: cashier_terminal,
|
cashier_terminal: cashier_terminal,
|
||||||
shift_employee: shift_sale.employee,
|
shift_employee: shift_sale.employee,
|
||||||
sale_items: sale_items,
|
sale_items: sale_items,
|
||||||
|
other_charges: total_other_charges_info,
|
||||||
sale_taxes: sale_taxes,
|
sale_taxes: sale_taxes,
|
||||||
other_payment: other_payment,
|
other_payment: other_payment,
|
||||||
total_amount_by_account: amount,
|
total_amount_by_account: amount,
|
||||||
@@ -94,7 +96,6 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|||||||
total_member_discount: member_discount,
|
total_member_discount: member_discount,
|
||||||
total_waste: total_waste,
|
total_waste: total_waste,
|
||||||
total_spoile: total_spoile,
|
total_spoile: total_spoile,
|
||||||
other_charges: other_charges,
|
|
||||||
total_other_charges: total_other_charges,
|
total_other_charges: total_other_charges,
|
||||||
total_credit_payments: total_credit_payments
|
total_credit_payments: total_credit_payments
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,8 +398,6 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# move_down 5
|
# move_down 5
|
||||||
|
|||||||
Reference in New Issue
Block a user