mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 17:28:18 +02:00
Invoice migration improvements, invoice issuing
This commit is contained in:
parent
7fe851d480
commit
5c0e2be387
12 changed files with 187 additions and 34 deletions
|
@ -3,16 +3,23 @@ class AddInvoiceColumns < ActiveRecord::Migration
|
|||
# invoice info
|
||||
# invoice number comes from id
|
||||
add_column :invoices, :invoice_type, :string, null: false # CRE / DEB
|
||||
add_column :invoices, :document_name, :string, null: false # Arve
|
||||
# add_column :invoices, :document_name, :string, null: false # Invoice / credit invoice ...
|
||||
add_column :invoices, :due_date, :datetime, null: false
|
||||
add_column :invoices, :payment_term, :string # maksetingimus (free text)
|
||||
add_column :invoices, :payment_term, :string # free text
|
||||
|
||||
add_column :invoices, :currency, :string, null: false
|
||||
add_column :invoices, :description, :string, null: false # Selgitus
|
||||
add_column :invoices, :reference_no, :string # Viitenumber
|
||||
add_column :invoices, :total_sum, :decimal
|
||||
add_column :invoices, :description, :string
|
||||
|
||||
add_column :invoices, :reference_no, :string
|
||||
add_column :invoices, :vat_prc, :decimal
|
||||
#add_column :invoices, :total_sum, :decimal # calculate on the fly
|
||||
add_column :invoices, :paid_at, :datetime
|
||||
|
||||
# seller info
|
||||
# add_column :invoices, :sellable_id, :integer # EIS is actually a registrar itself and invoice can belong to EIS
|
||||
# add_column :invoices, :sellable_type, :string
|
||||
|
||||
add_column :invoices, :seller_id, :integer
|
||||
add_column :invoices, :seller_name, :string, null: false
|
||||
add_column :invoices, :seller_reg_no, :string
|
||||
add_column :invoices, :seller_iban, :string, null: false
|
||||
|
@ -20,6 +27,8 @@ class AddInvoiceColumns < ActiveRecord::Migration
|
|||
add_column :invoices, :seller_swift, :string, null: false
|
||||
add_column :invoices, :seller_vat_no, :string
|
||||
|
||||
add_column :invoices, :seller_country_code, :string
|
||||
add_column :invoices, :seller_state, :string
|
||||
add_column :invoices, :seller_street, :string
|
||||
add_column :invoices, :seller_city, :string
|
||||
add_column :invoices, :seller_zip, :string
|
||||
|
@ -29,35 +38,24 @@ class AddInvoiceColumns < ActiveRecord::Migration
|
|||
|
||||
add_column :invoices, :seller_contact_name, :string
|
||||
|
||||
# payer info
|
||||
add_column :invoices, :payer_name, :string, null: false
|
||||
add_column :invoices, :payer_reg_no, :string, null: false
|
||||
# buyer info
|
||||
# add_column :invoices, :payable_id, :integer
|
||||
# add_column :invoices, :payable_type, :string
|
||||
add_column :invoices, :buyer_id, :integer
|
||||
|
||||
add_column :invoices, :payer_street, :string
|
||||
add_column :invoices, :payer_city, :string
|
||||
add_column :invoices, :payer_zip, :string
|
||||
add_column :invoices, :payer_phone, :string
|
||||
add_column :invoices, :payer_url, :string
|
||||
add_column :invoices, :payer_email, :string
|
||||
add_column :invoices, :buyer_name, :string, null: false
|
||||
add_column :invoices, :buyer_reg_no, :string, null: false
|
||||
|
||||
# MIGRATION TO invoice_rows / invoice_items
|
||||
# add_column :invoices, :serial_number, :string # kauba seeria kood
|
||||
add_column :invoices, :product_code, :string # teenuse kood müüja süsteemis (sellerProductId)
|
||||
add_column :invoices, :description, :string, null: false
|
||||
add_column :invoices, :item_unit, :string
|
||||
add_column :invoices, :item_amount, :integer
|
||||
add_column :invoices, :item_price, :decimal # without taxes and discounts
|
||||
add_column :invoices, :item_sum, :decimal # could calculate on the fly (amount * price) (without taxes and discounts)
|
||||
add_column :invoices, :vat_sum, :decimal # could calculate on the fly
|
||||
add_column :invoices, :item_total_sum, :decimal # could calculate on the fly (row's total sum with taxes)
|
||||
add_column :invoices, :buyer_country_code, :string
|
||||
add_column :invoices, :buyer_state, :string
|
||||
add_column :invoices, :buyer_street, :string
|
||||
add_column :invoices, :buyer_city, :string
|
||||
add_column :invoices, :buyer_zip, :string
|
||||
add_column :invoices, :buyer_phone, :string
|
||||
add_column :invoices, :buyer_url, :string
|
||||
add_column :invoices, :buyer_email, :string
|
||||
|
||||
|
||||
|
||||
###
|
||||
add_column :invoices, :seller_address, :string
|
||||
add_column :invoices, :seller_name, :string
|
||||
|
||||
add_column :invoices, :buyer_name, :string
|
||||
add_column :invoices, :buyer_reg_no, :string
|
||||
add_column :invoices, :buyer_contact_name, :string
|
||||
end
|
||||
end
|
||||
|
||||
|
|
14
db/migrate/20150408081917_create_invoice_items.rb
Normal file
14
db/migrate/20150408081917_create_invoice_items.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
class CreateInvoiceItems < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :invoice_items do |t|
|
||||
t.integer :invoice_id
|
||||
# t.string :product_code
|
||||
t.string :description, null: false
|
||||
t.string :item_unit
|
||||
t.integer :item_amount
|
||||
t.decimal :item_price
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue