Mobile Responsive for all reports

This commit is contained in:
code2lab
2019-05-30 14:00:39 +06:30
parent 24fbb46617
commit 453435f8fa
19 changed files with 391 additions and 381 deletions

View File

@@ -204,4 +204,14 @@ i.logout_icon{
.mbl-right-btn{ .mbl-right-btn{
text-align: right; text-align: right;
} }
.mbl-table{
display: block;
overflow: scroll;
}
.mbl-table-card{
overflow: scroll;
display: inline-block;
}
} }

View File

@@ -2,15 +2,15 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<% if defined? @payment_method %> <% if defined? @payment_method %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_payments") %></label>
<%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %> <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -26,10 +26,10 @@
</select> </select>
</div> </div>
<% if not defined? payments %> <% if not defined? payments %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_payments") %></label>
<select name="payment_type" id="payment_type" class="form-control"> <select name="payment_type" id="payment_type" class="form-control">
<% @payments.each do |pm| %> <% @payments.each do |pm| %>
<option class="<%=pm[1].downcase%>" value="<%=pm[1].downcase%>"><%=pm[0]%></option> <option class="<%=pm[1].downcase%>" value="<%=pm[1].downcase%>"><%=pm[0]%></option>
@@ -38,52 +38,52 @@
<option value="<%=pm.payment_method%>" class="<%=pm.payment_method%>" > <%=pm.payment_method%></option> <option value="<%=pm.payment_method%>" class="<%=pm.payment_method%>" > <%=pm.payment_method%></option>
<%end %> <%end %>
</select> </select>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <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>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" > <select class="form-control select" name="shift_name" id="shift_name" >
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 mbl-right-btn mbl-style">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#custom_excel').hide(); $('#custom_excel').hide();
$('#custom_excel').click(function(){ $('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url'); var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url) $('#frm_report').attr('action',url)
$('#frm_report').submit(); $('#frm_report').submit();
// window.location = url; // window.location = url;
}); });
var item = $('#item').val(); var item = $('#item').val();
var payment_type = $('#payment_type'); var payment_type = $('#payment_type');
if(item == 'order'){ if(item == 'order'){
$('#cashier').hide(); $('#cashier').hide();
$('#waiter').show(); $('#waiter').show();
if(payment_type){ if(payment_type){
$('#payment_type').hide(); $('#payment_type').hide();
} }
} }
else if(item == 'sale'){ else if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
@@ -91,7 +91,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });
@@ -109,7 +109,7 @@
$("#to").val("<%=params[:to] rescue '-'%>"); $("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>); $("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>); $("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
$(".<%=params[:payment_type]%>").attr('selected','selected') $(".<%=params[:payment_type]%>").attr('selected','selected')
@@ -128,7 +128,7 @@
if(item == 'sale'){ if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
if(payment_type){ if(payment_type){
$('#payment_type').show(); $('#payment_type').show();
} }

View File

@@ -16,10 +16,10 @@
<div class="text-right"> <div class="text-right">
<a href="javascript:export_to('<%=reports_card_sale_tran_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a> <a href="javascript:export_to('<%=reports_card_sale_tran_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div> </div>
<div class="margin-top-20"> <div class="margin-top-20 mbl-table">
<div class="card" style="width:112%;"> <div class="card mbl-table-card" style="width:112%;">
<table class="table table-striped" border="0"> <table class="table table-striped" border="0">
<thead> <thead>
@@ -28,12 +28,12 @@
</tr> </tr>
<% if @shift_from %> <% if @shift_from %>
<tr> <tr>
<% if @shift_data.employee %> <% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %> <% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th> <th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr> </tr>
<% end %> <% end %>
<tr> <tr>
<th><%= t("views.right_panel.detail.req_date") %></th> <th><%= t("views.right_panel.detail.req_date") %></th>
@@ -63,7 +63,7 @@
UnionPay UnionPay
<% else %> <% else %>
<%= cardSale.app %> <%= cardSale.app %>
<% end %> <% end %>
</td> </td>
<td><%= cardSale.sale.customer.name rescue '-' %></td> <td><%= cardSale.sale.customer.name rescue '-' %></td>
<td><%= cardSale.sale.cashier_name rescue '-' %></td> <td><%= cardSale.sale.cashier_name rescue '-' %></td>
@@ -72,18 +72,18 @@
TID : <%= cardSale.terminal_id %> TID : <%= cardSale.terminal_id %>
<br> <br>
<% end %> <% end %>
<% if cardSale.merchant_id != '' %> <% if cardSale.merchant_id != '' %>
MID : <%= cardSale.merchant_id %> MID : <%= cardSale.merchant_id %>
<br> <br>
<% end %> <% end %>
<% if cardSale.batch_no != '' %> <% if cardSale.batch_no != '' %>
Batch : <%= cardSale.batch_no %> Batch : <%= cardSale.batch_no %>
<br> <br>
<% end %> <% end %>
<% if cardSale.trace != '' %> <% if cardSale.trace != '' %>
Trace : <%= cardSale.trace %> Trace : <%= cardSale.trace %>
<% end %> <% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
<% else %> <% else %>
@@ -102,20 +102,20 @@
var check_arr = []; var check_arr = [];
search_by_period(); search_by_period();
$('#sel_period').change(function(){ $('#sel_period').change(function(){
search_by_period(); search_by_period();
}); });
function search_by_period(){ function search_by_period(){
var period = $('#sel_period').val(); var period = $('#sel_period').val();
var period_type = 0; var period_type = 0;
var from = ""; var from = "";
var to = ""; var to = "";
show_shift_name(period,period_type,from,to,'shift_item'); show_shift_name(period,period_type,from,to,'shift_item');
} }
// OK button is clicked // OK button is clicked
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){ $('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
new_date = new Date(date) ; new_date = new Date(date) ;
@@ -130,50 +130,50 @@
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear(); to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
$('#to').val(to) $('#to').val(to)
search_by_date(); search_by_date();
}); });
function search_by_date(){ function search_by_date(){
from = $("#from").val(); from = $("#from").val();
to = $("#to").val(); to = $("#to").val();
var period = 0; var period = 0;
var period_type = 1; var period_type = 1;
if(to != '' && from != ''){ if(to != '' && from != ''){
shift_name = from + ',' + to; shift_name = from + ',' + to;
check_arr.push(to); check_arr.push(to);
if(check_arr.length == 1){ if(check_arr.length == 1){
show_shift_name(period,period_type,from,to,'shift_item'); show_shift_name(period,period_type,from,to,'shift_item');
} }
if(check_arr.length == 3){ if(check_arr.length == 3){
check_arr = []; check_arr = [];
} }
} }
} }
function show_shift_name(period,period_type,from,to,shift_item){ function show_shift_name(period,period_type,from,to,shift_item){
var shift = $('#shift_name'); var shift = $('#shift_name');
shift.empty(); shift.empty();
var str = ''; var str = '';
var param_shift = ''; var param_shift = '';
var param_shift = '<%= params[:shift_name] rescue '-'%>'; var param_shift = '<%= params[:shift_name] rescue '-'%>';
if (from == '' && to == '') { if (from == '' && to == '') {
from = $("#from").val(); from = $("#from").val();
to = $("#to").val(); to = $("#to").val();
} }
url = '<%= reports_get_shift_by_date_path %>'; url = '<%= reports_get_shift_by_date_path %>';
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){ $.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
str = '<option value="0">--- All Shift ---</option>'; str = '<option value="0">--- All Shift ---</option>';
$(data.message).each(function(index){ $(data.message).each(function(index){
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date; var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date; var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
var shift_id = data.message[index].shift_id ; var shift_id = data.message[index].shift_id ;
@@ -182,18 +182,18 @@
selected = 'selected = "selected"'; selected = 'selected = "selected"';
} }
else{ else{
selected = ''; selected = '';
} }
}else{ }else{
selected = ''; selected = '';
} }
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>'; str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
// console.log(sh_date) // console.log(sh_date)
}) })
shift.append(str); shift.append(str);
}); });
} }
}); });
</script> </script>

