total other amount added to SaleItemsPdf
This commit is contained in:
@@ -81,15 +81,15 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
||||
end
|
||||
end
|
||||
|
||||
def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items)
|
||||
def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
|
||||
filename = "tmp/reports_sale_items.pdf"
|
||||
|
||||
if print_settings.unique_code == "CloseCashierPdf"
|
||||
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, nil, nil)
|
||||
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges, nil, nil, nil)
|
||||
puts 'Printing!!!!'
|
||||
end
|
||||
if print_settings.unique_code == "CloseCashierStarPdf"
|
||||
pdf = SaleItemsStarPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, nil, nil)
|
||||
pdf = SaleItemsStarPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges, nil, nil, nil)
|
||||
puts 'PrintingStar!!!!'
|
||||
end
|
||||
|
||||
|
||||
@@ -156,7 +156,14 @@ class ShiftSale < ApplicationRecord
|
||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||
.where('shift_sale_id =? and sales.sale_status = "completed" and c.customer_type = "Takeaway" and c.membership_id is null',shift.id)
|
||||
.first()
|
||||
end
|
||||
end
|
||||
|
||||
# def self.get_total_other_charges_for_sale_item_report(from, to)
|
||||
# query = SaleItem.select("sum(sale_items.qty * sale_items.unit_price) as total_other_charges_amount")
|
||||
# .joins("JOIN sales as s ON s.sale_id = sale_items.sale_id")
|
||||
# .joins("JOIN shift_sales ss ON ss.id = s.shift_sale_id")
|
||||
# .where('s.sale_status = "completed" and sale_items.product_code = "Other Charges" and sale_items.item_instance_code is null and s.receipt_date between ? and ?',from, to)
|
||||
# end
|
||||
|
||||
def self.get_total_other_charges(shift)
|
||||
query = SaleItem.select("sum(sale_items.qty * sale_items.unit_price) as total_other_charges_amount")
|
||||
|
||||
Reference in New Issue
Block a user