Add Dinein, Takeway, Change Total to Gross Sale,Grand Total
This commit is contained in:
@@ -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 = ''
|
||||
|
||||
Reference in New Issue
Block a user