Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-12-12 17:50:33 +06:30
8 changed files with 269 additions and 154 deletions

View File

@@ -1039,7 +1039,7 @@ end
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
end
query.sum("sp.payment_amount")
query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first()
end
def self.total_customer(today)