mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 10:16:01 +02:00
Basic pdf generating
This commit is contained in:
parent
e987e201ad
commit
727d1226ad
15 changed files with 298 additions and 3 deletions
|
@ -7,6 +7,9 @@ class Invoice < ActiveRecord::Base
|
|||
|
||||
accepts_nested_attributes_for :invoice_items
|
||||
|
||||
attr_accessor :billing_email
|
||||
validates :billing_email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
|
||||
|
||||
validates :invoice_type, :due_date, :currency, :seller_name,
|
||||
:seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true
|
||||
|
||||
|
@ -38,6 +41,14 @@ class Invoice < ActiveRecord::Base
|
|||
Country.new(buyer_country_code)
|
||||
end
|
||||
|
||||
def forward
|
||||
return false unless valid?
|
||||
return false unless billing_email
|
||||
|
||||
# TODO: forward invoice
|
||||
true
|
||||
end
|
||||
|
||||
def items
|
||||
invoice_items
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue