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

This commit is contained in:
Yan
2017-11-15 13:28:46 +06:30
6 changed files with 114 additions and 279 deletions

View File

@@ -904,7 +904,7 @@ end
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
" i.price as unit_price,mi.name as product_name")
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code")
.where("(i.qty > 0 ) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+
.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+
"and payment_status='paid' and sale_status= 'completed'")
.group('mi.name')
.order("SUM(i.qty) DESC").limit(5)
@@ -918,10 +918,11 @@ end
def self.employee_sales(today)
query = Sale.select("e.name as employee_name,grand_total")
.where('payment_status="paid" and sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
.where('sales.payment_status="paid" and sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
.joins("join employees e on e.id=sales.cashier_id")
.group('e.name')
.order('e.name ASC')
.joins("join sale_payments sp on sp.sale_id=sales.sale_id")
.group("sp.payment_method","e.name")
.order('e.name')
end
def self.total_sale(today)