total other amount added to SaleItemsPdf

This commit is contained in:
Zoey
2019-06-03 16:47:49 +06:30
parent fe0ae102f9
commit 4b73920e18
7 changed files with 95 additions and 36 deletions

View File

@@ -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")