Edit filter
This commit is contained in:
@@ -8,11 +8,9 @@ class Reports::CardSaleTranController < BaseReportController
|
||||
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
|
||||
["Alipay Payment","alipay"]]
|
||||
@sales = Sale.all
|
||||
# byebug
|
||||
|
||||
payment_type = params[:payment_type]
|
||||
|
||||
# from = params[:from]
|
||||
# to = params[:to]
|
||||
from, to = get_date_range_from_params
|
||||
status = 'Approved'
|
||||
@shift_sale_range = ''
|
||||
|
||||
@@ -9,13 +9,11 @@ class Transactions::CardSaleTransController < ApplicationController
|
||||
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
|
||||
["Alipay Payment","alipay"]]
|
||||
@sales = Sale.all
|
||||
# byebug
|
||||
|
||||
payment_type = params[:payment_type]
|
||||
sale_id = params[:sale_id]
|
||||
status_type = params[:status_type]
|
||||
|
||||
# from = params[:from]
|
||||
# to = params[:to]
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
if sale_id.nil? && from.nil? && to.nil? && payment_method.nil? && status_type.nil?
|
||||
|
||||
@@ -9,22 +9,21 @@ class Transactions::CardSettleTransController < ApplicationController
|
||||
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
|
||||
["Alipay Payment","alipay"]]
|
||||
@sales = Sale.all
|
||||
# byebug
|
||||
|
||||
payment_type = params[:payment_type]
|
||||
sale_id = params[:sale_id]
|
||||
cashier_name = params[:cashier_name]
|
||||
status_type = params[:status_type]
|
||||
|
||||
# from = params[:from]
|
||||
# to = params[:to]
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
if sale_id.nil? && from.nil? && to.nil? && payment_method.nil? && status_type.nil?
|
||||
if cashier_name.nil? && from.nil? && to.nil? && payment_method.nil? && status_type.nil?
|
||||
|
||||
@cardSettles = CardSettleTran.order("sale_id desc")
|
||||
|
||||
@cardSettles = Kaminari.paginate_array(@cardSettles).page(params[:page]).per(20)
|
||||
else
|
||||
cardSettle = CardSettleTran.search(sale_id,from,to,payment_type,status_type)
|
||||
cardSettle = CardSettleTran.search(cashier_name,from,to,payment_type,status_type)
|
||||
if cardSettle.count > 0
|
||||
@cardSettles = cardSettle
|
||||
@cardSettles = Kaminari.paginate_array(@cardSettles).page(params[:page]).per(20)
|
||||
|
||||
@@ -134,37 +134,30 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var item = $('#item').val();
|
||||
var payment_type = $('#payment_type');
|
||||
var status_type = $('#status_type');
|
||||
|
||||
if(item == 'order'){
|
||||
$('#cashier').hide();
|
||||
$('#waiter').show();
|
||||
if(payment_type){
|
||||
$('#payment_type').hide();
|
||||
}
|
||||
if(status_type){
|
||||
$('#status_type').hide();
|
||||
}
|
||||
}
|
||||
else if(item == 'sale'){
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
}
|
||||
else{
|
||||
$('#waiter').hide();
|
||||
$('#cashier').show();
|
||||
$("#item").val('sale');
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('#sale_id').val("<%= params[:sale_id] %>");
|
||||
$('#receipt_no').val("<%= params[:receipt_no] %>");
|
||||
$('#from').val("<%= params[:from] %>");
|
||||
$('#to').val("<%= params[:to] %>");
|
||||
$('#payment_type').val("<%= params[:payment_type] %>");
|
||||
$('#status_type').val("<%= params[:status_type] %>");
|
||||
$('#status_type').val("<%= params[:status_type] %>");
|
||||
$('#sale_id').val("<%= params[:sale_id] %>");
|
||||
$('#sel_period').val("<%= params[:period] %>");
|
||||
|
||||
var check_arr = [];
|
||||
search_by_period();
|
||||
$('#sel_period').change(function(){
|
||||
|
||||
search_by_period();
|
||||
|
||||
});
|
||||
|
||||
function search_by_period(){
|
||||
var period = $('#sel_period').val();
|
||||
var period_type = 0;
|
||||
var from = "";
|
||||
var to = "";
|
||||
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
|
||||
// OK button is clicked
|
||||
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
|
||||
@@ -182,7 +175,7 @@
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
function search_by_date(){
|
||||
function search_by_date(){
|
||||
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
@@ -202,9 +195,10 @@
|
||||
if(check_arr.length == 3){
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
if (from == '' && to == '') {
|
||||
@@ -246,13 +240,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
|
||||
<input type="text" id="sale_id" name="sale_id" class="form-control" placeholder="Cashier Name" style="margin-right: 10px;height: 34px;">
|
||||
<input type="text" id="cashier_name" name="cashier_name" class="form-control" placeholder="Cashier Name" style="margin-right: 10px;height: 34px;">
|
||||
</div>
|
||||
|
||||
<% if defined? @payment_method %>
|
||||
@@ -132,6 +132,11 @@
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
$('#from').val("<%= params[:from] %>");
|
||||
$('#to').val("<%= params[:to] %>");
|
||||
$('#status_type').val("<%= params[:status_type] %>");
|
||||
$('#cashier_name').val("<%= params[:cashier_name] %>");
|
||||
var check_arr = [];
|
||||
var check_arr = [];
|
||||
search_by_period();
|
||||
$('#sel_period').change(function(){
|
||||
|
||||
@@ -243,11 +243,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user