customer name filter

This commit is contained in:
Thein Lin Kyaw
2020-07-19 19:31:14 +06:30
parent 3f97f30c36
commit ced6a09095
12 changed files with 224 additions and 141 deletions

View File

@@ -2,9 +2,9 @@
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %>
<div class="row">
<div class="form-group col-md-2 mbl-style">
<label class="font-20 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control">
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control" style="height: 34px;">
<option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option>
<option value="1">Yesterday</option>
@@ -18,34 +18,37 @@
<option value="9">Last year</option>
</select>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.customer_name") %></label>
<input type="text" placeholder="Customer name" class="form-control m-t-3" name="customer" value="<%= params[:customer] %>" id="customer_filter" style="height: 32px;">
</div>
<% if defined? filter_for_credit %>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 col-mbl-view mbl-style">
<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 m-t-3", :style => "height: 32px;" %>
</div>
<% end %>
<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>
<%= 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 m-t-3", :style => "height: 32px;" %>
</div>
<div class="form-group col-md-2 col-mbl-view mbl-style">
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<!-- <label class="">Select Shift Period</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;">
<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;">
</div>
<div class="form-group col-md-2 col-mbl-view mbl-style">
<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;">
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<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;">
</div>
<div class="form-group col-md-2 mbl-style">
<label class="font-20 mbl_lbl">All Shift</label>
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14 mbl_lbl">All Shift</label>
<select class="form-control select" name="shift_name" id="shift_name" style="height: 34px;">
</select>
</div>
</div>
<div class="row clearfix">
<div class="form-group col-md-12 mbl-style mbl-right-btn" align="right">
<br>
<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'>
</div>
</div>

View File

@@ -4,7 +4,7 @@
<div class="row">
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<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 m-t-3" style="height: 32px;>
<option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option>
<option value="1">Yesterday</option>
@@ -18,12 +18,17 @@
<option value="9">Last year</option>
</select>
</div>
<% if not defined? payments %>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.customer_name") %></label>
<input type="text" placeholder="Customer name" class="form-control m-t-3" name="customer" value="<%= params[:customer] %>" id="customer_filter" style="height: 32px;">
</div>
<% if defined? @payments %>
<div class="col-lg-2 col-md-2 col-sm-2">
<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 m-t-3" style="height: 32px;">
<% @payments.each do |pm| %>
<option class="<%=pm[1].downcase%>" value="<%=pm[1].downcase%>"><%=pm[0]%></option>
<%end %>
@@ -33,6 +38,7 @@
</select>
</div>
<% end %>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> -->
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
@@ -44,11 +50,10 @@
</div>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<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 m-t-3" name="shift_name" id="shift_name" style="height: 32px;">
</select>
</div>
<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'>
</div>
</div>
@@ -104,37 +109,38 @@
$(".<%=params[:payment_type]%>").attr('selected','selected')
// shift = $(".shift-id").text()
// if (shift.length>0) {
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
// }
// shift = $(".shift-id").text()
// if (shift.length>0) {
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
// }
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
</script>

View File

@@ -44,7 +44,8 @@
<tr>
<th><%= t("views.right_panel.detail.dining") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t :customer %></th>
<th><%= t :cashier %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
@@ -92,6 +93,7 @@
<% end %>
</td>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.customer_name rescue '-' %></td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= number_format(result.total_amount, precision: precision.to_i, delimiter: delimiter) %></td>
<td><%= number_format(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '0' %></td>
@@ -253,8 +255,8 @@
}
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
// console.log(sh_date)
})
// console.log(sh_date)
})
shift.append(str);
});
}

View File

@@ -25,7 +25,8 @@
<tr>
<th><%= t("views.right_panel.detail.dining") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t :customer %></th>
<th><%= t :cashier %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
@@ -73,6 +74,7 @@
<% end %>
</td>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.customer_name rescue '-' %></td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= number_format(result.total_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>

View File

@@ -18,9 +18,9 @@
<option value="9">Last year</option>
</select>
</div>
<% if defined? @payment_methods %>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_payments") %></label>
<select name="payment_type" id="payment_type" class="form-control">
@@ -30,6 +30,12 @@
</select>
</div>
<% end %>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.customer_name") %></label>
<input type="text" placeholder="Customer name" class="form-control m-t-3" name="customer" id="customer_filter" >
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> -->
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>

View File

@@ -46,19 +46,13 @@
<tbody>
<% grand_total = 0 %>
<% @sale_data.each do |result| %>
<% table_name=nil
table_type =nil
if table = result.bookings[0].dining_facility
table_type = table.type
table_name = table.name
end %>
<% grand_total = grand_total + result.grand_total %>
<% grand_total = grand_total + result.grand_total %>
<tr style="border-top:4px double #666;">
<td><%= result.receipt_no rescue '-' %> </td>
<td><%=l result.receipt_date.getlocal, :format => :short rescue '-' %> </td>
<td><%= @shift_from %> - <%= @shift_to %></td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= table_type %> - <%= table_name %></td>
<td><%= result.table_type %> - <%= result.table_name %></td>
<td><%= number_format(result.grand_total, precision: precision, delimiter: delimiter) %></td>
<!-- <td>&nbsp;</td> -->
</tr>
@@ -179,9 +173,11 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Customer</td>
<td><%= result.customer.name rescue '-'%>
(<%= result.customer.company rescue '-' %>)
</td>
<td><%= result.customer_name rescue '-'%>
<% if result.customer_company.present? %>
(<%= result.customer_company rescue '-' %>)
<% end %>
</td>
<td>&nbsp;</td>
</tr>
<% end %>

View File

@@ -38,18 +38,12 @@
<% grand_total = 0 %>
<% @sale_data.each do |result| %>
<% grand_total = grand_total.to_f + result.grand_total.to_f%>
<% table_name=nil
table_type =nil
if table = result.bookings[0].dining_facility
table_type = table.type
table_name = table.name
end %>
<tr style="border-top:4px double #666;">
<td><%= result.receipt_no rescue '-' %> </td>
<td><%=l result.receipt_date.getlocal, :format => :short rescue '-' %> </td>
<td><%= @shift_from %> - <%= @shift_to %></td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= table_type %> - <%= table_name %></td>
<td><%= result.table_type %> - <%= result.table_name %></td>
<td><%= number_format(result.grand_total, precision: precision, delimiter: delimiter) %></td>
</tr>
@@ -171,9 +165,11 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Customer</td>
<td><%= result.customer.name rescue '-'%>
(<%= result.customer.company rescue '-' %>)
</td>
<td><%= result.customer_name rescue '-'%>
<% if result.customer_company.present? %>
(<%= result.customer_company rescue '-' %>)
<% end %>
</td>
<td>&nbsp;</td>
</tr>
<% end %>