add channel for checkin process
This commit is contained in:
@@ -979,11 +979,11 @@ end
|
||||
def self.hourly_sales(today)
|
||||
query= Sale.select("grand_total")
|
||||
.where('payment_status="paid" and sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
|
||||
.group("date_format(receipt_date, '%I %p')")
|
||||
.group("date_format(convert_tz(receipt_date,'+00:00','+06:30'), '%I:%p')")
|
||||
end
|
||||
|
||||
def self.employee_sales(today)
|
||||
query = Sale.select("e.name as employee_name,grand_total")
|
||||
query = Sale.select("e.name as employee_name,(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE sp.payment_amount END) as total_amount")
|
||||
.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")
|
||||
.joins("join sale_payments sp on sp.sale_id=sales.sale_id")
|
||||
@@ -1102,7 +1102,7 @@ end
|
||||
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||
.where("sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||
.group("a.product_code")
|
||||
.order("SUM(a.price) DESC")
|
||||
.order("SUM(a.qty) DESC")
|
||||
.first()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user