update close cashier pdf

This commit is contained in:
Thein Lin Kyaw
2020-08-24 16:07:25 +06:30
parent c8b0471794
commit bd65edcba3
4 changed files with 137 additions and 148 deletions

View File

@@ -87,13 +87,11 @@ class Origami::ShiftsController < BaseOrigamiController
end
shop_details = shop_detail
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
sale_items = ''
shift_obj = ShiftSale.where('id = ?', @shift.id)
@lookup = Lookup.shift_sale_items_lookup_value
if @lookup.to_i == 1
@sale_items = Sale.get_shift_sale_items(@shift.id)
other_charges = Sale.get_other_charges()
@total_other_charges_info = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",@shift)
@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='')
@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_takeway = ShiftSale.get_total_takeway(@shift).total_takeway_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
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
# get printer info
@@ -116,15 +113,9 @@ class Origami::ShiftsController < BaseOrigamiController
printer = Printer::CashierStationPrinter.new(print_settings)
# print close cashier setting
close_cashier_print = Lookup.collection_of('close_cashier_print')
if close_cashier_print.empty?
@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
if Lookup.collection_of('close_cashier_print').any? { |l| l == ['CloseCashierPrint', '1'] }
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)
end
# end
end