improve receipt/details reports and implement number formatting
1) eager load reports for receipt/details 2) introduce number_format lookups to replace print_settings for number formatting 3) implement NumberFormattable concern, reference number_format lookups or print_settings if not exist, to get number format settings and number formatting 4) replace rails NumberHelper.number_with_precision with NumberFormattable.number_format hopefully to reduce overhead, formatting numbers for huge lists of data
This commit is contained in:
@@ -279,6 +279,15 @@ For Food Court Settings On/Off
|
||||
** '0' means can not use food court and '1' means can use food court **
|
||||
=> settings/lookups => { type:food_court, name: FoodCourt, value:'{0 or 1}' }
|
||||
|
||||
For Number Formats
|
||||
Precision
|
||||
=> settings/lookups => { lookup_type: number_format, name: precision, value: {0..2} }
|
||||
Delimiter
|
||||
=> settings/lookups => { lookup_type: number_format, name: delimiter, value: { ',', '\u0020', '', ... }
|
||||
Strip insignificant zeros
|
||||
=> settings/lookups => { lookup_type: number_format, name: strip_insignificant_zeros,
|
||||
value: {true: => ['1', 't', 'true', 'on', 'y', 'yes'], false: => ['0', 'f', 'false', 'off', 'n', 'no', ...] }
|
||||
|
||||
/* Customer Types in lookups */
|
||||
1) settings/lookups => { type:customer_type, name: Dinein, value:Dinein }
|
||||
2) settings/lookups => { type:customer_type, name: Takeaway, value: Takeaway }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
include LoginVerification
|
||||
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
@@ -17,7 +17,5 @@ class ApplicationController < ActionController::Base
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ class BaseOrigamiController < ActionController::Base
|
||||
before_action :check_user
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :current_token
|
||||
|
||||
@@ -15,16 +15,16 @@ class BaseOrigamiController < ActionController::Base
|
||||
redirect_to origami_dashboard_path
|
||||
end
|
||||
|
||||
def check_user
|
||||
if check_mobile
|
||||
def check_user
|
||||
if check_mobile
|
||||
if current_user.nil?
|
||||
return render status: 401, json: {
|
||||
message: "User using other device!"
|
||||
message: "User using other device!"
|
||||
}.to_json
|
||||
end
|
||||
else
|
||||
else
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -41,13 +41,13 @@ class BaseOrigamiController < ActionController::Base
|
||||
#check webview
|
||||
def check_mobile
|
||||
status = false
|
||||
authenticate_with_http_token do |token, options|
|
||||
authenticate_with_http_token do |token, options|
|
||||
if token
|
||||
session[:webview] = true
|
||||
session[:session_token] = token
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if session[:webview] && request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i
|
||||
status = true
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
class BaseReportController < ActionController::Base
|
||||
include LoginVerification
|
||||
layout "application"
|
||||
layout "application"
|
||||
|
||||
before_action :check_user
|
||||
before_action :check_user
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
@@ -29,7 +29,7 @@ class BaseReportController < ActionController::Base
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
to = params[:to]
|
||||
day_ref = Time.now.utc.getlocal
|
||||
|
||||
if from.present? && to.present?
|
||||
@@ -39,10 +39,10 @@ class BaseReportController < ActionController::Base
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day.utc.getlocal
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
|
||||
else
|
||||
|
||||
else
|
||||
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
@@ -77,10 +77,10 @@ class BaseReportController < ActionController::Base
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return from, to
|
||||
return from, to
|
||||
end
|
||||
|
||||
def check_user
|
||||
|
||||
57
app/controllers/concerns/number_formattable.rb
Normal file
57
app/controllers/concerns/number_formattable.rb
Normal file
@@ -0,0 +1,57 @@
|
||||
module NumberFormattable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def precision
|
||||
@precision ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'precision'}
|
||||
if @precision
|
||||
@precision.value.to_i
|
||||
else
|
||||
@print_settings ||= PrintSetting.get_precision_delimiter
|
||||
if @print_settings
|
||||
@print_settings.precision.to_i
|
||||
end
|
||||
end || 2
|
||||
end
|
||||
|
||||
def delimiter
|
||||
@delimiter ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'delimiter'}
|
||||
if @delimiter
|
||||
@delimiter_value ||= @delimiter.value.to_s.gsub(/\\u(\h{4})/) { |m| [$1].pack("H*").unpack("n*").pack("U*") }
|
||||
else
|
||||
@print_settings ||= PrintSetting.get_precision_delimiter
|
||||
if @print_settings
|
||||
"," if @print_settings.delimiter
|
||||
end
|
||||
end || ""
|
||||
end
|
||||
|
||||
def strip_insignificant_zeros
|
||||
@strip_insignificant_zeros ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'strip_insignificant_zeros'}
|
||||
if @strip_insignificant_zeros
|
||||
['1', 't', 'true', 'on', 'y', 'yes'].include? @strip_insignificant_zeros.value.to_s
|
||||
end || false
|
||||
end
|
||||
|
||||
def number_format(number, options = {})
|
||||
options[:precision] = options[:precision] || precision
|
||||
# options[:delimiter] = options[:delimiter] || delimiter
|
||||
options[:strip_insignificant_zeros] = options[:strip_insignificant_zeros] || strip_insignificant_zeros
|
||||
|
||||
if options[:precision] > 0
|
||||
if options[:strip_insignificant_zeros]
|
||||
formatted = "%.12g" % number.round(options[:precision])
|
||||
else
|
||||
formatted = "%.#{options[:precision]}f" % number.round(options[:precision])
|
||||
end
|
||||
else
|
||||
formatted = number.to_i.to_s
|
||||
end
|
||||
|
||||
if options[:delimiter] &&
|
||||
formatted = formatted.gsub(/(\d)(?=\d{3}+(\.\d*)?$)/, "\\1#{options[:delimiter]}")
|
||||
end
|
||||
|
||||
return formatted
|
||||
end
|
||||
|
||||
end
|
||||
@@ -94,27 +94,24 @@ class HomeController < ApplicationController
|
||||
@shop = Shop.first
|
||||
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
@orders = Sale.where("payment_status = 'new' and sale_status = 'bill'")
|
||||
@sales = Sale.completed
|
||||
|
||||
if !@from.nil? && !@to.nil?
|
||||
@orders = @orders.date_between(@from, @to)
|
||||
@sales = @sales.date_between(@from, @to)
|
||||
if !@from_time.nil? && @to_time.nil?
|
||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}' and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%m') between '#{@from_time}' and '#{@to_time}'").count()
|
||||
else
|
||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count()
|
||||
@orders = @orders.time_between(@from_time, @to_time)
|
||||
@sales = @sales.time_between(@from_time, @to_time)
|
||||
end
|
||||
else
|
||||
@orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
@orders = @orders.date_on(today)
|
||||
@sales = @sales.date_on(today)
|
||||
end
|
||||
if !@from.nil? && !@to.nil?
|
||||
if !@from_time.nil? && @to_time.nil?
|
||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}' and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%m') between '#{@from_time}' and '#{@to_time}'").count()
|
||||
else
|
||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count()
|
||||
end
|
||||
else
|
||||
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
|
||||
end
|
||||
@top_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"top").sum('i.qty')
|
||||
@bottom_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"bottom").sum('i.qty')
|
||||
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time).sum(:grand_total)
|
||||
|
||||
@top_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"top")
|
||||
@bottom_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"bottom")
|
||||
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time)
|
||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
||||
# .sum(:grand_total)
|
||||
logger.debug 'hourly_sales<>><><><<<<<<>><<<><><><><><><><><><<>><'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Reports::ReceiptNoDetailController < BaseReportController
|
||||
class Reports::ReceiptNoDetailController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
|
||||
@@ -9,11 +9,10 @@ authorize_resource :class => false
|
||||
|
||||
@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 = 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
|
||||
if @shift_sale.shift_closed_at.blank?
|
||||
@@ -25,7 +24,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)
|
||||
|
||||
@from = from
|
||||
@to = to
|
||||
@@ -62,10 +61,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
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
module ApplicationHelper
|
||||
include NumberFormattable
|
||||
|
||||
def flash_class(level)
|
||||
case level
|
||||
when :notice then "alert alert-info fade-in"
|
||||
@@ -6,5 +8,6 @@ module ApplicationHelper
|
||||
when :error then "alert alert-error fade-in"
|
||||
when :alert then "alert alert-error fade-in"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,6 +2,8 @@ class Lookup < ApplicationRecord
|
||||
|
||||
has_many :accounts
|
||||
|
||||
scope :number_formats, -> { where(lookup_type: 'number_format')}
|
||||
|
||||
def available_types
|
||||
{'Employee Roles' => 'employee_roles',
|
||||
'Dining Facilities Status' => 'dining_facilities_status',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Sale < ApplicationRecord
|
||||
include NumberFormattable
|
||||
self.primary_key = "sale_id"
|
||||
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
@@ -7,12 +8,15 @@ class Sale < ApplicationRecord
|
||||
belongs_to :cashier, foreign_key: "cashier_id", class_name: "Employee"
|
||||
belongs_to :customer, :optional => true
|
||||
belongs_to :shift_sale
|
||||
has_one :survey, foreign_key: "receipt_no"
|
||||
has_many :sale_audits
|
||||
has_many :sale_items
|
||||
has_many :sale_discount_items
|
||||
has_many :sale_discounts
|
||||
has_many :sale_taxes
|
||||
has_many :sale_payments
|
||||
has_many :sale_orders
|
||||
has_many :sale_payments_for_credits, through: :sale_audits
|
||||
has_many :orders, through: :sale_orders
|
||||
has_many :order_items, through: :sale_orders
|
||||
has_many :bookings
|
||||
@@ -28,7 +32,7 @@ class Sale < ApplicationRecord
|
||||
scope :date_on, -> (date) { where("DATE(CONVERT_TZ(receipt_date, '+00:00', ?)) = ?", Time.zone.formatted_offset, date) }
|
||||
scope :date_between, -> (from, to) { where("DATE(CONVERT_TZ(receipt_date, '+00:00', ?)) BETWEEN ? AND ?", Time.zone.formatted_offset, from, to) }
|
||||
scope :time_between, -> (from, to) { where("TIME(CONVERT_TZ(receipt_date, '+00:00', ?)) BETWEEN ? AND ?", Time.zone.formatted_offset, from, to) }
|
||||
scope :along_with_sale_payments_except_void, -> { joins("LEFT JOIN sale_payments on sales.sale_status != 'void' AND sale_payments.sale_id = sales.sale_id AND DATE(CONVERT_TZ(sale_payments.created_at,'+00:00','+06:30')) = DATE(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'))") }
|
||||
scope :along_with_sale_payments_except_void, -> { joins("LEFT JOIN sale_payments on sales.sale_status != 'void' AND sale_payments.sale_id = sales.sale_id AND DATE(CONVERT_TZ(sale_payments.created_at,'+00:00', '#{Time.zone.formatted_offset}')) = DATE(CONVERT_TZ(sales.receipt_date,'+00:00', '#{Time.zone.formatted_offset}'))") }
|
||||
|
||||
def qty_of(item_instance_code)
|
||||
order_items.select(:order_items_id, :item_instance_code, 'SUM(qty) as qty').where(item_instance_code: item_instance_code).group(:item_instance_code).first
|
||||
@@ -542,15 +546,20 @@ class Sale < ApplicationRecord
|
||||
divided_value = (100 + rate)/rate
|
||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||
else
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
end
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
|
||||
if !tax.inclusive
|
||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||
end
|
||||
|
||||
#new taxable amount is standard rule for step by step
|
||||
if shop.calc_tax_order
|
||||
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
end
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
end
|
||||
end
|
||||
self.tax_type = tax_incl_exec
|
||||
@@ -598,6 +607,12 @@ class Sale < ApplicationRecord
|
||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||
else
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
end
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
|
||||
if !tax.inclusive
|
||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||
end
|
||||
|
||||
@@ -605,9 +620,6 @@ class Sale < ApplicationRecord
|
||||
if shop.calc_tax_order
|
||||
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
end
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
end
|
||||
self.tax_type = tax_incl_exec
|
||||
self.total_tax = total_tax_amount
|
||||
@@ -1197,7 +1209,7 @@ 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.all.select("sales.*,sale_payments.*,df.name,df.type")
|
||||
query = Sale.includes(:sale_items).select("sales.*,sale_payments.*,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")
|
||||
@@ -1215,17 +1227,16 @@ end
|
||||
|
||||
def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,payment_type)
|
||||
## => left join -> show all sales although no orders
|
||||
if payment_type.blank?
|
||||
payment_type = ''
|
||||
else
|
||||
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
||||
end
|
||||
|
||||
query = Sale.select("sales.*,bookings.dining_facility_id as table_id")
|
||||
.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")
|
||||
.group("sales.sale_id")
|
||||
query = Sale.includes([:customer, :survey, :sale_payments])
|
||||
.includes(:bookings => :dining_facility)
|
||||
.select("sales.*, SUM(sale_payments.payment_amount) AS payments_for_credits_amount")
|
||||
.joins(:bookings)
|
||||
.left_joins(:sale_payments_for_credits)
|
||||
.completed
|
||||
.where.not(total_amount: 0)
|
||||
.group(:sale_id)
|
||||
.order(:receipt_date)
|
||||
if shift.present?
|
||||
query = query.where("sales.shift_sale_id in (?)", shift.to_a)
|
||||
elsif shift_sale_range.present?
|
||||
@@ -1233,6 +1244,9 @@ def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,pay
|
||||
else
|
||||
query = query.where("sales.receipt_date between ? and ?",from,to)
|
||||
end
|
||||
|
||||
ActiveRecord::Associations::Preloader.new.preload(query, :sale_items, SaleItem.where.not(price: 0))
|
||||
|
||||
return query
|
||||
end
|
||||
|
||||
@@ -1503,101 +1517,53 @@ end
|
||||
end
|
||||
|
||||
def self.top_bottom_products(today,current_user,from,to,from_time,to_time,type)
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
if current_user.nil?
|
||||
query = Sale.top_bottom(today,nil,from,to,from_time,to_time)
|
||||
query = Sale.joins("JOIN sale_items ON sale_items.sale_id = sales.sale_id")
|
||||
.completed
|
||||
.where("qty > 0 AND price > 0")
|
||||
.group("SUBSTRING_INDEX(product_name, ' - ', 1)")
|
||||
|
||||
if type == "top"
|
||||
query = query.group('i.product_name')
|
||||
.order("SUM(i.qty) DESC").limit(20)
|
||||
elsif type == "bottom"
|
||||
query = query.group('i.product_name')
|
||||
.order("SUM(i.qty) ASC").limit(20)
|
||||
end
|
||||
else
|
||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||
query = Sale.top_bottom(today,nil,from,to,from_time,to_time)
|
||||
if type == "top"
|
||||
query = query.group('i.product_name')
|
||||
.order("SUM(i.qty) DESC").limit(20)
|
||||
elsif type == "bottom"
|
||||
query = query.group('i.product_name')
|
||||
.order("SUM(i.qty) ASC").limit(20)
|
||||
end
|
||||
else
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
if !shift.nil?
|
||||
query = Sale.top_bottom(today,shift,from,to,from_time,to_time)
|
||||
if type == "top"
|
||||
query = query.group('i.product_name')
|
||||
.order("SUM(i.qty) DESC").limit(20)
|
||||
elsif type == "bottom"
|
||||
query = query.group('i.product_name')
|
||||
.order("SUM(i.qty) ASC").limit(20)
|
||||
end
|
||||
end
|
||||
end
|
||||
if !from.nil? && !to.nil?
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
if current_user.nil?
|
||||
query = Sale.top_bottom(today).group('i.product_name')
|
||||
|
||||
if type == "top"
|
||||
query = query.order("SUM(i.qty) DESC").limit(20)
|
||||
elsif type == "bottom"
|
||||
query = query.order("SUM(i.qty) ASC").limit(20)
|
||||
end
|
||||
else
|
||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||
query = Sale.top_bottom(today).group('i.product_name')
|
||||
if type == "top"
|
||||
query = query.order("SUM(i.qty) DESC").limit(20)
|
||||
elsif type == "bottom"
|
||||
query = query.order("SUM(i.qty) ASC").limit(20)
|
||||
end
|
||||
else
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
if !shift.nil?
|
||||
query = Sale.top_bottom(today,shift).group('i.product_name')
|
||||
if type == "top"
|
||||
query = query.order("SUM(i.qty) DESC").limit(20)
|
||||
elsif type == "bottom"
|
||||
query = query.order("SUM(i.qty) ASC").limit(20)
|
||||
end
|
||||
end
|
||||
end
|
||||
query = query.date_on(today)
|
||||
end
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user.id)
|
||||
query = query.where("shift_sale_id='#{shift.id}'")
|
||||
end
|
||||
end
|
||||
|
||||
if type == "top"
|
||||
query = query.order("SUM(qty) DESC")
|
||||
else
|
||||
query = query.order("SUM(qty) ASC")
|
||||
end
|
||||
|
||||
query.limit(20).sum('qty')
|
||||
end
|
||||
|
||||
def self.hourly_sales(today,current_user,from,to,from_time,to_time)
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
if current_user.nil?
|
||||
query = Sale.hourly_sale_data(today,nil,from,to,from_time,to_time)
|
||||
else
|
||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||
query = Sale.hourly_sale_data(today,nil,from,to,from_time,to_time)
|
||||
else
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
if !shift.nil?
|
||||
query = Sale.hourly_sale_data(today,shift,from,to,from_time,to_time)
|
||||
end
|
||||
end
|
||||
query = Sale.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
||||
.order('receipt_date').completed
|
||||
|
||||
if !from.nil? && !to.nil?
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
if current_user.nil?
|
||||
query = Sale.hourly_sale_data(today)
|
||||
else
|
||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||
query = Sale.hourly_sale_data(today)
|
||||
else
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
if !shift.nil?
|
||||
query = Sale.hourly_sale_data(today,shift)
|
||||
end
|
||||
end
|
||||
query = query.date_on(today)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user.id)
|
||||
query = query.where("shift_sale_id='#{shift.id}'")
|
||||
end
|
||||
end
|
||||
query.sum(:grand_total)
|
||||
end
|
||||
|
||||
def self.employee_sales(today,current_user,from,to,from_time,to_time)
|
||||
@@ -2074,60 +2040,6 @@ def unique_tax_profiles(order_source, customer_id)
|
||||
return tax_data
|
||||
end
|
||||
|
||||
def self.top_bottom(today,shift=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
if !from.nil? && !to.nil?
|
||||
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
|
||||
" i.price as unit_price,i.product_name")
|
||||
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id")
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+
|
||||
" and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%i') between '#{from_time}' and '#{to_time}' and sale_status= 'completed'")
|
||||
else
|
||||
query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+
|
||||
" and sale_status= 'completed'")
|
||||
end
|
||||
if !shift.nil?
|
||||
query = query.where("shift_sale_id='#{shift.id}'")
|
||||
end
|
||||
else
|
||||
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
|
||||
" i.price as unit_price,i.product_name")
|
||||
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id")
|
||||
.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+
|
||||
" and sale_status= 'completed'")
|
||||
if !shift.nil?
|
||||
query = query.where("shift_sale_id='#{shift.id}'")
|
||||
end
|
||||
end
|
||||
return query
|
||||
end
|
||||
|
||||
def self.hourly_sale_data(today,shift=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
if !from.nil? && !to.nil?
|
||||
query = Sale.select("grand_total")
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time)
|
||||
else
|
||||
query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to)
|
||||
end
|
||||
if !shift.nil?
|
||||
query = query.where("shift_sale_id='#{shift.id}'")
|
||||
end
|
||||
query = query.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
||||
.order('receipt_date')
|
||||
else
|
||||
query = Sale.select("grand_total")
|
||||
.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
|
||||
if !shift.nil?
|
||||
query = query.where("shift_sale_id='#{shift.id}'")
|
||||
end
|
||||
query = query.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
||||
.order('receipt_date')
|
||||
end
|
||||
|
||||
return query
|
||||
end
|
||||
|
||||
def self.employee_sale(today,shift=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
query = Sale.joins(:cashier)
|
||||
.joins(:sale_payments)
|
||||
@@ -2291,7 +2203,7 @@ end
|
||||
def grand_total_round
|
||||
print_settings = PrintSetting.get_precision_delimiter()
|
||||
if !print_settings.nil?
|
||||
self.grand_total =self.grand_total.round(print_settings.precision.to_i)
|
||||
self.grand_total =self.grand_total.round(precision)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2438,8 +2350,6 @@ private
|
||||
def round_to_precision
|
||||
if (self.total_amount != self.total_amount_was || self.total_discount != self.total_discount_was || self.total_tax != self.total_tax_was)
|
||||
if (self.total_amount % 1 > 0 || self.total_discount % 1 > 0 || self.total_tax % 1 > 0)
|
||||
precision = PrintSetting.get_precision_delimiter().precision.to_i
|
||||
|
||||
self.total_amount = self.total_amount.round(precision)
|
||||
self.total_discount = self.total_discount.round(precision)
|
||||
self.total_tax = self.total_tax.round(precision)
|
||||
|
||||
@@ -6,7 +6,7 @@ class SaleAudit < ApplicationRecord
|
||||
|
||||
belongs_to :sale
|
||||
|
||||
belongs_to :credit_payment, -> { where "SUBSTRING_INDEX(sale_audits.remark,'||',1) = sale_payments.sale_payment_id" }, foreign_key: "sale_id", primary_key: "sale_id", class_name: "SalePayment"
|
||||
belongs_to :sale_payments_for_credit, -> { where "SUBSTRING_INDEX(sale_audits.remark,'||',1) = sale_payments.sale_payment_id" }, foreign_key: "sale_id", primary_key: "sale_id", class_name: "SalePayment"
|
||||
|
||||
def self.sync_sale_audit_records(sale_audits)
|
||||
if !sale_audits.nil?
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class SaleItem < ApplicationRecord
|
||||
include NumberFormattable
|
||||
self.primary_key = "sale_item_id"
|
||||
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
@@ -294,8 +295,6 @@ class SaleItem < ApplicationRecord
|
||||
if self.unit_price != self.unit_price_was || self.price != self.price_was
|
||||
if unit_price_fraction > 0 || price_fraction > 0
|
||||
if ['Discount', 'promotion'].include?(self.status)
|
||||
precision = PrintSetting.get_precision_delimiter().precision.to_i
|
||||
|
||||
self.unit_price = self.unit_price.round(precision)
|
||||
self.price = (self.unit_price * self.qty).round(precision)
|
||||
self.taxable_price = self.price
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class SaleTax < ApplicationRecord
|
||||
include NumberFormattable
|
||||
self.primary_key = "sale_tax_id"
|
||||
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
@@ -44,7 +45,6 @@ class SaleTax < ApplicationRecord
|
||||
def round_to_precision
|
||||
if self.tax_payable_amount != self.tax_payable_amount_was
|
||||
if self.tax_payable_amount % 1 > 0
|
||||
precision = PrintSetting.get_precision_delimiter().precision.to_i
|
||||
self.tax_payable_amount = self.tax_payable_amount.round(precision)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class CheckInOutPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:order_no_font_size, :item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,booking, table)
|
||||
self.page_width = print_settings.page_width
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class CloseCashierCustomisePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||
|
||||
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
||||
@@ -39,22 +39,11 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
#check delimiter
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header( shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
||||
end
|
||||
|
||||
def header (shop_details)
|
||||
@@ -103,13 +92,13 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ shift_sale.shift_closed_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Opening Float : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ number_with_precision(shift_sale.opening_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
text "#{ number_format(shift_sale.opening_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -117,8 +106,8 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Closing Float : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ number_with_precision(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
# text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}"
|
||||
text "#{ number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
# text_box "#{number_format(total_price, :precision => precision.to_i, :delimiter => delimiter)}"
|
||||
end
|
||||
|
||||
|
||||
@@ -135,7 +124,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Received Amount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
|
||||
end
|
||||
|
||||
@@ -144,7 +133,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Cash In :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -152,7 +141,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Cash Out :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down -5
|
||||
@@ -165,7 +154,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
|
||||
total_discount_account = total_discount_account.to_f + amount.total_price.to_f
|
||||
end
|
||||
#end total amount by Account
|
||||
#end total amount by Account
|
||||
|
||||
#start total FOC amount
|
||||
@total_foc = 0
|
||||
@@ -173,7 +162,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
@total_foc = other.foc_amount.round(2)
|
||||
end
|
||||
|
||||
#end total FOC amount
|
||||
#end total FOC amount
|
||||
total_grand_total = shift_sale.grand_total + @total_foc.to_f + shift_sale.total_void.to_f - total_discount_account.to_f
|
||||
# @total_grand_total = @shift_sale.grand_total + @overall + @total_foc + @shift_sale.total_void
|
||||
y_position = cursor
|
||||
@@ -181,21 +170,21 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Grand Total :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(total_grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(total_grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_discount_by_account.each do |amount|
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Discount:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end total amount by Account
|
||||
#end total amount by Account
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
@@ -205,8 +194,8 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
@total_foc = 0
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
text "(#{ number_format(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
@@ -218,7 +207,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
move_down 7
|
||||
|
||||
@total_foc = 0
|
||||
y_position = cursor
|
||||
@@ -226,7 +215,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -234,9 +223,9 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
#start other payment details
|
||||
#start other payment details
|
||||
if shift_sale.other_sales > 0
|
||||
other_payment.each do |other|
|
||||
@total_foc = other.foc_amount.round(2)
|
||||
@@ -246,7 +235,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "MPU Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.mpu_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.mpu_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -256,7 +245,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "VISA Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(other.visa_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(other.visa_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -266,7 +255,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Master Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.master_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.master_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -276,7 +265,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.jcb_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.jcb_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -286,7 +275,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "UNIONPAY Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.unionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.unionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -296,7 +285,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Alipay Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.alipay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.alipay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -306,7 +295,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "JunctionPay Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.junctionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.junctionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -316,7 +305,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Dinga Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.dinga_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.dinga_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -326,7 +315,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Redeem Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.paypar_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.paypar_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -336,7 +325,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Paymal Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -346,7 +335,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "GiftVoucher Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.giftvoucher_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.giftvoucher_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -356,7 +345,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Other Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.other_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.other_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -365,8 +354,8 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Rounding Adjustments :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
|
||||
text "#{ number_format(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -374,14 +363,14 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Gross Sale :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
text "#{ number_format(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
|
||||
# end other payment details
|
||||
# end other payment details
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
|
||||
|
||||
# start Dinein and Takeaway
|
||||
|
||||
y_position = cursor
|
||||
@@ -392,7 +381,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
total_dinein = 0
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(total_dinein, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(total_dinein, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -401,11 +390,11 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
end
|
||||
if total_takeway.nil?
|
||||
total_takeway = 0
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(total_takeway, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_format(total_takeway, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
|
||||
# stop Dinein and Takeaway
|
||||
move_down -5
|
||||
@@ -419,7 +408,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "#{tax.tax_name} :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(tax.st_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(tax.st_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -428,7 +417,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Total Taxes :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.total_taxes, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.total_taxes, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -436,7 +425,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Net Sales :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.nett_sales, :precision => precision.to_i, :delimiter => delimiter) }", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
||||
text "#{number_format(shift_sale.nett_sales, :precision => precision.to_i, :delimiter => delimiter) }", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
|
||||
if total_credit_payments && total_credit_payments.to_f > 0
|
||||
@@ -445,7 +434,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Total Credit Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(total_credit_payments, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(total_credit_payments, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end for service charges and commercial tax
|
||||
@@ -463,16 +452,16 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
move_down 7
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
# total_discount_by_account.each do |amount|
|
||||
|
||||
|
||||
# y_position = cursor
|
||||
# bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
# text "Total #{amount.account_name} Discount:", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
# text "#{ number_with_precision(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
# text "#{ number_format(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
# end
|
||||
#end total amount by Account
|
||||
#end total amount by Account
|
||||
|
||||
# y_position = cursor
|
||||
# bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
@@ -481,19 +470,19 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
# text "#{shift_sale.grand_total}", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
|
||||
|
||||
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_amount_by_account.each do |amount|
|
||||
total_amount_by_account.each do |amount|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Amount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end total amount by Account
|
||||
#end total amount by Account
|
||||
|
||||
#start total other charges amount
|
||||
if total_other_charges.present?
|
||||
@@ -502,9 +491,9 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Total Other Charges :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(total_other_charges, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(total_other_charges, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
#end total other charges amount
|
||||
|
||||
move_down -5
|
||||
@@ -513,32 +502,32 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
|
||||
#start total over all discount
|
||||
if total_member_discount[0].member_discount.present?
|
||||
@member_discount = total_member_discount[0].member_discount rescue 0.0
|
||||
@member_discount = total_member_discount[0].member_discount rescue 0.0
|
||||
@overall = shift_sale.total_discounts - @member_discount
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Member Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
else
|
||||
@overall = shift_sale.total_discounts
|
||||
else
|
||||
@overall = shift_sale.total_discounts
|
||||
end
|
||||
|
||||
|
||||
if @overall > 0
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "-#{ number_with_precision(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
text "-#{ number_format(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
end
|
||||
end
|
||||
#end total over all discount
|
||||
|
||||
if total_waste.to_f > 0
|
||||
@@ -547,7 +536,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Total Waste :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(total_waste, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
text "(#{ number_format(total_waste, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -557,7 +546,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
text "Total Spoile :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(total_spoile, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
text "(#{ number_format(total_spoile, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -591,4 +580,3 @@ class CloseCashierCustomisePdf < Prawn::Document
|
||||
move_down 5
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class CloseCashierPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||
|
||||
def initialize(printer_settings, shift_sale, sale_items, total_other_charges_info, acc_cate_count, menu_cate_count, total_by_acc, shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
||||
@@ -39,25 +39,14 @@ class CloseCashierPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
#check delimiter
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header( shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
|
||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
|
||||
|
||||
if !sale_items.nil? or !sale_items.blank?
|
||||
sale_items_detail(sale_items, acc_cate_count, menu_cate_count, total_by_acc, total_other_charges_info)
|
||||
sale_items_detail(sale_items, acc_cate_count, menu_cate_count, total_by_acc, total_other_charges_info)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -107,13 +96,13 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ shift_sale.shift_closed_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Opening Float : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ number_with_precision(shift_sale.opening_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
text "#{ number_format(shift_sale.opening_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -121,8 +110,8 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Closing Float : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ number_with_precision(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
# text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}"
|
||||
text "#{ number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
# text_box "#{number_format(total_price, :precision => precision.to_i, :delimiter => delimiter)}"
|
||||
end
|
||||
|
||||
|
||||
@@ -139,7 +128,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Received Amount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
|
||||
end
|
||||
|
||||
@@ -148,7 +137,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Cash In:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -156,7 +145,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Cash Out:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down -5
|
||||
@@ -169,7 +158,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -177,10 +166,10 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
#start other payment details
|
||||
#start other payment details
|
||||
if shift_sale.other_sales > 0
|
||||
other_payment.each do |other|
|
||||
@total_foc = other.foc_amount.round(2)
|
||||
@@ -190,7 +179,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "MPU Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.mpu_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.mpu_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -200,7 +189,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "VISA Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(other.visa_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(other.visa_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -210,7 +199,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Master Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.master_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.master_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -220,7 +209,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.jcb_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.jcb_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -230,7 +219,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "UNIONPAY Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.unionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.unionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -240,7 +229,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Alipay Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.alipay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.alipay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -250,7 +239,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "KBZ Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.kbzpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.kbzpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -260,7 +249,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "JunctionPay Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.junctionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.junctionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -270,7 +259,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Dinga Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.dinga_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.dinga_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -280,7 +269,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Redeem Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.paypar_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.paypar_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -290,7 +279,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Paymal Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -300,7 +289,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "GiftVoucher Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.giftvoucher_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.giftvoucher_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -310,7 +299,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Other Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.other_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.other_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -319,7 +308,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Rounding Adjustments :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -327,10 +316,10 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
text "#{ number_format(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
|
||||
# end other payment details
|
||||
# end other payment details
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
@@ -342,7 +331,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{tax.tax_name} :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(tax.st_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(tax.st_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -351,7 +340,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Taxes :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.total_taxes, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.total_taxes, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -359,7 +348,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Net Sales :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.nett_sales, :precision => precision.to_i, :delimiter => delimiter) }", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
||||
text "#{number_format(shift_sale.nett_sales, :precision => precision.to_i, :delimiter => delimiter) }", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
|
||||
if total_credit_payments && total_credit_payments.to_f > 0
|
||||
@@ -368,7 +357,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Credit Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(total_credit_payments, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(total_credit_payments, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end for service charges and commercial tax
|
||||
@@ -386,30 +375,30 @@ class CloseCashierPdf < Prawn::Document
|
||||
move_down 7
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_discount_by_account.each do |amount|
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Discount:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end total amount by Account
|
||||
#end total amount by Account
|
||||
|
||||
if total_member_discount[0].member_discount.present?
|
||||
@member_discount = total_member_discount[0].member_discount rescue 0.0
|
||||
@member_discount = total_member_discount[0].member_discount rescue 0.0
|
||||
@overall = shift_sale.total_discounts - @member_discount
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Member Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
else
|
||||
@overall = shift_sale.total_discounts
|
||||
else
|
||||
@overall = shift_sale.total_discounts
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -417,18 +406,18 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
text "#{ number_format(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total FOC :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
text "(#{ number_format(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Void :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
@@ -441,7 +430,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Waste :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(total_waste, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
text "(#{ number_format(total_waste, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -449,7 +438,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Spoile :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(total_spoile, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
text "(#{ number_format(total_spoile, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
# y_position = cursor
|
||||
@@ -459,19 +448,19 @@ class CloseCashierPdf < Prawn::Document
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
# text "#{shift_sale.grand_total}", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_amount_by_account.each do |amount|
|
||||
total_amount_by_account.each do |amount|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Amount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -482,7 +471,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{total_other_charges}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
#end total amount by Account
|
||||
#end total amount by Account
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
@@ -532,7 +521,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
sale_items.each do |item|
|
||||
|
||||
if !arr.include?(item['menu_category_id'])
|
||||
|
||||
|
||||
if flag == true
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
@@ -567,7 +556,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
# text_box "#{item['grand_total'].to_i}", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
# }
|
||||
add_item_line(item['product_name'], item['unit_price'].to_i, item['total_item'].to_i, item['grand_total'].to_i)
|
||||
|
||||
|
||||
if item['total_item'].to_i > 0 or item['status_type'] == 'foc' or item['status_type'] == 'void'
|
||||
total_qty += item['total_item'].to_i
|
||||
total_items += item['total_item'].to_i
|
||||
@@ -657,4 +646,4 @@ class CloseCashierPdf < Prawn::Document
|
||||
text_box "#{sub_total.to_i}", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class CloseCashierPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||
|
||||
def initialize(printer_settings, shift_sale, total_by_acc, shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
||||
@@ -39,22 +39,11 @@ class CloseCashierPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
#check delimiter
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header( shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
|
||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
|
||||
|
||||
end
|
||||
|
||||
@@ -104,13 +93,13 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ shift_sale.shift_closed_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Opening Float : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ number_with_precision(shift_sale.opening_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
text "#{ number_format(shift_sale.opening_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -118,8 +107,8 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Closing Float : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ number_with_precision(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
# text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}"
|
||||
text "#{ number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :left
|
||||
# text_box "#{number_format(total_price, :precision => precision.to_i, :delimiter => delimiter)}"
|
||||
end
|
||||
|
||||
|
||||
@@ -136,7 +125,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Received Amount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
|
||||
end
|
||||
|
||||
@@ -145,7 +134,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Cash In:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -153,7 +142,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Cash Out:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down -5
|
||||
@@ -166,7 +155,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -174,10 +163,10 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
#start other payment details
|
||||
#start other payment details
|
||||
if shift_sale.other_sales > 0
|
||||
other_payment.each do |other|
|
||||
@total_foc = other.foc_amount.round(2)
|
||||
@@ -187,7 +176,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "MPU Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.mpu_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.mpu_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -197,7 +186,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "VISA Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(other.visa_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(other.visa_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -207,7 +196,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Master Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.master_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.master_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -217,7 +206,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.jcb_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.jcb_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -227,7 +216,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "UNIONPAY Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.unionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.unionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -237,7 +226,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Alipay Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.alipay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.alipay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -247,7 +236,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "JunctionPay Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.junctionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.junctionpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -257,7 +246,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Dinga Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.dinga_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.dinga_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -267,7 +256,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Redeem Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.paypar_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.paypar_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -277,7 +266,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Paymal Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.paymal_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -287,7 +276,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "GiftVoucher Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(other.giftvoucher_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(other.giftvoucher_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -297,7 +286,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Other Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.other_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.other_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -306,7 +295,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Rounding Adjustments :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -314,10 +303,10 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
text "#{ number_format(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
|
||||
# end other payment details
|
||||
# end other payment details
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
@@ -329,7 +318,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{tax.tax_name} :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(tax.st_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(tax.st_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -338,7 +327,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Taxes :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(shift_sale.total_taxes, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(shift_sale.total_taxes, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -346,7 +335,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Net Sales :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(shift_sale.nett_sales, :precision => precision.to_i, :delimiter => delimiter) }", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
||||
text "#{number_format(shift_sale.nett_sales, :precision => precision.to_i, :delimiter => delimiter) }", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
|
||||
if total_credit_payments && total_credit_payments.to_f > 0
|
||||
@@ -355,7 +344,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Credit Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(total_credit_payments, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(total_credit_payments, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end for service charges and commercial tax
|
||||
@@ -373,30 +362,30 @@ class CloseCashierPdf < Prawn::Document
|
||||
move_down 7
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_discount_by_account.each do |amount|
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Discount:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end total amount by Account
|
||||
#end total amount by Account
|
||||
|
||||
if total_member_discount[0].member_discount.present?
|
||||
@member_discount = total_member_discount[0].member_discount rescue 0.0
|
||||
@member_discount = total_member_discount[0].member_discount rescue 0.0
|
||||
@overall = shift_sale.total_discounts - @member_discount
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Member Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
text "#{ number_format(@member_discount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
else
|
||||
@overall = shift_sale.total_discounts
|
||||
else
|
||||
@overall = shift_sale.total_discounts
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -404,18 +393,18 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{ number_with_precision(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
text "#{ number_format(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total FOC :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
text "(#{ number_format(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Void :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
@@ -428,7 +417,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Waste :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(total_waste, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
text "(#{ number_format(total_waste, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -436,7 +425,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "Total Spoile :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{ number_with_precision(total_spoile, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
text "(#{ number_format(total_spoile, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
# y_position = cursor
|
||||
@@ -446,19 +435,19 @@ class CloseCashierPdf < Prawn::Document
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
# text "#{shift_sale.grand_total}", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_amount_by_account.each do |amount|
|
||||
total_amount_by_account.each do |amount|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Amount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{number_with_precision(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
text "#{number_format(amount.total_price, :precision => precision.to_i, :delimiter => delimiter)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -469,7 +458,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{total_other_charges}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
#end total amount by Account
|
||||
#end total amount by Account
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
@@ -502,4 +491,4 @@ class CloseCashierPdf < Prawn::Document
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class MoveTablePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(printer_settings,to,from,shop_detail,date,type,moved_by,order_items)
|
||||
self.page_width = printer_settings.page_width
|
||||
@@ -39,7 +39,7 @@ class MoveTablePdf < Prawn::Document
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
add_lining_item(order_items, printer_settings.precision)
|
||||
add_lining_item(order_items, precision)
|
||||
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
@@ -98,7 +98,7 @@ class MoveTablePdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class MoveTableStarPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(printer_settings,to,from,shop_detail,date,type,moved_by,order_items)
|
||||
self.page_width = printer_settings.page_width
|
||||
@@ -38,7 +38,7 @@ class MoveTableStarPdf < Prawn::Document
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
add_lining_item(order_items, printer_settings.precision)
|
||||
add_lining_item(order_items, precision)
|
||||
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
@@ -97,7 +97,7 @@ class MoveTableStarPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderItemCustomisePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:order_no_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -47,7 +47,7 @@ class OrderItemCustomisePdf < Prawn::Document
|
||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item, options, alt_name, print_settings.precision, before_updated_qty)
|
||||
order_items(order_item, options, alt_name, precision, before_updated_qty)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -107,7 +107,7 @@ class OrderItemCustomisePdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 10,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
|
||||
text "[#{number_format(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -146,7 +146,7 @@ class OrderItemCustomisePdf < Prawn::Document
|
||||
# add option
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.page_width) do
|
||||
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "* Change quantity [#{number_format(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_format(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderItemPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
|
||||
def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
|
||||
@@ -48,7 +48,7 @@ class OrderItemPdf < Prawn::Document
|
||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item, options, alt_name, print_settings.precision, before_updated_qty)
|
||||
order_items(order_item, options, alt_name, precision, before_updated_qty)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -108,7 +108,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "[#{number_format(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -147,7 +147,7 @@ class OrderItemPdf < Prawn::Document
|
||||
# add option
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "* Change quantity [#{number_format(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_format(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :item_slim_font_size
|
||||
def initialize(print_settings,order_item_slim, print_status, options, alt_name, before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -11,9 +11,9 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
self.item_slim_font_size=8
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
@@ -29,17 +29,17 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if !order_item_slim.dining.nil?
|
||||
text "#{ order_item_slim.type + '-' + order_item_slim.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 1
|
||||
|
||||
@@ -47,35 +47,35 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at)
|
||||
|
||||
# order items slim
|
||||
order_items_slim(order_item_slim, options, alt_name, print_settings.precision, before_updated_qty)
|
||||
order_items_slim(order_item_slim, options, alt_name, precision, before_updated_qty)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_slim_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left
|
||||
text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_slim_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_slim_font_size,:align => :left
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -88,7 +88,7 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
def order_items_slim(order_item_slim, options, alt_name, precision, before_updated_qty)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
#Add Order Item
|
||||
add_order_items_slim(order_item_slim, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
@@ -108,7 +108,7 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
|
||||
text "[#{number_format(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -146,7 +146,7 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
# add option
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.page_width) do
|
||||
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "* Change quantity [#{number_format(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_format(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class OrderItemSlimPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
|
||||
|
||||
def initialize(print_settings,order_item_slim, print_status, options, alt_name, before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
self.page_height = print_settings.page_height
|
||||
@@ -12,9 +12,9 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
@@ -29,17 +29,17 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if !order_item_slim.dining.nil?
|
||||
text "#{ order_item_slim.type + '-' + order_item_slim.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 1
|
||||
|
||||
@@ -47,35 +47,35 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at)
|
||||
|
||||
# order items slim
|
||||
order_items_slim(order_item_slim, options, alt_name, print_settings.precision, before_updated_qty)
|
||||
order_items_slim(order_item_slim, options, alt_name, precision, before_updated_qty)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -87,7 +87,7 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
def order_items_slim(order_item_slim, options, alt_name, precision, before_updated_qty)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
#Add Order Item
|
||||
add_order_items_slim(order_item_slim, options, alt_name, precision)
|
||||
puts options
|
||||
puts '............PDF OPTIONS...............'
|
||||
@@ -108,7 +108,7 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "[#{number_format(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -146,7 +146,7 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
# add option
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "* Change quantity [#{number_format(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_format(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderItemStarPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
|
||||
def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
|
||||
@@ -48,7 +48,7 @@ class OrderItemStarPdf < Prawn::Document
|
||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item, options, alt_name, print_settings.precision, before_updated_qty)
|
||||
order_items(order_item, options, alt_name, precision, before_updated_qty)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -108,7 +108,7 @@ class OrderItemStarPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "[#{number_format(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -147,7 +147,7 @@ class OrderItemStarPdf < Prawn::Document
|
||||
# add option
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "* Change quantity [#{number_format(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_format(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderSetItemCustomisePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:order_no_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order_set_item, print_status, options, alt_name, before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -12,9 +12,9 @@ class OrderSetItemCustomisePdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
@@ -29,11 +29,11 @@ class OrderSetItemCustomisePdf < Prawn::Document
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if !order_set_item.dining.nil?
|
||||
text "#{ order_set_item.type + '-' + order_set_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
@@ -46,35 +46,35 @@ class OrderSetItemCustomisePdf < Prawn::Document
|
||||
order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at)
|
||||
|
||||
# order items
|
||||
order_set_items(order_set_item, options, alt_name, print_settings.precision, before_updated_qty)
|
||||
order_set_items(order_set_item, options, alt_name, precision, before_updated_qty)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.order_no_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.order_no_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
|
||||
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.order_no_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.order_no_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.order_no_font_size,:align => :left
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.order_no_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -86,7 +86,7 @@ class OrderSetItemCustomisePdf < Prawn::Document
|
||||
def order_set_items(order_set_item, options, alt_name, precision, before_updated_qty)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
#Add Order Item
|
||||
add_order_set_items(order_set_item, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
@@ -106,7 +106,7 @@ class OrderSetItemCustomisePdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(order_set_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
|
||||
text "[#{number_format(order_set_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -161,7 +161,7 @@ class OrderSetItemCustomisePdf < Prawn::Document
|
||||
# add option
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.page_width) do
|
||||
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "* Change quantity [#{number_format(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_format(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderSetItemPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order_set_item, print_status, options, alt_name, before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -11,9 +11,9 @@ class OrderSetItemPdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
@@ -28,11 +28,11 @@ class OrderSetItemPdf < Prawn::Document
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if !order_set_item.dining.nil?
|
||||
text "#{ order_set_item.type + '-' + order_set_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
@@ -45,35 +45,35 @@ class OrderSetItemPdf < Prawn::Document
|
||||
order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at)
|
||||
|
||||
# order items
|
||||
order_set_items(order_set_item, options, alt_name, print_settings.precision, before_updated_qty)
|
||||
order_set_items(order_set_item, options, alt_name, precision, before_updated_qty)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 2
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 2
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 2
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -85,7 +85,7 @@ class OrderSetItemPdf < Prawn::Document
|
||||
def order_set_items(order_set_item, options, alt_name, precision, before_updated_qty)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
#Add Order Item
|
||||
add_order_set_items(order_set_item, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
@@ -105,7 +105,7 @@ class OrderSetItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(order_set_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "[#{number_format(order_set_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -160,7 +160,7 @@ class OrderSetItemPdf < Prawn::Document
|
||||
# add option
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "* Change quantity [#{number_format(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_format(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderSummaryCustomisePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:order_no_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -48,9 +48,9 @@ class OrderSummaryCustomisePdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
order_items(order, alt_name, precision)
|
||||
else
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
order_items(order_items, alt_name, precision)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -113,7 +113,7 @@ class OrderSummaryCustomisePdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 10,y_position], :width => self.qty_width) do
|
||||
text " [#{number_with_precision(odi.qty, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text " [#{number_format(odi.qty, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderSummaryPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -11,9 +11,9 @@ class OrderSummaryPdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
@@ -27,18 +27,18 @@ class OrderSummaryPdf < Prawn::Document
|
||||
})
|
||||
|
||||
font "#{print_settings.font}"
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||
end
|
||||
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
|
||||
if !order[0].dining.nil?
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
@@ -47,38 +47,38 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
order_items(order, alt_name, precision)
|
||||
else
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
order_items(order_items, alt_name, precision)
|
||||
end
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no}", :size => self.item_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderNo: #{order_no}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -103,7 +103,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, alt_name, precision)
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
@@ -113,7 +113,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
order_item.each do|odi|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
# if odi.price != 0
|
||||
y_position = cursor
|
||||
|
||||
@@ -123,14 +123,14 @@ class OrderSummaryPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
|
||||
end
|
||||
|
||||
|
||||
if alt_name
|
||||
if !(odi.alt_name).empty?
|
||||
move_down 4
|
||||
@@ -138,15 +138,15 @@ class OrderSummaryPdf < Prawn::Document
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
# end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# add option
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
|
||||
if options != ""
|
||||
move_down 5
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{options}", :size => self.item_font_size,:align => :left
|
||||
@@ -161,7 +161,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
move_down 5
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_booking_id(order_no)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:order_no_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -12,9 +12,9 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
@@ -38,7 +38,7 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
@@ -47,38 +47,38 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
order_items(order, alt_name, precision)
|
||||
else
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
order_items(order_items, alt_name, precision)
|
||||
end
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.order_no_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.order_no_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
|
||||
text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.order_no_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.order_no_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.order_no_font_size,:align => :left
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.order_no_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -92,7 +92,7 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, alt_name, precision)
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
@@ -102,7 +102,7 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
order_item.each do|odi|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
# if odi.price != 0
|
||||
y_position = cursor
|
||||
|
||||
@@ -112,14 +112,14 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(odi.qty, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "[#{number_format(odi.qty, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
|
||||
end
|
||||
|
||||
|
||||
if alt_name
|
||||
if !(odi.alt_name).empty?
|
||||
move_down 4
|
||||
@@ -127,7 +127,7 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
# end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
#add set menu items
|
||||
@@ -148,10 +148,10 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
|
||||
# add option
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
|
||||
if options != ""
|
||||
move_down 5
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{options}", :size => self.item_font_size,:align => :left
|
||||
@@ -166,7 +166,7 @@ class OrderSummarySetCustomisePdf < Prawn::Document
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
move_down 5
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_booking_id(order_no)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderSummarySetPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -11,9 +11,9 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
@@ -37,7 +37,7 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
@@ -46,38 +46,38 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
order_items(order, alt_name, precision)
|
||||
else
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
order_items(order_items, alt_name, precision)
|
||||
end
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -102,7 +102,7 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, alt_name, precision)
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
@@ -112,7 +112,7 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
order_item.each do|odi|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
# if odi.price != 0
|
||||
y_position = cursor
|
||||
|
||||
@@ -122,14 +122,14 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
|
||||
end
|
||||
|
||||
|
||||
if alt_name
|
||||
if !(odi.alt_name).empty?
|
||||
move_down 4
|
||||
@@ -137,7 +137,7 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
# end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
#add set menu items
|
||||
@@ -158,10 +158,10 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
|
||||
# add option
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
|
||||
if options != ""
|
||||
move_down 5
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{options}", :size => self.item_font_size,:align => :left
|
||||
@@ -176,7 +176,7 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
move_down 5
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_booking_id(order_no)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:item_slim_font_size
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -11,10 +11,10 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.item_slim_font_size=8
|
||||
self.label_width=90
|
||||
self.item_slim_font_size=8
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
@@ -38,7 +38,7 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 1
|
||||
|
||||
@@ -47,38 +47,38 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
order_items(order, alt_name, precision)
|
||||
else
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
order_items(order_items, alt_name, precision)
|
||||
end
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_slim_font_size,:align => :left
|
||||
text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_slim_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_slim_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -95,7 +95,7 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, alt_name, precision)
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
@@ -105,7 +105,7 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
move_down 1
|
||||
|
||||
order_item.each do|odi|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
# if odi.price != 0
|
||||
y_position = cursor
|
||||
|
||||
@@ -115,14 +115,14 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do
|
||||
text "[#{number_with_precision(odi.qty, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
text "[#{number_format(odi.qty, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
|
||||
end
|
||||
|
||||
|
||||
if alt_name
|
||||
if !(odi.alt_name).empty?
|
||||
move_down 1
|
||||
@@ -134,7 +134,7 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
|
||||
# add option
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
|
||||
if options != ""
|
||||
move_down 1
|
||||
|
||||
@@ -152,7 +152,7 @@ class OrderSummarySlimCustomisePdf < Prawn::Document
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
move_down 1
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_booking_id(order_no)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderSummarySlimPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
@@ -11,9 +11,9 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
@@ -37,7 +37,7 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 1
|
||||
|
||||
@@ -46,38 +46,38 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
order_items(order, alt_name, precision)
|
||||
else
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
order_items(order_items, alt_name, precision)
|
||||
end
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -102,7 +102,7 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, alt_name, precision)
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
@@ -112,7 +112,7 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
move_down 1
|
||||
|
||||
order_item.each do|odi|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
# if odi.price != 0
|
||||
y_position = cursor
|
||||
|
||||
@@ -122,14 +122,14 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
|
||||
end
|
||||
|
||||
|
||||
if alt_name
|
||||
if !(odi.alt_name).empty?
|
||||
move_down 1
|
||||
@@ -141,7 +141,7 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
|
||||
# add option
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
|
||||
if options != ""
|
||||
move_down 1
|
||||
|
||||
@@ -159,7 +159,7 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
move_down 1
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_booking_id(order_no)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class ReceiptBillA5Pdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no,card_balance_amount)
|
||||
@@ -26,11 +26,6 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
#setting page margin and width
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != ""
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
@@ -46,23 +41,17 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header(shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
cashier_info(sale_data, customer_name, latest_order_no)
|
||||
line_items(sale_items,printer_settings.precision,delimiter)
|
||||
all_total(sale_data,printer_settings.precision,delimiter)
|
||||
line_items(sale_items,precision,delimiter)
|
||||
all_total(sale_data,precision,delimiter)
|
||||
|
||||
|
||||
if member_info != nil
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance)
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
end
|
||||
|
||||
customer(customer_name)
|
||||
@@ -77,21 +66,21 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
card_balance_data(card_balance_amount)
|
||||
end
|
||||
#end card blanace amount
|
||||
|
||||
|
||||
if discount_price_by_accounts.length > 0 && shop_details.show_account_info
|
||||
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
||||
discount_account(discount_price_by_accounts,precision,delimiter)
|
||||
end
|
||||
|
||||
if shop_details.show_account_info
|
||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||
items_account(item_price_by_accounts,precision,delimiter)
|
||||
if other_charges_amount
|
||||
show_other_charges_amount(other_charges_amount,printer_settings.precision,delimiter)
|
||||
show_other_charges_amount(other_charges_amount,precision,delimiter)
|
||||
end
|
||||
end
|
||||
|
||||
#start for individual payment
|
||||
if !sale_data.equal_persons.nil?
|
||||
individual_payment(sale_data, printer_settings.precision, delimiter)
|
||||
individual_payment(sale_data, precision, delimiter)
|
||||
end
|
||||
#end for individual payment
|
||||
|
||||
@@ -100,7 +89,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
if shop_details.note && !shop_details.note.nil?
|
||||
shop_note(printed_status)
|
||||
end
|
||||
|
||||
|
||||
footer(printed_status)
|
||||
end
|
||||
|
||||
@@ -130,7 +119,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "OrderNo : #{ latest_order_no }", :size => self.header_font_size+2,:align => :left
|
||||
end
|
||||
move_down line_move
|
||||
|
||||
|
||||
# move_down 2
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
@@ -154,7 +143,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
|
||||
bounding_box([self.item_description_width, y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.item_description_width - 2,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -172,7 +161,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
|
||||
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do
|
||||
# text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
|
||||
# text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
|
||||
# - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" ,
|
||||
# :size => self.item_font_size,:align => :right
|
||||
# end
|
||||
@@ -209,7 +198,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
end
|
||||
|
||||
def add_line_item_row(sale_items,precision,delimiter)
|
||||
|
||||
|
||||
if precision.to_i > 0
|
||||
item_name_width = (self.item_width+self.price_width)
|
||||
item_qty_front_width = (self.item_width+self.price_width) + 5
|
||||
@@ -229,17 +218,17 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
sub_total = 0.0
|
||||
total_qty = 0.0
|
||||
sale_items.each do |item|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
|
||||
show_price = Lookup.find_by_lookup_type("show_price")
|
||||
|
||||
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||
if item.status != 'Discount' && item.qty > 0
|
||||
if !show_price.nil? && show_price.value.to_i > 0 && item.price == 0
|
||||
total_qty += item.qty
|
||||
total_qty += item.qty
|
||||
else
|
||||
if item.price != 0
|
||||
total_qty += item.qty
|
||||
total_qty += item.qty
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -265,14 +254,14 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
# bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
|
||||
# text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
|
||||
# text "#{number_format(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
|
||||
# end
|
||||
# bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
|
||||
# text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
# text "#{number_format(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
# end
|
||||
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
text_box "#{number_format(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
end
|
||||
|
||||
def item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||
@@ -297,10 +286,10 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.item_width) do
|
||||
text "#{product_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||
text_box "#{number_format(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
if show_alt_name
|
||||
if !(item.product_alt_name).empty?
|
||||
@@ -328,7 +317,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "#{ dis_type }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||
text "( #{number_format(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
if sale_data.sale_taxes.length > 0
|
||||
@@ -344,7 +333,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -370,7 +359,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{sale_data.rounding_adjustment}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
move_down line_move
|
||||
@@ -380,15 +369,15 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
text "#{number_format(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
|
||||
|
||||
sale_payment(sale_data,precision,delimiter)
|
||||
|
||||
|
||||
end
|
||||
|
||||
def sale_payment(sale_data,precision,delimiter)
|
||||
def sale_payment(sale_data,precision,delimiter)
|
||||
stroke_horizontal_rule
|
||||
# move_down 10
|
||||
sql = "SELECT SUM(payment_amount)
|
||||
@@ -419,28 +408,28 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
if sale_data.amount_received > 0
|
||||
if sale_data.amount_received > 0
|
||||
y_position = cursor
|
||||
move_down line_move
|
||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||
text "Change Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
#move_down line_move
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# show member information
|
||||
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
if rebate_amount != nil
|
||||
if rebate_amount != nil
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
total = 0
|
||||
@@ -467,10 +456,10 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
# Total Rebate Amount if birthday
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
|
||||
rebate_balance = rebate_balance + res["deposit"]
|
||||
@@ -480,9 +469,9 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
#end Total rebate if birthday
|
||||
end
|
||||
|
||||
@@ -492,7 +481,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
if current_balance != nil
|
||||
@@ -502,10 +491,10 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "Old Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -515,7 +504,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
total_balance = total_balance + res["balance"]
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
move_down line_move
|
||||
@@ -524,10 +513,10 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def customer(customer_name)
|
||||
@@ -554,8 +543,8 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
text "(" + "#{ number_format(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
end
|
||||
@@ -570,8 +559,8 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
text "#{number_format(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
end
|
||||
@@ -582,9 +571,9 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
text "Other Charges", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(other_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(other_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
move_down line_move
|
||||
end
|
||||
|
||||
#individual payment per person
|
||||
@@ -604,7 +593,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 15
|
||||
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -623,17 +612,17 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
JOIN sale_audits sa
|
||||
ON SUBSTRING_INDEX(sa.remark,'||',1)=sale_payment_id
|
||||
where sa.sale_id='#{sale_data.sale_id}')) = 0
|
||||
THEN payment_method!='creditnote' ELSE 1 END) AND sale_id = ?", sale_data.sale_id).each do |payment|
|
||||
THEN payment_method!='creditnote' ELSE 1 END) AND sale_id = ?", sale_data.sale_id).each do |payment|
|
||||
if payment.payment_method == "creditnote"
|
||||
|
||||
y_position = cursor
|
||||
stroke_horizontal_rule
|
||||
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||
move_down 70
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||
move_down 73
|
||||
text "Approved By" , :size => self.item_font_size,:align => :center
|
||||
@@ -650,8 +639,8 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
move_down 70
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
if sale_data.payment_status == "foc"
|
||||
|
||||
if sale_data.payment_status == "foc"
|
||||
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||
move_down 73
|
||||
text "Acknowledged By" , :size => self.item_font_size,:align => :center
|
||||
@@ -661,10 +650,10 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
move_down 73
|
||||
text "Approved By" , :size => self.item_font_size,:align => :center
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def shop_note(shop)
|
||||
@@ -674,8 +663,8 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
|
||||
move_down line_move
|
||||
y_position = cursor
|
||||
|
||||
text "#{shop.note}", :size => self.item_font_size,:align => :left
|
||||
|
||||
text "#{shop.note}", :size => self.item_font_size,:align => :left
|
||||
|
||||
move_down line_move
|
||||
end
|
||||
@@ -688,10 +677,10 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.item_description_width) do
|
||||
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
move_down line_move
|
||||
end
|
||||
@@ -729,7 +718,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width) do
|
||||
text "Card Balance: ",:style => :bold, :size => header_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{card_balance_amount}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -753,4 +742,4 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
end
|
||||
return status
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class ReceiptBillOrderPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
||||
|
||||
@@ -27,11 +27,6 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
#setting page margin and width
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != ""
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
@@ -47,19 +42,13 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header(shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
cashier_info(sale_data, customer_name, latest_order_no,order_reservation)
|
||||
line_items(sale_items,printer_settings.precision,delimiter,order_reservation)
|
||||
all_total(sale_data,printer_settings.precision,delimiter,order_reservation)
|
||||
line_items(sale_items,precision,delimiter,order_reservation)
|
||||
all_total(sale_data,precision,delimiter,order_reservation)
|
||||
|
||||
footer(printed_status)
|
||||
end
|
||||
@@ -78,13 +67,13 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
|
||||
def cashier_info(sale_data, customer_name, latest_order_no,order_reservation)
|
||||
move_down line_move
|
||||
|
||||
|
||||
# move_down 2
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width , :height => self.item_height) do
|
||||
text "Order Date " , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{order_reservation.created_at.strftime('%d-%m-%Y %H:%M %p')}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -92,7 +81,7 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width , :height => self.item_height) do
|
||||
text "Requested Date Time " , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{order_reservation.requested_time.strftime('%d-%m-%Y %H:%M %p')}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -100,7 +89,7 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width , :height => self.item_height) do
|
||||
text "Payment Type" , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{order_reservation.payment_type}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -108,7 +97,7 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width , :height => self.item_height) do
|
||||
text "#{customer_name} " , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Online Order", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -167,14 +156,14 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
total_qty = 0.0
|
||||
show_price = Lookup.find_by_lookup_type("show_price")
|
||||
sale_items.each do |item|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
|
||||
if item.status != 'Discount' && item.qty > 0
|
||||
if !show_price.nil? && show_price.value.to_i > 0 && item.price == 0
|
||||
total_qty += item.qty
|
||||
total_qty += item.qty
|
||||
else
|
||||
if item.price != 0
|
||||
total_qty += item.qty
|
||||
total_qty += item.qty
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -191,7 +180,7 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
qty = item.qty
|
||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||
price = item.unit_price
|
||||
|
||||
|
||||
# end
|
||||
if !show_price.nil? && show_price.value.to_i>0
|
||||
item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||
@@ -209,8 +198,8 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
|
||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(order_reservation.total_amount, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(order_reservation.total_amount, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
if !order_reservation.delivery_type.nil? && order_reservation.delivery_fee.to_f > 0
|
||||
y_position = cursor
|
||||
@@ -219,27 +208,27 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.description_width - 48,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(order_reservation.delivery_fee, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
text "#{number_format(order_reservation.delivery_fee, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
if order_reservation.total_tax > 0
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.item_description_width , :height => self.item_height) do
|
||||
text "Tax " , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
end
|
||||
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(order_reservation.total_tax, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
text "#{number_format(order_reservation.total_tax, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.item_description_width , :height => self.item_height) do
|
||||
text "Convenience Charges " , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(order_reservation.convenience_charge, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(order_reservation.convenience_charge, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
if order_reservation.discount_amount > 0
|
||||
@@ -249,9 +238,9 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(order_reservation.discount_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
text "#{number_format(order_reservation.discount_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#Change items rows
|
||||
@@ -277,10 +266,10 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.item_width) do
|
||||
text "#{product_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||
text_box "#{number_format(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
if show_alt_name
|
||||
if !(item.product_alt_name).empty?
|
||||
@@ -309,11 +298,11 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(order_reservation.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
end
|
||||
text "#{number_format(order_reservation.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
|
||||
# sale_payment(sale_data,precision,delimiter)
|
||||
# sale_payment(sale_data,precision,delimiter)
|
||||
end
|
||||
|
||||
#Change Footer
|
||||
@@ -326,10 +315,10 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width) do
|
||||
text "#{printed_status}",:style => :bold, :size => header_font_size - 1,:align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size - 1,:align => :left
|
||||
end
|
||||
end
|
||||
|
||||
move_down line_move
|
||||
end
|
||||
@@ -351,4 +340,4 @@ class ReceiptBillOrderPdf < Prawn::Document
|
||||
end
|
||||
return status
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# require 'prawn/qrcode'
|
||||
require 'prawn/measurement_extensions'
|
||||
class ReceiptBillPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
||||
|
||||
@@ -29,11 +29,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
#setting page margin and width
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != ""
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
@@ -49,23 +44,17 @@ class ReceiptBillPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header(shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
cashier_info(sale_data, customer_name, latest_order_no)
|
||||
line_items(sale_items,printer_settings.precision,delimiter)
|
||||
all_total(sale_data,printer_settings.precision,delimiter)
|
||||
line_items(sale_items,precision,delimiter)
|
||||
all_total(sale_data,precision,delimiter)
|
||||
|
||||
|
||||
if member_info != nil
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance)
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
end
|
||||
|
||||
customer(customer_name)
|
||||
@@ -82,19 +71,19 @@ class ReceiptBillPdf < Prawn::Document
|
||||
#end card blanace amount
|
||||
|
||||
if discount_price_by_accounts.length > 0 && shop_details.show_account_info
|
||||
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
||||
discount_account(discount_price_by_accounts,precision,delimiter)
|
||||
end
|
||||
|
||||
if shop_details.show_account_info
|
||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||
items_account(item_price_by_accounts,precision,delimiter)
|
||||
if other_charges_amount
|
||||
show_other_charges_amount(other_charges_amount,printer_settings.precision,delimiter)
|
||||
show_other_charges_amount(other_charges_amount,precision,delimiter)
|
||||
end
|
||||
end
|
||||
|
||||
#start for individual payment
|
||||
if !sale_data.equal_persons.nil?
|
||||
individual_payment(sale_data,sale_data.equal_persons, printer_settings.precision, delimiter)
|
||||
individual_payment(sale_data,sale_data.equal_persons, precision, delimiter)
|
||||
end
|
||||
#end for individual payment
|
||||
|
||||
@@ -273,8 +262,8 @@ class ReceiptBillPdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
|
||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(@sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(@sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
end
|
||||
|
||||
def item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||
@@ -298,9 +287,9 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{product_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
if show_alt_name
|
||||
if !(item.product_alt_name).empty?
|
||||
@@ -330,7 +319,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{ dis_type }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||
text "( #{number_format(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
service_tax_desc = ""
|
||||
@@ -355,14 +344,14 @@ class ReceiptBillPdf < Prawn::Document
|
||||
sale_data.sale_taxes.each do |st|
|
||||
if (st.tax_name.include? "Service")
|
||||
service_tax_desc = st.tax_name
|
||||
service_tax_amount = number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
|
||||
service_tax_amount = number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
|
||||
if incl_tax
|
||||
service_tax_rate = st.tax_rate.to_i
|
||||
end
|
||||
end
|
||||
if (st.tax_name.include? "Commercial")
|
||||
com_tax_desc = st.tax_name
|
||||
com_tax_amount = number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
|
||||
com_tax_amount = number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
|
||||
if incl_tax
|
||||
com_tax_rate = st.tax_rate.to_i
|
||||
end
|
||||
@@ -374,7 +363,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{ service_tax_desc } (#{incl_tax} #{ service_tax_rate }%)", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(service_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(service_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
y_position = cursor
|
||||
@@ -391,7 +380,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{ com_tax_desc } (#{incl_tax} #{ com_tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(com_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(com_tax_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
else
|
||||
sale_data.sale_taxes.each do |st|
|
||||
@@ -402,7 +391,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -439,7 +428,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
text "#{number_format(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
|
||||
@@ -480,7 +469,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
@@ -491,7 +480,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Change Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
# move_down line_move
|
||||
end
|
||||
@@ -526,7 +515,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
@@ -539,7 +528,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
#end Total rebate if birthday
|
||||
@@ -551,7 +540,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
if current_balance != nil
|
||||
@@ -561,7 +550,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Old Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -583,7 +572,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -615,7 +604,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||
text "(" + "#{ number_format(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
@@ -631,7 +620,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
@@ -643,7 +632,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Other Charges", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(other_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(other_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
@@ -666,7 +655,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 15
|
||||
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class ReceiptBillStarPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
||||
|
||||
@@ -28,11 +28,6 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
#setting page margin and width
|
||||
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != ""
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
@@ -48,23 +43,17 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header(shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
cashier_info(sale_data, customer_name, latest_order_no)
|
||||
line_items(sale_items,printer_settings.precision,delimiter)
|
||||
all_total(sale_data,printer_settings.precision,delimiter)
|
||||
line_items(sale_items,precision,delimiter)
|
||||
all_total(sale_data,precision,delimiter)
|
||||
|
||||
|
||||
if member_info != nil
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance)
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
end
|
||||
|
||||
customer(customer_name)
|
||||
@@ -81,19 +70,19 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
#end card blanace amount
|
||||
|
||||
if discount_price_by_accounts.length > 0 && shop_details.show_account_info
|
||||
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
||||
discount_account(discount_price_by_accounts,precision,delimiter)
|
||||
end
|
||||
|
||||
if shop_details.show_account_info
|
||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||
items_account(item_price_by_accounts,precision,delimiter)
|
||||
if other_charges_amount
|
||||
show_other_charges_amount(other_charges_amount,printer_settings.precision,delimiter)
|
||||
show_other_charges_amount(other_charges_amount,precision,delimiter)
|
||||
end
|
||||
end
|
||||
|
||||
#start for individual payment
|
||||
if !sale_data.equal_persons.nil?
|
||||
individual_payment(sale_data,sale_data.equal_persons, printer_settings.precision, delimiter)
|
||||
individual_payment(sale_data,sale_data.equal_persons, precision, delimiter)
|
||||
end
|
||||
#end for individual payment
|
||||
|
||||
@@ -268,8 +257,8 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
|
||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
end
|
||||
|
||||
def item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||
@@ -293,9 +282,9 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{product_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_format(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
if show_alt_name
|
||||
if !(item.product_alt_name).empty?
|
||||
@@ -325,7 +314,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{ dis_type }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||
text "( #{number_format(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
if sale_data.sale_taxes.length > 0
|
||||
@@ -342,7 +331,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -378,7 +367,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
text "#{number_format(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
|
||||
@@ -419,7 +408,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
@@ -430,7 +419,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "Change Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
# move_down line_move
|
||||
end
|
||||
@@ -465,7 +454,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
@@ -478,7 +467,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
#end Total rebate if birthday
|
||||
@@ -490,7 +479,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
if current_balance != nil
|
||||
@@ -500,7 +489,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "Old Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -522,7 +511,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -554,7 +543,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||
text "(" + "#{ number_format(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
@@ -570,7 +559,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
@@ -582,7 +571,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "Other Charges", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(other_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(other_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
@@ -605,7 +594,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 15
|
||||
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
text "#{number_format(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class SaleItemsPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||
|
||||
def initialize(printer_settings, shop_details, period, type, account, from_date, to_date, shift, sale_items, total_other_charges)
|
||||
@@ -41,17 +41,6 @@ class SaleItemsPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
#check delimiter
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header( shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class SaleItemsStarPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include NumberFormattable
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||
|
||||
def initialize(printer_settings, shop_details, period, type, account, from_date, to_date, shift, sale_items, total_other_charges)
|
||||
@@ -41,17 +41,6 @@ class SaleItemsStarPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
#precision checked
|
||||
if printer_settings.precision.to_i > 2
|
||||
printer_settings.precision = 2
|
||||
end
|
||||
#check delimiter
|
||||
if printer_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
header( shop_details)
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
@@ -3,18 +3,6 @@
|
||||
<!-- <h2><%= t :dashboard %></h2> -->
|
||||
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
|
||||
</div>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 col-mbl-view">
|
||||
@@ -211,19 +199,19 @@
|
||||
<tr>
|
||||
<% revenue = @summ_sale.total_amount - @summ_sale.total_discount%>
|
||||
<td><%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : </td>
|
||||
<td align="right"><%= number_with_precision( revenue, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td align="right"><%= number_format( revenue, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td align="right"><%= number_format( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td align="right"><%= number_format( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total_sale") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
<td align="right"><%= number_format( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table">
|
||||
@@ -240,7 +228,7 @@
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<% pay_mth = payment.payment_method %>
|
||||
<%= number_with_precision(data[""+pay_mth+""], precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
<%= number_format(data[""+pay_mth+""], precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -253,7 +241,7 @@
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
|
||||
<td align="right">
|
||||
<%= number_with_precision(total_card["card"], precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
<%= number_format(total_card["card"], precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -6,18 +6,6 @@
|
||||
<!-- <h2><%= t :dashboard %></h2> -->
|
||||
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
|
||||
</div>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
@@ -91,19 +79,19 @@
|
||||
<tr>
|
||||
<% revenue = @summ_sale.total_amount - @summ_sale.total_discount%>
|
||||
<td><%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : </td>
|
||||
<td align="right"><%= number_with_precision( revenue, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td align="right"><%= number_format( revenue, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td align="right"><%= number_format( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
<td align="right"><%= number_format( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t :sale %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
<td align="right"><%= number_format( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table">
|
||||
|
||||
@@ -2,20 +2,6 @@
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<% if !@print_settings.nil? %>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
@@ -96,7 +82,7 @@
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= number_with_precision(sub_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= number_format(sub_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></strong></td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td class="charges-name"><strong>Food:</strong></td>
|
||||
@@ -113,15 +99,15 @@
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
|
||||
<td class="item-attr">(<strong id="order-discount"><%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong>)</td>
|
||||
<td class="item-attr">(<strong id="order-discount"><%= number_format(@sale_data.total_discount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></strong>)</td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_format(@sale_data.total_tax, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></strong></td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -283,6 +269,8 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
var totalAmount = <%= sub_total %>;
|
||||
var totalDiscount = <%= @sale_data.total_discount %>
|
||||
var precision = <%= precision %>;
|
||||
var originalAmount = totalAmount;
|
||||
var originalDiscount = totalDiscount;
|
||||
$(document).ready(function(){
|
||||
setHeaderBreadCrumb(_DISCOUNTS_);
|
||||
/* check webview loaded*/
|
||||
@@ -306,13 +294,13 @@ var precision = <%= precision %>;
|
||||
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
var original_value = 0;
|
||||
original_value = $('#discount-amount').val();
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
if (parseFloat(original_value) == 0){
|
||||
$('#discount-amount').val(input_value);
|
||||
}
|
||||
else{
|
||||
@@ -329,7 +317,7 @@ var precision = <%= precision %>;
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
break;
|
||||
case 'clr':
|
||||
$('#discount-amount').val("0.0");
|
||||
$('#discount-amount').val("0");
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
@@ -379,7 +367,7 @@ var precision = <%= precision %>;
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var sub_total = parseFloat($('#order-sub-total').text());
|
||||
var sub_total = totalAmount;
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
if(discount_value!=""){
|
||||
@@ -449,18 +437,15 @@ var precision = <%= precision %>;
|
||||
// Remove selected discount items
|
||||
$("#remove-item").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
// var total = 0;
|
||||
|
||||
$('.item-row.new-discount').each(function(i){
|
||||
var amount = parseFloat($(this).find('#item-total-price').text());
|
||||
totalAmount += Math.abs(amount)
|
||||
// total = total + Math.abs(amount);
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$("#order-sub-total").text(totalAmount);
|
||||
$("#order-discount").text(totalDiscount.toFixed(<%= precision.to_i %>));
|
||||
$("#order-sub-total").text(originalAmount.toFixed(<%= precision.to_i %>));
|
||||
$("#order-discount").text(originalDiscount.toFixed(<%= precision.to_i %>));
|
||||
});
|
||||
|
||||
// Pay Discount for Payment
|
||||
@@ -472,8 +457,8 @@ var precision = <%= precision %>;
|
||||
$("#loading_wrapper").show();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_items = JSON.stringify(get_new_discount_item_rows());
|
||||
var overall_discount = $("#order-discount").text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var overall_discount = totalDiscount;
|
||||
var sub_total = totalAmount;
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
var params = { 'cashier_type' : cashier_type,'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
||||
@@ -578,7 +563,7 @@ var precision = <%= precision %>;
|
||||
$("#member-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var sub_total = totalAmount;
|
||||
var ajax_url = "/origami/" + sale_id + "/member_discount";
|
||||
|
||||
// Selected Account
|
||||
@@ -702,9 +687,7 @@ function get_selected_account_types(){
|
||||
|
||||
/* Calculate Overall Discount*/
|
||||
function calculate_overall_discount(type, amount){
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text()) + parseFloat($("#order-discount").text());
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var sub_total = totalAmount;
|
||||
var total_discount = 0;
|
||||
|
||||
// For Net Pay
|
||||
@@ -724,18 +707,16 @@ function calculate_overall_discount(type, amount){
|
||||
});
|
||||
}
|
||||
else{
|
||||
total_discount = Math.round(totalAmount * amount / 100 * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
total_discount = Math.round(sub_total * amount / 100 * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
}
|
||||
}
|
||||
|
||||
sub_total = parseFloat(totalAmount) - parseFloat(total_discount)
|
||||
|
||||
totalDiscount = total_discount
|
||||
$("#order-discount").text(parseFloat(total_discount).toFixed(<%= precision.to_i %>));
|
||||
}
|
||||
|
||||
/* Calculate Items Discount*/
|
||||
function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var origin_sub_total = totalAmount;
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var total_discount = 0;
|
||||
@@ -749,17 +730,6 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
dis_amount = -Math.round(amount * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
if(parseFloat(amount) > parseFloat(sale_items[i].price)){
|
||||
arrItemName += ", " + sale_items[i].name;
|
||||
}else{
|
||||
@@ -773,7 +743,6 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -789,26 +758,6 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
|
||||
}
|
||||
|
||||
// No Needs For Auto Selected
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
|
||||
sub_total = parseFloat(origin_sub_total) - parseFloat(total_discount);
|
||||
totalAmount = sub_total
|
||||
$("#order-sub-total").text(parseFloat(sub_total).toFixed(<%= precision.to_i %>));
|
||||
@@ -829,18 +778,6 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
dis_amount = -Math.round(sale_items[i].price * amount / 100 * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
|
||||
@@ -851,35 +788,12 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
total_discount = total_discount - dis_amount;
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}
|
||||
// }
|
||||
}
|
||||
sub_total = parseFloat(origin_sub_total) + parseFloat(total_discount);
|
||||
totalAmount = sub_total
|
||||
$("#order-sub-total").text(parseFloat(sub_total).toFixed(<%= precision.to_i %>));
|
||||
}
|
||||
}
|
||||
// No Needs For Auto Selected
|
||||
// Check account types exists
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// console.log(account_types);
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
@@ -2,20 +2,6 @@
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<% if !@print_settings.nil? %>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% end %>
|
||||
<div class="row clearfix">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
@@ -57,14 +43,14 @@
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane dining active " id="tables" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @tables.each do |table| %>
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% else %>
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %> <br>
|
||||
<%= table.zone.name %>
|
||||
@@ -72,12 +58,12 @@
|
||||
<div style="font-size:12px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% else %>
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %> <br>
|
||||
<%= table.zone.name %>
|
||||
@@ -111,7 +97,7 @@
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= room.name %> <br>
|
||||
<%= room.zone.name %>
|
||||
<%= room.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -123,7 +109,7 @@
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= room.name %> <br>
|
||||
<%= room.zone.name %>
|
||||
<%= room.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -132,8 +118,8 @@
|
||||
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %> <br>
|
||||
<%= room.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %> hide">
|
||||
<%= room.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %> hide">
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -160,8 +146,8 @@
|
||||
<% else %>
|
||||
<% order_status = order.status %>
|
||||
<% end %>
|
||||
<%= order.order_id %>
|
||||
<% if !order_status.empty? %>| <%= order_status %>
|
||||
<%= order.order_id %>
|
||||
<% if !order_status.empty? %>| <%= order_status %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -193,7 +179,7 @@
|
||||
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
|
||||
</thead>
|
||||
<tbody class="tbd_credit_lists"></tbody>
|
||||
@@ -245,7 +231,7 @@
|
||||
<% else %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="row p-l-5 p-r-5">
|
||||
@@ -335,8 +321,8 @@
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
||||
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
||||
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
|
||||
<br>
|
||||
<span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
@@ -345,17 +331,17 @@
|
||||
<br><span class="font-13"> <%= set_item_option %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
</span>
|
||||
<% end
|
||||
sub_total += set_item_prices
|
||||
end %>
|
||||
</td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -364,7 +350,7 @@
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="sub-total"><%= number_with_precision(sub_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
|
||||
<td class="item-attr"><strong id="sub-total"><%= number_format(sub_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
|
||||
@@ -373,7 +359,7 @@
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
|
||||
<td class="item-attr"><strong id="order-discount">(<%= number_with_precision(@obj_sale.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= number_format(@obj_sale.total_discount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>)</strong></td>
|
||||
</tr>
|
||||
<% if @status_sale == "sale" %>
|
||||
<tr>
|
||||
@@ -396,15 +382,15 @@
|
||||
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@obj_sale.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_format(@obj_sale.total_tax, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= number_with_precision(@obj_sale.rounding_adjustment, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= number_format(@obj_sale.rounding_adjustment, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= number_with_precision(@obj_sale.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= number_format(@obj_sale.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="rebate_amount"></tr>
|
||||
@@ -431,10 +417,10 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
||||
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
|
||||
%>
|
||||
%>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
@@ -444,8 +430,8 @@
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
</span>
|
||||
<% end
|
||||
sub_total += set_item_prices
|
||||
end %>
|
||||
</td>
|
||||
@@ -456,7 +442,7 @@
|
||||
end
|
||||
%>
|
||||
</table> -->
|
||||
|
||||
|
||||
<!-- <button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button> -->
|
||||
<% end %>
|
||||
<% if @sale_array.size > 1 %>
|
||||
@@ -496,7 +482,7 @@
|
||||
<!-- <a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a> -->
|
||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||
<% if @dining.status != "available" %>
|
||||
<% if @dining.status != "available" %>
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<%if !@order_items.empty? %>
|
||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
|
||||
@@ -526,7 +512,7 @@
|
||||
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button> -->
|
||||
<% if current_login_employee.role == "cashier" %>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<% else %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
@@ -535,9 +521,9 @@
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
|
||||
|
||||
<% if !@split_bill.nil? %>
|
||||
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
|
||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||
@@ -545,19 +531,19 @@
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<!-- first bill not used in cloud -->
|
||||
|
||||
|
||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal" data-order="<%= existing_order %>">First Bill</button>
|
||||
<%else%>
|
||||
<button type="button" id="first_bill" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
|
||||
<%end%>
|
||||
|
||||
<button type="button" id="pay" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
|
||||
<!-- <button type="button" id="kbz_query" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">KBZ Query</button> -->
|
||||
|
||||
<!--<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
||||
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
||||
<% end %>-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -583,7 +569,7 @@
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<button class='btn btn-md waves-effect btn-link payment-btn-box payment_btn bg-green' data-type='Credit' data-value='Credit'>Credit</button>
|
||||
</div>
|
||||
|
||||
|
||||
<% @payment_methods.each_with_index do |pay, pay_index| %>
|
||||
<%if (pay_index+1)%3 == 0 %>
|
||||
<div class="row clearfix"></div>
|
||||
@@ -625,7 +611,7 @@
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -638,7 +624,7 @@
|
||||
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
|
||||
<div class="row bottom p-l-15 p-r-15 m-t-10">
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
|
||||
@@ -657,7 +643,7 @@
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
|
||||
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -690,7 +676,7 @@
|
||||
count += 1 %>
|
||||
|
||||
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
|
||||
<td><%= count %></td>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
@@ -701,10 +687,10 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance|
|
||||
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
|
||||
%>
|
||||
%>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
@@ -714,8 +700,8 @@
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
</span>
|
||||
<% end
|
||||
sub_total += set_item_prices
|
||||
end %>
|
||||
</td>
|
||||
@@ -823,7 +809,7 @@
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
|
||||
discount="<%= @membership.discount%>"
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
if (discount) {
|
||||
@@ -887,7 +873,7 @@
|
||||
} else {
|
||||
var sale_id = "<%= @dining.id %>";
|
||||
}
|
||||
//var table_id = $('.tables').attr("data-id");
|
||||
//var table_id = $('.tables').attr("data-id");
|
||||
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys"
|
||||
});
|
||||
|
||||
@@ -989,22 +975,22 @@
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// click select option icon for add
|
||||
$(document).on('click', '.payment_btn', function(event){
|
||||
// click select option icon for add
|
||||
$(document).on('click', '.payment_btn', function(event){
|
||||
active = $(this).hasClass('selected-payment');
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
group = $(this).data('group');
|
||||
payments = $(".payment_btn");
|
||||
|
||||
if (active) {
|
||||
if (active) {
|
||||
$(this).removeClass('selected-payment');
|
||||
}else{
|
||||
}else{
|
||||
$(this).addClass('selected-payment');
|
||||
}
|
||||
}); //End selecct attribute buttom
|
||||
@@ -1026,7 +1012,7 @@
|
||||
if(!location.pathname.includes("credit_payment")){
|
||||
calculate_member_discount(sale_id,"Cash",tax_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
@@ -1045,7 +1031,7 @@
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function calculate_member_discount(sale_id,type,tax_type) {
|
||||
@@ -1060,10 +1046,10 @@
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
|
||||
async: false,
|
||||
success:function(result){
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
$('#pay').on('click', function () {
|
||||
@@ -1137,11 +1123,11 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
swal("Opps","There is no orders!","warning");
|
||||
}
|
||||
@@ -1151,7 +1137,7 @@
|
||||
$('#split_bills').click(function(){
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/" + cashier_type +"/split_bills";
|
||||
});
|
||||
});
|
||||
|
||||
$('#move').on('click', function () {
|
||||
if($('#move').is(":visible")) {
|
||||
@@ -1236,7 +1222,7 @@
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#commissions').on('click', function () {
|
||||
@@ -1285,7 +1271,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
@@ -1303,7 +1289,7 @@
|
||||
window.location.href = '/origami/addorders/' + dining_id;
|
||||
});
|
||||
|
||||
/* check in process */
|
||||
/* check in process */
|
||||
$('#check_in').on('click',function(){
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
|
||||
@@ -1394,7 +1380,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function check_emp_access_code(access_code,type) {
|
||||
@@ -1460,11 +1446,11 @@
|
||||
type: "POST",
|
||||
url: "/origami/payment/"+cashier_type+"/change_tax",
|
||||
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: tax_type},
|
||||
success:function(data){
|
||||
success:function(data){
|
||||
if(data.status){
|
||||
localStorage.setItem("tax_type", tax_type);
|
||||
window.location.href = '/origami/table/'+dining_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
|
||||
@@ -2,20 +2,6 @@
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<% if !@print_settings.nil? %>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% end %>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
@@ -78,9 +64,9 @@
|
||||
<% sub_total += sale_item.price%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class="item-name"><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%></td>
|
||||
<td class="item-name"><%=sale_item.product_name%>@<%=number_format( sale_item.unit_price, precision: precision.to_i )%></td>
|
||||
<td class="item-attr"><%=sale_item.qty%></td>
|
||||
<td class="item-attr"><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%></td>
|
||||
<td class="item-attr"><%=(number_format(sale_item.price, precision: precision.to_i ))%></td>
|
||||
</tr>
|
||||
<%end %>
|
||||
</tbody>
|
||||
@@ -93,7 +79,7 @@
|
||||
<tfooter>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total</strong></td>
|
||||
<td class="item-attr"><strong><span id="sub-total"><%=number_with_precision(sub_total, precision: precision.to_i)%></span></strong></td>
|
||||
<td class="item-attr"><strong><span id="sub-total"><%=number_format(sub_total, precision: precision.to_i)%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
@@ -101,7 +87,7 @@
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>(Discount)</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong><span>(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</span></strong></td>
|
||||
<td class="item-attr"><strong><span>(<%= number_format(@sale_data.total_discount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>)</span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name">
|
||||
@@ -122,20 +108,20 @@
|
||||
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="item-attr"><strong><span id="total_tax"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
<td class="item-attr"><strong><span id="total_tax"><%= number_format(@sale_data.total_tax, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong><%= number_with_precision(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||
<td class="item-attr"><strong><%= number_format(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total</strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<%if @balance > 0%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong><%= @accountable_type %></strong></td>
|
||||
<td class="item-attr"><strong><span><%=number_with_precision(@balance, precision: precision.to_i )%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%=number_format(@balance, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@individual_total[0].nil? %>
|
||||
@@ -149,7 +135,7 @@
|
||||
<td class="charges-name">
|
||||
<strong>Amount Due (per person)</strong>
|
||||
</td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@individual_total[0]['per_person_amount'], precision: precision.to_i )%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_format(@individual_total[0]['per_person_amount'], precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tfooter>
|
||||
@@ -171,16 +157,16 @@
|
||||
<strong>
|
||||
<span id="grand_total" class="hidden">
|
||||
<% if @sale_payment.nil? %>
|
||||
<%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i)%>
|
||||
<%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
|
||||
<% else %>
|
||||
<%= number_with_precision(@sale_payment[0].payment_amount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i)%>
|
||||
<%= number_format(@sale_payment[0].payment_amount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
|
||||
<% end %>
|
||||
</span>
|
||||
<span id="amount_due">
|
||||
<% if @sale_payment.nil? %>
|
||||
<%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
|
||||
<%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
|
||||
<% else %>
|
||||
<%= number_with_precision(@sale_payment[0].payment_amount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i)%>
|
||||
<%= number_format(@sale_payment[0].payment_amount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
|
||||
<% end %>
|
||||
</span>
|
||||
</strong>
|
||||
@@ -190,13 +176,13 @@
|
||||
<div class="row payment cash-color p-l-5 p-r-5">
|
||||
<div class="col-md-8">Cash</div>
|
||||
<div class="col-md-4" id="cash" >
|
||||
<%= number_with_precision(@cash, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
|
||||
<%= number_format(@cash, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
|
||||
</div>
|
||||
</div>
|
||||
<% if @sale_payment.nil? && @cashier_type != "food_court" %>
|
||||
<div class="row payment credit-color p-l-5 p-r-5" id="credit_payment" >
|
||||
<div class="col-md-8">Credit</div>
|
||||
<div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="credit"><%= number_format(@credit, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="col-md-4 hidden" id="credit">0</div>
|
||||
@@ -205,21 +191,21 @@
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments (KBZ Pay)</div>
|
||||
<div class="col-md-4" id="others">
|
||||
<%= number_with_precision(@kbz_pay_amount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>
|
||||
<%= number_format(@kbz_pay_amount, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 && @giftvouchercount == 0.0 %>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="others">
|
||||
<%= number_with_precision(@other, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>
|
||||
<%= number_format(@other, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="other_payment_amount">
|
||||
<%= number_with_precision(@other_payment, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>
|
||||
<%= number_format(@other_payment, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -231,9 +217,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<% if @other != 0.0 %>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= number_with_precision(@other, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= number_format(@other, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="others"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="others"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -242,9 +228,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Redeem</div>
|
||||
<% if @ppamount != 0.0 %>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(@ppamount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="ppamount"><%= number_format(@ppamount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="ppamount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -253,9 +239,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">VISA</div>
|
||||
<% if @visacount != 0.0 %>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= number_with_precision(@visacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= number_format(@visacount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="visacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="visacount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -264,9 +250,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<% if @jcbcount != 0.0 %>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_with_precision(@jcbcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_format(@jcbcount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="jcbcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="jcbcount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -275,9 +261,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MASTER</div>
|
||||
<% if @mastercount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= number_with_precision(@mastercount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= number_format(@mastercount, precision: precision.to_i) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="mastercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="mastercount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- <br> -->
|
||||
@@ -287,9 +273,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">UNIONPAY</div>
|
||||
<% if @unionpaycount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_with_precision(@unionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_format(@unionpaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="unionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="unionpaycount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -298,9 +284,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Alipay</div>
|
||||
<% if @alipaycount != 0.0 %>
|
||||
<div class="col-md-4 alipay is_card" id="alipaycount"><%= number_with_precision(@alipaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 alipay is_card" id="alipaycount"><%= number_format(@alipaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="alipaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="alipaycount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -309,9 +295,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">PAYMAL</div>
|
||||
<% if @paymalcount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="paymalcount"><%= number_with_precision(@paymalcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 master is_card" id="paymalcount"><%= number_format(@paymalcount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="paymalcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="paymalcount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- DINGA -->
|
||||
@@ -319,9 +305,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">DINGA</div>
|
||||
<% if @dingacount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="dingacount"><%= number_with_precision(@dingacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 master is_card" id="dingacount"><%= number_format(@dingacount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="dingacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="dingacount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -330,9 +316,9 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JUNCTION PAY</div>
|
||||
<% if @junctionpaycount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="junctionpaycount"><%= number_with_precision(@junctionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 master is_card" id="junctionpaycount"><%= number_format(@junctionpaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="junctionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="junctionpaycount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -341,15 +327,15 @@
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">GIFT VOUCHER</div>
|
||||
<% if @giftvouchercount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="giftvouchercount"><%= number_with_precision(@giftvouchercount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4 master is_card" id="giftvouchercount"><%= number_format(@giftvouchercount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="giftvouchercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<div class="col-md-4" id="giftvouchercount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="row m-l-5 m-r-5">
|
||||
<div class="col-md-8"><strong class='amount_balance'>Balance</strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></span></strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></span></strong></div>
|
||||
</div>
|
||||
<!-- <br> -->
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,5 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<% if !@print_settings.nil? %>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% end %>
|
||||
|
||||
<div class="col-lg-4 col-md-6 col-sm-6">
|
||||
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
|
||||
@@ -89,7 +75,7 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= number_with_precision(sale_item.price, precision: precision.to_i ) %></td>
|
||||
<td class='item-attr'><%= number_format(sale_item.price, precision: precision.to_i ) %></td>
|
||||
</tr>
|
||||
<%
|
||||
# end
|
||||
@@ -108,7 +94,7 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= number_with_precision(order_item.qty*order_item.price, precision: precision.to_i ) %></td>
|
||||
<td class='item-attr'><%= number_format(order_item.qty*order_item.price, precision: precision.to_i ) %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
@@ -124,7 +110,7 @@
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><span id="sub_total"><%= number_with_precision(sub_total, precision: precision.to_i ) %></span></strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><span id="sub_total"><%= number_format(sub_total, precision: precision.to_i ) %></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
@@ -132,19 +118,19 @@
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= number_with_precision(@sale.total_discount, precision: precision.to_i ) rescue 0%>)</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= number_format(@sale.total_discount, precision: precision.to_i ) rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@sale.total_tax, precision: precision.to_i ) rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_format(@sale.total_tax, precision: precision.to_i ) rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= number_with_precision(@sale.rounding_adjustment, precision: precision.to_i ) rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= number_format(@sale.rounding_adjustment, precision: precision.to_i ) rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><span id="grand_total"><%= number_with_precision(@sale.grand_total, precision: precision.to_i ) rescue 0%></span></strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><span id="grand_total"><%= number_format(@sale.grand_total, precision: precision.to_i ) rescue 0%></span></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
@@ -163,7 +149,7 @@
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
|
||||
@@ -173,7 +159,7 @@
|
||||
<% else %>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
||||
<button type="button" data-toggle="modal" data-target="#voidModal" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -197,8 +183,8 @@
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
@@ -228,7 +214,7 @@
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -252,7 +238,7 @@
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -266,7 +252,7 @@
|
||||
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
|
||||
<div class="row bottom p-l-15 p-r-15 m-t-10">
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
|
||||
@@ -285,7 +271,7 @@
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
|
||||
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -298,7 +284,7 @@ $(document).ready(function(){
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
|
||||
discount="<%= @membership.discount%>"
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
if (discount) {
|
||||
@@ -339,7 +325,7 @@ $(document).ready(function(){
|
||||
// }
|
||||
// location.reload();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
// Print for first bill
|
||||
@@ -376,9 +362,9 @@ $(document).ready(function(){
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(".choose_payment").on('click', function () {
|
||||
@@ -389,10 +375,10 @@ $(document).ready(function(){
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
|
||||
|
||||
}else{
|
||||
calculate_member_discount(sale_id,"Cash");
|
||||
}
|
||||
}
|
||||
}
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
@@ -411,7 +397,7 @@ $(document).ready(function(){
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function calculate_member_discount(sale_id,type) {
|
||||
@@ -426,7 +412,7 @@ $(document).ready(function(){
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
||||
async: false,
|
||||
success:function(result){
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -439,7 +425,7 @@ $('#pay').on('click',function() {
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: url,
|
||||
// success:function(result){
|
||||
// success:function(result){
|
||||
// // console.log(result);
|
||||
// }
|
||||
// });
|
||||
@@ -453,7 +439,7 @@ $('#back').on('click',function(){
|
||||
}else{
|
||||
window.location.href = '/origami/table/<%= @table.id %>';
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#void').on('click',function () {
|
||||
@@ -487,7 +473,7 @@ $('#void').on('click',function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning");
|
||||
}
|
||||
@@ -505,12 +491,12 @@ $('#foc').click(function() {
|
||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':'cashier','access_code':access_code };
|
||||
// console.log(sale_id);
|
||||
if(sale_id != ''){
|
||||
if ($(this).attr('active')=== "true") {
|
||||
if ($(this).attr('active')=== "true") {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/payment/cashier/foc",
|
||||
data: params,
|
||||
success:function(result){
|
||||
success:function(result){
|
||||
if (cash >= 0) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
@@ -549,7 +535,7 @@ $(document).on('click', '.access_modal', function(event){
|
||||
if (result.status == true) {
|
||||
createAccessCode(code);
|
||||
if (type == "edit") {
|
||||
|
||||
|
||||
}else if(type == "void"){
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
$('#voidModal').modal('show');
|
||||
|
||||
@@ -43,18 +43,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% total_qty = 0 %>
|
||||
<% total_price = 0 %>
|
||||
<% total_amount = 0 %>
|
||||
@@ -65,9 +53,9 @@
|
||||
<td><%= result.sale_item_id rescue '-' %></td>
|
||||
<td><%= result.commissioner.name rescue '-' %></td>
|
||||
<td><%= result.porduct_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
|
||||
</tr>
|
||||
<% total_qty += result.qty.to_f %>
|
||||
@@ -77,9 +65,9 @@
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="4"></td>
|
||||
<td><b><%= number_with_precision(total_qty, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_with_precision(total_price, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_with_precision(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_format(total_qty, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_format(total_price, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_format(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -92,5 +80,3 @@
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -23,18 +23,6 @@
|
||||
|
||||
<div class="margin-top-20">
|
||||
<div class="card ">
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.blank? %>
|
||||
|
||||
<table class="table table-striped" border="0">
|
||||
@@ -82,7 +70,7 @@
|
||||
</td>
|
||||
<td><%= credit.cashier_name rescue '-' %></td>
|
||||
<td><%= credit.customer_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(credit.payment_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(credit.payment_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td>
|
||||
<%if credit.credit_payment_shift_name == '-' %>
|
||||
<%= credit.sale_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-'%>
|
||||
@@ -92,16 +80,16 @@
|
||||
</td>
|
||||
<td><%= credit.credit_payment_receipt_date rescue '-' %></td>
|
||||
<td><%= credit.credit_payment_cashier_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(credit.credit_payment, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(credit.credit_payment, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="5"><b>Total</b></td>
|
||||
<td><b><%= number_with_precision(total_credit_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(total_credit_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td><b><%= number_with_precision(total_credit_payment, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(total_credit_payment, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -125,18 +125,6 @@
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.blank? %>
|
||||
<tbody>
|
||||
<% void = 0 %>
|
||||
@@ -186,50 +174,50 @@
|
||||
<td style='text-align:right;'><%= count %></td>
|
||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||
<% if @payment_methods.include? ("MPU") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Master") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:master_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:master_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("VISA") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:visa_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:visa_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("JCB") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:jcb_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:jcb_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("UNIONPAY") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:unionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:unionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Alipay") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:alipay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:alipay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("KBZPay") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("PAYMAL") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:paymal_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paymal_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("DINGA") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:dinga_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:dinga_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("JunctionPay") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:junctionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:junctionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Redeem") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_format(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
</tr>
|
||||
<% count = count + 1 %>
|
||||
@@ -241,80 +229,80 @@
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(mpu , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(mpu , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end%>
|
||||
<% if @payment_methods.include? ("Master") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(master, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(master, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end%>
|
||||
<% if @payment_methods.include? ("VISA") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(visa, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(visa, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end%>
|
||||
<% if @payment_methods.include? ("JCB") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(jcb, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(jcb, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end%>
|
||||
<% if @payment_methods.include? ("UNIONPAY") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(unionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(unionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Alipay") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("KBZPay") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(kbzpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(kbzpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("PAYMAL") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(paymal, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paymal, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("DINGA") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(dinga, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(dinga, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("JunctionPay") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(junctionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(junctionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Redeem") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||
<% colspan += 1 %>
|
||||
<td style='text-align:right;'><%= number_with_precision(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='color:red;text-align:right;'><%= number_with_precision(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_format(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
</tr>
|
||||
<tr style="font-weight:600;">
|
||||
@@ -327,7 +315,7 @@
|
||||
total_tax += tax.tax_amount.to_f %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="<%= colspan %>" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||
<td colspan="2" style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td colspan="2" style='text-align:right;'><%= number_format(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -337,7 +325,7 @@
|
||||
<% net = net - total_tax %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="<%= colspan %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td colspan="2" style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td colspan="2" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end %>
|
||||
|
||||
@@ -64,18 +64,6 @@
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.blank? %>
|
||||
|
||||
<tbody>
|
||||
@@ -144,7 +132,7 @@
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("KBZPay") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("PAYMAL") %>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]),delimiter => ',') rescue '-'%></td>
|
||||
|
||||
@@ -60,18 +60,6 @@
|
||||
<% sale_item_count =sale_item_count +1 %>
|
||||
<% end %>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<!-- all total qty sum -->
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
|
||||
total_qty += sale.total_item
|
||||
@@ -113,8 +101,8 @@
|
||||
<td><%= sale.item_code %></td>
|
||||
<td><%= sale.product_name %></td>
|
||||
<td><%= sale.total_item.to_i %></td>
|
||||
<td><%= number_with_precision(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_with_precision(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<!-- <td><%= sale.date_format %></td> -->
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -133,7 +121,7 @@
|
||||
<td style="text-align:right"> <strong>Grand Total: </strong></td>
|
||||
<td >
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= number_with_precision(grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></strong>
|
||||
<strong><%= number_format(grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></strong>
|
||||
<% grand_total = 0 %>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
@@ -50,18 +50,6 @@
|
||||
<% sale_item_count =sale_item_count +1 %>
|
||||
<% end %>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<!-- all total qty sum -->
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
|
||||
total_qty += sale.total_item
|
||||
@@ -103,8 +91,8 @@
|
||||
<td><%= sale.item_code %></td>
|
||||
<td><%= sale.product_name %></td>
|
||||
<td><%= sale.total_item.to_i %></td>
|
||||
<td><%= number_with_precision(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_with_precision(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<!-- <td><%= sale.date_format %></td> -->
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -123,7 +111,7 @@
|
||||
<td style="text-align:right"> <strong>Grand Total: </strong></td>
|
||||
<td >
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= number_with_precision(grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></strong>
|
||||
<strong><%= number_format(grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></strong>
|
||||
<% grand_total = 0 %>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_order_reservation_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
@@ -33,12 +33,12 @@
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<th colspan="15"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.receipt_date") %></th>
|
||||
@@ -62,17 +62,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
<%
|
||||
discount_amount = 0.0
|
||||
delivery_fee = 0.0
|
||||
@@ -94,8 +83,8 @@
|
||||
%>
|
||||
<% unless @order_reservation_data.blank? %>
|
||||
<% @order_reservation_data.each do |order_reservation| %>
|
||||
<%
|
||||
provider = ""
|
||||
<%
|
||||
provider = ""
|
||||
discount_amount = order_reservation.discount_amount
|
||||
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
|
||||
convenience_charge = order_reservation.convenience_charge
|
||||
@@ -119,9 +108,9 @@
|
||||
total_tax += order_reservation.total_tax.to_f
|
||||
total_amount += order_reservation.total_amount.to_f
|
||||
grand_total += order_reservation.grand_total.to_f
|
||||
|
||||
total_transaction_fee += order_reservation.transaction_fee.to_f
|
||||
|
||||
|
||||
total_transaction_fee += order_reservation.transaction_fee.to_f
|
||||
|
||||
if order_reservation.provider == 'pick_up'
|
||||
provider = "Pick-Up"
|
||||
elsif order_reservation.provider == 'direct_delivery'
|
||||
@@ -147,32 +136,32 @@
|
||||
<td><%= provider%></td>
|
||||
<td><%= payment_type%></td>
|
||||
<td><%= order_reservation.payment_status%></td>
|
||||
<td><%= number_with_precision(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<!-- <td><%= number_with_precision(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td> -->
|
||||
<td><%= number_with_precision(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
|
||||
<td><%= number_with_precision(order_reservation.transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
|
||||
<td><%= number_format(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<!-- <td><%= number_format(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td> -->
|
||||
<td><%= number_format(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
|
||||
<td><%= number_format(order_reservation.transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
|
||||
</tr>
|
||||
<% end
|
||||
<% end
|
||||
end %>
|
||||
|
||||
<tr>
|
||||
<td colspan="7"><b>Total</b></td>
|
||||
<td><b><%= number_with_precision(total_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_with_precision(total_discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_with_precision(total_delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_with_precision(total_convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<!-- <td><b><%= number_with_precision(total_delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_with_precision(total_convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_with_precision(total_commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>-->
|
||||
<td><b><%= number_with_precision(total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_with_precision(grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_with_precision(total_transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_format(total_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_format(total_discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_format(total_delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_format(total_convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<!-- <td><b><%= number_format(total_delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_format(total_convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_format(total_commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>-->
|
||||
<td><b><%= number_format(total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_format(grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
<td><b><%= number_format(total_transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -189,16 +178,16 @@
|
||||
$('#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');
|
||||
}
|
||||
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
|
||||
// OK button is clicked
|
||||
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
|
||||
new_date = new Date(date) ;
|
||||
@@ -213,50 +202,50 @@
|
||||
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
|
||||
$('#to').val(to)
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function search_by_date(){
|
||||
|
||||
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
|
||||
var period = 0;
|
||||
var period_type = 1;
|
||||
var period_type = 1;
|
||||
|
||||
if(to != '' && from != ''){
|
||||
shift_name = from + ',' + to;
|
||||
|
||||
check_arr.push(to);
|
||||
|
||||
|
||||
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){
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
|
||||
shift.empty();
|
||||
|
||||
|
||||
var str = '';
|
||||
var param_shift = '';
|
||||
var param_shift = '';
|
||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||
if (from == '' && to == '') {
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
}
|
||||
url = '<%= reports_get_shift_by_order_reservation_path %>';
|
||||
|
||||
|
||||
$.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>';
|
||||
$(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 sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
||||
var shift_id = data.message[index].shift_id ;
|
||||
@@ -265,18 +254,18 @@
|
||||
selected = 'selected = "selected"';
|
||||
}
|
||||
else{
|
||||
selected = '';
|
||||
}
|
||||
selected = '';
|
||||
}
|
||||
}else{
|
||||
selected = '';
|
||||
}
|
||||
selected = '';
|
||||
}
|
||||
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
|
||||
|
||||
|
||||
// console.log(sh_date)
|
||||
})
|
||||
})
|
||||
shift.append(str);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -57,37 +57,25 @@
|
||||
<th><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.empty? %>
|
||||
<tbody>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<tr>
|
||||
<td><%= number_with_precision(sale[:mpu_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:master_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:visa_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:kbzpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<!-- <td><%= number_with_precision(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
|
||||
<td><%= number_with_precision(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:mpu_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:master_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:visa_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:kbzpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<!-- <td><%= number_format(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
|
||||
<td><%= number_format(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -135,11 +123,11 @@
|
||||
<td><%= payment.payment_method rescue '-' %></td>
|
||||
<td><%= payment.sale.customer.name rescue '-' %></td>
|
||||
<% if payment.payment_method === 'cash' %>
|
||||
<td><%= number_with_precision(payment.payment_amount - payment.change_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<td><%= number_format(payment.payment_amount - payment.change_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<%else%>
|
||||
<td><%= number_with_precision(payment.payment_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<td><%= number_format(payment.payment_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<%end%>
|
||||
<td><%= number_with_precision(payment.sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(payment.sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
@@ -147,7 +135,7 @@
|
||||
<%if total>0%>
|
||||
<tr>
|
||||
<td colspan="5" style="text-align: right;"><strong >Total </strong></td>
|
||||
<td colspan="2"><strong><%=number_with_precision(total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></strong></td>
|
||||
<td colspan="2"><strong><%=number_format(total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></strong></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="9">
|
||||
<th colspan="9">
|
||||
<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 '-'%>
|
||||
</strong>
|
||||
@@ -18,9 +18,9 @@
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<th colspan="9">
|
||||
<strong><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</strong>
|
||||
</th>
|
||||
@@ -44,40 +44,28 @@
|
||||
<th><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.empty? %>
|
||||
<tbody>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<tr>
|
||||
<td><%= number_with_precision(sale[:mpu_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:master_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:visa_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:kbzpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<!-- <td><%= number_with_precision(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
|
||||
<td><%= number_with_precision(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:mpu_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:master_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:visa_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:kbzpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<!-- <td><%= number_format(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
|
||||
<td><%= number_format(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
@@ -92,7 +80,7 @@
|
||||
<td colspan="7"><strong>All Payment Details</strong></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
|
||||
|
||||
<tr>
|
||||
<th> <%= t("views.right_panel.detail.shift_name") %> </th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
@@ -109,9 +97,9 @@
|
||||
<% if payment.payment_method === 'cash'
|
||||
total += payment.payment_amount - payment.change_amount
|
||||
else
|
||||
total += payment.payment_amount
|
||||
end%>
|
||||
<tr>
|
||||
total += payment.payment_amount
|
||||
end%>
|
||||
<tr>
|
||||
<% if @shift_from.nil? && @shift_to.nil? %>
|
||||
<td><%= payment.sale_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-'%></td>
|
||||
<% else %>
|
||||
@@ -122,19 +110,19 @@
|
||||
<td><%= payment.payment_method rescue '-' %></td>
|
||||
<td><%= payment.sale.customer.name rescue '-' %></td>
|
||||
<% if payment.payment_method === 'cash' %>
|
||||
<td><%= number_with_precision(payment.payment_amount - payment.change_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<td><%= number_format(payment.payment_amount - payment.change_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<%else%>
|
||||
<td><%= number_with_precision(payment.payment_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<td><%= number_format(payment.payment_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<%end%>
|
||||
<td><%= number_with_precision(payment.sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
|
||||
<td><%= number_format(payment.sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
<% end %>
|
||||
<%if total>0%>
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: right;"><strong >Total </strong></td>
|
||||
<td colspan="2"><strong><%=number_with_precision(total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></strong></td>
|
||||
<td colspan="2"><strong><%=number_format(total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></strong></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
@@ -142,4 +130,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_product_sale_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="card">
|
||||
@@ -25,18 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="items_table" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -47,7 +36,7 @@
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
|
||||
<!-- <th><%= t("views.right_panel.detail.unit_price") %></th> -->
|
||||
<th><%= t("views.right_panel.detail.total") %></th>
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbd_data">
|
||||
<% unless @sale_data.blank? %>
|
||||
@@ -57,7 +46,7 @@
|
||||
<% total_qty = 0 %>
|
||||
<% total_item = {} %>
|
||||
<% total_data = {} %>
|
||||
<% @sale_data.each do |sale|
|
||||
<% @sale_data.each do |sale|
|
||||
if !total_item.has_key?(sale.item_code)
|
||||
grand_total += sale.grand_total
|
||||
total_item[sale.item_code] = sale.total_item
|
||||
@@ -66,25 +55,25 @@
|
||||
if sale.status_type == "void"
|
||||
total_item[sale.item_code] += sale.total_item
|
||||
end
|
||||
if sale.status_type == "void" || sale.status_type == "Discount" || sale.status_type == "foc"
|
||||
if sale.status_type == "void" || sale.status_type == "Discount" || sale.status_type == "foc"
|
||||
total_data[sale.item_code] += sale.grand_total
|
||||
grand_total += sale.grand_total
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end %>
|
||||
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
|
||||
total_qty += sale.total_item
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
<% if sale.status_type == "foc" && sale.price > 0
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
|
||||
|
||||
<% if sale.status_type != "Discount" && sale.price.to_f >= 0 %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<td><%= sale.menu_category_name %></td>
|
||||
<% cate_arr.push(sale.menu_category_id) %>
|
||||
<% else %>
|
||||
@@ -96,8 +85,8 @@
|
||||
<td><%= sale.item_code rescue '-' %></td>
|
||||
<td><%= sale.product_name rescue '-' %></td>
|
||||
<td><%= total_item[sale.item_code] rescue '-' %></td>
|
||||
<!-- <td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td><%= number_with_precision(total_data[sale.item_code] , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||
<!-- <td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td><%= number_format(total_data[sale.item_code] , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
<!-- end sub total -->
|
||||
@@ -107,9 +96,9 @@
|
||||
<td colspan="3"></td>
|
||||
<td><strong>Total</strong></td>
|
||||
<td><strong><%= total_qty %></strong></td>
|
||||
<td><strong><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></strong></td>
|
||||
<td><strong><%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></strong></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -123,9 +112,9 @@
|
||||
$(function(){
|
||||
$('#order_by').val('<%= @order_by %>');
|
||||
});
|
||||
|
||||
|
||||
$('#order_by').on('change', function(){
|
||||
var order_by = $("#order_by").val();
|
||||
window.location.href = "?order_by=" + order_by;
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -60,18 +60,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% after_rounding = 0 %>
|
||||
@@ -105,18 +93,18 @@
|
||||
</td>
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.total_amount, precision: precision.to_i, delimiter: delimiter) %></td>
|
||||
<td><%= number_with_precision(result.total_discount, precision: precision.to_i, delimiter: delimiter) rescue '0' %></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>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<% if sale_tax = result.sale_taxes.find { |sale_tax| sale_tax.tax_name == tax.name } %>
|
||||
<td><%= number_with_precision(sale_tax.tax_payable_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %> </td>
|
||||
<td><%= number_format(sale_tax.tax_payable_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %> </td>
|
||||
<% else %>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<td><%= number_with_precision(result.grand_total - result.rounding_adjustment, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.grand_total - result.rounding_adjustment, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.rounding_adjustment.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.grand_total, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<% if @lookup.value.to_i == 1 %>
|
||||
<td>
|
||||
<!-- ############### Need to Check SyncStatus ############# -->
|
||||
@@ -134,18 +122,18 @@
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="3"> </td>
|
||||
<td><b><%= number_with_precision(total_sum, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(total_sum, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(discount_amt, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<% if sale_tax = @sale_taxes.find { |sale_tax| sale_tax.tax_name == tax.name } %>
|
||||
<td><%= number_with_precision(sale_tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %> </td>
|
||||
<td><%= number_format(sale_tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %> </td>
|
||||
<% else %>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '0' %></b></td>
|
||||
<td><b><%= number_with_precision(rounding_adj.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(old_grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '0' %></b></td>
|
||||
<td><b><%= number_format(rounding_adj.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -40,17 +40,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
@@ -85,34 +74,34 @@
|
||||
</td>
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.total_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.total_discount, 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>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<% if sale_tax = result.sale_taxes.find { |sale_tax| sale_tax.tax_name == tax.name } %>
|
||||
<td><%= number_with_precision(sale_tax.tax_payable_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %> </td>
|
||||
<td><%= number_format(sale_tax.tax_payable_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %> </td>
|
||||
<% else %>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<td><%= number_with_precision(result.grand_total - result.rounding_adjustment, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.grand_total - result.rounding_adjustment, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.rounding_adjustment.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(result.grand_total, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="3"> </td>
|
||||
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<% if sale_tax = @sale_taxes.find { |sale_tax| sale_tax.tax_name == tax.name } %>
|
||||
<td><%= number_with_precision(sale_tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %> </td>
|
||||
<td><%= number_format(sale_tax.st_amount, precision: precision.to_i, delimiter: delimiter) rescue '-' %> </td>
|
||||
<% else %>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(0, precision: precision.to_i, delimiter: delimiter) rescue '-' %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '0' %></b></td>
|
||||
<td><b><%= number_with_precision(rounding_adj.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(old_grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '0' %></b></td>
|
||||
<td><b><%= number_format(rounding_adj.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(grand_total.to_f, precision: precision.to_i, delimiter: delimiter) rescue '-' %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
|
||||
@@ -34,43 +34,30 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th><b><%= t("views.right_panel.detail.shift_name") %></b></th>
|
||||
<th><b><%= t("views.right_panel.detail.table") %></b></th>
|
||||
<th><b><%= t("views.right_panel.detail.receipt_no") %></b></th>
|
||||
<th><b><%= t :cashier %> <%= t("views.right_panel.detail.name") %></b></th>
|
||||
<th><b><%= t("views.right_panel.detail.revenue") %></b></th>
|
||||
<th><b><%= t("views.right_panel.detail.shift_name") %></b></th>
|
||||
<th><b><%= t("views.right_panel.detail.table") %></b></th>
|
||||
<th><b><%= t("views.right_panel.detail.receipt_no") %></b></th>
|
||||
<th><b><%= t :cashier %> <%= t("views.right_panel.detail.name") %></b></th>
|
||||
<th><b><%= t("views.right_panel.detail.revenue") %></b></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% grand_total = 0 %>
|
||||
<% @sale_data.each do |result| %>
|
||||
<% table_name=nil
|
||||
table_type =nil
|
||||
if result.table_id.to_i>0
|
||||
table = DiningFacility.find(result.table_id)
|
||||
if table = result.bookings[0].dining_facility
|
||||
table_type = table.type
|
||||
table_name = table.name
|
||||
end %>
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f%>
|
||||
<% grand_total = grand_total + result.grand_total %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td><%= @shift_from %> - <%= @shift_to %></td>
|
||||
<td><%= table_type %> - <%= table_name %></td>
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.grand_total, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(result.grand_total, precision: precision, delimiter: delimiter) %></td>
|
||||
<!-- <td> </td> -->
|
||||
</tr>
|
||||
|
||||
@@ -85,8 +72,8 @@
|
||||
<% result.sale_items.each do |item|%>
|
||||
<tr>
|
||||
<td>
|
||||
<% if item.price.to_i < 0.to_i %>
|
||||
<% if item.qty.to_i < 0.to_i%>
|
||||
<% if item.price < 0 %>
|
||||
<% if item.qty < 0 %>
|
||||
[PROMO QTY]<%= item.product_name rescue '-' %>
|
||||
<% else %>
|
||||
[PROMO PRICE]<%= item.product_name rescue '-' %>
|
||||
@@ -96,15 +83,15 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= item.qty rescue '-' %></td>
|
||||
<td><%= number_with_precision(item.unit_price, precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(item.price, precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
||||
<td><%=l item.created_at.utc.getlocal, :format => :short rescue '-' %> </td>
|
||||
<td><%= number_format(item.unit_price, precision: precision, delimiter: delimiter, strip_insignificant_zeros: strip_insignificant_zeros) rescue '-' %></td>
|
||||
<td><%= number_format(item.price, precision: precision, delimiter: delimiter, strip_insignificant_zeros: strip_insignificant_zeros) rescue '-' %></td>
|
||||
<td><%=l item.created_at.getlocal, :format => :short rescue '-' %> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr><td colspan="5"> </td></tr>
|
||||
|
||||
<%survey = Survey.find_by_receipt_no(result.receipt_no)%>
|
||||
<%survey = result.survey%>
|
||||
<% if !survey.nil?%>
|
||||
<tr>
|
||||
<td> </td>
|
||||
@@ -120,19 +107,19 @@
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><%= number_with_precision(result.total_amount, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(result.total_amount, precision: precision, delimiter: delimiter, strip_insignificant_zeros: strip_insignificant_zeros) %></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% if result.total_discount.to_f > 0 %>
|
||||
<% if result.total_discount > 0 %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td><%= t("views.right_panel.detail.total") %>
|
||||
<%= t("views.right_panel.detail.discount") %>
|
||||
<%= t("views.right_panel.detail.amount") %></td>
|
||||
<td> - <%= number_with_precision(result.total_discount, precision:precision.to_i,delimiter:delimiter) %> </td>
|
||||
<td> - <%= number_format(result.total_discount, precision: precision, delimiter: delimiter, strip_insignificant_zeros: strip_insignificant_zeros) %> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -142,39 +129,38 @@
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td>Tax Amount </td>
|
||||
<td><%= number_with_precision(result.total_tax, precision:precision.to_i,delimiter:delimiter) %> </td>
|
||||
<td><%= number_format(result.total_tax, precision: precision, delimiter: delimiter, strip_insignificant_zeros: strip_insignificant_zeros) %> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% sale_payments = SalePayment.get_sale_payments(result) %>
|
||||
<% sale_payments = result.sale_payments %>
|
||||
<% if sale_payments.length > 0%>
|
||||
<% sale_payments.each do |rec| %>
|
||||
<%if rec.payment_amount.to_f > 0 %>
|
||||
<% next if rec.payment_method == 'credit_note' && result.payments_for_credits_amount < rec.payment_amount %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td>Payment <%= rec.payment_method.upcase %></td>
|
||||
<td><%= number_format(rec.payment_amount, precision: precision, delimiter: delimiter, strip_insignificant_zeros: strip_insignificant_zeros) %> ( <%= rec.payment_status %> )</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
||||
<% if !rec.payment_reference.nil? %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td>Payment <%= rec.payment_method.upcase %></td>
|
||||
<td><%= number_with_precision(rec.payment_amount, precision:precision.to_i,delimiter:delimiter) %> ( <%= rec.payment_status %> )</td>
|
||||
<td>Payment Ref.</td>
|
||||
<td><%= rec.payment_reference %></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
||||
<% if !rec.payment_reference.nil? %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td>Payment Ref.</td>
|
||||
<td><%= rec.payment_reference %></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if result.amount_changed != 0 && !result.amount_changed.nil? %>
|
||||
<% if result.amount_changed != 0 %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td><%= t("views.right_panel.detail.change") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><%= number_with_precision(result.amount_changed, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(result.amount_changed, precision: precision, delimiter: delimiter, strip_insignificant_zeros: strip_insignificant_zeros) %></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -196,7 +182,7 @@
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td><b>Total Nett</b> - <b><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) %></b></td>
|
||||
<td><b>Total Nett</b> - <b><%= number_format(grand_total, precision: precision, delimiter: delimiter, strip_insignificant_zeros: strip_insignificant_zeros) %></b></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -46,18 +46,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
<% p_qty = 0 %>
|
||||
@@ -111,7 +99,7 @@
|
||||
<td>
|
||||
<% @totalByAccount.each do |account, total| %>
|
||||
<% if sale.account_id == account %>
|
||||
<b><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||
<b><%= number_format(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||
<% grand_total += total %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -135,8 +123,8 @@
|
||||
<td><%= sale.total_item*(-1) rescue '-' %></td>
|
||||
<% end %>
|
||||
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -161,7 +149,7 @@
|
||||
<td><b>Total <%= sale.account_name %> Qty </b> </td>
|
||||
<td><b><%= sub_qty %></b></td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
|
||||
<td ><span class="underline"><%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
|
||||
</tr>
|
||||
<% sub_total = 0.0%>
|
||||
<% sub_qty = 0 %>
|
||||
@@ -191,8 +179,8 @@
|
||||
<td><%= product.product_code rescue '-' %></td>
|
||||
<td><%= product.product_name rescue '-' %></td>
|
||||
<td><%= product.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -205,7 +193,7 @@
|
||||
<td><b><%= p_qty %></b></td>
|
||||
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
<!-- End Product Sale -->
|
||||
@@ -229,8 +217,8 @@
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
<td><%= other.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -240,7 +228,7 @@
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
<!-- End Other Charges -->
|
||||
@@ -249,18 +237,18 @@
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
|
||||
<td><span><%= total_qty%></span></td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td><span><%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<% if @type =="" || @type =="all" || @type.nil? %>
|
||||
<tr class="foc_payment">
|
||||
<td colspan="5"> </td>
|
||||
<td>Total FOC Amount</td>
|
||||
<td><span><%= number_with_precision(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td><span><%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<tr class="foc_payment" style="border-top:2px solid grey;border-bottom:2px solid grey;">
|
||||
<td colspan="5"> </td>
|
||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -282,8 +270,8 @@
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
<td><%= other.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -293,7 +281,7 @@
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="items_table" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -17,9 +17,9 @@
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<th colspan="7"> <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -31,23 +31,11 @@
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.revenue") %></th>
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
<% p_qty = 0 %>
|
||||
<% sub_qty = 0 %>
|
||||
<% sub_total = 0 %>
|
||||
@@ -67,7 +55,7 @@
|
||||
<% unless @sale_data.blank? %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<!-- all total qty sum -->
|
||||
|
||||
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
@@ -81,20 +69,20 @@
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
<!-- end all total qty -->
|
||||
|
||||
|
||||
<% if sale.status_type == "foc" && sale.grand_total < 0
|
||||
total_item_foc += sale.grand_total*(-1)
|
||||
end %>
|
||||
end %>
|
||||
|
||||
<% if sale.status_type == "Discount" && sale.grand_total < 0
|
||||
total_item_dis += sale.grand_total*(-1)
|
||||
end %>
|
||||
<% if !acc_arr.include?(sale.account_id) %>
|
||||
|
||||
|
||||
<% @totalByAccount.each do |account, total| %>
|
||||
<% if sale.account_id == account %>
|
||||
|
||||
<% grand_total += total %>
|
||||
|
||||
<% grand_total += total %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% acc_arr.push(sale.account_id) %>
|
||||
@@ -109,15 +97,15 @@
|
||||
<%else%>
|
||||
<td><%= sale.total_item*(-1) rescue '-' %></td>
|
||||
<% end %>
|
||||
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
<td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
<% @menu_cate_count.each do |key,value| %>
|
||||
<% if sale.account_id == key %>
|
||||
<% count = count + 1 %>
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% #sub_qty += sale.total_item %>
|
||||
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC") && sale.status_type != "promotion"
|
||||
@@ -130,7 +118,7 @@
|
||||
<% if sale.remark == "promotion"
|
||||
sub_qty += sale.total_item
|
||||
end %>
|
||||
<% if count == value %>
|
||||
<% if count == value %>
|
||||
<% sub_total = 0.0%>
|
||||
<% sub_qty = 0 %>
|
||||
<% count = 0%>
|
||||
@@ -141,7 +129,7 @@
|
||||
<% end %>
|
||||
<!--Product Sale -->
|
||||
<% if @product.present?%>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><b>Product</b></td>
|
||||
<td colspan="4"> </td>
|
||||
@@ -159,13 +147,13 @@
|
||||
<td><%= product.product_code rescue '-' %></td>
|
||||
<td><%= product.product_name rescue '-' %></td>
|
||||
<td><%= product.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
|
||||
<% product_sub_total += product.grand_total %>
|
||||
<!-- end sub total -->
|
||||
<!-- end sub total -->
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
@@ -173,14 +161,14 @@
|
||||
<td><b><%= p_qty %></b></td>
|
||||
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
<!-- End Product Sale -->
|
||||
|
||||
<!--Other Charges -->
|
||||
<% if @type == "other" || @other_charges.present?%>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><b>Other Charges</b></td>
|
||||
<td colspan="4"> </td>
|
||||
@@ -197,18 +185,18 @@
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
<td><%= other.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
|
||||
<% other_sub_total += other.grand_total %>
|
||||
<!-- end sub total -->
|
||||
<!-- end sub total -->
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
<!-- End Other Charges -->
|
||||
@@ -217,23 +205,23 @@
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
|
||||
<td><span><%= total_qty%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<% if @type =="" || @type =="all" %>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Total FOC Amount</td>
|
||||
<td><span><%= number_with_precision(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td><span><%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<tr style="border-top:2px solid grey;border-bottom:2px solid grey;">
|
||||
<td colspan="5"> </td>
|
||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @type == "other"%>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><b>Other Charges</b></td>
|
||||
<td colspan="4"> </td>
|
||||
@@ -250,18 +238,18 @@
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
<td><%= other.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
|
||||
<% other_sub_total += other.grand_total %>
|
||||
<!-- end sub total -->
|
||||
<!-- end sub total -->
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
@@ -285,4 +273,4 @@
|
||||
$('.foc_payment').hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_saleitem_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="card">
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="items_table" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -28,9 +28,9 @@
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift_data.employee %>
|
||||
<% if @shift_data.employee %>
|
||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<th colspan="7"> <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -42,24 +42,12 @@
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.revenue") %></th>
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.blank? %>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
|
||||
<% sub_qty = 0 %>
|
||||
<% sub_total = 0 %>
|
||||
@@ -87,7 +75,7 @@
|
||||
<!-- end all total qty -->
|
||||
<% if sale.status_type == "foc" && sale.grand_total < 0
|
||||
total_item_foc += sale.grand_total*(-1)
|
||||
end %>
|
||||
end %>
|
||||
|
||||
<% if sale.status_type == "Discount" && sale.grand_total < 0
|
||||
total_item_dis += sale.grand_total*(-1)
|
||||
@@ -101,8 +89,8 @@
|
||||
<td>
|
||||
<% @totalByAccount.each do |account, total| %>
|
||||
<% if sale.account_id == account %>
|
||||
<b><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||
<% grand_total += total %>
|
||||
<b><%= number_format(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||
<% grand_total += total %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
@@ -111,7 +99,7 @@
|
||||
<% end %>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<td><%= sale.menu_category_name %></td>
|
||||
<% cate_arr.push(sale.menu_category_id) %>
|
||||
<% else %>
|
||||
@@ -120,27 +108,27 @@
|
||||
<td><%= sale.item_code rescue '-' %></td>
|
||||
<td><%= sale.product_name rescue '-' %></td>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
<% @menu_cate_count.each do |key,value| %>
|
||||
<% if sale.account_id == key %>
|
||||
<% count = count + 1 %>
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% #sub_qty += sale.total_item %>
|
||||
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
|
||||
sub_qty += sale.total_item
|
||||
end %>
|
||||
|
||||
<% if count == value %>
|
||||
<% if count == value %>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
<td><b>Total <%= sale.account_name %> Qty </b> </td>
|
||||
<td><b><%= sub_qty %></b></td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
|
||||
<td ><span class="underline"><%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
|
||||
</tr>
|
||||
<% sub_total = 0.0%>
|
||||
<% sub_qty = 0 %>
|
||||
@@ -168,18 +156,18 @@
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
<td><%= other.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
|
||||
<% other_sub_total += other.grand_total %>
|
||||
<!-- end sub total -->
|
||||
<!-- end sub total -->
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
<!-- End Other Charges -->
|
||||
@@ -188,25 +176,25 @@
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
|
||||
<td><span><%= total_qty%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><span><%= number_with_precision(total_item_foc , precision:precision.to_i,delimiter:delimiter) %></span></td>
|
||||
<td><span><%= number_format(total_item_foc , precision:precision.to_i,delimiter:delimiter) %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(total_item_dis , precision:precision.to_i,delimiter:delimiter) %></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_format(total_item_dis , precision:precision.to_i,delimiter:delimiter) %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.foc_sales") %></td>
|
||||
<td>
|
||||
<span><%= number_with_precision(@foc_data, precision:precision.to_i, delimiter:delimiter) %></span>
|
||||
<span><%= number_format(@foc_data, precision:precision.to_i, delimiter:delimiter) %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -214,11 +202,11 @@
|
||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td style="border-bottom:2px solid grey;">
|
||||
<span>
|
||||
<%= number_with_precision(@discount_data , precision: precision.to_i,delimiter: delimiter) %>
|
||||
<%= number_format(@discount_data , precision: precision.to_i,delimiter: delimiter) %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tr>
|
||||
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<!-- <tr>
|
||||
<td colspan="5"> </td>
|
||||
@@ -232,13 +220,13 @@
|
||||
<td colspan="5"> </td>
|
||||
<td style="border-top:2px solid grey;">Net Amount</td>
|
||||
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
|
||||
<td style="border-top:2px solid grey;"><%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision.to_i,delimiter:delimiter)%></td>
|
||||
<td style="border-top:2px solid grey;"><%= number_format(grand_total.to_f - @discount_data.to_f , precision:precision.to_i,delimiter:delimiter)%></td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td colspan="5"> </td>
|
||||
<td>Grand Total</td>
|
||||
|
||||
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
|
||||
|
||||
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
|
||||
</tr> -->
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -259,14 +247,14 @@
|
||||
if(search){
|
||||
|
||||
if(parseInt(search) == 0){
|
||||
search_by_period();
|
||||
search_by_period();
|
||||
}
|
||||
else{
|
||||
search_by_date();
|
||||
search_by_date();
|
||||
}
|
||||
}else{
|
||||
search_by_period();
|
||||
}
|
||||
search_by_period();
|
||||
}
|
||||
|
||||
$('#sel_period').change(function(){
|
||||
search_by_period();
|
||||
@@ -278,8 +266,8 @@
|
||||
var from = "";
|
||||
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
|
||||
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
|
||||
@@ -295,13 +283,13 @@
|
||||
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
|
||||
$('#to').val(to)
|
||||
search_by_date();
|
||||
});
|
||||
});
|
||||
|
||||
function search_by_date(){
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
var period = 0;
|
||||
var period_type = 1;
|
||||
var period_type = 1;
|
||||
|
||||
if(to != '' && from != ''){
|
||||
shift_name = from + ',' + to;
|
||||
@@ -310,7 +298,7 @@
|
||||
|
||||
console.log(check_arr.length)
|
||||
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){
|
||||
check_arr = [];
|
||||
@@ -329,13 +317,13 @@
|
||||
var selected = '';
|
||||
var str = '';
|
||||
var param_shift = '<%= params[:shift_name]%>';
|
||||
|
||||
|
||||
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){
|
||||
console.log(data)
|
||||
|
||||
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 sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
||||
@@ -346,21 +334,21 @@
|
||||
selected = 'selected = "selected"';
|
||||
}
|
||||
else{
|
||||
selected = '';
|
||||
}
|
||||
selected = '';
|
||||
}
|
||||
}
|
||||
else{
|
||||
selected = '';
|
||||
}
|
||||
selected = '';
|
||||
}
|
||||
|
||||
|
||||
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
|
||||
|
||||
// console.log(sh_date)
|
||||
})
|
||||
})
|
||||
shift.append(str);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -69,18 +69,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% void = 0%>
|
||||
<% cash = 0%>
|
||||
<% credit = 0%>
|
||||
@@ -104,16 +92,16 @@
|
||||
<%= result[:shift_closed_at] ? result[:shift_closed_at].strftime("%e %b %I:%M%p") : '-' %>
|
||||
</td>
|
||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||
<td><%= number_with_precision(result[:cash_sales].to_f, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_with_precision(result[:credit_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(result[:cash_sales].to_f, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(result[:credit_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
|
||||
<td class="d-none d-sm-table-cell"><%= number_with_precision(result[:other_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td class="d-none d-sm-table-cell"><%= number_format(result[:other_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td class="d-none d-sm-table-cell">
|
||||
<%= number_with_precision(result[:foc_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%>
|
||||
<%= number_format(result[:foc_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%>
|
||||
</td>
|
||||
<td><%= number_with_precision(result[:grand_total].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(result[:grand_total].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td>
|
||||
<%= link_to "Print", reports_get_shift_id_path(result[:shift_id].to_i), class:"btn btn-info wave-effects" %>
|
||||
</td>
|
||||
@@ -134,15 +122,15 @@
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
||||
<td><b><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
||||
<td class="d-none d-sm-table-cell"><b><%= number_with_precision(card, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<td class="d-none d-sm-table-cell"><b><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<td class="d-none d-sm-table-cell"><b><%= number_format(card, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<td class="d-none d-sm-table-cell"><b><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||
<td><b><%= number_with_precision(g_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_format(g_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -46,18 +46,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
<% p_qty = 0 %>
|
||||
@@ -111,7 +99,7 @@
|
||||
<td>
|
||||
<% @totalByAccount.each do |account, total| %>
|
||||
<% if sale.account_id == account %>
|
||||
<b><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||
<b><%= number_format(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||
<% grand_total += total %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -135,8 +123,8 @@
|
||||
<td><%= sale.total_item*(-1) rescue '-' %></td>
|
||||
<% end %>
|
||||
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -161,7 +149,7 @@
|
||||
<td><b>Total <%= sale.account_name %> Qty </b> </td>
|
||||
<td><b><%= sub_qty %></b></td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
|
||||
<td ><span class="underline"><%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
|
||||
</tr>
|
||||
<% sub_total = 0.0%>
|
||||
<% sub_qty = 0 %>
|
||||
@@ -191,8 +179,8 @@
|
||||
<td><%= product.product_code rescue '-' %></td>
|
||||
<td><%= product.product_name rescue '-' %></td>
|
||||
<td><%= product.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -205,7 +193,7 @@
|
||||
<td><b><%= p_qty %></b></td>
|
||||
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
<!-- End Product Sale -->
|
||||
@@ -218,18 +206,18 @@
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
|
||||
<td><span><%= total_qty%></span></td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td><span><%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<% if @type =="" || @type =="all" || @type.nil? %>
|
||||
<!-- <tr class="foc_payment">
|
||||
<td colspan="5"> </td>
|
||||
<td>Total FOC Amount</td>
|
||||
<td><span><%= number_with_precision(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td><span><%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr> -->
|
||||
<!-- <tr class="foc_payment" style="border-top:2px solid grey;border-bottom:2px solid grey;">
|
||||
<td colspan="5"> </td>
|
||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr> -->
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -251,8 +239,8 @@
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
<td><%= other.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -262,7 +250,7 @@
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
|
||||
@@ -34,18 +34,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
<% p_qty = 0 %>
|
||||
@@ -99,7 +87,7 @@
|
||||
<td>
|
||||
<% @totalByAccount.each do |account, total| %>
|
||||
<% if sale.account_id == account %>
|
||||
<b><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||
<b><%= number_format(total, precision:precision.to_i,delimiter:delimiter) %></b>
|
||||
<% grand_total += total %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -123,8 +111,8 @@
|
||||
<td><%= sale.total_item*(-1) rescue '-' %></td>
|
||||
<% end %>
|
||||
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -149,7 +137,7 @@
|
||||
<td><b>Total <%= sale.account_name %> Qty </b> </td>
|
||||
<td><b><%= sub_qty %></b></td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
|
||||
<td ><span class="underline"><%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
|
||||
</tr>
|
||||
<% sub_total = 0.0%>
|
||||
<% sub_qty = 0 %>
|
||||
@@ -179,8 +167,8 @@
|
||||
<td><%= product.product_code rescue '-' %></td>
|
||||
<td><%= product.product_name rescue '-' %></td>
|
||||
<td><%= product.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -193,7 +181,7 @@
|
||||
<td><b><%= p_qty %></b></td>
|
||||
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
<!-- End Product Sale -->
|
||||
@@ -206,18 +194,18 @@
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
|
||||
<td><span><%= total_qty%></span></td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td><span><%= number_format(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<% if @type =="" || @type =="all" || @type.nil? %>
|
||||
<!-- <tr class="foc_payment">
|
||||
<td colspan="5"> </td>
|
||||
<td>Total FOC Amount</td>
|
||||
<td><span><%= number_with_precision(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td><span><%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr> -->
|
||||
<!-- <tr class="foc_payment" style="border-top:2px solid grey;border-bottom:2px solid grey;">
|
||||
<td colspan="5"> </td>
|
||||
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr> -->
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -238,8 +226,8 @@
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
<td><%= other.total_item rescue '-' %></td>
|
||||
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td> <%= number_format(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -249,7 +237,7 @@
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
<td ><span><%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
|
||||
@@ -28,18 +28,6 @@
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -66,14 +54,14 @@
|
||||
<td>
|
||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
|
||||
<% if menu_item.nil? %>
|
||||
<% if !arr_item_code.include?(result.item_code) %>
|
||||
<% if !arr_item_code.include?(result.item_code) %>
|
||||
<%= Product.find_by_item_code(result.item_code).name rescue "-" %>
|
||||
<% arr_item_code.push(result.item_code) %>
|
||||
<% else %>
|
||||
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if !arr_item_code.include?(result.item_code) %>
|
||||
<% if !arr_item_code.include?(result.item_code) %>
|
||||
<%= menu_item.menu_item.name rescue "-" %>
|
||||
- <%= menu_item.item_instance_name rescue "-" %>
|
||||
<% arr_item_code.push(result.item_code) %>
|
||||
@@ -98,7 +86,7 @@
|
||||
<!-- <tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<td><b><%= total_stock_count rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= total_different rescue '-' %></b></td>
|
||||
<td></td>
|
||||
</tr> -->
|
||||
@@ -108,4 +96,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<!-- <tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<td><b><%= total_stock_count rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_format(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= total_different rescue '-' %></b></td>
|
||||
<td></td>
|
||||
</tr> -->
|
||||
|
||||
@@ -52,18 +52,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% total_amount = 0.0 %>
|
||||
<% grand_total = 0.0 %>
|
||||
<% rounding_adjustment = 0.0 %>
|
||||
@@ -73,10 +61,10 @@
|
||||
<tr>
|
||||
<td><%= item.receipt_no rescue '-' %> </td>
|
||||
<td><%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></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.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_format(item.total_amount.to_f, precision: precision.to_i ,delimiter: delimiter) %> </td>
|
||||
<td><%= number_format(item.grand_total.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
|
||||
<td><%= number_format(item.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(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><%= item.remarks rescue '-' %> </td> -->
|
||||
</tr>
|
||||
@@ -88,10 +76,10 @@
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;font-weight:600;">
|
||||
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
||||
<td><%= number_with_precision(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(grand_total, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(rounding_adjustment, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></td>
|
||||
<td colspan="3"><%= number_with_precision(grand_rounding_adjustment, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></td>
|
||||
<td><%= number_format(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(grand_total, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_format(rounding_adjustment, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></td>
|
||||
<td colspan="3"><%= number_format(grand_rounding_adjustment, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -45,18 +45,6 @@
|
||||
|
||||
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% receipt_arr = Array.new %>
|
||||
<% menu_cat_arr = Array.new %>
|
||||
<% footer_arr = Array.new %>
|
||||
@@ -79,8 +67,8 @@
|
||||
<td><%= sale.product_name %></td>
|
||||
<td><%= sale.product_code.to_i %></td>
|
||||
<td><%= sale.qty.to_i %></td>
|
||||
<td><%= number_with_precision(sale.unit_price, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_with_precision(sale.price, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(sale.unit_price, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
<td><%= number_format(sale.price, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -91,13 +79,13 @@
|
||||
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
|
||||
<td>
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= number_with_precision(waste_and_spoil_item_count, precision:precision.to_i,delimiter:delimiter) %></strong>
|
||||
<strong><%= number_format(waste_and_spoil_item_count, precision:precision.to_i,delimiter:delimiter) %></strong>
|
||||
<% waste_and_spoil_item_count = 0%>
|
||||
</span></td>
|
||||
<td style="text-align:right"> <strong>Grand Total: </strong></td>
|
||||
<td >
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) %></strong>
|
||||
<strong><%= number_format(grand_total, precision:precision.to_i,delimiter:delimiter) %></strong>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -98,17 +98,6 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
<%
|
||||
discount_amount = 0.0
|
||||
delivery_fee = 0.0
|
||||
@@ -158,16 +147,16 @@
|
||||
<td><%= order_reservation.status %></td>
|
||||
<td><%= order_reservation.payment_type%></td>
|
||||
<td><%= order_reservation.payment_status%></td>
|
||||
<td><%= number_with_precision(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<!-- <td><%= number_with_precision(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td> -->
|
||||
<td><%= number_with_precision(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_with_precision(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
|
||||
<td><%= number_with_precision(order_reservation.transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
|
||||
<td><%= number_format(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<!-- <td><%= number_format(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td> -->
|
||||
<td><%= number_format(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
|
||||
<td><%= number_format(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
|
||||
<td><%= number_format(order_reservation.transaction_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -9,17 +9,6 @@
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end %>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<!-- Column One -->
|
||||
|
||||
@@ -70,18 +59,18 @@
|
||||
<th><%= t("views.right_panel.detail.created_at") %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tr>
|
||||
<% @order_reservation.order_reservation_items.each do |item| %>
|
||||
<tr>
|
||||
<td><%=item.item_name rescue ' '%></td>
|
||||
<td><%=item.qty rescue ' '%></td>
|
||||
<td><%= number_with_precision(item.price > 0 ? item.price : item.unit_price, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= number_with_precision(item.price > 0 ? item.qty * item.price : item.qty * item.unit_price, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= number_format(item.price > 0 ? item.price : item.unit_price, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= number_format(item.price > 0 ? item.qty * item.price : item.qty * item.unit_price, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%=l item.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%
|
||||
discount_amount = 0.0
|
||||
delivery_fee = 0.0
|
||||
@@ -130,70 +119,70 @@
|
||||
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td colspan="4"><%= number_with_precision(total_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td colspan="4"><%= number_format(total_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% if total_discount_amount > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.discount_amount") %></td>
|
||||
<td colspan="4"><%= number_with_precision(total_discount_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.discount_amount") %></td>
|
||||
<td colspan="4"><%= number_format(total_discount_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_delivery_fee > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.delivery_fee") %></td>
|
||||
<td colspan="4"><%= number_with_precision(total_delivery_fee, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.delivery_fee") %></td>
|
||||
<td colspan="4"><%= number_format(total_delivery_fee, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_convenience_charge > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.convenience_charge") %></td>
|
||||
<td colspan="4"><%= number_with_precision(total_convenience_charge, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.convenience_charge") %></td>
|
||||
<td colspan="4"><%= number_format(total_convenience_charge, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- <% if total_delivery_tax > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.delivery_tax") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_delivery_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.delivery_tax") %></td>
|
||||
<td colspan="3"><%= number_format(total_delivery_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_convenience_tax > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.convenience_tax") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_convenience_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.convenience_tax") %></td>
|
||||
<td colspan="3"><%= number_format(total_convenience_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_commercial_tax > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.commercial_tax") %></td>
|
||||
<td colspan="3"><%= number_with_precision(total_commercial_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.commercial_tax") %></td>
|
||||
<td colspan="3"><%= number_format(total_commercial_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %> -->
|
||||
<% if total_tax > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></td>
|
||||
<td colspan="4"><%= number_with_precision(total_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></td>
|
||||
<td colspan="4"><%= number_format(total_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if grand_total > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan="2" style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %> </td>
|
||||
<td colspan="4"><%= number_with_precision(grand_total, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %> </td>
|
||||
<td colspan="4"><%= number_format(grand_total, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if total_transaction_fee > 0 %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan="2" style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.transaction_fee") %></td>
|
||||
<td colspan="4"><%= number_with_precision(total_transaction_fee, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.transaction_fee") %></td>
|
||||
<td colspan="4"><%= number_format(total_transaction_fee, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
@@ -83,8 +83,8 @@
|
||||
<tr>
|
||||
<td><%=s.product_name rescue ' '%></td>
|
||||
<td><%=s.qty rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.unit_price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%= number_format(s.unit_price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%= number_format(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
|
||||
<td><%=s.remark rescue ' '%></td>
|
||||
</tr>
|
||||
@@ -92,42 +92,42 @@
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.total") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td colspan="3"><%= number_format(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.discount") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td colspan="3"><%= number_format(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% @sale.sale_taxes.each do |r|%>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= r.tax_name %> </td>
|
||||
<td colspan="3"><%= number_with_precision(r.tax_payable_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td colspan="3"><%= number_format(r.tax_payable_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td colspan="3"><%= number_format(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<tr><td colspan="5"> <td></tr>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.total_pay_amount") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td colspan="3"><%= number_format(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% @sale_receivables.each do |r|%>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td> <%= r.payment_method.capitalize rescue ' '%> Payment</td>
|
||||
<td colspan="3"><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td colspan="3"><%= number_format(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.change") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td colspan="3"><%= number_format(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -107,6 +107,11 @@ units = Lookup.create([{lookup_type:'unit', name: 'PCS', value: 'pcs'},
|
||||
# Country
|
||||
countries = Lookup.create({lookup_type:'country', name: 'Japan', value: 'Japan'})
|
||||
|
||||
# number formats
|
||||
number_formats = Lookup.create([{lookup_type: 'number_format', name: 'precision', '2'},
|
||||
{lookup_type: 'number_format', name: 'delimiter', ','},
|
||||
{lookup_type: 'number_format', name: 'strip_insignificant_zeros', '0'}])
|
||||
|
||||
# Default CUSTOMER
|
||||
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000", customer_type:"Dinein", tax_profiles:["2", "1"]})
|
||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111", customer_type:"Takeaway", tax_profiles:["1"]})
|
||||
@@ -133,7 +138,7 @@ product = Account.create({title: "Product", account_type: "2"})
|
||||
|
||||
# YGN BBQ
|
||||
# person = Account.create({title: "Person", account_type: "3"})
|
||||
# END
|
||||
# END
|
||||
|
||||
#Default Menu Options
|
||||
menu_options = MenuItemOption.create([{option_type: "Spicy", name: "Less Spicy", value: "less_spicy"},{option_type: "Spicy", name: "Spicy", value: "spicy"},{option_type: "Spicy", name: "Super Spicy", value: "super_spicy"}])
|
||||
|
||||
Reference in New Issue
Block a user