mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
parent
f86ab085ac
commit
7dee10c683
13 changed files with 29 additions and 13 deletions
|
@ -34,7 +34,7 @@ class Directo < ActiveRecord::Base
|
|||
xml.line(
|
||||
"ProductID" => Setting.directo_receipt_product_name,
|
||||
"Quantity" => 1,
|
||||
"UnitPriceWoVAT" => ActionController::Base.helpers.number_with_precision(invoice.sum_cache/(1+invoice.vat_prc), precision: 2, separator: "."),
|
||||
"UnitPriceWoVAT" => ActionController::Base.helpers.number_with_precision(invoice.sum_cache/(1+invoice.vat_rate), precision: 2, separator: "."),
|
||||
"ProductName" => invoice.order
|
||||
)
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class Invoice < ActiveRecord::Base
|
|||
validates :billing_email, email_format: { message: :invalid }, allow_blank: true
|
||||
|
||||
validates :invoice_type, :due_date, :currency, :seller_name,
|
||||
:seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true
|
||||
:seller_iban, :buyer_name, :invoice_items, :vat_rate, presence: true
|
||||
|
||||
before_create :set_invoice_number, :check_vat
|
||||
|
||||
|
@ -52,7 +52,7 @@ class Invoice < ActiveRecord::Base
|
|||
|
||||
def check_vat
|
||||
if buyer.country_code != 'EE' && buyer.vat_no.present?
|
||||
self.vat_prc = 0
|
||||
self.vat_rate = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -157,7 +157,7 @@ class Invoice < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def vat
|
||||
(sum_without_vat * vat_prc).round(2)
|
||||
(sum_without_vat * vat_rate).round(2)
|
||||
end
|
||||
|
||||
def sum
|
||||
|
|
|
@ -81,7 +81,7 @@ class Registrar < ActiveRecord::Base
|
|||
payment_term: 'prepayment',
|
||||
description: description,
|
||||
currency: 'EUR',
|
||||
vat_prc: Setting.registry_vat_prc,
|
||||
vat_rate: Setting.registry_vat_prc,
|
||||
seller_name: Setting.registry_juridical_name,
|
||||
seller_reg_no: Setting.registry_reg_no,
|
||||
seller_iban: Setting.registry_iban,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
%td= currency(@invoice.sum_without_vat)
|
||||
%tr
|
||||
%th.no-border{colspan: 3}
|
||||
%th= t('vat', vat_prc: (@invoice.vat_prc * 100).round)
|
||||
%th= t('vat', rate: (@invoice.vat_rate * 100).round)
|
||||
%td= currency(@invoice.vat)
|
||||
%tr
|
||||
%th.no-border{colspan: 3}
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
%td= "#{currency(@invoice.sum_without_vat)} #{@invoice.currency}"
|
||||
%tr
|
||||
%th.no-border{colspan: 3}
|
||||
%th= t('vat', vat_prc: (@invoice.vat_prc * 100).round)
|
||||
%th= t('vat', rate: (@invoice.vat_rate * 100).round)
|
||||
%td= "#{currency(@invoice.vat)} #{@invoice.currency}"
|
||||
%tr
|
||||
%th.no-border{colspan: 3}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue