Skip to content

BalancesContainer

The container of balances of an [[Account]] or [[Group]]

The container is composed of a list of [[Balances]] for a window of time, as well as its period and cumulative totals.

Properties

getAccount()

getAccount: () => Promise<Account | null>;

Gets the [[Account]] associated with this container.

Returns

Promise<Account | null>

The [[Account]] associated with this container


getBalances()

getBalances: () => Balance[];

Gets all [[Balances]] of the container

Returns

Balance[]

All [[Balances]] of the container


getBalancesContainer()

getBalancesContainer: (name) => BalancesContainer;

Gets a specific [[BalancesContainer]].

Parameters

ParameterTypeDescription
namestringThe [[Account]] or [[Group]] name

Returns

BalancesContainer

The retrieved [[BalancesContainer]]


getBalancesContainers()

getBalancesContainers: () => BalancesContainer[];

Gets all child [[BalancesContainers]].

NOTE: Only for Group balance containers. Accounts returns null.

Returns

BalancesContainer[]

All child [[BalancesContainers]]


getBalancesReport()

getBalancesReport: () => BalancesReport;

Gets the parent [[BalancesReport]] of the container.

Returns

BalancesReport

The parent [[BalancesReport]] of the container


getCumulativeBalance()

getCumulativeBalance: () => Amount;

Gets the cumulative balance to the date.

Returns

Amount

The cumulative balance to the date


getCumulativeBalanceRaw()

getCumulativeBalanceRaw: () => Amount;

Gets the cumulative raw balance to the date.

Returns

Amount

The cumulative raw balance to the date


getCumulativeBalanceRawText()

getCumulativeBalanceRawText: () => string;

Gets the cumulative raw balance formatted according to [[Book]] decimal format and fraction digits.

Returns

string

The cumulative raw balance formatted according to [[Book]] decimal format and fraction digits


getCumulativeBalanceText()

getCumulativeBalanceText: () => string;

Gets the cumulative balance formatted according to [[Book]] decimal format and fraction digits.

Returns

string

The cumulative balance formatted according to [[Book]] decimal format and fraction digits


getDepth()

getDepth: () => number;

Gets the depth in the parent chain up to the root.

Returns

number

The depth in the parent chain up to the root


getGroup()

getGroup: () => Promise<Group | null>;

Gets the [[Group]] associated with this container.

Returns

Promise<Group | null>

The [[Group]] associated with this container


getName()

getName: () => string;

Gets the [[Account]] or [[Group]] name.

Returns

string

The [[Account]] or [[Group]] name


getNormalizedName()

getNormalizedName: () => string;

Gets the [[Account]] or [[Group]] name without spaces or special characters.

Returns

string

The [[Account]] or [[Group]] name without spaces or special characters


getParent()

getParent: () => BalancesContainer | null;

Gets the parent BalanceContainer.

Returns

BalancesContainer | null

The parent BalanceContainer


getPeriodBalance()

getPeriodBalance: () => Amount;

Gets the balance on the date period.

Returns

Amount

The balance on the date period


getPeriodBalanceRaw()

getPeriodBalanceRaw: () => Amount;

Gets the raw balance on the date period.

Returns

Amount

The raw balance on the date period


getPeriodBalanceRawText()

getPeriodBalanceRawText: () => string;

Gets the raw balance on the date period formatted according to [[Book]] decimal format and fraction digits.

Returns

string

The raw balance on the date period formatted according to [[Book]] decimal format and fraction digits


getPeriodBalanceText()

getPeriodBalanceText: () => string;

Gets the balance on the date period formatted according to [[Book]] decimal format and fraction digits.

Returns

string

The balance on the date period formatted according to [[Book]] decimal format and fraction digits


hasGroupBalances()

hasGroupBalances: () => boolean;

Gets whether the balance container is from a parent group.

Returns

boolean

True if the balance container is from a parent group


isCredit()

isCredit: () => boolean | undefined;

Gets the credit nature of the BalancesContainer, based on [[Account]] or [[Group]].

For [[Account]], the credit nature will be the same as the one from the Account.

For [[Group]], the credit nature will be the same, if all accounts containing on it has the same credit nature. False if mixed.

Returns

boolean | undefined

The credit nature of the BalancesContainer


isFromAccount()

isFromAccount: () => boolean;

Gets whether this balance container is from an [[Account]].

Returns

boolean

True if this balance container if from an [[Account]]


isFromGroup()

isFromGroup: () => boolean;

Gets whether this balance container is from a [[Group]].

Returns

boolean

True if this balance container if from a [[Group]]


isPermanent()

isPermanent: () => boolean;

Tell if this balance container is permanent, based on the [[Account]] or [[Group]].

Permanent are the ones which final balance is relevant and keep its balances over time.

They are also called Real Accounts.

Usually represents assets or liabilities, capable of being perceived by the senses or the mind, like bank accounts, money, debts and so on.

Returns

boolean

True if its a permanent Account


payload

payload: AccountBalances | GroupBalances;

Methods

createDataTable()

createDataTable(): BalancesDataTableBuilder;

Creates a BalancesDataTableBuilder to generate a two-dimensional array with all [[BalancesContainers]]

Returns

BalancesDataTableBuilder


getCumulativeCredit()

getCumulativeCredit(): Amount;

The cumulative credit to the date.

Returns

Amount


getCumulativeCreditText()

getCumulativeCreditText(): string;

The cumulative credit formatted according to [[Book]] decimal format and fraction digits.

Returns

string


getCumulativeDebit()

getCumulativeDebit(): Amount;

The cumulative debit to the date.

Returns

Amount


getCumulativeDebitText()

getCumulativeDebitText(): string;

The cumulative credit formatted according to [[Book]] decimal format and fraction digits.

Returns

string


getPeriodCredit()

getPeriodCredit(): Amount;

The credit on the date period.

Returns

Amount


getPeriodCreditText()

getPeriodCreditText(): string;

The credit on the date period formatted according to [[Book]] decimal format and fraction digits

Returns

string


getPeriodDebit()

getPeriodDebit(): Amount;

The debit on the date period.

Returns

Amount


getPeriodDebitText()

getPeriodDebitText(): string;

The debit on the date period formatted according to [[Book]] decimal format and fraction digits

Returns

string


getProperties()

getProperties(): object;

Gets the custom properties stored in this Account or Group.

Returns

object


getProperty()

getProperty(...keys): string | undefined;

Gets the property value for given keys. First property found will be retrieved

Parameters

ParameterTypeDescription
keysstring[]The property key

Returns

string | undefined


getPropertyKeys()

getPropertyKeys(): string[];

Gets the custom properties keys stored in the associated [[Account]] or [[Group]].

Returns

string[]