foodcourt

This commit is contained in:
Myat Zin Wai Maw
2019-12-10 13:37:06 +06:30
parent 5b3a62917d
commit c606ca73db
8 changed files with 29 additions and 36 deletions

View File

@@ -60,18 +60,17 @@ class Foodcourt::OrdersController < BaseFoodcourtController
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and bookings.booking_id='#{params[:booking_id]}'").first
@customer_id =@booking.customer_id
@booking_id =@booking.booking_id
@order_id =@booking.order_id
@sale_data = Sale.find_by_sale_id(@booking.sale_id)
@customer_id =@booking.customer_id
@booking_id =@booking.booking_id
@order_id =@booking.order_id
@sale_data = Sale.find_by_sale_id(@booking.sale_id)
end
@bookings = Booking.select("bookings.*,customers.*")
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}'").order("bookings.created_at desc").uniq
# .where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}' and DATE(bookings.created_at) = '#{Date.today}'").order("bookings.created_at desc").uniq
.where("orders.source='app' and bookings.shop_code=? and DATE(bookings.created_at)=?",Shop.current_shop.shop_code,Date.today).order("bookings.created_at desc").uniq
end
def completed
customer =Customer.find_by_customer_id(params[:customer_id])