Pull from master

This commit is contained in:
San Wai Lwin
2018-08-20 11:26:07 +06:30
parent 3c2faf5970
commit d1852d24c3
28 changed files with 464 additions and 216 deletions

View File

@@ -5,12 +5,14 @@
<th><%= t("views.right_panel.detail.product") %></th>
<th><%= t("views.right_panel.detail.min_order") %></th>
<th><%= t("views.right_panel.detail.max_stock") %></th>
<th><%= t("views.right_panel.detail.created_by") %></th>
<th><%= t("views.right_panel.detail.created_time") %></th>
<th><%= t("views.right_panel.detail.balance") %></th>
<th><%= t("views.right_panel.detail.action") %></th>
<!-- <th><%= t("views.right_panel.detail.created_by") %></th>
<th><%= t("views.right_panel.detail.created_time") %></th> -->
</tr>
<%
count = 0
@products.each do |item|
@inventory_definitions.each do |item|
count += 1
%>
<tr>
@@ -26,9 +28,20 @@
</td>
<td><%= item.min_order_level %></td>
<td><%= item.max_stock_level %></td>
<td><%= Employee.find(item.created_by).name rescue '-' %></td>
<td><%= item.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></td>
<td><%= item.balance rescue '0' %></td>
<td>
<button type="button" data-value="<%= item.id %>" class="btn bg-blue waves-effect btn-link show_track"><%= t("views.btn.show") %> <%= t("views.right_panel.detail.stock_check") %></button>
</td>
<!-- <td><%= Employee.find(item.created_by).name rescue '-' %></td>
<td><%= item.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></td> -->
</tr>
<% end %>
</table>
</table>
<script>
$('.show_track').on('click', function () {
var ID = $(this).attr("data-value");
window.location.href = '/inventory/'+ID+'/show';
});
</script>

View File

@@ -12,10 +12,10 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
<div class="m-b-10 clearfix">
<button id="stock_check_report" type="button" class="btn bg-blue float-right waves-effect" style='margin-left:5px;'> <%= t("views.btn.stock_check_report") %>
</button>
<button id="stock_taking" type="button" class="btn bg-blue float-right waves-effect" style='margin-left:5px;'> <%= t("views.btn.new_stock_taking") %></button>
<button id='new_inventory_product' class='btn btn-primary float-right waves-effect' style='margin-left:5px;'><%= t("views.btn.new") + " " + (t :inventory) %>
<!-- <button id="stock_check_report" type="button" class="btn bg-blue float-right waves-effect" style='margin-left:5px;'> <%= t("views.btn.stock_check_report") %>
</button> -->
<button id="stock_taking" type="button" class="btn bg-blue float-right waves-effect" style='margin-left:5px;'> <%= t("views.btn.stock_taking") %></button>
<button id='new_inventory_product' class='btn btn-primary float-right waves-effect' style='margin-left:5px;'><%= (t :track) +" "+ t("views.btn.new") + " " + (t :inventory) %>
</button>
</div>
<div class="card">
@@ -27,14 +27,14 @@
<div class="body">
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
<p>
1) <%= t("views.btn.new") + " " + (t :inventory) %> - <%= t("views.right_panel.detail.create_btn_txt") %> <%= t("views.right_panel.detail.inventory") %> <br>
1) <%= (t :track) +" "+ t("views.btn.new") + " " + (t :inventory) %> - <%= t("views.right_panel.detail.create_btn_txt") %> <%= t("views.right_panel.detail.inventory") %> <br>
</p>
<p>
2) <%= t("views.btn.new") + " " + t("views.right_panel.detail.stock_taking") %> - <%= t("views.right_panel.detail.create_btn_txt") %> <%= t("views.right_panel.detail.stock_taking_txt") %> <br>
2) <%= t("views.right_panel.detail.stock_taking") %> - <%= t("views.right_panel.detail.create_btn_txt") %> <%= t("views.right_panel.detail.stock_taking_txt") %> <br>
</p>
<p>
<!-- <p>
3) <%= t("views.right_panel.detail.stock_check_report") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.stock_check_report_txt") %> <br>
</p>
</p> -->
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
<p>
1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
@@ -51,12 +51,12 @@
window.location.href = '<%= inventory_stock_checks_path %>';
});
$('#stock_check_report').on('click', function () {
window.location.href = '<%= reports_stock_check_index_path %>';
});
// $('#stock_check_report').on('click', function () {
// window.location.href = '<%= reports_stock_check_index_path %>';
// });
$('#new_inventory_product').on('click',function(){
window.location.href = '/inventory/inventory_definitions/new';
})
});
</script>

View File

@@ -0,0 +1,70 @@
<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 :inventory %></li>
<span class="float-right">
<%= link_to t('.back', :default => t("views.btn.back")), inventory_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<table class="table table-responsive table-striped table-hover">
<thead>
<tr>
<th><%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.item") %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t :credit %></th>
<th><%= t :debit %></th>
<th><%= t("views.right_panel.detail.balance") %></th>
<th><%= t("views.right_panel.detail.remark") %></th>
</tr>
</thead>
<tbody>
<% total_credit = 0 %>
<% total_debit = 0 %>
<% total_balance = 0 %>
<% if !@stock_journals.nil? && !@stock_journals.empty? %>
<% @stock_journals.each do |result| %>
<tr>
<td><%= result.created_at.strftime('%e %b %Y %I:%M %p') rescue '-' %></td>
<td><%= result.trans_type 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.credit rescue '-' %></td>
<td><%= result.debit rescue '-' %></td>
<td><%= result.balance rescue '-' %></td>
<td><%= result.remark rescue '-' %></td>
</tr>
<% !result.credit.nil? ? total_credit += result.credit : total_credit += 0 %>
<% !result.debit.nil? ? total_debit += result.debit : total_debit += 0 %>
<% !result.balance.nil? ? total_balance += result.balance : total_balance += 0 %>
<% end %>
<!-- <tr style="border-top: 3px solid grey;">
<td colspan="3"></td>
<td><b><%= total_credit rescue '-' %></b></td>
<td><b><%= total_debit rescue '-' %></b></td>
<td><b><%= total_balance rescue '-' %></b></td>
<td colspan="2"></td>
</tr> -->
<% else %>
<tr>
<td colspan="8" class="text-center">There is no record...</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>

View File

@@ -101,14 +101,25 @@
</div>
<script>
var count = 0;
$(document).ready(function(){
clearFormData();
});
function clearFormData(){
$('#stock_check_reason').val("");
$('#product_qty').val("");
$('#product_sku').val("");
}
$('#save_to_stock_check').on('click', function () {
count += 1;
product_sku = $('#product_sku').val();
product_qty = $('#product_qty').val();
product_name = $("#product_sku").find("option:selected").text();
// clearFormData();
var tr = '<tr>'
//+ '<td>' + count + '</td>'
+ '<td><input type=hidden value="' + product_sku + '" id="item_sku_' + count + '" name=' + count + '/>'