change view order api for ygn bbq
This commit is contained in:
@@ -19,6 +19,13 @@ if (@booking)
|
||||
@total_amount = 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
|
||||
order_items = []
|
||||
@booking.booking_orders.each do |bo|
|
||||
@@ -28,13 +35,6 @@ if (@booking)
|
||||
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|
|
||||
# For YGN BBQ
|
||||
if item.item_code == "P00001"
|
||||
@@ -60,8 +60,16 @@ if (@booking)
|
||||
end
|
||||
|
||||
# For YGN BBQ
|
||||
if adult_count > 0
|
||||
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
|
||||
|
||||
json.sub_total @total_amount
|
||||
|
||||
Reference in New Issue
Block a user