122 lines
4.6 KiB
Plaintext
122 lines
4.6 KiB
Plaintext
<div class="container-fluid">
|
|
<div class="page-header">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
|
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
|
|
<span class="float-right">
|
|
<%= link_to 'Back', dashboard_path %>
|
|
</span>
|
|
</ol>
|
|
</div>
|
|
<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} %>
|
|
<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>
|
|
</div>
|
|
<div class="margin-top-20">
|
|
<div class="card">
|
|
|
|
<table class="table table-striped" border="0">
|
|
<% time_arr = Array.new %>
|
|
<% menu_cat_arr = Array.new %>
|
|
<% footer_arr = Array.new %>
|
|
<% count = 0 %>
|
|
<% waste_and_spoil_item_count = 0%>
|
|
<% total_qty = 0 %>
|
|
<% time_count = 0 %>
|
|
<% @sale_data.each do |sale| %>
|
|
<% if !time_arr.include?(sale.date_format) %>
|
|
<% time_count = time_count + 1 %>
|
|
<thead>
|
|
<td> </td>
|
|
<tr>
|
|
<td >
|
|
<strong>Time :<%= sale.date_format %></strong>
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td colspan="3" style="text-align:right"><strong>Date : </strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>Menu Category</strong></td>
|
|
<td><strong>Item Code</strong></td>
|
|
<td><strong>Item Name</strong></td>
|
|
<td><strong>Qty</strong></td>
|
|
<td><strong>Price</strong></td>
|
|
<td><strong>Total Price</strong></td>
|
|
</tr>
|
|
</thead>
|
|
<% time_arr.push(sale.date_format) %>
|
|
<% menu_cat_arr.clear %>
|
|
<% count = 0 %>
|
|
<% end %>
|
|
<tbody>
|
|
<!-- all total qty sum -->
|
|
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
|
|
total_qty += sale.total_item
|
|
end %>
|
|
<% if sale.status_type == "foc" && sale.price > 0
|
|
total_qty += sale.total_item
|
|
end %>
|
|
<% if sale.status_type == "Discount"
|
|
total_qty += sale.total_item*(-1)
|
|
end %>
|
|
<% if sale.status_type =="promotion" && @type == "promotion"
|
|
total_qty += sale.total_item*(-1)
|
|
end %>
|
|
<!-- end all total qty -->
|
|
<% if !sale.item_code.nil?%>
|
|
<% waste_and_spoil_item_count += sale.qty.to_i %>
|
|
<tr>
|
|
<% if !menu_cat_arr.include?(sale.menu_category_name) %>
|
|
<td><%= sale.menu_category_name %></td>
|
|
<% menu_cat_arr.push(sale.menu_category_name) %>
|
|
<% else %>
|
|
<td> </td>
|
|
<% end %>
|
|
<td><%= sale.item_code %></td>
|
|
<td><%= sale.product_name %></td>
|
|
<td><%= sale.total_item.to_i %></td>
|
|
<td><%= sale.unit_price %></td>
|
|
<td><%= sale.price %></td>
|
|
<td><%= sale.date_format %></td>
|
|
</tr>
|
|
<% end %>
|
|
|
|
|
|
<!-- new tr -->
|
|
|
|
<% @hourly_total_qty.each do |qty| %>
|
|
<% qty_count = qty["total_qty"] %>
|
|
<% logger.debug ' qty count+++++++++++++++++++++++++' %>
|
|
<% logger.debug qty_count %>
|
|
<% #logger.debug ' normal count+++++++++++++++++++++++++' %>
|
|
<% #logger.debug sale.sale_items.count %>
|
|
<% end %>
|
|
|
|
<% count = count + 1 %>
|
|
<% logger.debug 'count ------------------------------------' %>
|
|
<% logger.debug count %>
|
|
<% if sale.sale_items.count == count %>
|
|
<tr style="border-top:2px solid grey;">
|
|
<td colspan="3"> </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 %>
|
|
</tbody>
|
|
<% end %>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|