Fuentes v0.0.1 Fuentes.Entry

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

Summary

Functions

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

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

Accepts and returns a changeset, adding an error if “credit” and “debit” amounts are not equivalent

Functions

balanced?(entry, repo)

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

changeset(model, params \\ %{})

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

validate_debits_and_credits_balance(changeset)

Accepts and returns a changeset, adding an error if “credit” and “debit” amounts are not equivalent