update query in order model for origami
This commit is contained in:
@@ -211,15 +211,15 @@ class Order < ApplicationRecord
|
||||
#Origami: Cashier : to view order type Table
|
||||
|
||||
def self.get_order_table
|
||||
order_table = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||
order_items.id as order_items_id,dining_facilities.name as table_name")
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.id
|
||||
left join bookings on bookings.id = booking_orders.id
|
||||
order_table = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||
order_items.order_items_id as order_items_id,dining_facilities.name as table_name")
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||
left join bookings on bookings.booking_id = booking_orders.booking_order_id
|
||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||
left join order_items on order_items.order_id = orders.id")
|
||||
left join order_items on order_items.order_id = orders.order_id")
|
||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
||||
|
||||
.group("orders.id, order_items.id,dining_facilities.name")
|
||||
.group("orders.order_id, order_items.id,dining_facilities.name")
|
||||
end
|
||||
|
||||
|
||||
def self.get_booking_order_table
|
||||
@@ -270,8 +270,7 @@ class Order < ApplicationRecord
|
||||
left join sale_orders on sale_orders.order_id = orders.order_id
|
||||
left join sales on sales.sale_id = sale_orders.sale_id")
|
||||
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
|
||||
.group("orders.id,order_items.id,dining_facilities.name")
|
||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name")
|
||||
|
||||
end
|
||||
|
||||
@@ -285,4 +284,5 @@ class Order < ApplicationRecord
|
||||
def set_order_date
|
||||
self.date = Time.now.utc
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user