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

This commit is contained in:
Min Zeya Phyo
2017-06-03 15:05:25 +06:30
112 changed files with 2468 additions and 259 deletions

View File

@@ -238,13 +238,15 @@ class Order < ApplicationRecord
end
#Origami: Cashier : to view orders
def self.get_orders
from = Time.now.beginning_of_day.utc
to = Time.now.end_of_day.utc
orders = 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_or_room_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.is_active=?",true)
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
.group("orders.id")
end
end