Origami update commit

This commit is contained in:
Cherry
2017-06-01 09:27:37 +06:30
parent 44e7d2452f
commit 47469cf466
5 changed files with 101 additions and 161 deletions

View File

@@ -1,20 +1,12 @@
class Origami::HomeController < BaseOrigamiController
def index
@order = 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("orders.order_type=? and dining_facilities.is_active=?","dine_in",true)
.group("orders.id")
@order_table = Order.get_order_table()
@order_rooms = Order.get_order_rooms()
@orders = Order.get_orders()
end
def show
@order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
.joins("left join orders on orders.id = order_items.order_id")
.where("order_items.order_id=?",params[:order_id])
# render :json => @order_details.to_json
str = []
str = []
@order_details = OrderItem.get_order_items_details(params[:order_id])
@order_details.each do |ord_detail|
str.push(ord_detail)
end