Merge branch 'master' of ssh://bitbucket.org/code2lab/sxrestaurant

# Conflicts:
#	app/models/order_item.rb
This commit is contained in:
Min Zeya Phyo
2017-06-04 16:37:13 +06:30
33 changed files with 365 additions and 108 deletions

View File

@@ -25,7 +25,7 @@ class Order < ApplicationRecord
if self.new_booking
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
:booking_status => "new" })
:booking_status => "assign" })
else
if (self.booking_id.to_i > 0 )
booking = Booking.find(self.booking_id)
@@ -215,7 +215,9 @@ 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")
end
#Origami: Cashier : to view order type Room
def self.get_order_rooms
@@ -226,7 +228,7 @@ 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::ROOM_TYPE,"dine_in",true)
.group("orders.id")
.group("orders.id,order_items.id,dining_facilities.name")
end
#Origami: Cashier : to view orders
def self.get_orders
@@ -238,6 +240,7 @@ class Order < ApplicationRecord
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.is_active=? and orders.date between ? and ?",true,from,to)
.group("orders.id")
end