Account
NAME
App::Moneymoor::Model::Account - a place money actually sits.
SYNOPSIS
use App::Moneymoor::Model::Account;
my $current = App::Moneymoor::Model::Account.new(
name => 'Current Account',
type => 'cash',
);
my $visa = App::Moneymoor::Model::Account.new(
name => 'Visa',
type => 'credit',
note => 'statement on the 14th',
);
# From a DBIish row hash (SQL column names, underscore form):
my $a = App::Moneymoor::Model::Account.new-from-row(%row);
say $a.is-on-budget; # True for cash and credit, False for tracking
say $a.is-credit; # True only for credit
DESCRIPTION
Three account types, and the difference between them is exactly which part of the budget they touch:
cashā current accounts, savings, physical cash. On budget: their combined balance is the money the envelopes partition, and it is the right-hand side of the master invariant.creditā credit cards. On budget: spending from one is real spending and hits your envelopes, but the balance is debt, not cash. Every credit account owns apaymentcategory that tracks the cash you have set aside to pay it.trackingā mortgages, pensions, an investment account you want to see but not budget from. Off budget: their transactions never touch an envelope. Moving money to one is spending (categorized on the on-budget leg of the transfer); moving money from one is income.
closed hides an account from pickers without deleting its history ā
the same soft-retire idea as hiding a category. A closed account's
transactions still count towards balances and the budget, because
they really happened.
amount signs live on transactions, not here: an account has no
stored balance at all. Balances are derived (see
App::Moneymoor::Service::Budget), because a stored balance is a
cache that will eventually disagree with the transactions that
produced it.
ATTRIBUTES
idā primary key; absent on a not-yet-inserted row.nameā required, unique across accounts.typeācash/credit/tracking; defaultcash.noteā free-form, default empty string.closedā Bool; default False.sort-orderā display order; default 0.created-atā gateway-managed timestamp.
METHODS
new-from-row(%row)ā build from a DBIish row hash.is-cash/is-credit/is-trackingā type predicates.is-on-budgetā True forcashandcredit.