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

This commit is contained in:
Aung Myo
2018-03-29 16:16:33 +06:30
4 changed files with 35 additions and 24 deletions

View File

@@ -3,6 +3,7 @@ class Oqs::EditController < BaseOqsController
assigned_item_id = params[:id]
@link_type = params[:type]
@dining_type = nil
@booking = nil
if params[:type] == 'oqs'
assigned_item = AssignedOrderItem.find(assigned_item_id)
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'")

View File

@@ -942,7 +942,7 @@ def self.get_menu_item_query(order_by)
"(CASE WHEN si.qty IS NOT NULL THEN (SUM(si.qty) * si.unit_price) ELSE 0 END) as grand_total," +
"mii.price as unit_price, (CASE WHEN si.product_name IS NOT NULL THEN si.product_name ELSE CONCAT(menu_items.name,' - ',mii.item_instance_name) END) as product_name,
mc.name as" +
" menu_category_name,mc.id as menu_category_id, si.remark as status_type,
" menu_category_name,mc.id as menu_category_id, si.status as status_type,
si.price as price ")
.joins(" LEFT JOIN menu_item_instances mii ON menu_items.id = mii.menu_item_id" +
" LEFT JOIN menu_categories mc ON mc.id = menu_items.menu_category_id" +

View File

@@ -58,14 +58,14 @@
<% total_qty = 0 %>
<% @sale_data.each do |sale| %>
<% grand_total += sale.grand_total %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% grand_total += sale.grand_total %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if !sale.status_type %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
@@ -81,8 +81,9 @@
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
</tr>
<!-- sub total -->
<!-- end sub total -->
<!-- sub total -->
<!-- end sub total -->
<% end %>
<% end %>
<tr>
<td colspan="3"></td>

View File

@@ -23,31 +23,40 @@
<% total_qty = 0 %>
<% @sale_data.each do |sale| %>
<% grand_total += sale.grand_total %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
grand_total += sale.grand_total
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
grand_total += sale.grand_total
end %>
<tr>
<td>&nbsp;</td>
<td><%= sale.menu_category_name %></td>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= sale.unit_price rescue '-' %></td>
<td><%= sale.grand_total rescue '-' %></td>
</tr>
<% if !sale.status_type %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<% cate_arr = Array.new %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue ' ' %></td>
<td><%= sale.unit_price rescue ' ' %></td>
<td><%= sale.grand_total rescue ' ' %></td>
</tr>
<!-- sub total -->
<!-- end sub total -->
<% end %>
<% end %>
<tr>
<td colspan="3"></td>
<td><strong>Total</strong></td>
<td><strong><%= total_qty %></strong></td>
<td><strong><%= total_qty rescue ' ' %></strong></td>
<td></td>
<td><strong><%= grand_total rescue '-' %></strong></td>
<td><strong><%= grand_total rescue ' ' %></strong></td>
</tr>
<% end %>
</tbody>