Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class Booking < ApplicationRecord
|
||||
|
||||
class Booking < ApplicationRecord
|
||||
self.primary_key = "booking_id"
|
||||
|
||||
|
||||
#primary key - need to be unique
|
||||
before_create :generate_custom_id
|
||||
|
||||
|
||||
@@ -210,6 +210,18 @@ 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
|
||||
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")
|
||||
|
||||
|
||||
def self.get_booking_order_table
|
||||
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||
@@ -258,16 +270,9 @@ 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.order_id")
|
||||
|
||||
# Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||
# .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||
# .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||
# .joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
# .joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||
# .joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||
# .where("booking_orders.order_id IS NOT NULL and dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
# .group("orders.order_id")
|
||||
.group("orders.id,order_items.id,dining_facilities.name")
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
booking.sale_id = sale_id
|
||||
end
|
||||
|
||||
order = booking.booking_orders.take.order
|
||||
link_order_sale(order.id)
|
||||
return status
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user