update waste and spoilage

This commit is contained in:
Aung Myo
2018-03-30 14:42:58 +06:30
parent 5588f40753
commit 4faf1083d1
3 changed files with 111 additions and 167 deletions

View File

@@ -1,83 +1,75 @@
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_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">
<!-- <div class="container"> -->
<%= 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> -->
<!-- <div class="container"> -->
<!-- <div class="row"> -->
<div class="container-fluid">
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_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> -->
<!-- </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>
<% @sale_data.each do |sale| %>
<% waste_and_spoil_item_count = 0%>
<thead>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</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>
</thead>
<tbody>
<tr>
<td ><strong>Product</strong></td>
<td ><strong>Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
</tr>
<% end %>
<% end %>
<tr>
<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>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
</tbody>
<% end %>
</table>
</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>
<% @sale_data.each do |sale| %>
<% waste_and_spoil_item_count = 0%>
<thead>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</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>
</thead>
<tbody>
<tr>
<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>
</tr>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
</tr>
<% end %>
<% end %>
<tr>
<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>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
</tbody>
<% end %>
</table>
</div>
</div>
</div>
</div>
</div>
</div>