check product sale query

This commit is contained in:
phyusin
2018-03-05 14:12:30 +06:30
parent a70b649e46
commit 5eec1ad377
2 changed files with 13 additions and 9 deletions

View File

@@ -47,7 +47,6 @@
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t("views.right_panel.detail.unit_price") %></th>
<th><%= t("views.right_panel.detail.total") %></th>
<th><%= t("views.right_panel.detail.remark") %></th>
</tr>
</thead>
<tbody id="tbd_data">
@@ -59,24 +58,28 @@
<% 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>
<% 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><%= 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>
<td><%= sale.status_type rescue '' %></td>
</tr>
<!-- sub total -->
<!-- end sub total -->
@@ -86,7 +89,7 @@
<td><strong>Total</strong></td>
<td><strong><%= total_qty %></strong></td>
<td></td>
<td colspan="2"><strong><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></strong></td>
<td><strong><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></strong></td>
</tr>
<% end %>