promotion add in report
This commit is contained in:
@@ -878,13 +878,16 @@ def self.get_item_query(type)
|
||||
sale_type = "i.status = 'void' and i.item_instance_code IS NOT NULL and i.qty > 0"
|
||||
elsif type == "other"
|
||||
sale_type = "i.item_instance_code IS NULL"
|
||||
elsif type == "promotion"
|
||||
sale_type = "i.status = 'promotion'"
|
||||
end
|
||||
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.status as status_type,"+
|
||||
"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 ")
|
||||
"i.status as status_type,i.remark as remark,"+
|
||||
"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" +
|
||||
" JOIN menu_item_instances mii ON i.item_instance_code = mii.item_instance_code" +
|
||||
@@ -901,7 +904,7 @@ end
|
||||
def self.get_other_charges()
|
||||
query = Sale.select("i.account_id as account_id, " +
|
||||
"SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item," +
|
||||
"i.status as status_type,"+
|
||||
"i.status as status_type,i.remark as remark,"+
|
||||
" i.unit_price as unit_price,i.product_name as product_name")
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id")
|
||||
query = query.where("i.item_instance_code IS NULL AND i.product_code = 'Other Charges'")
|
||||
|
||||
Reference in New Issue
Block a user