SoftBank.Entry (soft_bank v0.1.3) View Source

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

Link to this section 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

Link to this section Types

Specs

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

Link to this section Functions

Link to this function

balanced?(repo \\ Repo, entry)

View Source

Specs

balanced?(Ecto.Repo.t(), t()) :: Boolean.t()

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 \\ %{})

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)

View Source

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