From 07f89f8ce581dad31996f524317a6b0387589aab Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Thu, 13 Aug 2015 15:44:51 +0300 Subject: [PATCH] Added additional rounding #2783 --- app/models/invoice.rb | 6 +++--- app/models/invoice_item.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/invoice.rb b/app/models/invoice.rb index a658b69df..583f26825 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -126,14 +126,14 @@ class Invoice < ActiveRecord::Base end def sum_without_vat - items.map(&:item_sum_without_vat).sum + (items.map(&:item_sum_without_vat).sum).round(2) end def vat - sum_without_vat * vat_prc + (sum_without_vat * vat_prc).round(2) end def sum - sum_without_vat + vat + (sum_without_vat + vat).round(2) end end diff --git a/app/models/invoice_item.rb b/app/models/invoice_item.rb index e613b4a12..8ab3ac736 100644 --- a/app/models/invoice_item.rb +++ b/app/models/invoice_item.rb @@ -3,6 +3,6 @@ class InvoiceItem < ActiveRecord::Base belongs_to :invoice def item_sum_without_vat - amount * price + (amount * price).round(2) end end