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

@@ -1,16 +1,17 @@
class Reports::CreditPaymentController < BaseReportController
class Reports::CreditPaymentController < BaseReportController
authorize_resource :class => false
def index
@filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']]
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
from, to = get_date_range_from_params
customer_filter = params[:customer]
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift = ''
if params[:shift_name].to_i != 0
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
else
@@ -20,8 +21,8 @@ authorize_resource :class => false
@filter = params[:filter_check]
@order_source = params[:order_source]
@sale_data = Sale.get_by_shift_sale_credit_payment(@shift_sale_range,@shift,from,to,@filter,@order_source)
@sale_data = Sale.get_by_shift_sale_credit_payment(@shift_sale_range,@shift,from,to,@filter,customer_filter,@order_source)
@from = from
@to = to
@@ -58,10 +59,10 @@ authorize_resource :class => false
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end
end

View File

@@ -3,59 +3,60 @@ authorize_resource :class => false
def index
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
@payment_method = PaymentMethodSetting.all
from, to = get_date_range_from_params
from, to = get_date_range_from_params
customer_filter = params[:customer]
@shift_sale_range = ''
@shift = ''
if params[:shift_name].to_i != 0
@shift = ''
if params[:shift_name].to_i != 0
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at)
else
if @shift_sale.shift_closed_at.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
end
end
end
@shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at)
else
if @shift_sale.shift_closed_at.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
end
end
end
@lookup = Lookup.find_by_lookup_type('reprint_receipt')
if @lookup.nil?
@lookup = Lookup.create_reprint_receipt_lookup
end
@lookup = Lookup.find_by_lookup_type('reprint_receipt')
if @lookup.nil?
@lookup = Lookup.create_reprint_receipt_lookup
end
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
@tax_profiles = TaxProfile.group('name').order('order_by asc') #.limit(2)
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range, @shift, from, to, payment_type, customer_filter)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range, @shift, from, to, payment_type)
@tax_profiles = TaxProfile.group('name').order('order_by asc') #.limit(2)
@from = from
@to = to
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
if @shift.present?
@shift.each do |sh|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_data = sh
end
end
@from = from
@to = to
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
if @shift.present?
@shift.each do |sh|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_data = sh
end
end
respond_to do |format|
format.html
format.xls
end
format.html
format.xls
end
end
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|
@@ -68,11 +69,11 @@ authorize_resource :class => false
date_arr.push(str)
end
out = {:status => 'ok', :message => date_arr}
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
respond_to do |format|
format.json { render json: out }
end
end
def sync_data

View File

@@ -5,6 +5,8 @@ authorize_resource :class => false
from, to = get_date_range_from_params
customer_filter = params[:customer]
@shift_sale_range = ''
@shift = ''
@@ -24,7 +26,7 @@ authorize_resource :class => false
end
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type)
@sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range, @shift, from, to, payment_type, customer_filter)
@from = from
@to = to

View File

