merge all 03062017

This commit is contained in:
Yan
2017-06-03 12:50:08 +06:30
38 changed files with 754 additions and 22 deletions

View File

@@ -16,6 +16,7 @@ class Order < ApplicationRecord
# option_values : [],
# sub_order_items : [],
# }
def generate
booking = nil
@@ -235,13 +236,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