From 150ff664461f69b11e2b56bc455added4e0157e6 Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 19 Feb 2018 10:49:24 +0630 Subject: [PATCH] change slae item query --- app/models/sale.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/sale.rb b/app/models/sale.rb index f42b62a0..efdc8d30 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -743,7 +743,7 @@ def self.get_item_query() query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code,i.account_id as account_id, " + "SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item,i.qty as qty," + "i.remark as status_type,"+ - " mii.price as unit_price,i.price as price,i.product_name as product_name, mc.name as" + + " i.unit_price,i.price as price,i.product_name as product_name, mc.name as" + " menu_category_name,mc.id as menu_category_id ") query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" + @@ -754,7 +754,7 @@ def self.get_item_query() # "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ") query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id") # query = query.where("i.item_instance_code IS NOT NULL") - query = query.group("acc.title,mi.account_id,mi.menu_category_id,i.product_name") + query = query.group("acc.title,mi.account_id,mi.menu_category_id,i.product_name,i.unit_price") .order("acc.title desc, mi.account_id desc, mi.menu_category_id desc, i.unit_price asc") end