fix request bill error with show_total_before_tax

This commit is contained in:
Thein Lin Kyaw
2019-11-29 14:24:35 +06:30
parent 5b88d16485
commit 0ef1b4fd87
2 changed files with 7 additions and 5 deletions

View File

@@ -45,15 +45,17 @@ module NumberFormattable
options[:precision] = options[:precision] || precision
# options[:delimiter] = options[:delimiter] || delimiter
options[:strip_insignificant_zeros] = options[:strip_insignificant_zeros] || strip_insignificant_zeros
number = number.to_f.round(options[:precision])
if options[:precision] > 0
if options[:strip_insignificant_zeros]
formatted = "%.12g" % number.round(options[:precision])
formatted = "%.12g" % number
else
formatted = "%.#{options[:precision]}f" % number.round(options[:precision])
formatted = "%.#{options[:precision]}f" % number
end
else
formatted = number.round(options[:precision]).to_i.to_s
formatted = number.to_i.to_s
end
if options[:delimiter] && !options[:delimiter].empty?

View File

@@ -344,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_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
service_tax_amount = st.tax_payable_amount
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_format(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)
com_tax_amount = st.tax_payable_amount
if incl_tax
com_tax_rate = st.tax_rate.to_i
end