Introduced invoices and deliveries. Integration (especially of deliveries) isn't finished yet.
This commit is contained in:
parent
1894f27fe0
commit
30f3d199d3
65 changed files with 1193 additions and 209 deletions
28
app/models/invoice.rb
Normal file
28
app/models/invoice.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: invoices
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# delivery_id :integer(4)
|
||||
# number :string(255)
|
||||
# date :date
|
||||
# paid_on :date
|
||||
# amount :decimal(8, 2) default(0.0), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
|
||||
class Invoice < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
|
||||
validates_presence_of :supplier_id
|
||||
validates_uniqueness_of :date, :scope => [:supplier_id]
|
||||
|
||||
# Custom attribute setter that accepts decimal numbers using localized decimal separator.
|
||||
def amount=(amount)
|
||||
self[:amount] = String.delocalized_decimal(amount)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue