Class: Aloe::Reports::AccountsList

Inherits:
Object
  • Object
show all
Defined in:
lib/aloe/reports/accounts_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(currency = Money.default_currency.to_s) ⇒ AccountsList

Returns a new instance of AccountsList.



7
8
9
# File 'lib/aloe/reports/accounts_list.rb', line 7

def initialize(currency = Money.default_currency.to_s)
  @currency = currency
end

Instance Attribute Details

#currencyObject (readonly)

Returns the value of attribute currency.



5
6
7
# File 'lib/aloe/reports/accounts_list.rb', line 5

def currency
  @currency
end

Instance Method Details

#bodyObject



15
16
17
18
19
20
# File 'lib/aloe/reports/accounts_list.rb', line 15

def body
  accounts.map do |a|
    type = a.name? ? 'System' : 'Entity'
    [type, a.id, a.name, a.owner_type_and_id, a.currency, a.balance.format]
  end
end


22
23
24
# File 'lib/aloe/reports/accounts_list.rb', line 22

def footer
  ['', '', '', '', '', trial_balance.format]
end

#headerObject



11
12
13
# File 'lib/aloe/reports/accounts_list.rb', line 11

def header
  ['Type', 'Id', 'Name', 'Owner', 'Currency', 'Balance']
end