View File

@@ -2,15 +2,15 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<% if defined? @payment_method %> <% if defined? @payment_method %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_payments") %></label>
<%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %> <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -26,10 +26,10 @@
</select> </select>
</div> </div>
<% if not defined? payments %> <% if not defined? payments %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label> <label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label>
<select name="payment_type" id="payment_type" class="form-control"> <select name="payment_type" id="payment_type" class="form-control">
<% @payments.each do |pm| %> <% @payments.each do |pm| %>
<option class="<%=pm[1].downcase%>" value="<%=pm[1].downcase%>"><%=pm[0]%></option> <option class="<%=pm[1].downcase%>" value="<%=pm[1].downcase%>"><%=pm[0]%></option>
@@ -38,52 +38,52 @@
<option value="<%=pm.payment_method%>" class="<%=pm.payment_method%>" > <%=pm.payment_method%></option> <option value="<%=pm.payment_method%>" class="<%=pm.payment_method%>" > <%=pm.payment_method%></option>
<%end %> <%end %>
</select> </select>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <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>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" > <select class="form-control select" name="shift_name" id="shift_name" >
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 mbl-right-btn mbl-style">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#custom_excel').hide(); $('#custom_excel').hide();
$('#custom_excel').click(function(){ $('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url'); var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url) $('#frm_report').attr('action',url)
$('#frm_report').submit(); $('#frm_report').submit();
// window.location = url; // window.location = url;
}); });
var item = $('#item').val(); var item = $('#item').val();
var payment_type = $('#payment_type'); var payment_type = $('#payment_type');
if(item == 'order'){ if(item == 'order'){
$('#cashier').hide(); $('#cashier').hide();
$('#waiter').show(); $('#waiter').show();
if(payment_type){ if(payment_type){
$('#payment_type').hide(); $('#payment_type').hide();
} }
} }
else if(item == 'sale'){ else if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
@@ -91,7 +91,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });
@@ -109,7 +109,7 @@
$("#to").val("<%=params[:to] rescue '-'%>"); $("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>); $("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>); $("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
$(".<%=params[:payment_type]%>").attr('selected','selected') $(".<%=params[:payment_type]%>").attr('selected','selected')
@@ -128,7 +128,7 @@
if(item == 'sale'){ if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
if(payment_type){ if(payment_type){
$('#payment_type').show(); $('#payment_type').show();
} }

View File

@@ -16,10 +16,10 @@
<div class="text-right"> <div class="text-right">
<a href="javascript:export_to('<%=reports_card_settle_tran_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a> <a href="javascript:export_to('<%=reports_card_settle_tran_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div> </div>
<div class="margin-top-20"> <div class="margin-top-20 mbl-table">
<div class="card"> <div class="card mbl-table-card">
<table class="table table-striped" border="0"> <table class="table table-striped" border="0">
<thead> <thead>
@@ -28,12 +28,12 @@
</tr> </tr>
<% if @shift_from %> <% if @shift_from %>
<tr> <tr>
<% if @shift_data.employee %> <% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %> <% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th> <th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr> </tr>
<% end %> <% end %>
<tr> <tr>
<th><%= t("views.right_panel.detail.shift_sale_id") %></th> <th><%= t("views.right_panel.detail.shift_sale_id") %></th>
@@ -81,20 +81,20 @@
var check_arr = []; var check_arr = [];
search_by_period(); search_by_period();
$('#sel_period').change(function(){ $('#sel_period').change(function(){
search_by_period(); search_by_period();
}); });
function search_by_period(){ function search_by_period(){
var period = $('#sel_period').val(); var period = $('#sel_period').val();
var period_type = 0; var period_type = 0;
var from = ""; var from = "";
var to = ""; var to = "";
show_shift_name(period,period_type,from,to,'shift_item'); show_shift_name(period,period_type,from,to,'shift_item');
} }
// OK button is clicked // OK button is clicked
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){ $('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
new_date = new Date(date) ; new_date = new Date(date) ;
@@ -109,50 +109,50 @@
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear(); to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
$('#to').val(to) $('#to').val(to)
search_by_date(); search_by_date();
}); });
function search_by_date(){ function search_by_date(){
from = $("#from").val(); from = $("#from").val();
to = $("#to").val(); to = $("#to").val();
var period = 0; var period = 0;
var period_type = 1; var period_type = 1;
if(to != '' && from != ''){ if(to != '' && from != ''){
shift_name = from + ',' + to; shift_name = from + ',' + to;
check_arr.push(to); check_arr.push(to);
if(check_arr.length == 1){ if(check_arr.length == 1){
show_shift_name(period,period_type,from,to,'shift_item'); show_shift_name(period,period_type,from,to,'shift_item');
} }
if(check_arr.length == 3){ if(check_arr.length == 3){
check_arr = []; check_arr = [];
} }
} }
} }
function show_shift_name(period,period_type,from,to,shift_item){ function show_shift_name(period,period_type,from,to,shift_item){
var shift = $('#shift_name'); var shift = $('#shift_name');
shift.empty(); shift.empty();
var str = ''; var str = '';
var param_shift = ''; var param_shift = '';
var param_shift = '<%= params[:shift_name] rescue '-'%>'; var param_shift = '<%= params[:shift_name] rescue '-'%>';
if (from == '' && to == '') { if (from == '' && to == '') {
from = $("#from").val(); from = $("#from").val();
to = $("#to").val(); to = $("#to").val();
} }
url = '<%= reports_get_shift_by_date_path %>'; url = '<%= reports_get_shift_by_date_path %>';
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){ $.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
str = '<option value="0">--- All Shift ---</option>'; str = '<option value="0">--- All Shift ---</option>';
$(data.message).each(function(index){ $(data.message).each(function(index){
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date; var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date; var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
var shift_id = data.message[index].shift_id ; var shift_id = data.message[index].shift_id ;
@@ -161,18 +161,18 @@
selected = 'selected = "selected"'; selected = 'selected = "selected"';
} }
else{ else{
selected = ''; selected = '';
} }
}else{ }else{
selected = ''; selected = '';
} }
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>'; str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
// console.log(sh_date) // console.log(sh_date)
}) })
shift.append(str); shift.append(str);
}); });
} }
}); });
</script> </script>

View File

@@ -11,17 +11,17 @@
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true"> <input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
<% end %> <% end %>
</div> --> </div> -->
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t :commissioner %></label> <label class="font-14 mbl_lbl"><%= t :commissioner %></label>
<select class="form-control" name="commissioner" id="commissioner" style="height: 37px;"> <select class="form-control" name="commissioner" id="commissioner" style="height: 37px;">
<option value=""></option> <option value=""></option>
<% @commissioner.each do |c| %> <% @commissioner.each do |c| %>
@@ -33,7 +33,7 @@
<% end %> <% end %>
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20"> <div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-right-btn mbl-style">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-info wave-effects'> <input type="submit" value="Generate Report" class='btn btn-info wave-effects'>
</div> </div>
@@ -89,4 +89,4 @@
}); });
</script> </script>
--> -->

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="form-group col-md-2"> <div class="form-group col-md-2 mbl-style">
<label class="font-20"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-20 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -19,60 +19,60 @@
</select> </select>
</div> </div>
<% if defined? filter_for_credit %> <% if defined? filter_for_credit %>
<div class="form-group col-md-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 col-mbl-view mbl-style">
<label class="font-20">Select Paid/ Unpaid</label> <label class="font-14">Select Paid/ Unpaid</label>
<%= select_tag "filter_check", options_for_select(@filter_for_credit, :selected => params[:filter_check]), :class => "form-control", :style => "height: 37px;" %> <%= select_tag "filter_check", options_for_select(@filter_for_credit, :selected => params[:filter_check]), :class => "form-control", :style => "height: 37px;" %>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.order_source") %></label> <label class="font-14"><%= t("views.right_panel.detail.order_source") %></label>
<%= select_tag "order_source", options_for_select(@sources, :selected => params[:order_source]), :class => "form-control" %> <%= select_tag "order_source", options_for_select(@sources, :selected => params[:order_source]), :class => "form-control" %>
</div> </div>
<div class="form-group col-md-2"> <div class="form-group col-md-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-20">From</label> <label class="font-20 mbl_lbl">From</label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
</div> </div>
<div class="form-group col-md-2"> <div class="form-group col-md-2 col-mbl-view mbl-style">
<label class="font-20">To</label> <label class="font-20 mbl_lbl">To</label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
</div> </div>
<div class="form-group col-md-2"> <div class="form-group col-md-2 mbl-style">
<label class="font-20">All Shift</label> <label class="font-20 mbl_lbl">All Shift</label>
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;"> <select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
</select> </select>
</div> </div>
</div> </div>
<div class="row clearfix"> <div class="row clearfix">
<div class="form-group col-md-12" align="right"> <div class="form-group col-md-12 mbl-style mbl-right-btn" align="right">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#custom_excel').hide(); $('#custom_excel').hide();
$('#custom_excel').click(function(){ $('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url'); var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url) $('#frm_report').attr('action',url)
$('#frm_report').submit(); $('#frm_report').submit();
// window.location = url; // window.location = url;
}); });
var item = $('#item').val(); var item = $('#item').val();
var payment_type = $('#payment_type'); var payment_type = $('#payment_type');
if(item == 'order'){ if(item == 'order'){
$('#cashier').hide(); $('#cashier').hide();
$('#waiter').show(); $('#waiter').show();
if(payment_type){ if(payment_type){
$('#payment_type').hide(); $('#payment_type').hide();
} }
} }
else if(item == 'sale'){ else if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
@@ -80,7 +80,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });
@@ -117,7 +117,7 @@
if(item == 'sale'){ if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
if(payment_type){ if(payment_type){
$('#payment_type').show(); $('#payment_type').show();
} }

View File

@@ -30,7 +30,7 @@
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 35px;"> <input data-behaviour='datepicker' class="form-control datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 35px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-right-btn"> <div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-right-btn mbl-style">
<label></label><br> <label></label><br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -20,8 +20,8 @@
</div> </div>
<!-- <input type="hidden" name="report_type" value="sale_item" id="sel_sale_type"> --> <!-- <input type="hidden" name="report_type" value="sale_item" id="sel_sale_type"> -->
<% if defined? commissioners %> <% if defined? commissioners %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14">Select Commissioner</label> <label class="font-14 mbl_lbl">Select Commissioner</label>
<select class="form-control" id="commissioner" name="commissioner"> <select class="form-control" id="commissioner" name="commissioner">
<option value="">--Select Commissioner--</option> <option value="">--Select Commissioner--</option>
<% if !@commissioners.nil? %> <% if !@commissioners.nil? %>
@@ -34,31 +34,31 @@
<% end %> <% end %>
<% end %> <% end %>
</select> </select>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14">All Shift</label> <label class="font-14 mbl_lbl">All Shift</label>
<select class="form-control select" name="shift_name" id="shift_name" > <select class="form-control select" name="shift_name" id="shift_name" >
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20"> <div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-right-btn mbl-style">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
@@ -83,7 +83,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-13"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-13 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -19,40 +19,40 @@
</select> </select>
</div> </div>
<% if defined? providers %> <% if defined? providers %>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1 col-mbl-view mbl-style">
<label class="font-13"><%= t("views.right_panel.detail.select_providers") %></label> <label class="font-13"><%= t("views.right_panel.detail.select_providers") %></label>
<%= select_tag "provider", options_for_select(@providers, :selected => params[:provider]), :class => "form-control", :style => "height: 35px;" %> <%= select_tag "provider", options_for_select(@providers, :selected => params[:provider]), :class => "form-control", :style => "height: 35px;" %>
</div> </div>
<% end %> <% end %>
<% if defined? payment_types %> <% if defined? payment_types %>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1 col-mbl-view mbl-style">
<label class="font-13"><%= t("views.right_panel.detail.select_payment") %></label> <label class="font-13"><%= t("views.right_panel.detail.select_payment") %></label>
<%= select_tag "payment_type", options_for_select(@payment_types, :selected => params[:payment_type]), :class => "form-control", :style => "height: 35px;" %> <%= select_tag "payment_type", options_for_select(@payment_types, :selected => params[:payment_type]), :class => "form-control", :style => "height: 35px;" %>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-13"><%= t("views.right_panel.detail.from") %></label> <label class="font-13 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-13"><%= t("views.right_panel.detail.to") %></label> <label class="font-13 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <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>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-13"><%= t("views.right_panel.detail.all_shift") %></label> <label class="font-13 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" > <select class="form-control select" name="shift_name" id="shift_name" >
</select> </select>
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20"> <div class="col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-right-btn mbl-style">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
<% if params[:shift_name].to_i > 0%> <% if params[:shift_name].to_i > 0%>

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -19,55 +19,55 @@
</select> </select>
</div> </div>
<% if defined? payments %> <% if defined? payments %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label> <label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label>
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %> <%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 from" name="from" id="from" type="text" placeholder="From date" style="height: 34px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3 from" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 to" name="to" id="to" type="text" placeholder="To date" style="height: 34px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3 to" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;" > <select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;" >
</select> </select>
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20"> <div class="col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-right-btn mbl-style">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#custom_excel').hide(); $('#custom_excel').hide();
$('#custom_excel').click(function(){ $('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url'); var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url) $('#frm_report').attr('action',url)
$('#frm_report').submit(); $('#frm_report').submit();
// window.location = url; // window.location = url;
}); });
var item = $('#item').val(); var item = $('#item').val();
var payment_type = $('#payment_type'); var payment_type = $('#payment_type');
if(item == 'order'){ if(item == 'order'){
$('#cashier').hide(); $('#cashier').hide();
$('#waiter').show(); $('#waiter').show();
if(payment_type){ if(payment_type){
$('#payment_type').hide(); $('#payment_type').hide();
} }
} }
else if(item == 'sale'){ else if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
@@ -75,7 +75,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });
@@ -112,7 +112,7 @@
if(item == 'sale'){ if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
if(payment_type){ if(payment_type){
$('#payment_type').show(); $('#payment_type').show();
} }

View File

@@ -16,14 +16,14 @@
<hr /> <hr />
<div class="text-right"> <div class="text-right">
<a href="javascript:export_to('<%=reports_payment_method_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a> <a href="javascript:export_to('<%=reports_payment_method_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div> </div>
<div class="margin-top-20"> <div class="margin-top-20 mbl-table">
<div class="card"> <div class="card mbl-table-card">
<table class="table table-bordered"> <table class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th colspan="9"> <th colspan="9">
<strong> <strong>
<%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
</strong> </strong>
@@ -31,9 +31,9 @@
</tr> </tr>
<% if @shift_from %> <% if @shift_from %>
<tr> <tr>
<% if @shift_data.employee %> <% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %> <% end %>
<th colspan="9"> <th colspan="9">
<strong><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</strong> <strong><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</strong>
</th> </th>
@@ -67,7 +67,7 @@
else else
delimiter = "" delimiter = ""
end end
%> %>
<% unless @sale_data.empty? %> <% unless @sale_data.empty? %>
<tbody> <tbody>
<% @sale_data.each do |sale| %> <% @sale_data.each do |sale| %>
@@ -88,7 +88,7 @@
<td><%= number_with_precision(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> <td><%= number_with_precision(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
<% end %> <% end %>
</table> </table>
@@ -103,7 +103,7 @@
<td colspan="7"><strong>All Payment Details</strong></td> <td colspan="7"><strong>All Payment Details</strong></td>
</tr> </tr>
<%end%> <%end%>
<tr> <tr>
<th> <%= t("views.right_panel.detail.shift_name") %> </th> <th> <%= t("views.right_panel.detail.shift_name") %> </th>
<th><%= t("views.right_panel.detail.receipt_no") %></th> <th><%= t("views.right_panel.detail.receipt_no") %></th>
@@ -120,9 +120,9 @@
<% if payment.payment_method === 'cash' <% if payment.payment_method === 'cash'
total += payment.payment_amount - payment.change_amount total += payment.payment_amount - payment.change_amount
else else
total += payment.payment_amount total += payment.payment_amount
end%> end%>
<tr> <tr>
<% if @shift_from.nil? && @shift_to.nil? %> <% if @shift_from.nil? && @shift_to.nil? %>
<td><%= payment.sale_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-'%></td> <td><%= payment.sale_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-'%></td>
<% else %> <% else %>
@@ -138,9 +138,9 @@
<td><%= number_with_precision(payment.payment_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td> <td><%= number_with_precision(payment.payment_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
<%end%> <%end%>
<td><%= number_with_precision(payment.sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> <td><%= number_with_precision(payment.sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
</tr> </tr>
<% end %> <% end %>
<%if total>0%> <%if total>0%>
<tr> <tr>
@@ -162,15 +162,15 @@
$('#sel_period').change(function(){ $('#sel_period').change(function(){
search_by_period(); search_by_period();
}); });
function search_by_period(){ function search_by_period(){
var period = $('#sel_period').val(); var period = $('#sel_period').val();
var period_type = 0; var period_type = 0;
var from = ""; var from = "";
var to = ""; var to = "";
show_shift_name(period,period_type,from,to,'shift_item'); show_shift_name(period,period_type,from,to,'shift_item');
} }
// OK button is clicked // OK button is clicked
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){ $('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
@@ -186,49 +186,49 @@
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear(); to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
$('#to').val(to) $('#to').val(to)
search_by_date(); search_by_date();
}); });
function search_by_date(){ function search_by_date(){
from = $("#from").val(); from = $("#from").val();
to = $("#to").val(); to = $("#to").val();
var period = 0; var period = 0;
var period_type = 1; var period_type = 1;
if(to != '' && from != ''){ if(to != '' && from != ''){
shift_name = from + ',' + to; shift_name = from + ',' + to;
check_arr.push(to); check_arr.push(to);
if(check_arr.length == 1){ if(check_arr.length == 1){
show_shift_name(period,period_type,from,to,'shift_item'); show_shift_name(period,period_type,from,to,'shift_item');
} }
if(check_arr.length == 3){ if(check_arr.length == 3){
check_arr = []; check_arr = [];
} }
} }
} }
function show_shift_name(period,period_type,from,to,shift_item){ function show_shift_name(period,period_type,from,to,shift_item){
var shift = $('#shift_name'); var shift = $('#shift_name');
shift.empty(); shift.empty();
if (from == '' && to == '') { if (from == '' && to == '') {
from = $("#from").val(); from = $("#from").val();
to = $("#to").val(); to = $("#to").val();
} }
var str = ''; var str = '';
var param_shift = ''; var param_shift = '';
var param_shift = '<%= params[:shift_name] rescue '-'%>'; var param_shift = '<%= params[:shift_name] rescue '-'%>';
console.log(param_shift); console.log(param_shift);
url = '<%= reports_get_shift_by_date_path %>'; url = '<%= reports_get_shift_by_date_path %>';
console.log(url); console.log(url);
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){ $.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
console.log(data); console.log(data);
str = '<option value="0">--- All Shift ---</option>'; str = '<option value="0">--- All Shift ---</option>';
$(data.message).each(function(index){ $(data.message).each(function(index){
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date; var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date; var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
var shift_id = data.message[index].shift_id ; var shift_id = data.message[index].shift_id ;
@@ -237,19 +237,19 @@
selected = 'selected = "selected"'; selected = 'selected = "selected"';
} }
else{ else{
selected = ''; selected = '';
} }
}else{ }else{
selected = ''; selected = '';
} }
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>'; str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
// console.log(sh_date) // console.log(sh_date)
}) })
shift.append(str); shift.append(str);
}); });
} }
}); });
</script> </script>

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -33,21 +33,21 @@
</select> </select>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <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>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" > <select class="form-control select" name="shift_name" id="shift_name" >
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20" style="margin-top: 20px;"> <div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-style mbl-right-btn" style="margin-top: 20px;">
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -19,10 +19,10 @@
</select> </select>
</div> </div>
<% if defined? payments %> <% if defined? payments %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_payments") %></label>
<select name="payment_type" id="payment_type" class="form-control"> <select name="payment_type" id="payment_type" class="form-control">
<% @payments.each do |pm| %> <% @payments.each do |pm| %>
<option class="<%=pm[1].downcase%>" value="<%=pm[1].downcase%>"><%=pm[0]%></option> <option class="<%=pm[1].downcase%>" value="<%=pm[1].downcase%>"><%=pm[0]%></option>
@@ -31,52 +31,52 @@
<option value="<%=pm.payment_method%>" class="<%=pm.payment_method%>" > <%=pm.payment_method%></option> <option value="<%=pm.payment_method%>" class="<%=pm.payment_method%>" > <%=pm.payment_method%></option>
<%end %> <%end %>
</select> </select>
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <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>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" > <select class="form-control select" name="shift_name" id="shift_name" >
</select> </select>
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20"> <div class="col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-style mbl-right-btn">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#custom_excel').hide(); $('#custom_excel').hide();
$('#custom_excel').click(function(){ $('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url'); var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url) $('#frm_report').attr('action',url)
$('#frm_report').submit(); $('#frm_report').submit();
// window.location = url; // window.location = url;
}); });
var item = $('#item').val(); var item = $('#item').val();
var payment_type = $('#payment_type'); var payment_type = $('#payment_type');
if(item == 'order'){ if(item == 'order'){
$('#cashier').hide(); $('#cashier').hide();
$('#waiter').show(); $('#waiter').show();
if(payment_type){ if(payment_type){
$('#payment_type').hide(); $('#payment_type').hide();
} }
} }
else if(item == 'sale'){ else if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
@@ -84,7 +84,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });
@@ -101,7 +101,7 @@
$("#to").val("<%=params[:to] rescue '-'%>"); $("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>); $("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>); $("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
$(".<%=params[:payment_type]%>").attr('selected','selected') $(".<%=params[:payment_type]%>").attr('selected','selected')
// shift = $(".shift-id").text() // shift = $(".shift-id").text()
@@ -124,7 +124,7 @@
if(item == 'sale'){ if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
if(payment_type){ if(payment_type){
$('#payment_type').show(); $('#payment_type').show();
} }

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -18,9 +18,9 @@
<option value="9">Last year</option> <option value="9">Last year</option>
</select> </select>
</div> </div>
<!-- <input type="hidden" name="report_type" value="sale_item" id="sel_sale_type"> --> <!-- <input type="hidden" name="report_type" value="sale_item" id="sel_sale_type"> -->
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14">Select Type</label> <label class="font-14 mbl_lbl">Select Type</label>
<select name="sale_type" id="sel_sale_type" class="form-control"> <select name="sale_type" id="sel_sale_type" class="form-control">
<option value="">Select Type</option> <option value="">Select Type</option>
<option value="revenue" selected>Revenue Only</option> <option value="revenue" selected>Revenue Only</option>
@@ -31,40 +31,40 @@
<option value="promotion">Promotion Only</option> <option value="promotion">Promotion Only</option>
<option value="other">Other Amount Only</option> <option value="other">Other Amount Only</option>
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_account") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_account") %></label>
<select name="account_type" id="account_type" class="form-control"> <select name="account_type" id="account_type" class="form-control">
<option value = "">Select Account</option> <option value = "">Select Account</option>
<% @account.each do |acc| %> <% @account.each do |acc| %>
<option value="<%=acc.title%>" class="<%=acc.title%>" > <%=acc.title%></option> <option value="<%=acc.title%>" class="<%=acc.title%>" > <%=acc.title%></option>
<%end %> <%end %>
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14">All Shift</label> <label class="font-14 mbl_lbl">All Shift</label>
<select class="form-control select" name="shift_name" id="shift_name" > <select class="form-control select" name="shift_name" id="shift_name" >
</select> </select>
</div> </div>
<div class="col-lg-12 col-md-12 col-sm-12 margin-top-20"> <div class="col-lg-12 col-md-12 col-sm-12 margin-top-20 mbl-right-btn">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary float_right'> <input type="submit" value="Generate Report" class='btn btn-primary float_right'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
@@ -87,7 +87,7 @@
$('#waiter').show(); $('#waiter').show();
if(payment_type){ if(payment_type){
$('#payment_type').hide(); $('#payment_type').hide();
} }
} }
else if(item == 'sale'){ else if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
@@ -95,7 +95,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });
@@ -130,7 +130,7 @@
if(item == 'sale'){ if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
if(payment_type){ if(payment_type){
$('#payment_type').show(); $('#payment_type').show();
} }

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -18,50 +18,50 @@
<option value="9">Last year</option> <option value="9">Last year</option>
</select> </select>
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
<!-- <label class="font-14">Select Shift Period</label> --> <!-- <label class="font-14">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <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>
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" > <select class="form-control select" name="shift_name" id="shift_name" >
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20"><br> <div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-style mbl-right-btn"><br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#custom_excel').hide(); $('#custom_excel').hide();
$('#custom_excel').click(function(){ $('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url'); var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url) $('#frm_report').attr('action',url)
$('#frm_report').submit(); $('#frm_report').submit();
// window.location = url; // window.location = url;
}); });
var item = $('#item').val(); var item = $('#item').val();
var payment_type = $('#payment_type'); var payment_type = $('#payment_type');
if(item == 'order'){ if(item == 'order'){
$('#cashier').hide(); $('#cashier').hide();
$('#waiter').show(); $('#waiter').show();
if(payment_type){ if(payment_type){
$('#payment_type').hide(); $('#payment_type').hide();
} }
} }
else if(item == 'sale'){ else if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
@@ -69,7 +69,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });
@@ -102,7 +102,7 @@ $('#item').change(function(){
if(item == 'sale'){ if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
if(payment_type){ if(payment_type){
$('#payment_type').show(); $('#payment_type').show();
} }
@@ -115,4 +115,4 @@ $('#item').change(function(){
} }
} }
}); });
</script> </script>

