stock_check report template
This commit is contained in:
923
.idea/workspace.xml
generated
923
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,4 @@
|
|||||||
class Inventory::StockChecksController < BaseInventoryController
|
class Inventory::StockChecksController < BaseInventoryController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@check = StockCheck.new
|
@check = StockCheck.new
|
||||||
@inventory_definitions = InventoryDefinition.active.all
|
@inventory_definitions = InventoryDefinition.active.all
|
||||||
@@ -29,7 +28,7 @@ class Inventory::StockChecksController < BaseInventoryController
|
|||||||
stockcheck = StockCheck.find(stock_id)
|
stockcheck = StockCheck.find(stock_id)
|
||||||
stockcheck_items = stockcheck.stock_check_items
|
stockcheck_items = stockcheck.stock_check_items
|
||||||
member_info = nil
|
member_info = nil
|
||||||
unique_code = "StockPrint"
|
unique_code = 'StockPrint'
|
||||||
|
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop.find(1)
|
||||||
checker = Employee.find(stockcheck.check_by)
|
checker = Employee.find(stockcheck.check_by)
|
||||||
@@ -37,7 +36,6 @@ class Inventory::StockChecksController < BaseInventoryController
|
|||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, shop_details)
|
printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, shop_details)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
|
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
|
||||||
|
|||||||
50
app/controllers/reports/stock_check_controller.rb
Normal file
50
app/controllers/reports/stock_check_controller.rb
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
class Reports::StockCheckController < BaseReportController
|
||||||
|
# authorize_resource :class => false
|
||||||
|
|
||||||
|
def index
|
||||||
|
from_date = DateTime.now.beginning_of_day.utc.getlocal
|
||||||
|
to_date = DateTime.now.end_of_day.utc.getlocal
|
||||||
|
unless params[:daterange].blank?
|
||||||
|
from_date = Date.parse(params[:daterange].split(' - ')[0]).beginning_of_day.utc.getlocal
|
||||||
|
to_date = Date.parse(params[:daterange].split(' - ')[1]).end_of_day.utc.getlocal
|
||||||
|
@daterange = params[:daterange]
|
||||||
|
end
|
||||||
|
commissioner = params[:commissioner].to_i
|
||||||
|
@com_id = commissioner
|
||||||
|
@commissioner = Commissioner.active.all
|
||||||
|
@inventory_definitions = InventoryDefinition.active.all
|
||||||
|
|
||||||
|
@transaction = ProductCommission.get_transaction(from_date, to_date, commissioner)
|
||||||
|
@from = from_date
|
||||||
|
@to = to_date
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xls
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
from, to = get_date_range_from_params
|
||||||
|
|
||||||
|
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||||
|
|
||||||
|
date_arr = Array.new
|
||||||
|
@sale_data.each do |sale|
|
||||||
|
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
|
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||||
|
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||||
|
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||||
|
shift_id = sale.id.nil? ? '-' : sale.id
|
||||||
|
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||||
|
date_arr.push(str)
|
||||||
|
end
|
||||||
|
|
||||||
|
out = {:status => 'ok', :message => date_arr}
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.json { render json: out }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@@ -7,13 +7,23 @@ class MenuItemInstance < ApplicationRecord
|
|||||||
|
|
||||||
def self.findParentCategory(item)
|
def self.findParentCategory(item)
|
||||||
if item.menu_category_id
|
if item.menu_category_id
|
||||||
return item.menu_category_id
|
item.menu_category_id
|
||||||
else
|
else
|
||||||
parentitem = MenuItem.find(item.menu_item_id)
|
parentitem = MenuItem.find(item.menu_item_id)
|
||||||
findParentCategory(parentitem)
|
findParentCategory(parentitem)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_item_name(item_code)
|
||||||
|
menu_item = MenuItemInstance.find_by_item_instance_code(item_code)
|
||||||
|
if menu_item.nil?
|
||||||
|
item_name = Product.find_by_item_code(item_code).name
|
||||||
|
else
|
||||||
|
item_name = menu_item.menu_item.name + ' - ' + menu_item.item_instance_name
|
||||||
|
end
|
||||||
|
item_name
|
||||||
|
end
|
||||||
|
|
||||||
# private
|
# private
|
||||||
|
|
||||||
# def generate_menu_item_instance_code
|
# def generate_menu_item_instance_code
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class StockCheck < ApplicationRecord
|
|||||||
|
|
||||||
has_many :stock_check_items
|
has_many :stock_check_items
|
||||||
|
|
||||||
def create(user, eason, item_list)
|
def create(user, reason, item_list)
|
||||||
self.reason = reason
|
self.reason = reason
|
||||||
self.check_by = user.id
|
self.check_by = user.id
|
||||||
self.check_start = Time.now
|
self.check_start = Time.now
|
||||||
|
|||||||
@@ -78,8 +78,10 @@ class StockResultPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
|
item_name = MenuItemInstance.get_item_name(st.item_code)
|
||||||
|
|
||||||
bounding_box([0, y_position], :width => self.item_description_width, :height => self.item_height) do
|
bounding_box([0, y_position], :width => self.item_description_width, :height => self.item_height) do
|
||||||
text "#{ st.item_code }", :size => self.item_font_size,:align => :left
|
text item_name.to_s, :size => self.item_font_size, :align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width, y_position], :width => self.label_width) do
|
bounding_box([self.item_description_width, y_position], :width => self.label_width) do
|
||||||
text "#{st.stock_count.to_i}", :size => self.item_font_size, :align => :right
|
text "#{st.stock_count.to_i}", :size => self.item_font_size, :align => :right
|
||||||
|
|||||||
@@ -22,11 +22,19 @@
|
|||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td><%= item.item_code rescue ""%></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.min_order_level %></td>
|
<td><%= item.min_order_level %></td>
|
||||||
<td><%= item.max_stock_level %></td>
|
<td><%= item.max_stock_level %></td>
|
||||||
<td><%= item.created_by %></td>
|
<td><%= Employee.find(item.created_by).name rescue '-' %></td>
|
||||||
<td><%= item.created_at%></td>
|
<td><%= item.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||||
<%= render 'inventory_list' %>
|
<%= render 'inventory_list' %>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
<% if current_login_employee.role == "administrator" || current_login_employee.role == 'manager' %>
|
||||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back</button>
|
<button id="back" type="button" class="btn btn-block btn-primary"> Back</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
<button id="stock_taking" type="button" class="btn btn-block btn-primary"> New Stock Taking</button>
|
<button id="stock_taking" type="button" class="btn btn-block btn-primary"> New Stock Taking</button>
|
||||||
@@ -14,9 +13,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$('#stock_taking').on('click', function () {
|
$('#stock_taking').on('click', function () {
|
||||||
window.location.href = '/inventory/stock_checks';
|
window.location.href = '<%= inventory_stock_checks_path %>';
|
||||||
})
|
});
|
||||||
|
|
||||||
$('#stock_check_report').on('click', function () {
|
$('#stock_check_report').on('click', function () {
|
||||||
window.location.href = '';
|
window.location.href = '<%= reports_stock_check_index_path %>';
|
||||||
})
|
});
|
||||||
|
|
||||||
|
$('#back').on('click', function () {
|
||||||
|
window.location.href = '<%= dashboard_path %>';
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -45,7 +45,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= f.button :submit %>
|
<%= link_to 'Back', inventory_path, class: 'btn btn-success' %>
|
||||||
|
<%= f.button :submit, class: 'btn btn-primary' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<h1>Editing Inventory Definition</h1>
|
<div class="span12">
|
||||||
|
<div class="page-header">
|
||||||
<%= render 'form', inventory_definition: @inventory_definition %>
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= root_path %>">Home</a></li>
|
||||||
<%= link_to 'Show', @inventory_definition %> |
|
<li><a href="<%= inventory_path %>">Product Inventory</a></li>
|
||||||
<%= link_to 'Back', inventory_definitions_path %>
|
<li>Edit</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<%= render 'form', inventory: @inventory_definition %>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -20,8 +20,14 @@
|
|||||||
<select class='form-control' id='product_sku'>
|
<select class='form-control' id='product_sku'>
|
||||||
<option value="">Select Product</option>
|
<option value="">Select Product</option>
|
||||||
<% @inventory_definitions.each do |id| %>
|
<% @inventory_definitions.each do |id| %>
|
||||||
<% item_name = MenuItemInstance.find_by_item_instance_code(id.item_code) %>
|
<option value="<%= id.item_code %>">
|
||||||
<option value="<%= id.item_code %>"><%= item_name.item_instance_name %></option>
|
<% 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 %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,7 +56,7 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<table class="table table-striped" id='stock_item'>
|
<table class="table table-striped" id='stock_item'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<!--<th>#</th>-->
|
||||||
<th>Product</th>
|
<th>Product</th>
|
||||||
<th>Balance</th>
|
<th>Balance</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
@@ -61,6 +67,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-1">
|
<div class="col-md-1">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<button class="btn btn-primary pull-right form-control" style='margin-bottom:2px;' id='back'> Back</button>
|
||||||
<button class="btn btn-primary pull-right form-control" style='margin-bottom:2px;' id='finish'> Finish</button>
|
<button class="btn btn-primary pull-right form-control" style='margin-bottom:2px;' id='finish'> Finish</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,13 +87,13 @@
|
|||||||
count += 1;
|
count += 1;
|
||||||
product_sku = $('#product_sku').val();
|
product_sku = $('#product_sku').val();
|
||||||
product_qty = $('#product_qty').val();
|
product_qty = $('#product_qty').val();
|
||||||
product_name = $("#product_sku option:selected").text();
|
product_name = $("#product_sku").find("option:selected").text();
|
||||||
var tr = '<tr>'
|
var tr = '<tr>'
|
||||||
+ '<td>' + count + '</td>'
|
//+ '<td>' + count + '</td>'
|
||||||
+ '<td><input type=hidden value="' + product_sku + '" id="item_sku_' + count + '" name=' + count + '/>'
|
+ '<td><input type=hidden value="' + product_sku + '" id="item_sku_' + count + '" name=' + count + '/>'
|
||||||
+ '<input type=text value="' + product_name + '" id="item_name_' + count + '" name=' + count + ' disabled/></td>'
|
+ product_name + '</td>'
|
||||||
+ '<td><input type=text value="' + product_qty + '" id="item_qty_' + count + '" name=' + count + '/></td>'
|
+ '<td><input type=text value="' + product_qty + '" id="item_qty_' + count + '" name=' + count + '/></td>'
|
||||||
+ '<td><input type=button value="Remove" id="item_qty_' + count + '" name=' + count + '/></td>'
|
+ '<td><input type=button value="X" id="item_remove_' + count + '" name=' + count + ' onclick="remove_row('+ count +')"/></td>'
|
||||||
+ '</tr>';
|
+ '</tr>';
|
||||||
$('#stock_item').append(tr);
|
$('#stock_item').append(tr);
|
||||||
// $('#product_sku').val('');
|
// $('#product_sku').val('');
|
||||||
@@ -101,7 +108,9 @@
|
|||||||
for (var i = 1; i <= count; i++) {
|
for (var i = 1; i <= count; i++) {
|
||||||
itemname = $('#item_sku_' + i).val();
|
itemname = $('#item_sku_' + i).val();
|
||||||
itemqty = $('#item_qty_' + i).val();
|
itemqty = $('#item_qty_' + i).val();
|
||||||
|
if(itemname !== undefined){
|
||||||
arr.push({sku: itemname, qty: itemqty});
|
arr.push({sku: itemname, qty: itemqty});
|
||||||
|
}
|
||||||
jsonStr = JSON.stringify(arr);
|
jsonStr = JSON.stringify(arr);
|
||||||
}
|
}
|
||||||
console.log(jsonStr);
|
console.log(jsonStr);
|
||||||
@@ -113,6 +122,14 @@
|
|||||||
window.location.href = '/inventory/stock_checks/' + data['stock_id'];
|
window.location.href = '/inventory/stock_checks/' + data['stock_id'];
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
|
||||||
|
$('#back').on('click', function () {
|
||||||
|
window.location.href = '/inventory';
|
||||||
|
});
|
||||||
|
|
||||||
|
function remove_row(row) {
|
||||||
|
$("#item_remove_"+row).parent().parent().remove();
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
Check by
|
Check by
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<%= @check.check_by %>
|
<%= Employee.find(@check.check_by).name rescue '' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
Check At
|
Check At
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<%= @check.created_at %></div>
|
<%= @check.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
@@ -42,7 +42,15 @@
|
|||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td><%= item.item_code %></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_count %></td>
|
||||||
<td><%= item.stock_balance %></td>
|
<td><%= item.stock_balance %></td>
|
||||||
<td><%= item.different %></td>
|
<td><%= item.different %></td>
|
||||||
@@ -60,6 +68,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$('#save_to_journal').on('click', function () {
|
$('#save_to_journal').on('click', function () {
|
||||||
check_id = $('#stock_check_id').val();
|
check_id = $('#stock_check_id').val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -67,10 +76,11 @@ $('#save_to_journal').on('click', function(){
|
|||||||
url: '<%= inventory_save_to_journal_path %>',
|
url: '<%= inventory_save_to_journal_path %>',
|
||||||
data: 'data=' + check_id,
|
data: 'data=' + check_id,
|
||||||
success: function () {
|
success: function () {
|
||||||
alert('success')
|
alert('Successfully saved to journal.');
|
||||||
|
window.location.href = '/inventory';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
|
||||||
$('#print').on('click', function () {
|
$('#print').on('click', function () {
|
||||||
check_id = $('#stock_check_id').val();
|
check_id = $('#stock_check_id').val();
|
||||||
@@ -79,5 +89,10 @@ $('#print').on('click',function(){
|
|||||||
url: '<%= inventory_print_stock_check_path %>',
|
url: '<%= inventory_print_stock_check_path %>',
|
||||||
data: 'stock_check_id=' + check_id
|
data: 'stock_check_id=' + check_id
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
|
||||||
|
$('#back').on('click', function () {
|
||||||
|
window.location.href = '/inventory';
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= form_tag report_path, :method => :get, :id => "frm_report", :class => "form" do %>
|
||||||
|
<% if period_type != false %>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label class="">Select Date Range</label>
|
||||||
|
<% if @daterange %>
|
||||||
|
<input class="form-control" name="daterange" id="daterange" value="<%= @daterange %>" type="text" placeholder="Date Range" readonly="true">
|
||||||
|
<% else %>
|
||||||
|
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label class="">Definition 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 '-' %>
|
||||||
|
<% end %>
|
||||||
|
</option>
|
||||||
|
<% end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2 margin-top-20">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2 margin-top-20">
|
||||||
|
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$('#item_code').select2({
|
||||||
|
placeholder: 'Select Product',
|
||||||
|
allowClear: true
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#clear_filter').click(function () {
|
||||||
|
$('#daterange').val('');
|
||||||
|
$('#item_code').val('').text('');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="daterange"]').daterangepicker({
|
||||||
|
autoUpdateInput: false,
|
||||||
|
ranges: {
|
||||||
|
'Today': [moment(), moment()],
|
||||||
|
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||||
|
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||||
|
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||||
|
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||||
|
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||||
|
},
|
||||||
|
locale: {
|
||||||
|
format: 'YYYY-MM-DD'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (start, end, label) {
|
||||||
|
$('input[name="daterange"]').val(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="daterange"]').on('apply.daterangepicker', function (ev, picker) {
|
||||||
|
$('input[name="daterange"]').val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
|
||||||
|
|
||||||
|
from_date = picker.startDate.format('YYYY-MM-DD 00:00:00');
|
||||||
|
to_date = picker.endDate.format('YYYY-MM-DD 23:59:59');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="daterange"]').on('cancel.daterangepicker', function (ev, picker) {
|
||||||
|
$('input[name="daterange"]').val('');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
79
app/views/reports/stock_check/index.html.erb
Normal file
79
app/views/reports/stock_check/index.html.erb
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
|
<li>Stock Check Report</li>
|
||||||
|
</ul>
|
||||||
|
</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="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 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="container margin-top-20">
|
||||||
|
<div class="card row">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<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>Sale</th>
|
||||||
|
<th>Sale Item</th>
|
||||||
|
<th>Commissioner Name</th>
|
||||||
|
<th>Product Name</th>
|
||||||
|
<th>Qty</th>
|
||||||
|
<th>Commission Price</th>
|
||||||
|
<th>Commission Amount</th>
|
||||||
|
<th>Date</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% total_qty = 0 %>
|
||||||
|
<% total_price = 0 %>
|
||||||
|
<% total_amount = 0 %>
|
||||||
|
|
||||||
|
<% @transaction.each do |result| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= result.sale_id rescue '-' %></td>
|
||||||
|
<td><%= result.sale_item_id rescue '-' %></td>
|
||||||
|
<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="4"></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>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
52
app/views/reports/stock_check/index.xls.erb
Normal file
52
app/views/reports/stock_check/index.xls.erb
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<div class="container margin-top-20">
|
||||||
|
<div class="card row">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<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>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% total_qty = 0 %>
|
||||||
|
<% total_price = 0 %>
|
||||||
|
<% total_amount = 0 %>
|
||||||
|
|
||||||
|
<% @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>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -328,6 +328,7 @@ Rails.application.routes.draw do
|
|||||||
resources :credit_payment, :only => [:index, :show]
|
resources :credit_payment, :only => [:index, :show]
|
||||||
resources :void_sale, :only => [:index, :show]
|
resources :void_sale, :only => [:index, :show]
|
||||||
resources :commission, :only => [:index, :show]
|
resources :commission, :only => [:index, :show]
|
||||||
|
resources :stock_check, :only => [:index, :show]
|
||||||
|
|
||||||
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user