fix request bill error with show_total_before_tax
This commit is contained in:
@@ -45,15 +45,17 @@ module NumberFormattable
|
|||||||
options[:precision] = options[:precision] || precision
|
options[:precision] = options[:precision] || precision
|
||||||
# options[:delimiter] = options[:delimiter] || delimiter
|
# options[:delimiter] = options[:delimiter] || delimiter
|
||||||
options[:strip_insignificant_zeros] = options[:strip_insignificant_zeros] || strip_insignificant_zeros
|
options[:strip_insignificant_zeros] = options[:strip_insignificant_zeros] || strip_insignificant_zeros
|
||||||
|
|
||||||
|
number = number.to_f.round(options[:precision])
|
||||||
|
|
||||||
if options[:precision] > 0
|
if options[:precision] > 0
|
||||||
if options[:strip_insignificant_zeros]
|
if options[:strip_insignificant_zeros]
|
||||||
formatted = "%.12g" % number.round(options[:precision])
|
formatted = "%.12g" % number
|
||||||
else
|
else
|
||||||
formatted = "%.#{options[:precision]}f" % number.round(options[:precision])
|
formatted = "%.#{options[:precision]}f" % number
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
formatted = number.round(options[:precision]).to_i.to_s
|
formatted = number.to_i.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
if options[:delimiter] && !options[:delimiter].empty?
|
if options[:delimiter] && !options[:delimiter].empty?
|
||||||
|
|||||||
@@ -344,14 +344,14 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
sale_data.sale_taxes.each do |st|
|
sale_data.sale_taxes.each do |st|
|
||||||
if (st.tax_name.include? "Service")
|
if (st.tax_name.include? "Service")
|
||||||
service_tax_desc = st.tax_name
|
service_tax_desc = st.tax_name
|
||||||
service_tax_amount = number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
|
service_tax_amount = st.tax_payable_amount
|
||||||
if incl_tax
|
if incl_tax
|
||||||
service_tax_rate = st.tax_rate.to_i
|
service_tax_rate = st.tax_rate.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (st.tax_name.include? "Commercial")
|
if (st.tax_name.include? "Commercial")
|
||||||
com_tax_desc = st.tax_name
|
com_tax_desc = st.tax_name
|
||||||
com_tax_amount = number_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
|
com_tax_amount = st.tax_payable_amount
|
||||||
if incl_tax
|
if incl_tax
|
||||||
com_tax_rate = st.tax_rate.to_i
|
com_tax_rate = st.tax_rate.to_i
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user