change dashboard data

This commit is contained in:
phyusin
2017-12-12 15:43:56 +06:30
parent f8b2cd90ba
commit 8611489ecb
3 changed files with 4 additions and 4 deletions

View File

@@ -1038,7 +1038,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)