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

@@ -21,19 +21,19 @@
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
</div>
<div class="form-group col-md-4">
<label class="font-14">Definition Item</label>
<label class="font-14">Select Item</label>
<select class="form-control" name="item_code" id="item_code">
<option value="">Select Product</option>
<% @inventory_definitions.each do |id| %>
<option value="<%= id.item_code %>">
<% menu_item = MenuItemInstance.find_by_item_instance_code(id.item_code) %>
<% if menu_item.nil? %>
<%= Product.find_by_item_code(id.item_code).name rescue "-" %>
<% else %>
<%= menu_item.menu_item.name rescue '-' %> - <%= menu_item.item_instance_name rescue '-' %>
<option value="">Select Item</option>
<% @inventory_definitions.each do |id| %>
<option value="<%= id.item_code %>">
<% menu_item = MenuItemInstance.find_by_item_instance_code(id.item_code) %>
<% if menu_item.nil? %>
<%= Product.find_by_item_code(id.item_code).name rescue "-" %>
<% else %>
<%= menu_item.menu_item.name rescue '-' %> - <%= menu_item.item_instance_name rescue '-' %>
<% end %>
</option>
<% end %>
</option>
<% end %>
</select>
</div>
<div class="form-group col-md-2 margin-top-20"><br>

View File

@@ -3,102 +3,107 @@
<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', inventory_path %>
<%= link_to 'Back', inventory_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="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<!-- <div class="container"> -->
<!-- <div class="row"> -->
<div class="text-right">
<a href="javascript:export_to('<%= reports_stock_check_index_path %>.xls')" class="btn btn-info wave-effects">Export to
Excel</a>
</div>
<!-- </div> -->
<!-- </div> -->
<!-- <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="margin-top-20">
<div class="card">
<div class="table-responsive">
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<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 %>
<!-- <div class="container"> -->
<!-- <div class="row"> -->
<div class="text-right">
<a href="javascript:export_to('<%= reports_stock_check_index_path %>.xls')" class="btn btn-info wave-effects">Export to
Excel</a>
</div>
<!-- </div> -->
<!-- </div> -->
<% @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? %>
<div class="margin-top-20">
<div class="card">
<div class="table-responsive">
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<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><%= t("views.right_panel.detail.item") %> <%= t("views.right_panel.detail.name") %></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>
<th><%= t("views.right_panel.detail.checked_by") %></th>
<th><%= t("views.right_panel.detail.stock_check") %> <%= t("views.right_panel.detail.reason") %></th>
</tr>
</thead>
<tbody>
<% total_stock_count = 0 %>
<% total_stock_balance = 0 %>
<% total_different = 0 %>
<% arr_item_code = [] %>
<% @transaction.each do |result| %>
<tr>
<td>
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
<% if menu_item.nil? %>
<% if !arr_item_code.include?(result.item_code) %>
<%= Product.find_by_item_code(result.item_code).name rescue "-" %>
<% else %>
<% arr_item_code.push(result.item_code) %>
<% else %>
&nbsp;
<% end %>
<% else %>
<% if !arr_item_code.include?(result.item_code) %>
<%= menu_item.menu_item.name rescue "-" %>
- <%= menu_item.item_instance_name rescue "-" %>
<% end %>
</td>
<td><%= result.stock_count rescue '-' %></td>
<td><%= number_with_precision(result.stock_balance, precision:precision.to_i,delimiter:delimiter) 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 %>
<% arr_item_code.push(result.item_code) %>
<% else %>
&nbsp;
<% end %>
<% 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><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
<td><%= result.stock_check.reason 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><%= number_with_precision(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
<td><b><%= total_different rescue '-' %></b></td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- <tr style="border-top: 3px solid grey;">
<td colspan="3"></td>
<td><b><%= total_stock_count rescue '-' %></b></td>
<td><b><%= number_with_precision(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
<td><b><%= total_different rescue '-' %></b></td>
<td></td>
</tr> -->
</tbody>
</table>
</div>
<script>
$(function () {
});
</script>
</div>
</div>
</div>
</div>

View File

@@ -14,44 +14,60 @@
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
</tr>
<tr>
<th>Commissioner Name</th>
<th>Product Name</th>
<th>Qty</th>
<th>Commission Price</th>
<th>Commission Amount</th>
<th>Date</th>
<th><%= t("views.right_panel.detail.item") %> <%= t("views.right_panel.detail.name") %></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>
<th><%= t("views.right_panel.detail.checked_by") %></th>
<th><%= t("views.right_panel.detail.stock_check") %> <%= t("views.right_panel.detail.reason") %></th>
</tr>
</thead>
<tbody>
<% total_qty = 0 %>
<% total_price = 0 %>
<% total_amount = 0 %>
<% total_stock_count = 0 %>
<% total_stock_balance = 0 %>
<% total_different = 0 %>
<% arr_item_code = [] %>
<% @transaction.each do |result| %>
<tr>
<td>
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
<% if menu_item.nil? %>
<% if !arr_item_code.include?(result.item_code) %>
<%= Product.find_by_item_code(result.item_code).name rescue "-" %>
<% arr_item_code.push(result.item_code) %>
<% else %>
&nbsp;
<% end %>
<% else %>
<% if !arr_item_code.include?(result.item_code) %>
<%= menu_item.menu_item.name rescue "-" %>
- <%= menu_item.item_instance_name rescue "-" %>
<% arr_item_code.push(result.item_code) %>
<% else %>
&nbsp;
<% end %>
<% 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><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
<td><%= result.stock_check.reason 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 %>
<% @transaction.each do |result| %>
<tr>
<td>
<%= result.commissioner.name rescue '-' %>
</td>
<td>
<%= result.commission.menu_item.name rescue '-' %>
</td>
<td><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %></td>
<td><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %></td>
<td><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %></td>
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
</tr>
<% total_qty += result.qty.to_f %>
<% total_price += result.price.to_f %>
<% total_amount += result.amount.to_f %>
<% end %>
<tr style="border-top: 3px solid grey;">
<td colspan="2"></td>
<td><b><%= sprintf("%.2f", total_qty) rescue '-' %></b></td>
<td><b><%= sprintf("%.2f", total_price) rescue '-' %></b></td>
<td><b><%= sprintf("%.2f", total_amount) rescue '-' %></b></td>
<td></td>
</tr>
<!-- <tr style="border-top: 3px solid grey;">
<td colspan="3"></td>
<td><b><%= total_stock_count rescue '-' %></b></td>
<td><b><%= number_with_precision(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
<td><b><%= total_different rescue '-' %></b></td>
<td></td>
</tr> -->
</tbody>
</table>
</div>