Method: Invoice#amount
- Defined in:
- app/models/invoice.rb
#amount(force_reload = false) ⇒ Object Also known as: grand_total
105 106 107 108 109 |
# File 'app/models/invoice.rb', line 105 def amount( force_reload = false ) (attribute_present? :amount_in_cents and !force_reload) ? Money.new(read_attribute(:amount_in_cents).to_i) : self.activities.inject(Money.new(0)){|sum,a| sum + ((a.cost) ? a.cost : Money.new(0)) + ((a.tax) ? a.tax : Money.new(0)) } end |