View Source SoftBank.Account (soft_bank v1.2.5)

An Account represents accounts in the system which are of asset, liability, or equity types, in accordance with the "accounting equation".

Each account must be set to one of the following types:

TYPENORMAL BALANCEDESCRIPTION
assetDebitResources owned by the Business Entity
liabilityCreditDebts owed to outsiders
equityCreditOwners rights to the Assets

Each account can also be marked as a Contra Account. A contra account will have it's normal balance swapped. For example, to remove equity, a "Drawing" account may be created as a contra equity account as follows:

account = %SoftBank.Account{name: "Drawing", type: "asset", contra: true}

At all times the balance of all accounts should conform to the "accounting equation"

Assets = Liabilities + Owner's Equity

Each account type acts as it's own ledger.

For more details see:

Wikipedia - Accounting Equation Wikipedia - Debits, Credits, and Contra Accounts

Summary

Types

t()

An Account type.

Functions

Computes the account balance for a given SoftBank.Account in a given Ecto.Repo when provided with a map of dates in the format %{from_date: from_date, to_date: to_date}. Returns Decimal type.

Builds a changeset based on the struct and params.

Fetch the Account from the Repo.

Create new account with default ledgers

Computes a test balance for all accounts in the provided Ecto.Repo. Returns Money type.

Types

@type t() :: %SoftBank.Account{
  __meta__: term(),
  account_number: String.t(),
  amounts: [SoftBank.Amount],
  balance: term(),
  contra: Boolean.t(),
  default_currency: String.t(),
  entry: term(),
  id: term(),
  inserted_at: term(),
  name: String.t(),
  owner: term(),
  owner_id: term(),
  type: String.t(),
  updated_at: term()
}

An Account type.

Functions

Link to this function

account_balance(repo \\ Repo, account_or_account_list, dates \\ nil)

View Source

Computes the account balance for a given SoftBank.Account in a given Ecto.Repo when provided with a map of dates in the format %{from_date: from_date, to_date: to_date}. Returns Decimal type.

Link to this function

bank_account_number(number \\ 12)

View Source
Link to this function

changeset(struct, params \\ %{})

View Source

Builds a changeset based on the struct and params.

Link to this function

fetch(account, repo \\ Repo)

View Source

Fetch the Account from the Repo.

Create new account with default ledgers

Link to this function

test_balance(repo \\ Repo)

View Source

Computes a test balance for all accounts in the provided Ecto.Repo. Returns Money type.