Class: CreditInvoice
- Defined in:
- app/models/credit_invoice.rb
Constant Summary
Constants inherited from Invoice
Class Method Summary collapse
-
.direct_account ⇒ Object
Accounts ========.
Instance Method Summary collapse
Methods inherited from Invoice
#active, #amount, #build_booking, #open, #overdue?, #state_adverb, #state_noun, #update_code
Methods included from ApplicationHelper
#currency_fmt, #current_tenant, #engine_stylesheet_link_tag, #icon_delete_link_to, #icon_edit_link_to, #list_item_actions_for, #show_new_form
Class Method Details
.direct_account ⇒ Object
Accounts
21 22 23 |
# File 'app/models/credit_invoice.rb', line 21 def self.direct_account Account.find_by_code("2000") end |
Instance Method Details
#balance_account ⇒ Object
25 26 27 |
# File 'app/models/credit_invoice.rb', line 25 def balance_account bookings.first.try(:debit_account) end |
#profit_account ⇒ Object
29 30 31 |
# File 'app/models/credit_invoice.rb', line 29 def profit_account bookings.first.try(:credit_account) end |
#to_s(format = :default) ⇒ Object
String
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/models/credit_invoice.rb', line 3 def to_s(format = :default) return "" if amount.nil? identifier = title identifier += " / #{code}" if code.present? case format when :reference return identifier + " (#{company.to_s})" when :long return "%s: %s für %s à %s" % [I18n::localize(value_date), ident, company, currency_fmt(amount)] else return identifier end end |