View File

@@ -11,23 +11,23 @@
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true"> <input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
<% end %> <% end %>
</div> --> </div> -->
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14">From</label> <label class="font-14 mbl_lbl">From</label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
<label class="font-14">To</label> <label class="font-14 mbl_lbl">To</label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;"> <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>
<div class="form-group col-md-4"> <div class="form-group col-md-4 mbl-style">
<label class="font-14">Select Item</label> <label class="font-14 mbl_lbl">Select Item</label>
<select class="form-control" name="item_code" id="item_code"> <select class="form-control" name="item_code" id="item_code">
<option value="">Select Item</option> <option value="">Select Item</option>
<% @inventory_definitions.each do |item| %> <% @inventory_definitions.each do |item| %>
<% <%
selected = "" selected = ""
if item.item_code.to_s == params[:item_code].to_s if item.item_code.to_s == params[:item_code].to_s
selected = "selected" selected = "selected"
end end
%> %>
@@ -43,7 +43,7 @@
<% end %> <% end %>
</select> </select>
</div> </div>
<div class="form-group col-md-2 margin-top-20"><br> <div class="form-group col-md-2 margin-top-20 mbl-right-btn mbl-style"><br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
<!-- <div class="form-group col-md-2 margin-top-20"> <!-- <div class="form-group col-md-2 margin-top-20">

