119 lines
4.2 KiB
Plaintext
Executable File
119 lines
4.2 KiB
Plaintext
Executable File
<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"><a href="<%=inventory_stock_checks_path%>"></a><%= t("views.right_panel.detail.stock_check") %></li>
|
|
<li class="breadcrumb-item active"><%= t :details %></li>
|
|
<span class="float-right">
|
|
<%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %>
|
|
</span>
|
|
</ol>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-xs-12 col-sm-12 col-md-10 col-lg-10">
|
|
<div class="card">
|
|
<input type='hidden' id='stock_check_id' value='<%= @check.id %>'/>
|
|
<div class="p-l-20 p-t-15">
|
|
<div class="row">
|
|
<div class="col-md-2">
|
|
<%= t("views.right_panel.detail.check_by") %>
|
|
</div>
|
|
<div class="col-md-8">
|
|
<%= Employee.find(@check.check_by).name rescue '' %>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-2">
|
|
<%= t("views.right_panel.detail.check_at") %>
|
|
</div>
|
|
<div class="col-md-8">
|
|
<%= @check.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-2">
|
|
<%= t("views.right_panel.detail.reason") %>
|
|
</div>
|
|
<div class="col-md-8">
|
|
<%= @check.reason %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<br>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped col-md-12">
|
|
<tr>
|
|
<th>#</th>
|
|
<th><%= t("views.right_panel.detail.product") %></th>
|
|
<th><%= t("views.right_panel.detail.stock_count") %></th>
|
|
<th><%= t("views.right_panel.detail.stock_balance") %></th>
|
|
<th><%= t("views.right_panel.detail.different") %></th>
|
|
<th><%= t("views.right_panel.detail.remark") %></th>
|
|
</tr>
|
|
<%
|
|
count = 0
|
|
@check.stock_check_items.each do |item|
|
|
count += 1
|
|
%>
|
|
<tr>
|
|
<td><%= count %></td>
|
|
<td>
|
|
<% menu_item = MenuItemInstance.find_by_item_instance_code(item.item_code)%>
|
|
<% if menu_item.nil? %>
|
|
<%= Product.find_by_item_code(item.item_code).name rescue "-" %>
|
|
<% else %>
|
|
<%= menu_item.menu_item.name rescue "-" %>
|
|
- <%= menu_item.item_instance_name rescue "-" %>
|
|
<% end %>
|
|
</td>
|
|
<td><%= item.stock_count %></td>
|
|
<td><%= item.stock_balance %></td>
|
|
<td><%= item.different %></td>
|
|
<td><%= item.remark %></td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
|
|
|
|
<div class="body">
|
|
<button id="save_to_journal" type="button" class="btn btn-block btn-primary"> <%= t("views.right_panel.button.save_to_journal") %></button>
|
|
<button id="print" type="button" class="btn btn-block btn-primary"> <%= t :print %></button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
|
$('#save_to_journal').on('click', function () {
|
|
check_id = $('#stock_check_id').val();
|
|
$.ajax({
|
|
type: 'post',
|
|
url: '<%= inventory_save_to_journal_path %>',
|
|
data: 'data=' + check_id,
|
|
success: function () {
|
|
alert('Successfully saved to journal.');
|
|
window.location.href = '/inventory';
|
|
}
|
|
})
|
|
});
|
|
|
|
$('#print').on('click', function () {
|
|
check_id = $('#stock_check_id').val();
|
|
$.ajax({
|
|
type: 'post',
|
|
url: '<%= inventory_print_stock_check_path %>',
|
|
data: 'stock_check_id=' + check_id
|
|
})
|
|
});
|
|
|
|
$('#back').on('click', function () {
|
|
window.location.href = '/inventory';
|
|
});
|
|
|
|
</script>
|