product sale checked
This commit is contained in:
@@ -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" +
|
||||
|
||||
@@ -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> </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>
|
||||
|
||||
@@ -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> </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> </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> </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>
|
||||
|
||||
Reference in New Issue
Block a user