fixed conflict

This commit is contained in:
Nweni
2017-06-04 10:19:35 +06:30
130 changed files with 2582 additions and 265 deletions

View File

@@ -1,4 +1,6 @@
class Order < ApplicationRecord
#primary key - need to be unique
before_create :set_order_date
belongs_to :customer
@@ -238,13 +240,16 @@ 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)
.group("orders.id,order_items.id,dining_facilities.name")
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
.group("orders.id")
end
end