change view order api for ygn bbq
This commit is contained in:
@@ -19,6 +19,13 @@ if (@booking)
|
|||||||
@total_amount = 0.00
|
@total_amount = 0.00
|
||||||
@total_tax = 0.00
|
@total_tax = 0.00
|
||||||
|
|
||||||
|
# For YGN BBQ
|
||||||
|
adult_count = 0
|
||||||
|
child_count = 0
|
||||||
|
adult_spent = 0
|
||||||
|
child_spent = 0
|
||||||
|
# End YGN BBQ
|
||||||
|
|
||||||
if @booking.booking_orders
|
if @booking.booking_orders
|
||||||
order_items = []
|
order_items = []
|
||||||
@booking.booking_orders.each do |bo|
|
@booking.booking_orders.each do |bo|
|
||||||
@@ -26,14 +33,7 @@ if (@booking)
|
|||||||
if (order.status == "new")
|
if (order.status == "new")
|
||||||
order_items = order_items + order.order_items
|
order_items = order_items + order.order_items
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# For YGN BBQ
|
|
||||||
adult_count = 0
|
|
||||||
child_count = 0
|
|
||||||
adult_spent = 0
|
|
||||||
child_spent = 0
|
|
||||||
# End YGN BBQ
|
|
||||||
|
|
||||||
json.order_items order_items do |item|
|
json.order_items order_items do |item|
|
||||||
# For YGN BBQ
|
# For YGN BBQ
|
||||||
@@ -60,8 +60,16 @@ if (@booking)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# For YGN BBQ
|
# For YGN BBQ
|
||||||
json.per_adult_spent (adult_spent / adult_count) * 0.05
|
if adult_count > 0
|
||||||
json.per_child_spent (child_spent / child_count) * 0.05
|
json.per_adult_spent (adult_spent/adult_count) * 0.05
|
||||||
|
else
|
||||||
|
json.per_adult_spent 0
|
||||||
|
end
|
||||||
|
if child_count > 0
|
||||||
|
json.per_child_spent (child_spent/child_count) * 0.05
|
||||||
|
else
|
||||||
|
json.per_child_spent 0
|
||||||
|
end
|
||||||
# End YGN BBQ
|
# End YGN BBQ
|
||||||
|
|
||||||
json.sub_total @total_amount
|
json.sub_total @total_amount
|
||||||
|
|||||||
Reference in New Issue
Block a user