Change Invoice::Item price scale to 3 places

This commit is contained in:
Karl Erik Õunapuu 2020-09-10 12:00:13 +03:00
parent 3decec8b02
commit d62e55e6a1
No known key found for this signature in database
GPG key ID: C9DD647298A34764
5 changed files with 18 additions and 16 deletions

View file

@ -82,7 +82,7 @@ class Invoice < ApplicationRecord
end
def vat_amount
subtotal * vat_rate / 100
(subtotal * vat_rate / 100)
end
def total
@ -118,9 +118,8 @@ class Invoice < ApplicationRecord
vat = VatRateCalculator.new(registrar: registrar_user).calculate
wo_vat = (transaction.sum / (1 + (vat / 100)))
registrar_user.issue_prepayment_invoice(wo_vat, 'Direct top-up via bank transfer',
payable: false, total: transaction.sum)
payable: false)
end
private
@ -130,6 +129,6 @@ class Invoice < ApplicationRecord
end
def calculate_total
self.total = subtotal + vat_amount
self.total = (subtotal + vat_amount).round(3)
end
end