class Aloe::Reports::AccountsList

Attributes

currency[R]

Public Class Methods

new(currency = Money.default_currency.to_s) click to toggle source
# File lib/aloe/reports/accounts_list.rb, line 7
def initialize(currency = Money.default_currency.to_s)
  @currency = currency
end

Public Instance Methods

body() click to toggle source
# 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
header() click to toggle source
# File lib/aloe/reports/accounts_list.rb, line 11
def header
  ['Type', 'Id', 'Name', 'Owner', 'Currency', 'Balance']
end

Protected Instance Methods

accounts() click to toggle source
# File lib/aloe/reports/accounts_list.rb, line 28
def accounts
  @accounts ||= Aloe::Account.currency(@currency).all
end
trial_balance() click to toggle source
# File lib/aloe/reports/accounts_list.rb, line 32
def trial_balance
  amount = Aloe::Account.trial_balance(@currency)
  Money.new(amount, @currency)
end