This commit is contained in:
Myat Zin Wai Maw
2019-08-30 14:03:48 +06:30
parent 67793b282e
commit f0be0d19a1
7 changed files with 52 additions and 47 deletions

View File

@@ -11,7 +11,7 @@
<div class="row">
<div class="col-md-12">
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_waste_and_spoilage_index_path} %>
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_hourly_saleitem_index_path} %>
<hr />
<div class="text-right">
<a href="javascript:export_to('<%=reports_waste_and_spoilage_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
@@ -21,6 +21,7 @@
<table class="table table-striped" border="0">
<% time_arr = Array.new %>
<% sale_item_count =0 %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
@@ -29,6 +30,7 @@
<% time_count = 0 %>
<% @sale_data.each do |sale| %>
<% if !time_arr.include?(sale.date_format) %>
<% sale_item_count =1 %>
<% time_count = time_count + 1 %>
<thead>
<td>&nbsp;</td>
@@ -52,6 +54,9 @@
<% time_arr.push(sale.date_format) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% else %>
<%= time_arr %>
<% sale_item_count =sale_item_count +1 %>
<% end %>
<tbody>
<!-- all total qty sum -->
@@ -85,24 +90,21 @@
<td><%= sale.date_format %></td>
</tr>
<% end %>
<!-- new tr -->
<% count = count + 1 %>
<% logger.debug ' normal count+++++++++++++++++++++++++' %>
<% logger.debug sale.sale_items.count %>
<% logger.debug 'time_count count------------------------------------' %>
<% logger.debug time_count %>
<% if sale.sale_items.count == count %>
<tr style="border-top:2px solid grey;">
<td colspan="3">&nbsp;</td>
<td>Total Qty:</td>
<td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;">Grand Total:</td>
<td style="border-bottom:2px solid grey;"><span></span></td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% end %>
<% @hourly_total_qty.each do |hr| %>
<% if hr["date"].to_s == sale.date_format.to_s && hr["total_qty"].to_i ==sale_item_count%>
<tr style="border-top:2px solid grey;">
<td colspan="2">&nbsp;</td>
<td>Total Qty:</td>
<td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;">Grand Total:</td>
<td style="border-bottom:2px solid grey;"><span></span></td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% total_qty =0%>
<% end %>
<% end %>
</tbody>
<% end %>