update query in order model for origami
This commit is contained in:
@@ -116,9 +116,7 @@ GEM
|
|||||||
mini_portile2 (2.1.0)
|
mini_portile2 (2.1.0)
|
||||||
minitest (5.10.2)
|
minitest (5.10.2)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
|
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
|
|
||||||
mysql2 (0.4.6)
|
mysql2 (0.4.6)
|
||||||
nio4r (2.1.0)
|
nio4r (2.1.0)
|
||||||
nokogiri (1.7.2)
|
nokogiri (1.7.2)
|
||||||
|
|||||||
@@ -211,15 +211,15 @@ class Order < ApplicationRecord
|
|||||||
#Origami: Cashier : to view order type Table
|
#Origami: Cashier : to view order type Table
|
||||||
|
|
||||||
def self.get_order_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_table = Order.select("orders.order_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")
|
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.id
|
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||||
left join bookings on bookings.id = booking_orders.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 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)
|
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
||||||
|
.group("orders.order_id, order_items.id,dining_facilities.name")
|
||||||
.group("orders.id, order_items.id,dining_facilities.name")
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.get_booking_order_table
|
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 sale_orders on sale_orders.order_id = orders.order_id
|
||||||
left join sales on sales.sale_id = sale_orders.sale_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)
|
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||||
|
.group("orders.order_id,order_items.order_items_id,dining_facilities.name")
|
||||||
.group("orders.id,order_items.id,dining_facilities.name")
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -285,4 +284,5 @@ class Order < ApplicationRecord
|
|||||||
def set_order_date
|
def set_order_date
|
||||||
self.date = Time.now.utc
|
self.date = Time.now.utc
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user