update dashboard total sale and count

This commit is contained in:
Aung Myo
2017-10-24 10:55:02 +06:30
parent 2f254a34ca
commit 59c38b2c96
3 changed files with 22 additions and 6 deletions

View File

@@ -867,6 +867,15 @@ end
.order('e.name ASC')
end
def self.total_sale(today)
total = Sale.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today).sum("grand_total")
end
def self.total_count(today)
total = Sale.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today).count
end
private
def generate_custom_id