Add Dinein, Takeway, Change Total to Gross Sale,Grand Total

This commit is contained in:
San Wai Lwin
2018-02-15 18:35:33 +06:30
parent d8d119edd6
commit e50915aa3b
6 changed files with 467 additions and 16 deletions

View File

@@ -135,6 +135,20 @@ class ShiftSale < ApplicationRecord
end
def self.get_total_dinein(shift)
query = Sale.select("sum(sales.grand_total) as total_dinein_amount")
.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 = "Dinein" and c.membership_id is null',shift.id)
.first()
end
def self.get_total_takeway(shift)
query = Sale.select("sum(sales.grand_total) as total_takeway_amount")
.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
def self.search(filter,from,to)
if filter.blank?
keyword = ''