Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui

This commit is contained in:
Aung Myo
2017-12-05 10:24:20 +06:30
12 changed files with 92 additions and 18 deletions

View File

@@ -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|
@@ -26,21 +33,45 @@ if (@booking)
if (order.status == "new")
order_items = order_items + order.order_items
end
end
end
json.order_items order_items do |item|
json.item_instance_code item.item_code
json.item_name item.item_name
json.price item.price
json.qty item.qty
json.options item.options
json.remark item.remark
json.item_status item.order_item_status
@total_amount = @total_amount + (item.price * item.qty)
# For YGN BBQ
if item.item_code == "P00001"
adult_count += item.qty
adult_spent += (item.price * item.qty)
end
if item.item_code == "P00002"
child_count += item.qty
child_spent += (item.price * item.qty)
end
# End YGN BBQ
json.item_code item.item_code
json.item_instance_code item.item_instance_code
json.item_name item.item_name
json.price item.price
json.qty item.qty
json.options item.options
json.remark item.remark
json.item_status item.order_item_status
@total_amount = @total_amount + (item.price * item.qty)
end
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
json.commerical_tax @total_amount * 0.05
json.total @total_amount + (@total_amount * 0.05)

View File

@@ -16,6 +16,8 @@
<%= f.input :is_available,:input_html => {:class => "col-md-9"} %>
<%= f.input :taxable,:input_html => {:class => "col-md-9"} %>
<%= f.input :is_sub_item,:input_html => {:class => "col-md-9"} %>
<%= f.input :unit, :collection => Lookup.collection_of("unit") ,:input_html => {:class => "col-md-9"} %>

View File

@@ -16,6 +16,8 @@
<%= f.input :is_available,:input_html => {:class => "col-md-9"} %>
<%= f.input :taxable,:input_html => {:class => "col-md-9"} %>
<%= f.input :is_sub_item,:input_html => {:class => "col-md-9"} %>
<%= f.input :unit, :collection => Lookup.collection_of("unit") ,:input_html => {:class => "col-md-9"} %>