Files
sx-fc/app/views/reports/stock_check/index.html.erb
2017-10-23 11:38:10 +06:30

92 lines
3.7 KiB
Plaintext
Executable File

<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li>
<li class="breadcrumb-item active">Stock Check 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 => 'stock_check_report_filter',
:locals => {:period_type => true, :shift_name => true, :report_path => reports_stock_check_index_path} %>
<hr/>
<!-- </div> -->
<!-- <div class="container"> -->
<!-- <div class="row"> -->
<div class="text-right">
<a href="javascript:export_to('<%= reports_stock_check_index_path %>.xls')" class="btn btn-default">Export to
Excel</a>
</div>
<!-- </div> -->
<!-- </div> -->
<div class="margin-top-20">
<div class="card">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th colspan="8"><i> From Date </i>: <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <i>To Date</i> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
</tr>
<tr>
<th>Stock Check Reason</th>
<th>Checked By</th>
<th>Item Name</th>
<th>Stock Count</th>
<th>Stock Balance</th>
<th>Different</th>
<th>Remark</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<% total_stock_count = 0 %>
<% total_stock_balance = 0 %>
<% total_different = 0 %>
<% @transaction.each do |result| %>
<tr>
<td><%= result.stock_check.reason rescue '-' %></td>
<td><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
<td>
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
<% if menu_item.nil? %>
<%= Product.find_by_item_code(result.item_code).name rescue "-" %>
<% else %>
<%= menu_item.menu_item.name rescue "-" %>
- <%= menu_item.item_instance_name rescue "-" %>
<% end %>
</td>
<td><%= result.stock_count rescue '-' %></td>
<td><%= result.stock_balance rescue '-' %></td>
<td><%= result.different rescue '-' %></td>
<td><%= result.remark rescue '-' %></td>
<td><%= result.created_at.strftime('%e %b %Y %I:%M %p') rescue '-' %></td>
</tr>
<% !result.stock_count.nil? ? total_stock_count += result.stock_count : total_stock_count += 0 %>
<% !result.stock_balance.nil? ? total_stock_balance += result.stock_balance : total_stock_balance += 0 %>
<% !result.different.nil? ? total_different += result.different : total_different += 0 %>
<% end %>
<tr style="border-top: 3px solid grey;">
<td colspan="3"></td>
<td><b><%= total_stock_count rescue '-' %></b></td>
<td><b><%= total_stock_balance rescue '-' %></b></td>
<td><b><%= total_different rescue '-' %></b></td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(function () {
});
</script>