waste and spoil report

This commit is contained in:
NyanLinHtut
2019-08-09 14:21:24 +06:30
parent 3f08f99bf4
commit 5e344dc4a6
12 changed files with 1044 additions and 189 deletions

View File

@@ -18,46 +18,47 @@
</div>
<div class="margin-top-20">
<div class="card">
<table class="table table-striped" border="0">
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<% receipt_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<% @sale_data.each do |sale| %>
<% if !receipt_arr.include?(sale.receipt_no) %>
<thead>
<td>&nbsp;</td>
<thead>
<!-- <td>&nbsp;</td>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<strong>Receipt No :</strong>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : </strong></td>
</tr> -->
<tr>
<td><strong>Menu Category</strong></td>
<td><strong>Item Name</strong></td>
<td><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</thead>
<% receipt_arr.push(sale.receipt_no) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% end %>
<tbody>
<% if !sale.item_instance_code.nil?%>
<% receipt_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<% grand_total = 0%>
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<% if !sale.item_instance_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<% grand_total += sale.grand_total.to_i %>
<% end %>
<tr>
<% if !menu_cat_arr.include?(sale.name) %>
<% if !menu_cat_arr.include?(sale.name) %>
<td><%= sale.name %></td>
<% menu_cat_arr.push(sale.name) %>
<% else %>
@@ -68,33 +69,35 @@
<td><%= sale.qty.to_i %></td>
<td><%= sale.unit_price %></td>
<td><%= sale.price %></td>
</tr>
<% end %>
</tr>
<% count = count + 1 %>
<% if sale.sale_items.count == count %>
<% if @sale_data.length == count %>
<tr>
<td></td>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td>
<span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
<% waste_and_spoil_item_count = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
<strong><%= grand_total %></strong>
</span>
</td>
</tr>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% end %>
</tbody>
<% end %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>