foodsoft/app/models/invoice.rb
benni 8a74e7d77f Removed annoate and hirb Gemfiles.
Annotate: Better look in schema.rb, this reference should be always up
to date.

Hirb: To reactivate hirb, look in railscasts:
http://railscasts.com/episodes/48-console-tricks-revised
2012-07-27 18:07:42 +02:00

21 lines
458 B
Ruby

class Invoice < ActiveRecord::Base
belongs_to :supplier
belongs_to :delivery
belongs_to :order
validates_presence_of :supplier_id
validates_numericality_of :amount, :deposit, :deposit_credit
scope :unpaid, :conditions => { :paid_on => nil }
# Replace numeric seperator with database format
localize_input_of :amount, :deposit, :deposit_credit
# Amount without deposit
def net_amount
amount - deposit + deposit_credit
end
end