update order and request bill

This commit is contained in:
Thein Lin Kyaw
2019-12-11 17:56:39 +06:30
parent 26edf23b46
commit 58117d0f48
28 changed files with 336 additions and 448 deletions

View File

@@ -67,15 +67,10 @@ class Api::OrdersController < Api::ApiController
if checkin_checkout_time(params[:booking_id])
if params[:booking_id].present?
booking = Booking.find(params[:booking_id])
end
if params[:table_id].present?
if booking.nil? || booking.dining_facility_id.to_i != params[:table_id].to_i
table = DiningFacility.find(params[:table_id])
booking = table.get_current_booking
end
end
table = DiningFacility.find(params[:table_id]) if params[:table_id].present?
booking = table.current_checkin_booking if table
booking ||= Booking.find(params[:booking_id]) if params[:booking_id].present?
#for extratime
is_extra_time = false
@@ -118,6 +113,7 @@ class Api::OrdersController < Api::ApiController
end
@status, @booking = @order.generate
if @status && @booking
Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
end
@@ -195,7 +191,7 @@ class Api::OrdersController < Api::ApiController
#checked checkin and checkout time
def checkin_checkout_time(booking_id)
status = true
if !booking_id.nil?
if booking_id.present?
if booking = Booking.find(booking_id)
if booking.checkout_at.present?
if booking.checkout_at.utc <= Time.now.utc