Merge branch 'r-1902001-01' into foodcourt
This commit is contained in:
@@ -54,6 +54,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
current_balance = nil
|
current_balance = nil
|
||||||
|
|
||||||
|
# For Cashier by Zone
|
||||||
if sale.booking.dining_facility_id.to_i > 0
|
if sale.booking.dining_facility_id.to_i > 0
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ authorize_resource :class => false
|
|||||||
@filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']]
|
@filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']]
|
||||||
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
|
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
|
||||||
from, to = get_date_range_from_params
|
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_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||||
|
|
||||||
@@ -13,14 +14,13 @@ authorize_resource :class => false
|
|||||||
if to.blank?
|
if to.blank?
|
||||||
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL",shift_sale.shift_started_at)
|
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL",shift_sale.shift_started_at)
|
||||||
else
|
else
|
||||||
|
|
||||||
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ?",shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ?",shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@filter = params[:filter_check]
|
@filter = params[:filter_check]
|
||||||
@order_source = params[:order_source]
|
@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
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ authorize_resource :class => false
|
|||||||
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
|
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
|
||||||
@payment_method = PaymentMethodSetting.all
|
@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_sale_range = ''
|
||||||
|
|
||||||
@@ -14,12 +15,12 @@ authorize_resource :class => false
|
|||||||
|
|
||||||
@shift_sale = ShiftSale.find(params[:shift_name])
|
@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)
|
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at)
|
||||||
else
|
else
|
||||||
if @shift_sale.shift_closed_at.blank?
|
if @shift_sale.shift_closed_at.blank?
|
||||||
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL",@shift_sale.shift_started_at)
|
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at)
|
||||||
else
|
else
|
||||||
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ?",@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
|
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -30,7 +31,7 @@ authorize_resource :class => false
|
|||||||
end
|
end
|
||||||
|
|
||||||
payment_type = params[:payment_type]
|
payment_type = params[:payment_type]
|
||||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,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)
|
@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)
|
@tax_profiles = TaxProfile.group('name').order('order_by asc') #.limit(2)
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ class Reports::ReceiptNoDetailController < BaseReportController
|
|||||||
@payment_methods += PaymentMethodSetting.pluck(:payment_method).map { |payment_method| [payment_method.parameterize == 'paymal' ? 'Card' : payment_method, payment_method.parameterize] }
|
@payment_methods += PaymentMethodSetting.pluck(:payment_method).map { |payment_method| [payment_method.parameterize == 'paymal' ? 'Card' : payment_method, payment_method.parameterize] }
|
||||||
|
|
||||||
from, to = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
|
|
||||||
|
customer_filter = params[:customer]
|
||||||
|
|
||||||
|
@shift_sale_range = ''
|
||||||
|
|
||||||
@shift = ''
|
@shift = ''
|
||||||
if params[:shift_name].to_i != 0
|
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)
|
||||||
@@ -23,7 +28,7 @@ class Reports::ReceiptNoDetailController < BaseReportController
|
|||||||
end
|
end
|
||||||
|
|
||||||
payment_type = params[:payment_type]
|
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
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class Employee < ApplicationRecord
|
|||||||
if (session_token)
|
if (session_token)
|
||||||
user = Employee.find_by_token_session(session_token)
|
user = Employee.find_by_token_session(session_token)
|
||||||
expiry_time = login_expiry_time
|
expiry_time = login_expiry_time
|
||||||
|
|
||||||
if user && user.session_expiry && user.session_expiry.utc > DateTime.now.utc
|
if user && user.session_expiry && user.session_expiry.utc > DateTime.now.utc
|
||||||
#Extend the login time each time authenticatation take place
|
#Extend the login time each time authenticatation take place
|
||||||
user.session_expiry = user.session_expiry.utc + expiry_time.minutes
|
user.session_expiry = user.session_expiry.utc + expiry_time.minutes
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Sale < ApplicationRecord
|
|||||||
has_one :booking
|
has_one :booking
|
||||||
has_many :product_commissions
|
has_many :product_commissions
|
||||||
|
|
||||||
before_validation :round_to_precision
|
before_save :member_discount, :round_to_precision
|
||||||
after_update :update_stock_journal
|
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}'") }
|
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||||
@@ -1207,7 +1207,7 @@ def self.get_menu_item_query(order_by)
|
|||||||
end
|
end
|
||||||
#product sale report query
|
#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
|
## => left join -> show all sales although no orders
|
||||||
if payment_type.blank?
|
if payment_type.blank?
|
||||||
payment_type = ''
|
payment_type = ''
|
||||||
@@ -1215,12 +1215,21 @@ 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}'"
|
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
||||||
end
|
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}")
|
.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 sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
.joins("join bookings on bookings.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")
|
.joins("left join dining_facilities df on df.id = bookings.dining_facility_id")
|
||||||
.group("sales.sale_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?
|
if shift.present?
|
||||||
query = query.where("sales.shift_sale_id in (?)", shift.to_a)
|
query = query.where("sales.shift_sale_id in (?)", shift.to_a)
|
||||||
elsif shift_sale_range.present?
|
elsif shift_sale_range.present?
|
||||||
@@ -1228,16 +1237,18 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
|
|||||||
else
|
else
|
||||||
query = query.where("sales.receipt_date between ? and ?", from, to)
|
query = query.where("sales.receipt_date between ? and ?", from, to)
|
||||||
end
|
end
|
||||||
|
|
||||||
return query
|
return query
|
||||||
end
|
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
|
## => left join -> show all sales although no orders
|
||||||
|
|
||||||
query = Sale.includes([:customer, :survey, :sale_payments])
|
query = Sale.includes([:survey, :sale_payments])
|
||||||
.includes(:bookings => :dining_facility)
|
|
||||||
.select("sales.*, SUM(sale_payments.payment_amount) AS payments_for_credits_amount")
|
.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")
|
.joins("INNER JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
||||||
.left_joins(:payments_for_credits)
|
.left_joins(:payments_for_credits)
|
||||||
.completed
|
.completed
|
||||||
@@ -1245,6 +1256,13 @@ def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,pay
|
|||||||
.group(:sale_id)
|
.group(:sale_id)
|
||||||
.order(:receipt_date)
|
.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.present?
|
||||||
if payment_type == 'card'
|
if payment_type == 'card'
|
||||||
query = query.where(sanitize_sql_array(["sp.payment_method IN (?)", SalePayment::CARD]))
|
query = query.where(sanitize_sql_array(["sp.payment_method IN (?)", SalePayment::CARD]))
|
||||||
@@ -1266,7 +1284,7 @@ def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,pay
|
|||||||
return query
|
return query
|
||||||
end
|
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("
|
payments_for_credits = SalePayment.select("
|
||||||
sales.sale_id,
|
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,
|
DATE_FORMAT(CONVERT_TZ(sale_payments.created_at,'+00:00','+06:30'),'%d %b %y %h:%i%p') as credit_payment_receipt_date,
|
||||||
@@ -1293,11 +1311,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_cashier_name, '-') as credit_payment_cashier_name,
|
||||||
IFNULL(payments_for_credits.credit_payment_shift_name, '-') as credit_payment_shift_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("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)
|
.joins(:sale => :orders)
|
||||||
.credits
|
.credits
|
||||||
.where("sales_sale_payments.sale_status = ?", 'completed')
|
.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.present?
|
||||||
if order_source == "cashier"
|
if order_source == "cashier"
|
||||||
credits = credits.where("orders.source IN (?)", ['cashier', 'emenu'])
|
credits = credits.where("orders.source IN (?)", ['cashier', 'emenu'])
|
||||||
@@ -2412,6 +2436,50 @@ private
|
|||||||
end
|
end
|
||||||
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
|
def round_to_precision
|
||||||
if (self.total_amount % 1 > 0 || self.total_discount % 1 > 0 || self.total_tax % 1 > 0)
|
if (self.total_amount % 1 > 0 || self.total_discount % 1 > 0 || self.total_tax % 1 > 0)
|
||||||
self.total_amount = self.total_amount.round(precision)
|
self.total_amount = self.total_amount.round(precision)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ class TaxProfile < ApplicationRecord
|
|||||||
default_scope { order('order_by asc') }
|
default_scope { order('order_by asc') }
|
||||||
# validations
|
# validations
|
||||||
validates_presence_of :name, :rate, :group_type
|
validates_presence_of :name, :rate, :group_type
|
||||||
|
|
||||||
def self.calculate_tax(group_type)
|
def self.calculate_tax(group_type)
|
||||||
divided_value =0.0
|
divided_value =0.0
|
||||||
exclusive =0.0
|
exclusive =0.0
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ menu_json = json.array! @menus do |menu|
|
|||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
<%= 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 mbl-style">
|
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
|
||||||
<label class="font-20 mbl_lbl"><%= 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" style="height: 34px;">
|
||||||
<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>
|
||||||
<option value="1">Yesterday</option>
|
<option value="1">Yesterday</option>
|
||||||
@@ -18,34 +18,37 @@
|
|||||||
<option value="9">Last year</option>
|
<option value="9">Last year</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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 %>
|
<% if defined? filter_for_credit %>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 col-mbl-view mbl-style">
|
<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>
|
<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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 col-mbl-view mbl-style">
|
<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 m-t-3", :style => "height: 32px;" %>
|
||||||
</div>
|
</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="">Select Shift Period</label> -->
|
||||||
<label class="font-20 mbl_lbl">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: 34px;">
|
<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="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="font-20 mbl_lbl">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: 34px;">
|
<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-2 mbl-style">
|
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
|
||||||
<label class="font-20 mbl_lbl">All Shift</label>
|
<label class="font-14 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: 34px;">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-style mbl-right-btn" style="margin-top: 20px;">
|
||||||
<div class="row clearfix">
|
|
||||||
<div class="form-group col-md-12 mbl-style mbl-right-btn" align="right">
|
|
||||||
<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>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<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_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 m-t-3" style="height: 32px;>
|
||||||
<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>
|
||||||
<option value="1">Yesterday</option>
|
<option value="1">Yesterday</option>
|
||||||
@@ -18,12 +18,17 @@
|
|||||||
<option value="9">Last year</option>
|
<option value="9">Last year</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<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 m-t-3" style="height: 32px;">
|
||||||
<% @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>
|
||||||
<%end %>
|
<%end %>
|
||||||
@@ -33,6 +38,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
|
<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 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
|
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
|
||||||
@@ -44,11 +50,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<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.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 m-t-3" name="shift_name" id="shift_name" style="height: 32px;">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-style mbl-right-btn" 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>
|
||||||
</div>
|
</div>
|
||||||
@@ -137,4 +142,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -37,7 +37,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th><%= t("views.right_panel.detail.dining") %></th>
|
<th><%= t("views.right_panel.detail.dining") %></th>
|
||||||
<th><%= t("views.right_panel.detail.receipt_no") %></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.total") %> <%= t("views.right_panel.detail.amount") %></th>
|
||||||
<th><%= t("views.right_panel.detail.discount") %> <%= 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| %>
|
<% @tax_profiles.each do |tax| %>
|
||||||
@@ -85,6 +86,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= result.receipt_no rescue '-' %> </td>
|
<td><%= result.receipt_no rescue '-' %> </td>
|
||||||
|
<td><%= result.customer_name rescue '-' %></td>
|
||||||
<td><%= result.cashier_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_amount, precision: precision.to_i, delimiter: delimiter) %></td>
|
||||||
<td><%= number_format(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '0' %></td>
|
<td><%= number_format(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '0' %></td>
|
||||||
|
|||||||
@@ -25,7 +25,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th><%= t("views.right_panel.detail.dining") %></th>
|
<th><%= t("views.right_panel.detail.dining") %></th>
|
||||||
<th><%= t("views.right_panel.detail.receipt_no") %></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.total") %> <%= t("views.right_panel.detail.amount") %></th>
|
||||||
<th><%= t("views.right_panel.detail.discount") %> <%= 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| %>
|
<% @tax_profiles.each do |tax| %>
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= result.receipt_no rescue '-' %> </td>
|
<td><%= result.receipt_no rescue '-' %> </td>
|
||||||
|
<td><%= result.customer_name rescue '-' %></td>
|
||||||
<td><%= result.cashier_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_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_format(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_format(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
<option value="9">Last year</option>
|
<option value="9">Last year</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<% if defined? @payment_methods %>
|
|
||||||
|
|
||||||
|
<% 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>
|
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_payments") %></label>
|
||||||
|
|
||||||
@@ -30,6 +30,12 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% 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">
|
<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 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
|
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>
|
||||||
|
|||||||
@@ -39,19 +39,13 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% grand_total = 0 %>
|
<% grand_total = 0 %>
|
||||||
<% @sale_data.each do |result| %>
|
<% @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;">
|
<tr style="border-top:4px double #666;">
|
||||||
<td><%= result.receipt_no rescue '-' %> </td>
|
<td><%= result.receipt_no rescue '-' %> </td>
|
||||||
<td><%=l result.receipt_date.getlocal, :format => :short rescue '-' %> </td>
|
<td><%=l result.receipt_date.getlocal, :format => :short rescue '-' %> </td>
|
||||||
<td><%= @shift_from %> - <%= @shift_to %></td>
|
<td><%= @shift_from %> - <%= @shift_to %></td>
|
||||||
<td><%= result.cashier_name rescue '-' %></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><%= number_format(result.grand_total, precision: precision, delimiter: delimiter) %></td>
|
||||||
<!-- <td> </td> -->
|
<!-- <td> </td> -->
|
||||||
</tr>
|
</tr>
|
||||||
@@ -172,8 +166,10 @@
|
|||||||
<td> </td>
|
<td> </td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<td>Customer</td>
|
<td>Customer</td>
|
||||||
<td><%= result.customer.name rescue '-'%>
|
<td><%= result.customer_name rescue '-'%>
|
||||||
(<%= result.customer.company rescue '-' %>)
|
<% if result.customer_company.present? %>
|
||||||
|
(<%= result.customer_company rescue '-' %>)
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -38,18 +38,12 @@
|
|||||||
<% grand_total = 0 %>
|
<% grand_total = 0 %>
|
||||||
<% @sale_data.each do |result| %>
|
<% @sale_data.each do |result| %>
|
||||||
<% grand_total = grand_total.to_f + result.grand_total.to_f%>
|
<% 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;">
|
<tr style="border-top:4px double #666;">
|
||||||
<td><%= result.receipt_no rescue '-' %> </td>
|
<td><%= result.receipt_no rescue '-' %> </td>
|
||||||
<td><%=l result.receipt_date.getlocal, :format => :short rescue '-' %> </td>
|
<td><%=l result.receipt_date.getlocal, :format => :short rescue '-' %> </td>
|
||||||
<td><%= @shift_from %> - <%= @shift_to %></td>
|
<td><%= @shift_from %> - <%= @shift_to %></td>
|
||||||
<td><%= result.cashier_name rescue '-' %></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><%= number_format(result.grand_total, precision: precision, delimiter: delimiter) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@@ -171,8 +165,10 @@
|
|||||||
<td> </td>
|
<td> </td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<td>Customer</td>
|
<td>Customer</td>
|
||||||
<td><%= result.customer.name rescue '-'%>
|
<td><%= result.customer_name rescue '-'%>
|
||||||
(<%= result.customer.company rescue '-' %>)
|
<% if result.customer_company.present? %>
|
||||||
|
(<%= result.customer_company rescue '-' %>)
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -78,13 +78,19 @@
|
|||||||
total_item_dis += sale.grand_total*(-1)
|
total_item_dis += sale.grand_total*(-1)
|
||||||
end %>
|
end %>
|
||||||
<% if !acc_arr.include?(sale.account_id) %>
|
<% if !acc_arr.include?(sale.account_id) %>
|
||||||
|
<tr>
|
||||||
|
<td><b><%= sale.account_name %></b></td>
|
||||||
|
<td colspan="4"> </td>
|
||||||
|
<td><%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %></td>
|
||||||
|
<td>
|
||||||
<% @totalByAccount.each do |account, total| %>
|
<% @totalByAccount.each do |account, total| %>
|
||||||
<% if sale.account_id == account %>
|
<% if sale.account_id == account %>
|
||||||
|
<b><%= number_format(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||||
<% grand_total += total %>
|
<% grand_total += total %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<% acc_arr.push(sale.account_id) %>
|
<% acc_arr.push(sale.account_id) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
<% return if ENV['SERVER_MODE'] == 'cloud' %>
|
||||||
|
|
||||||
<% license_status = current_license.detail_with_local_file %>
|
<% license_status = current_license.detail_with_local_file %>
|
||||||
<% renewable_date = current_license.read_license("renewable_date") %>
|
<% renewable_date = current_license.read_license("renewable_date") %>
|
||||||
<% date_count = (renewable_date.to_date - Date.today).to_i %>
|
<% date_count = (renewable_date.to_date - Date.today).to_i %>
|
||||||
@@ -21,7 +23,6 @@
|
|||||||
<span aria-hidden="true" class="text-white">×</span>
|
<span aria-hidden="true" class="text-white">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Reference in New Issue
Block a user