To update close cashier

This commit is contained in:
San Wai Lwin
2018-02-20 17:35:54 +06:30
parent e50915aa3b
commit 51a243ea7c
5 changed files with 116 additions and 56 deletions

View File

@@ -149,6 +149,13 @@ class ShiftSale < ApplicationRecord
.first()
end
def self.get_total_other_charges(shift)
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")
.where('shift_sale_id =? and s.sale_status = "completed" and sale_items.product_code = "Other Charges" and sale_items.item_instance_code is null',shift.id)
.first()
end
def self.search(filter,from,to)
if filter.blank?
keyword = ''