updated order.rb for order_items_id
This commit is contained in:
@@ -218,9 +218,8 @@ class Order < ApplicationRecord
|
||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||
left join order_items on order_items.order_id = orders.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.order_items_id,dining_facilities.name")
|
||||
end
|
||||
|
||||
def self.get_booking_order_table
|
||||
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||
@@ -234,6 +233,7 @@ class Order < ApplicationRecord
|
||||
.group("bookings.booking_id")
|
||||
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view order type Room
|
||||
def self.get_booking_order_rooms
|
||||
booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as room_name")
|
||||
@@ -245,6 +245,7 @@ class Order < ApplicationRecord
|
||||
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
||||
.group("bookings.booking_id")
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view order type Room
|
||||
def self.get_order_rooms
|
||||
order_rooms = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||
@@ -254,9 +255,10 @@ class Order < ApplicationRecord
|
||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_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::ROOM_TYPE,"dine_in",true)
|
||||
.group("orders.order_id,order_items.order_item_id,dining_facilities.name")
|
||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name")
|
||||
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view orders
|
||||
def self.get_orders
|
||||
from = Time.now.beginning_of_day.utc
|
||||
@@ -265,17 +267,15 @@ class Order < ApplicationRecord
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||
left join bookings on bookings.booking_id = booking_orders.order_id
|
||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||
|
||||
left join order_items on order_items.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")
|
||||
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
.group("orders.order_id,order_items.order_item_id,dining_facilities.name")
|
||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name")
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
self.order_id = SeedGenerator.generate_id(self.class.name, "ODR")
|
||||
end
|
||||
@@ -283,4 +283,5 @@ class Order < ApplicationRecord
|
||||
def set_order_date
|
||||
self.date = Time.now.utc
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user