1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

fix error message about rounding inconsistencies when generating invoices

This commit is contained in:
Sylvain 2016-11-29 11:52:11 +01:00
parent f487133825
commit 3894523eae

View File

@ -190,8 +190,8 @@ module PDF
data += [ [I18n.t('invoices.including_amount_payed_on_ordering'), number_to_currency(total)] ]
# checking the round number
rounded = sprintf('%.2f', vat).to_i + sprintf('%.2f', total-vat).to_i
if rounded != sprintf('%.2f', total_calc).to_i
rounded = sprintf('%.2f', vat).to_f + sprintf('%.2f', total-vat).to_f
if rounded != sprintf('%.2f', total_calc).to_f
puts "ERROR: rounding the numbers cause an invoice inconsistency. Total expected: #{sprintf('%.2f', total_calc)}, total computed: #{rounded}"
end
else