Add tests to invoice

This commit is contained in:
Martin Lensment 2015-04-10 13:19:54 +03:00
parent 416842f924
commit 7eff257434
7 changed files with 119 additions and 26 deletions

View file

@ -1,18 +1,18 @@
class AddInvoiceColumns < ActiveRecord::Migration
def change
# 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 # Invoice / credit invoice ...
add_column :invoices, :due_date, :datetime, null: false
# invoice number comes from id # e-invoice
add_column :invoices, :invoice_type, :string, null: false # CRE / DEB # e-invoice
# add_column :invoices, :document_name, :string, null: false # Invoice / credit invoice ... # e-invoice
add_column :invoices, :due_date, :datetime, null: false # e-invoice
add_column :invoices, :payment_term, :string # free text
add_column :invoices, :currency, :string, null: false
add_column :invoices, :currency, :string, null: false # e-invoice
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, :vat_prc, :decimal, null: false
#add_column :invoices, :total_sum, :decimal # calculate on the fly # e-invoice
add_column :invoices, :paid_at, :datetime # maybe figure this out from transactions
# seller info
@ -20,11 +20,11 @@ class AddInvoiceColumns < ActiveRecord::Migration
# add_column :invoices, :sellable_type, :string
add_column :invoices, :seller_id, :integer
add_column :invoices, :seller_name, :string, null: false
add_column :invoices, :seller_name, :string, null: false # e-invoice
add_column :invoices, :seller_reg_no, :string
add_column :invoices, :seller_iban, :string, null: false
add_column :invoices, :seller_bank, :string, null: false
add_column :invoices, :seller_swift, :string, null: false
add_column :invoices, :seller_iban, :string, null: false # e-invoice
add_column :invoices, :seller_bank, :string
add_column :invoices, :seller_swift, :string
add_column :invoices, :seller_vat_no, :string
add_column :invoices, :seller_country_code, :string
@ -43,8 +43,8 @@ class AddInvoiceColumns < ActiveRecord::Migration
# add_column :invoices, :payable_type, :string
add_column :invoices, :buyer_id, :integer
add_column :invoices, :buyer_name, :string, null: false
add_column :invoices, :buyer_reg_no, :string, null: false
add_column :invoices, :buyer_name, :string, null: false # e-invoice
add_column :invoices, :buyer_reg_no, :string
add_column :invoices, :buyer_country_code, :string
add_column :invoices, :buyer_state, :string
@ -55,7 +55,7 @@ class AddInvoiceColumns < ActiveRecord::Migration
add_column :invoices, :buyer_url, :string
add_column :invoices, :buyer_email, :string
add_column :invoices, :buyer_contact_name, :string
# add_column :invoices, :buyer_contact_name, :string
end
end

View file

@ -3,7 +3,7 @@ class CreateInvoiceItems < ActiveRecord::Migration
create_table :invoice_items do |t|
t.integer :invoice_id
# t.string :product_code
t.string :description, null: false
t.string :description, null: false # e-invoice
t.string :unit
t.integer :amount
t.decimal :price

View file

@ -225,14 +225,14 @@ ActiveRecord::Schema.define(version: 20150413140933) do
t.string "currency", null: false
t.string "description"
t.string "reference_no"
t.decimal "vat_prc"
t.decimal "vat_prc", null: false
t.datetime "paid_at"
t.integer "seller_id"
t.string "seller_name", null: false
t.string "seller_reg_no"
t.string "seller_iban", null: false
t.string "seller_bank", null: false
t.string "seller_swift", null: false
t.string "seller_bank"
t.string "seller_swift"
t.string "seller_vat_no"
t.string "seller_country_code"
t.string "seller_state"
@ -245,7 +245,7 @@ ActiveRecord::Schema.define(version: 20150413140933) do
t.string "seller_contact_name"
t.integer "buyer_id"
t.string "buyer_name", null: false
t.string "buyer_reg_no", null: false
t.string "buyer_reg_no"
t.string "buyer_country_code"
t.string "buyer_state"
t.string "buyer_street"
@ -254,7 +254,6 @@ ActiveRecord::Schema.define(version: 20150413140933) do
t.string "buyer_phone"
t.string "buyer_url"
t.string "buyer_email"
t.string "buyer_contact_name"
end
create_table "keyrelays", force: :cascade do |t|