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

@@ -34,12 +34,12 @@
</select>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<div class="col-lg-3 col-md-3 col-sm-3">
<!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<div class="col-lg-3 col-md-3 col-sm-3">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
</div>

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>

View File

@@ -1,104 +1,56 @@
<div class="row">
<div class="col-md-12">
<div class="margin-top-20">
<div class="card">
<table class="table table-striped" border="0">
<thead>
<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>
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
<th><%= tax.name %></th>
<% end %>
<!-- <th>Other Amount</th> -->
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</th>
<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>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% total_tax = 0 %>
<% guest_count = 0 %>
<% total_sum = 0 %>
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<%if @sale_data %>
<% @sale_data.each do |result| %>
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
<% total_tax += result.total_tax.to_f %>
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
<tr>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= result.total_amount rescue '-' %></td>
<td><%= result.total_discount rescue '-' %></td>
<%if result.customer.customer_type == "Takeaway"%>
<td>0.0</td>
<%end%>
<% result.sale_taxes.each do |tax| %>
<td><%= tax.tax_payable_amount rescue '-' %></td>
<%end%>
<td><%= result.grand_total %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= result.grand_total_after_rounding() rescue '-'%></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>
</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 style="border-top:4px double #666;">
<td colspan="2">&nbsp;</td>
<td><b><%= total_sum rescue '-'%></b></td>
<td><b><%= discount_amt rescue '-'%></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= tax.st_amount.round(2) %></b></td>
<% end %>
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
<td><b><%= rounding_adj rescue '-'%></b></td>
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<% @tax_profiles.each do |tax| %>
<td><%= tax.name %></td>
<% end %>
<td><%= t("views.right_panel.detail.grand_total") %></td>
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
<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>
<%end%>
</tbody>
</tr>
</tbody>
<% end %>
</table>
</div>
</div>