View File

@@ -2,8 +2,8 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %> <% if period_type != false %>
<div class="row"> <div class="row">
<div class="form-group col-lg-2 col-md-2 col-sm-2"> <div class="form-group col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-20"><%= t("views.right_panel.detail.select_period") %><%= t("views.right_panel.detail.select_period") %></label> <label class="font-20 mbl_lbl"><%= t("views.right_panel.detail.select_period") %><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control"> <select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option> <option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option> <option value="0">Today</option>
@@ -19,25 +19,25 @@
</select> </select>
</div> </div>
<div class="form-group col-lg-2 col-md-2 col-sm-2"> <div class="form-group col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-20"><%= t("views.right_panel.detail.from") %></label> <label class="font-20 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
</div> </div>
<div class="form-group col-lg-2 col-md-2 col-sm-2"> <div class="form-group col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<label class="font-20"><%= t("views.right_panel.detail.to") %></label> <label class="font-20 mbl_lbl"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;"> <input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
</div> </div>
<div class="form-group col-lg-3 col-md-3 col-sm-3"> <div class="form-group col-lg-3 col-md-3 col-sm-3 mbl-style">
<label class="font-20"><%= t("views.right_panel.detail.all_shift") %></label> <label class="font-20 mbl_lbl"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;"> <select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
</select> </select>
</div> </div>
<div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20"> <div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-right-btn mbl-style">
<br> <br>
<input type="submit" value="Generate Report" class='btn btn-primary'> <input type="submit" value="Generate Report" class='btn btn-primary'>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
@@ -60,7 +60,7 @@
$('#waiter').show(); $('#waiter').show();
if(payment_type){ if(payment_type){
$('#payment_type').hide(); $('#payment_type').hide();
} }
} }
else if(item == 'sale'){ else if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
@@ -68,7 +68,7 @@
} }
else{ else{
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
$("#item").val('sale'); $("#item").val('sale');
} }
}); });
@@ -105,7 +105,7 @@
if(item == 'sale'){ if(item == 'sale'){
$('#waiter').hide(); $('#waiter').hide();
$('#cashier').show(); $('#cashier').show();
if(payment_type){ if(payment_type){
$('#payment_type').show(); $('#payment_type').show();
} }

View File

@@ -19,12 +19,12 @@
<!-- <div class="row"> --> <!-- <div class="row"> -->
<div class="col-md-12 text-right"> <div class="col-md-12 text-right">
<a href="javascript:export_to('<%=reports_void_sale_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a> <a href="javascript:export_to('<%=reports_void_sale_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div> </div>
<!-- </div> --> <!-- </div> -->
<!-- </div> --> <!-- </div> -->
<div class="margin-top-20"> <div class="margin-top-20 mbl-table">
<div class="card"> <div class="card mbl-table-card">
<% if @sale_data.count > 0 %> <% if @sale_data.count > 0 %>
<table class="table table-striped" border="0"> <table class="table table-striped" border="0">
<thead> <thead>
@@ -35,19 +35,19 @@
<% end %> <% end %>
<% if @shift_from %> <% if @shift_from %>
<tr> <tr>
<% if @shift %> <% if @shift %>
<% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %> <% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %>
<% end %> <% end %>
<th colspan="3"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th> <th colspan="3"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
</tr> </tr>
<% end %> <% end %>
<tr> <tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th> <th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t("views.right_panel.detail.sale_date") %></th> <th><%= t("views.right_panel.detail.sale_date") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th> <th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th> <th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th> <th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> + <br/><%= t("views.right_panel.detail.rnd_adj_sh") %></th> <th><%= t("views.right_panel.detail.grand_total") %> + <br/><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<!-- <th>Sale Status</th> --> <!-- <th>Sale Status</th> -->
</tr> </tr>
</thead> </thead>
@@ -63,7 +63,7 @@
else else
delimiter = "" delimiter = ""
end end
%> %>
<% total_amount = 0.0 %> <% total_amount = 0.0 %>
<% grand_total = 0.0 %> <% grand_total = 0.0 %>
<% rounding_adjustment = 0.0 %> <% rounding_adjustment = 0.0 %>
@@ -76,7 +76,7 @@
<td><%= number_with_precision(item.total_amount.to_f, precision: precision.to_i ,delimiter: delimiter) %> </td> <td><%= number_with_precision(item.total_amount.to_f, precision: precision.to_i ,delimiter: delimiter) %> </td>
<td><%= number_with_precision(item.grand_total.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td> <td><%= number_with_precision(item.grand_total.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
<td><%= number_with_precision(item.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> <td><%= number_with_precision(item.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(item.grand_total.to_f + item.rounding_adjustment.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td> <td><%= number_with_precision(item.grand_total.to_f + item.rounding_adjustment.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
<!-- <td><%= result.sales_status rescue '-' %> </td> --> <!-- <td><%= result.sales_status rescue '-' %> </td> -->
<!-- <td><%= item.remarks rescue '-' %> </td> --> <!-- <td><%= item.remarks rescue '-' %> </td> -->
</tr> </tr>
@@ -113,8 +113,8 @@
var from = ""; var from = "";
var to = ""; var to = "";
show_shift_name(period,period_type,from,to,'shift_item'); show_shift_name(period,period_type,from,to,'shift_item');
} }
// OK button is clicked // OK button is clicked
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){ $('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
@@ -130,13 +130,13 @@
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear(); to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
$('#to').val(to) $('#to').val(to)
search_by_date(); search_by_date();
}); });
function search_by_date(){ function search_by_date(){
from = $("#from").val(); from = $("#from").val();
to = $("#to").val(); to = $("#to").val();
var period = 0; var period = 0;
var period_type = 1; var period_type = 1;
if(to != '' && from != ''){ if(to != '' && from != ''){
shift_name = from + ',' + to; shift_name = from + ',' + to;
@@ -145,7 +145,7 @@
console.log(check_arr.length) console.log(check_arr.length)
if(check_arr.length == 1){ if(check_arr.length == 1){
show_shift_name(period,period_type,from,to,'shift_item'); show_shift_name(period,period_type,from,to,'shift_item');
} }
if(check_arr.length == 3){ if(check_arr.length == 3){
check_arr = []; check_arr = [];
@@ -163,7 +163,7 @@
shift.empty(); shift.empty();
var str = ''; var str = '';
var param_shift = ''; var param_shift = '';
var param_shift = '<%= params[:shift_name] rescue '-'%>'; var param_shift = '<%= params[:shift_name] rescue '-'%>';
url = '<%= reports_get_shift_by_date_path %>'; url = '<%= reports_get_shift_by_date_path %>';
@@ -171,7 +171,7 @@
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){ $.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
str = '<option value="0">--- All Shift ---</option>'; str = '<option value="0">--- All Shift ---</option>';
$(data.message).each(function(index){ $(data.message).each(function(index){
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date; var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date; var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
@@ -181,18 +181,18 @@
selected = 'selected = "selected"'; selected = 'selected = "selected"';
} }
else{ else{
selected = ''; selected = '';
} }
}else{ }else{
selected = ''; selected = '';
} }
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>'; str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
// console.log(sh_date) // console.log(sh_date)
}) })
shift.append(str); shift.append(str);
}); });
} }
}); });
</script> </script>