View Source SoftBank.Entry (soft_bank v1.2.3)

Entries are the recording of account debits and credits and can be considered as consituting a traditional accounting Journal.

Summary

Functions

Accepts an SoftBank.Entry and Ecto.Repo and returns true/false based on whether the associated amounts for that entry sum to zero.

Creates a changeset for SoftBank.Entry, validating a required :description and :date, casting an provided "debit" and "credit" SoftBank.Amounts, and validating that those amounts balance.

Accepts and returns a changeset, appending an error if "credit" and "debit" amounts are not equivalent

Types

@type t() :: %SoftBank.Entry{
  __meta__: term(),
  amounts: term(),
  date: Ecto.Date.t(),
  description: String.t(),
  id: term(),
  inserted_at: term(),
  updated_at: term()
}

Functions

Link to this function

balanced?(repo \\ Config.repo(), entry, default_currency \\ :USD)

View Source

Accepts an SoftBank.Entry and Ecto.Repo and returns true/false based on whether the associated amounts for that entry sum to zero.

Link to this function

changeset(model, params \\ %{}, default_currency \\ :USD)

View Source

Creates a changeset for SoftBank.Entry, validating a required :description and :date, casting an provided "debit" and "credit" SoftBank.Amounts, and validating that those amounts balance.

Link to this function

validate_debits_and_credits_balance(changeset, default_currency \\ :USD)

View Source

Accepts and returns a changeset, appending an error if "credit" and "debit" amounts are not equivalent