Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into sqa-1804-001

This commit is contained in:
phyusin
2018-05-17 17:53:29 +06:30
12 changed files with 97 additions and 183 deletions

View File

@@ -751,7 +751,7 @@ def self.daily_sales_list(from,to)
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
.joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id")
.joins(" left join sale_payments on sale_payments.sale_id = sales.sale_id")
.where("sale_status = ? AND sales.receipt_date between ? and ? ", 'completed', from, to)
.group("DATE_FORMAT((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')),'%Y-%m-%d')")