add first bill

This commit is contained in:
Yan
2017-06-29 11:34:13 +06:30
parent d35aa23e34
commit 9991970203
13 changed files with 374 additions and 125 deletions

View File

@@ -68,8 +68,10 @@ class Api::OrdersController < Api::ApiController
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
if !booking.sale_id.nil?
sale_status = check_order_with_booking(booking)
puts "WWwwWWWWWWww"
puts sale_status
if sale_status
return false
return false , @message = "bill requested"
end
else
@order.new_booking = false
@@ -77,22 +79,38 @@ class Api::OrdersController < Api::ApiController
end
else
sale_status = check_order_with_table(params[:table_id])
puts "OOOOOOOOO"
puts sale_status
if sale_status
return false
return false , @message = "bill requested"
end
end
end #booking exists
else
check_order_with_table(params[:table_id])
end
sale_status = check_order_with_table(params[:table_id])
puts "MMMMMMMM"
puts sale_status
if sale_status
return false , @message = "bill requested"
end
end
@status, @booking = @order.generate
end
# render json for http status code 202
def return_json_status_with_code(code, msg, booking_id)
render status: code, json: {
message: msg,
booking_id: booking_id
}.to_json
end
def check_order_with_table(table_id)
table = DiningFacility.find(table_id)
if table
booking = table.get_current_booking
puts booking
if booking
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
@order.new_booking = true