merge with august_spring
This commit is contained in:
@@ -22,11 +22,19 @@
|
||||
%>
|
||||
<tr>
|
||||
<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.max_stock_level %></td>
|
||||
<td><%= item.created_by%></td>
|
||||
<td><%= item.created_at%></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>
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<%= render 'inventory_list' %>
|
||||
<%= render 'inventory_list' %>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back </button>
|
||||
<%end%>
|
||||
<button id="stock_taking" type="button" class="btn btn-block btn-primary"> New Stock Taking </button>
|
||||
<% if current_login_employee.role == "administrator" || current_login_employee.role == 'manager' %>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back</button>
|
||||
<% end %>
|
||||
<button id="stock_taking" type="button" class="btn btn-block btn-primary"> New Stock Taking</button>
|
||||
<button id="stock_check_report" type="button" class="btn btn-block btn-primary"> Stock Check Report</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#stock_taking').on('click',function(){
|
||||
window.location.href = '/inventory/stock_checks';
|
||||
})
|
||||
$('#stock_check_report').on('click', function(){
|
||||
window.location.href = '';
|
||||
})
|
||||
$('#stock_taking').on('click', function () {
|
||||
window.location.href = '<%= inventory_stock_checks_path %>';
|
||||
});
|
||||
|
||||
$('#stock_check_report').on('click', function () {
|
||||
window.location.href = '<%= reports_stock_check_index_path %>';
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '<%= dashboard_path %>';
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,56 +1,84 @@
|
||||
<%= simple_form_for([:inventory, @inventory_definition]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<%= simple_form_for([:inventory,@inventory_definition]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :item_code %>
|
||||
|
||||
<div class="row">
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-3">
|
||||
<label class="control-label"><abbr title="required">*</abbr> Item</label>
|
||||
<select class="form-control item_code_place">
|
||||
<% if !@inventory_definition.item_code.nil? %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@inventory_definition.item_code) %>
|
||||
<% if menuiteminstance.nil?%>
|
||||
<% code = @inventory_definition.item_code %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
<div class="form-inputs">
|
||||
<div class="row">
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name, :item_code) %>
|
||||
<% Product.order("name desc").pluck(:name, :item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-3">
|
||||
<label class="control-label"><abbr title="required">*</abbr> Item</label>
|
||||
<select class="form-control item_code_place" id="item">
|
||||
<% if !@inventory_definition.item_code.nil? %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@inventory_definition.item_code) %>
|
||||
<% if menuiteminstance.nil? %>
|
||||
<% code = @inventory_definition.item_code %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<option value=""></option>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1] %>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1] %>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<% sample = [] %>
|
||||
<% if @inventory_definition.item_code.nil? %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@inventory_definition.item_code).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?", @inventory_definition.item_code).pluck(:item_instance_name, :item_instance_code) %>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?", @inventory_definition.item_code).pluck(:name, :item_code) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-md-3"><%= f.input :item_code, collection: sample %></div>
|
||||
</div>
|
||||
|
||||
<% sample = [] %>
|
||||
<% if @inventory_definition.item_code.nil? %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@inventory_definition.item_code).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?",@inventory_definition.item_code).pluck(:item_instance_name,:item_instance_code)%>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?",@inventory_definition.item_code).pluck(:name,:item_code)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-md-3"><%= f.input :item_code, collection: sample %></div>
|
||||
<!-- <div class="col-md-6"><%= f.input :item_code, collection: MenuItemInstance.order("item_instance_name desc").pluck(:item_instance_name,:item_instance_code),input_html: { selected: 2 } %></div> -->
|
||||
<div class="col-md-6"><%= f.input :min_qty %></div>
|
||||
<%= f.input :min_order_level %>
|
||||
<%= f.input :max_stock_level %>
|
||||
</div>
|
||||
|
||||
<%= f.input :min_order_level %>
|
||||
<%= f.input :max_stock_level %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', inventory_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".item_code_place").select2({
|
||||
placeholder: 'Select Item'
|
||||
});
|
||||
$("select#inventory_definition_item_code").select2();
|
||||
|
||||
$(".item_code_place").on('change', function (event) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var item_code = this.value;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
data: 'item_code=' + item_code,
|
||||
success: function (result) {
|
||||
$("#inventory_definition_item_code").empty();
|
||||
var itemlist;
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
itemlist = "<option value ='" + result[i][1] + "'>" + result[i][0] + "</option>";
|
||||
$("select#inventory_definition_item_code").append(itemlist);
|
||||
}
|
||||
// $("select#inventory_definition_item_code").append(itemlist);
|
||||
$("select#inventory_definition_item_code").select2();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -1,6 +1,10 @@
|
||||
<h1>Editing Inventory Definition</h1>
|
||||
|
||||
<%= render 'form', inventory_definition: @inventory_definition %>
|
||||
|
||||
<%= link_to 'Show', @inventory_definition %> |
|
||||
<%= link_to 'Back', inventory_definitions_path %>
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= inventory_path %>">Product Inventory</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', inventory: @inventory_definition %>
|
||||
</div>
|
||||
|
||||
@@ -7,17 +7,29 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<input type='text' id='stock_check_reason' class='form-control' placeholder="Set Stock Check Reason" value=''></input>
|
||||
</div>
|
||||
<input type='text' id='stock_check_reason' class='form-control' placeholder="Set Stock Check Reason" value=''/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-2">
|
||||
Product
|
||||
Item
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<input type='text' class='form-control' placeholder="Product Name" id='product_sku' value=''></input>
|
||||
<select class='form-control' id='product_sku'>
|
||||
<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>
|
||||
<br>
|
||||
@@ -27,14 +39,14 @@
|
||||
Qty
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<input type='text' class='form-control' placeholder="Qty" id='product_qty' value=''></input>
|
||||
<input type='text' class='form-control' placeholder="Qty" id='product_qty' value=''/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4"></div>
|
||||
<div class="col-md-7">
|
||||
<button class="btn btn-primary form-control" id='save_to_stock_check'> Save </button>
|
||||
<button class="btn btn-primary form-control" id='save_to_stock_check'> Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,9 +56,10 @@
|
||||
<div class="col-md-12">
|
||||
<table class="table table-striped" id='stock_item'>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<!--<th>#</th>-->
|
||||
<th>Product</th>
|
||||
<th>Balance</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -54,49 +67,69 @@
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="row">
|
||||
<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='back'> Back</button>
|
||||
<button class="btn btn-primary pull-right form-control" style='margin-bottom:2px;' id='finish'> Finish</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var count = 0
|
||||
$(document).ready(function () {
|
||||
$('#product_sku').select2({
|
||||
allowClear: true,
|
||||
placeholder: 'Select Product'
|
||||
})
|
||||
});
|
||||
|
||||
$('#save_to_stock_check').on('click', function(){
|
||||
count += 1;
|
||||
product_sku = $('#product_sku').val();
|
||||
product_qty = $('#product_qty').val();
|
||||
var tr = '<tr>'
|
||||
+ '<td>'+ count +'</td>'
|
||||
+ '<td><input type=text value="'+ product_sku +'" id="item_sku_'+ count +'" name='+count+'></input></td>'
|
||||
+ '<td><input type=text value="'+ product_qty +'" id="item_qty_'+ count +'" name='+count+'></input></td>'
|
||||
+ '</tr>'
|
||||
$('#stock_item').append(tr)
|
||||
$('#product_sku').val('');
|
||||
var count = 0;
|
||||
|
||||
$('#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();
|
||||
var tr = '<tr>'
|
||||
//+ '<td>' + count + '</td>'
|
||||
+ '<td><input type=hidden value="' + product_sku + '" id="item_sku_' + count + '" name=' + count + '/>'
|
||||
+ product_name + '</td>'
|
||||
+ '<td><input type=text value="' + product_qty + '" 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>';
|
||||
$('#stock_item').append(tr);
|
||||
// $('#product_sku').val('');
|
||||
$('#product_qty').val('');
|
||||
})
|
||||
});
|
||||
|
||||
$('#finish').on('click',function(){
|
||||
var reason = $('#stock_check_reason').val();
|
||||
var arr = [];
|
||||
var jsonStr = ''
|
||||
$('#finish').on('click', function () {
|
||||
var reason = $('#stock_check_reason').val();
|
||||
var arr = [];
|
||||
var jsonStr = '';
|
||||
|
||||
for(var i = 1; i <= count; i++){
|
||||
itemname = $('#item_sku_'+i ).val();
|
||||
itemqty = $('#item_qty_'+i ).val();
|
||||
arr.push({sku:itemname, qty:itemqty})
|
||||
jsonStr = JSON.stringify(arr)
|
||||
for (var i = 1; i <= count; i++) {
|
||||
itemname = $('#item_sku_' + i).val();
|
||||
itemqty = $('#item_qty_' + i).val();
|
||||
if(itemname !== undefined){
|
||||
arr.push({sku: itemname, qty: itemqty});
|
||||
}
|
||||
jsonStr = JSON.stringify(arr);
|
||||
}
|
||||
console.log(jsonStr);
|
||||
$.ajax({
|
||||
type: 'Post',
|
||||
url: '<%= inventory_stock_check_save_path %>',
|
||||
data: 'stock_item=' + jsonStr + '&reason=' + reason,
|
||||
success: function (data) {
|
||||
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();
|
||||
}
|
||||
console.log(jsonStr)
|
||||
$.ajax({
|
||||
type: 'Post',
|
||||
url: '<%= inventory_stock_check_save_path %>',
|
||||
data:'stock_item='+ jsonStr + '&reason='+ reason,
|
||||
success:function(data){
|
||||
alert(data['stock_id'])
|
||||
window.location.href = '/inventory/stock_checks/'+ data['stock_id'];
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
@@ -3,81 +3,96 @@
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
Check by
|
||||
Check by
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<%= @check.check_by %>
|
||||
<%= Employee.find(@check.check_by).name rescue '' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
Check At
|
||||
Check At
|
||||
</div>
|
||||
<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 class="row">
|
||||
<div class="col-md-2">
|
||||
Reason
|
||||
Reason
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<%= @check.reason %>
|
||||
<%= @check.reason %>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<table class="table table-striped col-md-12">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Product</th>
|
||||
<th>Stock Count</th>
|
||||
<th>Stock Balance</th>
|
||||
<th>Different</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
<%
|
||||
count = 0
|
||||
@check.stock_check_items.each do |item|
|
||||
count += 1
|
||||
%>
|
||||
<table class="table table-striped col-md-12">
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td><%= item.item_code %></td>
|
||||
<td><%= item.stock_count %></td>
|
||||
<td><%= item.stock_balance %></td>
|
||||
<td><%= item.different %></td>
|
||||
<td><%= item.remark %></td>
|
||||
<th>#</th>
|
||||
<th>Product</th>
|
||||
<th>Stock Count</th>
|
||||
<th>Stock Balance</th>
|
||||
<th>Different</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<%
|
||||
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-md-2">
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back </button>
|
||||
<button id="save_to_journal" type="button" class="btn btn-block btn-primary"> Save to Journal </button>
|
||||
<button id="print" type="button" class="btn btn-block btn-primary"> Print </button>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back</button>
|
||||
<button id="save_to_journal" type="button" class="btn btn-block btn-primary"> Save to Journal</button>
|
||||
<button id="print" type="button" class="btn btn-block btn-primary"> Print</button>
|
||||
</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('success')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('#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
|
||||
})
|
||||
})
|
||||
$('#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>
|
||||
|
||||
38
app/views/layouts/_header_inventory.html.erb
Normal file
38
app/views/layouts/_header_inventory.html.erb
Normal file
@@ -0,0 +1,38 @@
|
||||
<div class="container-fluid" style="min-height:30px; padding-left:0px !important; padding-right:0px !important; background:#54A5AF; margin-bottom:5px">
|
||||
<div style="padding-top:5px;padding-bottom:5px;margin-left:15px; margin-right:15px;">
|
||||
<div style="float:left;margin-top:3px;text-align:left;color:#ffffff">
|
||||
<strong>Inventory - <span id="clockbox"></span></strong>
|
||||
</div>
|
||||
<div style="float:right; margin-top:3px; text-align:right;width:200px;color:#ffffff">
|
||||
<% if current_login_employee %>
|
||||
<%= current_login_employee.name %> | <%= link_to 'Logout', logout_path, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
tday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
|
||||
tmonth=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
|
||||
|
||||
function GetClock(){
|
||||
var d=new Date();
|
||||
var nday=d.getDay(),nmonth=d.getMonth(),ndate=d.getDate(),nyear=d.getFullYear();
|
||||
var nhour=d.getHours(),nmin=d.getMinutes(),nsec=d.getSeconds(),ap;
|
||||
|
||||
if(nhour==0){ap=" AM";nhour=12;}
|
||||
else if(nhour<12){ap=" AM";}
|
||||
else if(nhour==12){ap=" PM";}
|
||||
else if(nhour>12){ap=" PM";nhour-=12;}
|
||||
|
||||
if(nmin<=9) nmin="0"+nmin;
|
||||
if(nsec<=9) nsec="0"+nsec;
|
||||
|
||||
document.getElementById('clockbox').innerHTML=""+tday[nday]+", "+tmonth[nmonth]+" "+ndate+", "+nyear+" "+nhour+":"+nmin+":"+nsec+ap+"";
|
||||
}
|
||||
|
||||
window.onload=function(){
|
||||
GetClock();
|
||||
setInterval(GetClock,1000);
|
||||
}
|
||||
</script>
|
||||
<div id="clockbox"></div>
|
||||
@@ -9,14 +9,14 @@
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'inventory_definitions', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render 'layouts/header_orgiami' %>
|
||||
<%= render 'layouts/header_inventory' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<% if !flash["errors"]%>
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-primary btn-block">Charges</button>
|
||||
<button type="button" id="commissions" class="btn btn-primary btn-block">Commissions</button>
|
||||
<button type="button" id="in_juties" class="btn btn-primary btn-block">In Juties</button>
|
||||
<button type="button" id="in_duties" class="btn btn-primary btn-block">In Duties</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
||||
@@ -579,9 +579,9 @@
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/load_commissioners";
|
||||
});
|
||||
|
||||
$('#in_juties').on('click', function () {
|
||||
$('#in_duties').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
window.location.href = '/origami/assign_in_juty/'+ dining_id;
|
||||
window.location.href = '/origami/assign_in_duty/'+ dining_id;
|
||||
});
|
||||
|
||||
$('#void').on('click', function () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= simple_form_for([:origami, @in_juty]) do |f| %>
|
||||
<%= simple_form_for([:origami, @in_duty]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= simple_form_for @in_juty, :url => origami_index_in_juty_path(@table.id), :method => :post do |f| %>
|
||||
<%= simple_form_for @in_duty, :url => origami_index_in_duty_path(@table.id), :method => :post do |f| %>
|
||||
<span class="patch_method"></span>
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
2
app/views/origami/in_duties/_in_duty.json.jbuilder
Normal file
2
app/views/origami/in_duties/_in_duty.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! in_duty, :id, :created_at, :updated_at
|
||||
json.url in_duty_url(in_duty, format: :json)
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<h3>Create In Juty</h3>
|
||||
<h3>Create In Duty</h3>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami,@in_juty]) do |f| %>
|
||||
<%= simple_form_for([:origami,@in_duty]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
@@ -22,10 +22,10 @@
|
||||
<div class="form-actions">
|
||||
<div class='row'>
|
||||
<div class="col-md-2">
|
||||
<%= link_to 'Back', origami_index_in_juty_path(@table.id), class: 'btn btn-success' %>
|
||||
<%= link_to 'Back', origami_index_in_duty_path(@table.id), class: 'btn btn-success' %>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<button type="button" class="btn btn-primary btn-block" id='in_juty'>Create In Juty</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='in_duty'>Create In Duty</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -45,18 +45,18 @@ $(function() {
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
});
|
||||
|
||||
$('#in_juty').on('click', function () {
|
||||
var ajax_url = "/origami/assign_in_juty";
|
||||
var commissioner_ids = $('#in_juty_commissioner_ids').val();
|
||||
var in_time = $('#in_juty_in_time').val();
|
||||
var out_time = $('#in_juty_out_time').val();
|
||||
$('#in_duty').on('click', function () {
|
||||
var ajax_url = "/origami/assign_in_duty";
|
||||
var commissioner_ids = $('#in_duty_commissioner_ids').val();
|
||||
var in_time = $('#in_duty_in_time').val();
|
||||
var out_time = $('#in_duty_out_time').val();
|
||||
var dining_id = '<%= @table.id %>'
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'dining_id=' + dining_id + "&commissioner_ids=" + commissioner_ids +'&in_time=' + in_time + "&out_time=" + out_time,
|
||||
success: function (result) {
|
||||
window.location.href = '/origami/assign_in_juty/'+ dining_id;
|
||||
window.location.href = '/origami/assign_in_duty/'+ dining_id;
|
||||
}
|
||||
});
|
||||
})
|
||||
@@ -2,9 +2,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
|
||||
<li><a href="<%= origami_in_duties_path %>">In Duties</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', in_juty: @in_juty %>
|
||||
<%= render 'form', in_duty: @in_duty %>
|
||||
</div>
|
||||
6
app/views/origami/in_duties/edit_in_duty.html.erb
Normal file
6
app/views/origami/in_duties/edit_in_duty.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<h3>Update In Duty</h3>
|
||||
</div>
|
||||
<%= render 'edit_in_duty', in_duty: @in_duty %>
|
||||
</div>
|
||||
@@ -14,27 +14,27 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @juties_in.each do |in_juty| %>
|
||||
<tr class="injuty_tr" data-ref="<%= in_juty.id %>">
|
||||
<% @duties_in.each do |in_duty| %>
|
||||
<tr class="induty_tr" data-ref="<%= in_duty.id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
|
||||
<td><%= in_juty.dining_facility.name rescue '-' %></td>
|
||||
<td><%= in_juty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
<td><%= in_duty.dining_facility.name rescue '-' %></td>
|
||||
<td><%= in_duty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Destroy', origami_destroy_in_duty_path(in_duty.dining_facility.id, in_duty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @juties_in %>
|
||||
<%= paginate @duties_in %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 partial">
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
<%= render 'form', in_duty: @in_duty, table: @table %>
|
||||
</div>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_juty_path, :class => 'btn btn-primary btn-sm' %>
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_duty_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -43,13 +43,13 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', ".injuty_tr", function () {
|
||||
$(document).on('click', ".induty_tr", function () {
|
||||
|
||||
$(this).closest('tr').find('.checkbox_check').prop("checked", true);
|
||||
|
||||
var in_juty_id = $(this).attr('data-ref');
|
||||
var in_duty_id = $(this).attr('data-ref');
|
||||
var table_id = "<%= @table.id %>";
|
||||
var url = "/origami/assign_in_juty/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
|
||||
var url = "/origami/assign_in_duty/table/" + table_id + "/in_duty/" + in_duty_id + "/edit";
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -59,22 +59,22 @@
|
||||
success: function (data) {
|
||||
debugger;
|
||||
$('.partial').empty().append(data);
|
||||
// $('#in_juty_id').val(data.in_juty.id);
|
||||
// $('#in_juty_commissioner_ids').val(data.commissioner.id);
|
||||
// $('#in_juty_in_time').val(data.in_juty.in_time);
|
||||
// $('#in_juty_out_time').val(data.in_juty.out_time);
|
||||
// $('#in_duty_id').val(data.in_duty.id);
|
||||
// $('#in_duty_commissioner_ids').val(data.commissioner.id);
|
||||
// $('#in_duty_in_time').val(data.in_duty.in_time);
|
||||
// $('#in_duty_out_time').val(data.in_duty.out_time);
|
||||
//
|
||||
// $('#update').removeAttr('disabled').val('');
|
||||
// $('#update').attr('value', 'Update');
|
||||
// $('#create').attr('disabled', 'disabled');
|
||||
//
|
||||
// $("#new_in_juty").attr('class', 'simple_form edit_in_juty');
|
||||
// var id = "edit_in_juty_" + in_juty_id;
|
||||
// $("#new_in_juty").attr('id', id);
|
||||
// $("#new_in_duty").attr('class', 'simple_form edit_in_duty');
|
||||
// var id = "edit_in_duty_" + in_duty_id;
|
||||
// $("#new_in_duty").attr('id', id);
|
||||
//
|
||||
// $(".edit_in_juty").attr('id', id);
|
||||
// $(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
// $(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
// $(".edit_in_duty").attr('id', id);
|
||||
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
||||
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
||||
// $(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
||||
|
||||
// setInterval(function () {
|
||||
1
app/views/origami/in_duties/index.json.jbuilder
Normal file
1
app/views/origami/in_duties/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @in_duties, partial: 'in_duties/in_duty', as: :in_duty
|
||||
@@ -18,24 +18,24 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @juties_in.each do |in_juty| %>
|
||||
<tr class="injuty_tr" data-ref="<%= in_juty.id %>">
|
||||
<% @duties_in.each do |in_duty| %>
|
||||
<tr class="induty_tr" data-ref="<%= in_duty.id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
|
||||
<td><%= in_juty.dining_facility.name rescue '-' %></td>
|
||||
<td><%= in_juty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Remove', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
<td><%= in_duty.dining_facility.name rescue '-' %></td>
|
||||
<td><%= in_duty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Remove', origami_destroy_in_duty_path(in_duty.dining_facility.id, in_duty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @juties_in %>
|
||||
<%= paginate @duties_in %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 partial">
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
<%= render 'form', in_duty: @in_duty, table: @table %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
@@ -45,13 +45,13 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', ".injuty_tr", function () {
|
||||
$(document).on('click', ".induty_tr", function () {
|
||||
|
||||
$(this).closest('tr').find('.checkbox_check').prop("checked", true);
|
||||
|
||||
var in_juty_id = $(this).attr('data-ref');
|
||||
var in_duty_id = $(this).attr('data-ref');
|
||||
var table_id = "<%= @table.id %>";
|
||||
var url = "/origami/assign_in_juty/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
|
||||
var url = "/origami/assign_in_duty/table/" + table_id + "/in_duty/" + in_duty_id + "/edit";
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -61,22 +61,22 @@
|
||||
success: function (data) {
|
||||
debugger;
|
||||
$('.partial').empty().append(data);
|
||||
// $('#in_juty_id').val(data.in_juty.id);
|
||||
// $('#in_juty_commissioner_ids').val(data.commissioner.id);
|
||||
// $('#in_juty_in_time').val(data.in_juty.in_time);
|
||||
// $('#in_juty_out_time').val(data.in_juty.out_time);
|
||||
// $('#in_duty_id').val(data.in_duty.id);
|
||||
// $('#in_duty_commissioner_ids').val(data.commissioner.id);
|
||||
// $('#in_duty_in_time').val(data.in_duty.in_time);
|
||||
// $('#in_duty_out_time').val(data.in_duty.out_time);
|
||||
//
|
||||
// $('#update').removeAttr('disabled').val('');
|
||||
// $('#update').attr('value', 'Update');
|
||||
// $('#create').attr('disabled', 'disabled');
|
||||
//
|
||||
// $("#new_in_juty").attr('class', 'simple_form edit_in_juty');
|
||||
// var id = "edit_in_juty_" + in_juty_id;
|
||||
// $("#new_in_juty").attr('id', id);
|
||||
// $("#new_in_duty").attr('class', 'simple_form edit_in_duty');
|
||||
// var id = "edit_in_duty_" + in_duty_id;
|
||||
// $("#new_in_duty").attr('id', id);
|
||||
//
|
||||
// $(".edit_in_juty").attr('id', id);
|
||||
// $(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
// $(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
// $(".edit_in_duty").attr('id', id);
|
||||
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
||||
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
||||
// $(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
||||
|
||||
// setInterval(function () {
|
||||
@@ -91,14 +91,14 @@
|
||||
});
|
||||
|
||||
$('#reset').click(function () {
|
||||
var url = "<%= new_origami_in_juty_path %>";
|
||||
var url = "<%= new_origami_in_duty_path %>";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: { table_id: <%= @table.id %> },
|
||||
success: function (data) {
|
||||
$('.partial').empty().append(data);
|
||||
$('.injuty_tr > td > .checkbox_check').prop("checked", false);
|
||||
$('.induty_tr > td > .checkbox_check').prop("checked", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -2,9 +2,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Duties</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
<%= render 'form', in_duty: @in_duty, table: @table %>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
|
||||
<li><a href="<%= origami_in_duties_path %>">In Duties</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
@@ -9,34 +9,34 @@
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">In Juty</h4>
|
||||
<h4 class="card-title">In Duty</h4>
|
||||
<table class="table">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td style="width:20%">Dining Facility Name</td>
|
||||
<td><%= @in_juty.dining_facility.name%></td>
|
||||
<td><%= @in_duty.dining_facility.name%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Commissioner Name</td>
|
||||
<td>
|
||||
<%= @in_juty.commissioner.name rescue '-' %>
|
||||
<%= @in_duty.commissioner.name rescue '-' %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">In Time</td>
|
||||
<td><%= @in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= @in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Out Time</td>
|
||||
<td><%= @in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= @in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', origami_in_juties_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_in_juty_path(@in_juty), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_in_juty_path(@in_juty), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
<%= link_to 'Back', origami_in_duties_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_in_duty_path(@in_duty), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_in_duty_path(@in_duty), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
1
app/views/origami/in_duties/show.json.jbuilder
Normal file
1
app/views/origami/in_duties/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "in_duties/in_duty", in_duty: @in_duty
|
||||
@@ -1,2 +0,0 @@
|
||||
json.extract! in_juty, :id, :created_at, :updated_at
|
||||
json.url in_juty_url(in_juty, format: :json)
|
||||
@@ -1,6 +0,0 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<h3>Update In Juty</h3>
|
||||
</div>
|
||||
<%= render 'edit_in_juty', in_juty: @in_juty %>
|
||||
</div>
|
||||
@@ -1 +0,0 @@
|
||||
json.array! @in_juties, partial: 'in_juties/in_juty', as: :in_juty
|
||||
@@ -1 +0,0 @@
|
||||
json.partial! "in_juties/in_juty", in_juty: @in_juty
|
||||
@@ -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>
|
||||
@@ -39,18 +39,19 @@
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="row checkboxes">
|
||||
<%= f.hidden_field :promo_day, :value => "", :class => "form-control col-md-1" %>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Sunday" value="0" id="0"> Sun</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Monday" value="1" id="1">Mon</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Tuesday" value="2" id="2"> Tue</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Wednesday" value="3" id="3"> Wed</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Thursday" value="4" id="4">Thu</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Friday" value="5" id="5">Fri</div>
|
||||
<div class="col-md-1"><input class="selectDay" type="checkbox" name="Saturday" value="6" id="6">Sat</div>
|
||||
<div class="col-md-2"><label class="control-label"><abbr title="required">*</abbr> Promotion Day</label></div>
|
||||
<%= f.hidden_field :promo_day, :class => "form-control" %>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Sunday" value="0" id="0"> Sun</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Monday" value="1" id="1">Mon</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Tuesday" value="2" id="2"> Tue</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Wednesday" value="3" id="3"> Wed</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Thursday" value="4" id="4"> Thu</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Friday" value="5" id="5"> Fri</label></div>
|
||||
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Saturday" value="6" id="6"> Sat</label></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<%= f.input :promo_type,input_html: { class: "" },
|
||||
@@ -73,11 +74,12 @@
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<option value="" selected>Choose Something</option>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
@@ -109,19 +111,23 @@
|
||||
<div class="row"></div >
|
||||
<%= f.fields_for :promotion_products do |pro| %>
|
||||
<div class="row">
|
||||
<%= pro.hidden_field :item_code,:class => "promo_product" %>
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-2" style="text-align:left">
|
||||
<div class="col-md-2 menu_item_choose" style="text-align:left">
|
||||
<select class="form-control item_code_place1">
|
||||
<option value="">Choose Something</option>
|
||||
<% arr.each do |a| %>
|
||||
<option value="<%= a[1 ]%>"><%= a[0] %></option>
|
||||
<option value="<%= a[1 ]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<% sample = [] %>
|
||||
<div class="col-md-2" style="text-align:left"><%= pro.input :item_code, :class => 'promoproduct', collection: sample,input_html: { selected: 2 }, label: false %></div>
|
||||
<!-- <% sample = [] %> -->
|
||||
|
||||
<div class="col-md-2" style="text-align:left"><%= pro.input :item_code, :class => 'promoproduct', collection:[],input_html: { selected: 2 }, label: false %></div>
|
||||
|
||||
<div class="col-md-2"><%= pro.input :min_qty , label: false%></div>
|
||||
<div class="col-md-2"><%= pro.input :net_off , label: false %></div>
|
||||
<div class="col-md-2"><%= pro.input :net_price , label: false %></div>
|
||||
@@ -156,14 +162,24 @@ $(document).ready(function(){
|
||||
$('#promotion_promo_start_hour').datetimepicker({
|
||||
datepicker:false,
|
||||
format:'H:m'
|
||||
});
|
||||
});
|
||||
$('#promotion_promo_end_hour').datetimepicker({
|
||||
datepicker:false,
|
||||
format:'H:m'
|
||||
});
|
||||
|
||||
$('#promotion_promo_start_hour').on('change', function(event) {
|
||||
$('#promotion_promo_start_hour').val($('#promotion_promo_start_hour').val().split(":")[0]+":00");
|
||||
});
|
||||
|
||||
$('#promotion_promo_end_hour').on('change', function(event) {
|
||||
$('#promotion_promo_end_hour').val($('#promotion_promo_end_hour').val().split(":")[0]+":00");
|
||||
});
|
||||
|
||||
var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
|
||||
jQuery.each( dayy.split(","), function( i, d ) {
|
||||
$("input.selectDay[value='"+d+"']").prop( "checked", true );
|
||||
});
|
||||
|
||||
var form = document.getElementById("new_promotion");
|
||||
var inputs = $("input");
|
||||
@@ -197,7 +213,7 @@ $(".selectDay").click(function() {
|
||||
$("#promotion_original_product").select2();
|
||||
$(".item_code_place").select2();
|
||||
$(".item_code_place").on('change', function(event) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var item_code = this.value;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -223,6 +239,29 @@ $(".selectDay").click(function() {
|
||||
callforpromoproduct();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
// for promotion products data showing
|
||||
var promopdt = $(".promo_product");
|
||||
jQuery.each( promopdt, function( i, ppdt ) {
|
||||
var ajax_url = "<%= settings_find_parent_item_path %>";
|
||||
var item_code = ppdt.value;
|
||||
var select_id = ppdt.id;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
data: 'item_instance_code=' + item_code,
|
||||
success: function (result) {
|
||||
if(result.length > 0){
|
||||
$("select#"+select_id).empty();
|
||||
$("select#"+select_id).append("<option value='"+item_code+"'>"+result[0]+"</option>");
|
||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+result[1]+"']").attr("selected","true")
|
||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").select2();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// promotion_promotion_products_attributes_0_item_code
|
||||
function callforpromoproduct(){
|
||||
$(".item_code_place1").select2();
|
||||
$(".item_code_place1").on('change', function(event) {
|
||||
@@ -234,16 +273,17 @@ $(".selectDay").click(function() {
|
||||
url: ajax_url,
|
||||
data: 'item_code=' + item_code,
|
||||
success: function (result) {
|
||||
$("#"+id).empty();
|
||||
$("select#"+id).empty();
|
||||
var itemlist;
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
itemlist += "<option value ="+result[i][1]+">"+result[i][0]+"</option>"
|
||||
}
|
||||
$("#"+id).append(itemlist);
|
||||
$("#"+id).select2();
|
||||
$("select#"+id).append(itemlist);
|
||||
$("select#"+id).select2();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user