Split

NAME

App::Moneymoor::Model::Split - the categorized part of a transaction.

SYNOPSIS


use App::Moneymoor::Model::Split;

# A £60 shop split between food and household:
my @splits = (
    App::Moneymoor::Model::Split.new(category-id => $groceries, amount => -4500),
    App::Moneymoor::Model::Split.new(category-id => $household, amount => -1500),
);
# ... created together with the transaction, in one SQL transaction:
$gw.create($txn, :@splits);

my $s = App::Moneymoor::Model::Split.new-from-row(%row);

DESCRIPTION

Splits are where transactions meet envelopes. Every categorized transaction owns at least one, and their amounts must sum to the transaction's amount — Gateway::Transaction enforces that inside the same SQL transaction that writes them, so a budget file can never contain a half-categorized transaction.

Amounts follow the transaction's sign convention (outflow negative, inflow positive), so a refund split is positive and a spending split is negative. A split may be zero — that is a legitimate placeholder while a UI is being edited — and the engine treats zero splits as no-ops.

Inflows are categorized like anything else: a salary payment is a split against the rta category, which is what makes it "Ready to Assign" rather than money that appeared in an envelope by magic.

memo is per-split, so a three-way split can explain each part.

ATTRIBUTES

  • id — primary key; absent on a not-yet-inserted row.

  • transaction-id — FK to transactions.id. Left unset when building splits to pass to Gateway::Transaction.create: the gateway fills it in once the transaction has an id.

  • category-id — required FK to categories.id.

  • amount — required signed integer pence.

  • memo — free-form, default empty string.

METHODS

  • new-from-row(%row) — build from a DBIish row hash.

  • is-inflow / is-outflow — amount sign predicates.

App::Moneymoor v0.4.2

YNAB-style envelope budgeting: a derivation engine

Authors

  • Matt Doughty

License

Artistic-2.0

Dependencies

DBIish:ver<0.6.7>:auth<zef:raku-community-modules>Notcurses::Native:ver<0.6.5+>:auth<zef:apogee>Selkie:ver<0.16.0+>:auth<zef:apogee>JSON::Fast:ver<0.19>:auth<cpan:TIMOTIMO>MacOS::NativeLib:ver<0.0.6>:auth<zef:lizmat>

Test Dependencies

Provides

  • App::Moneymoor
  • App::Moneymoor::Config
  • App::Moneymoor::DB
  • App::Moneymoor::Gateway::Account
  • App::Moneymoor::Gateway::Assignment
  • App::Moneymoor::Gateway::Category
  • App::Moneymoor::Gateway::Payee
  • App::Moneymoor::Gateway::Transaction
  • App::Moneymoor::Handlers::Boot
  • App::Moneymoor::Model::Account
  • App::Moneymoor::Model::Assignment
  • App::Moneymoor::Model::Category
  • App::Moneymoor::Model::CategoryGroup
  • App::Moneymoor::Model::Payee
  • App::Moneymoor::Model::Split
  • App::Moneymoor::Model::Transaction
  • App::Moneymoor::Screen::Accounts
  • App::Moneymoor::Screen::Budget
  • App::Moneymoor::Screen::Login
  • App::Moneymoor::Screen::Main
  • App::Moneymoor::Screen::Main::Keybinds
  • App::Moneymoor::Screen::Main::Modals
  • App::Moneymoor::Screen::Main::Subscriptions
  • App::Moneymoor::Screen::Reports
  • App::Moneymoor::Service::Budget
  • App::Moneymoor::Service::Icons
  • App::Moneymoor::Service::Target
  • App::Moneymoor::Service::Workspace
  • App::Moneymoor::StoreHandlers
  • App::Moneymoor::Theme
  • App::Moneymoor::Theme::Catppuccin
  • App::Moneymoor::Theme::Dracula
  • App::Moneymoor::Theme::Everforest
  • App::Moneymoor::Theme::Gruvbox
  • App::Moneymoor::Theme::Kanagawa
  • App::Moneymoor::Theme::Monokai
  • App::Moneymoor::Theme::Nord
  • App::Moneymoor::Theme::OneDark
  • App::Moneymoor::Theme::RosePine
  • App::Moneymoor::Theme::Solarized
  • App::Moneymoor::Theme::TokyoNight
  • App::Moneymoor::Themes
  • App::Moneymoor::UI
  • App::Moneymoor::Util::Money
  • App::Moneymoor::Util::Period
  • App::Moneymoor::View::BudgetRow
  • App::Moneymoor::View::EmptyState
  • App::Moneymoor::View::HintBar
  • App::Moneymoor::View::InspectorPane
  • App::Moneymoor::View::ModalChrome
  • App::Moneymoor::View::RegisterRow
  • App::Moneymoor::View::ReportRow
  • App::Moneymoor::Widget::BannerBar
  • App::Moneymoor::Widget::BootProgressModal

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.