add other charges

This commit is contained in:
Yan
2017-06-30 13:29:55 +06:30
parent dd95b29d7d
commit 9c1a324eff
6 changed files with 418 additions and 12 deletions

View File

@@ -68,8 +68,8 @@ 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
# puts "WWwwWWWWWWww"
# puts sale_status
if sale_status
return return_json_status_with_code(400, "bill requested")
end
@@ -79,8 +79,8 @@ class Api::OrdersController < Api::ApiController
end
else
sale_status = check_order_with_table(params[:table_id])
puts "OOOOOOOOO"
puts sale_status
# puts "OOOOOOOOO"
# puts sale_status
if sale_status
return return_json_status_with_code(400, "bill requested")
end
@@ -88,8 +88,8 @@ class Api::OrdersController < Api::ApiController
end #booking exists
else
sale_status = check_order_with_table(params[:table_id])
puts "MMMMMMMM"
puts sale_status
# puts "MMMMMMMM"
# puts sale_status
if sale_status
# return false , @message = "bill requested"
return return_json_status_with_code(400, "bill requested")
@@ -109,13 +109,13 @@ class Api::OrdersController < Api::ApiController
def check_order_with_table(table_id)
table = DiningFacility.find(table_id)
if table
booking = table.get_moved_booking
puts booking
booking = table.get_current_booking
# puts booking
if booking
if !booking.sale_id.nil?
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
@order.new_booking = true
return true
return false
end
else
@order.new_booking = false
@@ -130,7 +130,7 @@ class Api::OrdersController < Api::ApiController
def check_order_with_booking(booking)
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
@order.new_booking = true
return true
return false
else
@order.new_booking = false
@order.booking_id = params[:booking_id]