@@ -26,7 +26,7 @@ class Sale < ApplicationRecord
has_one :booking
has_many :product_commissions
before_validation :round_to_precision
before_save :member_discount, :round_to_precision
after_update :update_stock_journal
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
@@ -1167,7 +1167,7 @@ def self.get_menu_item_query(order_by)
end
#product sale report query
def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_type)
def self.get_shift_sales_by_receipt_no(shift_sale_range, shift, from, to, payment_type, customer_filter)
## => left join -> show all sales although no orders
if payment_type.blank?
payment_type = ''
@@ -1175,29 +1175,40 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
end
query = Sale.includes(:sale_items).select("sales.*,sale_payments.*,df.name,df.type")
query = Sale.includes(:sale_items).select("sales.*, sale_payments.*")
.select("customers.customer_id, customers.name as customer_name, df.name, df.type")
.where("sale_status= 'completed' and sale_payments.payment_amount != 0 #{payment_type}")
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.joins("join bookings on bookings.sale_id = sales.sale_id")
.joins("left join dining_facilities df on df.id = bookings.dining_facility_id")
.group("sales.sale_id")
if customer_filter.present?
query = query.joins(sanitize_sql_array(["INNER JOIN customers ON customers.customer_id = sales.customer_id AND " +
"customers.name LIKE :filter", filter: "%#{customer_filter}%"]))
else
query = query.joins(:customer)
end
if shift.present?
query = query.where("sales.shift_sale_id in (?)", shift.to_a)
elsif shift_sale_range.present?
query = query.where("sales.shift_sale_id in (?)",shift_sale_range.to_a)
query = query.where("sales.shift_sale_id in (?)", shift_sale_range.to_a)
else
query = query.where("sales.receipt_date between ? and ?",from,to)
query = query.where("sales.receipt_date between ? and ?", from, to)
end
return query
end
def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,payment_type)
def self.get_shift_sales_by_receipt_no_detail(shift_sale_range, shift, from, to, payment_type, customer_filter)
## => left join -> show all sales although no orders
query = Sale.includes([:customer, :survey, :sale_payments])
.includes(:bookings => :dining_facility)
query = Sale.includes([:survey, :sale_payments])
.select("sales.*, SUM(sale_payments.payment_amount) AS payments_for_credits_amount")
.joins(:bookings)
.select("dining_facilities.type AS table_type, dining_facilities.name AS table_name")
.select("customers.customer_id, customers.name AS customer_name, customers.company AS customer_company")
.joins(:booking => :dining_facility)
.joins("INNER JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.left_joins(:payments_for_credits)
.completed
@@ -1205,6 +1216,13 @@ def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,pay
.group(:sale_id)
.order(:receipt_date)
if customer_filter.present?
query = query.joins(sanitize_sql_array(["INNER JOIN customers ON customers.customer_id = sales.customer_id AND " +
"customers.name LIKE :filter", filter: "%#{customer_filter}%"]))
else
query = query.joins(:customer)
end
if payment_type.present?
if payment_type == 'card'
query = query.where(sanitize_sql_array(["sp.payment_method IN (?)", SalePayment::CARD]))
@@ -1226,7 +1244,7 @@ def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,pay
return query
end
def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to,filter,order_source)
def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to,filter,customer_filter,order_source)
payments_for_credits = SalePayment.select("
sales.sale_id,
DATE_FORMAT(CONVERT_TZ(sale_payments.created_at,'+00:00','+06:30'),'%d %b %y %h:%i%p') as credit_payment_receipt_date,
@@ -1253,11 +1271,17 @@ def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to,filter,
IFNULL(payments_for_credits.credit_payment_cashier_name, '-') as credit_payment_cashier_name,
IFNULL(payments_for_credits.credit_payment_shift_name, '-') as credit_payment_shift_name")
.joins("LEFT JOIN (#{payments_for_credits}) payments_for_credits ON payments_for_credits.sale_id = sales_sale_payments.sale_id")
.joins(:sale => :customer)
.joins(:sale => :orders)
.credits
.where("sales_sale_payments.sale_status = ?", 'completed')
if customer_filter.present?
credits = credits.joins(sanitize_sql_array(["INNER JOIN customers ON customers.customer_id = sales_sale_payments.customer_id AND " +
"customers.name LIKE :filter", filter: "%#{customer_filter}%"]))
else
credits = credits.joins(:sale => :customer)
end
if order_source.present?
if order_source == "cashier"
credits = credits.where("orders.source IN (?)", ['cashier', 'emenu'])
@@ -2297,6 +2321,50 @@ private
end
end
def member_discount
return unless will_save_change_to_customer_id? || will_save_change_to_total_amount?
if self.customer && self.customer.membership_id.present?
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
merchant_uid = memberaction.merchant_account_id.to_s
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
auth_token = memberaction.auth_token
url = "#{membership.gateway_url}#{memberaction.gateway_url}"
begin
response = HTTParty.get(url,
:body => {
member_group_id: sObj.customer.membership_type,
merchant_uid: merchant_uid,
campaign_type_id: campaign_type_id,
auth_token: auth_token
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
}, :timeout => 10)
rescue Net::OpenTimeout
response = { "status": false , "message": " Connection timeout" }
rescue OpenURI::HTTPError
response = { "status": false, "message": "Can't connect server"}
rescue SocketError
response = { "status": false, "message": "Can't connect server"}
end
return unless response['status'] && response['membership_campaign_data'].present?
Account.where(discount: true).inject(0) do |dis, acc|
rule = response['membership_campaign_data'].find { |c| c['rules_type'].downcase.strip == acc.title.downcase.strip }
dis += acc.sale_items.inject(0) { |i| i.account_id == acc.id ? i.price : 0 } * rule["change_unit"].to_i / rule["base_unit"].to_i
end
else
end
end
def round_to_precision
if (self.total_amount % 1 > 0 || self.total_discount % 1 > 0 || self.total_tax % 1 > 0)
self.total_amount = self.total_amount.round(precision)

View File

@@ -684,7 +684,7 @@ class SalePayment < ApplicationRecord
end
end
sale.save!
if sale.sale_status == 'completed'
table_update_status(sale)
update_shift

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 %>