fix for oqs and add instance code to assign order item
This commit is contained in:
@@ -7,10 +7,11 @@ class AssignedOrderItem < ApplicationRecord
|
||||
belongs_to :order
|
||||
belongs_to :order_queue_station
|
||||
|
||||
def self.assigned_order_item (order, item_code, order_queue_station )
|
||||
def self.assigned_order_item (order, item_code, instance_code, order_queue_station )
|
||||
assigned_order_item = AssignedOrderItem.new()
|
||||
assigned_order_item.order = order
|
||||
assigned_order_item.item_code = item_code
|
||||
assigned_order_item.instance_code = instance_code
|
||||
assigned_order_item.order_queue_station = order_queue_station
|
||||
assigned_order_item.print_status = false
|
||||
assigned_order_item.delivery_status = false
|
||||
@@ -23,7 +24,7 @@ class AssignedOrderItem < ApplicationRecord
|
||||
oqs.id as station_id, oqs.station_name,
|
||||
oqs.is_active, oqpz.zone_id,
|
||||
df.name as zone, df.type as table_type,
|
||||
odt.order_id, odt.item_code, odt.item_name,
|
||||
odt.order_id, odt.item_code, odt.item_instance_code, odt.item_name,
|
||||
odt.price, odt.qty, odt.item_order_by, odt.options,
|
||||
cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
|
||||
@@ -70,7 +70,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
# else
|
||||
|
||||
if (order_item.price != 0)
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, order_item.item_instance_code, oqs)
|
||||
oqs_order_items.push(order_item)
|
||||
end
|
||||
# end
|
||||
|
||||
@@ -605,7 +605,7 @@ end
|
||||
|
||||
def self.get_item_query()
|
||||
query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code, " +
|
||||
"(SUM(i.qty * i.unit_price)) as grand_total,SUM(i.qty) as total_item," +
|
||||
"(i.qty * i.unit_price) as grand_total,(i.qty) as total_item," +
|
||||
" i.unit_price as unit_price,i.product_name as product_name, mc.name as" +
|
||||
" menu_category_name,mc.id as menu_category_id ")
|
||||
|
||||
@@ -617,7 +617,7 @@ def self.get_item_query()
|
||||
|
||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||
query = query.where("i.unit_price > 0")
|
||||
query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id")
|
||||
query = query.group("i.item_instance_code").order("mi.account_id, mi.menu_category_id")
|
||||
end
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||
|
||||
Reference in New Issue
Block a user