P3: party totals by what moved the money, once (defects 14, 11, 24)

Each party's part of an entry is signed as its own account would show it,
with a direction and its cash and in-kind amounts; a reversal is its
original negated. Totals on a cash or all basis: for a member, all equals
the members' equity statement and cash the K-1's cash. Money is cash,
cards and the financing accounts, and a liability credit never pays its
own creditor (creditor_of), so accruals and declared distributions count
once. tin_last4 from the TIN or W-9 facts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3gXMVt7XJPi6ens1or9Dj
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-21 12:12:26 -06:00
1 parent 9ab003d0d1
commit c2ceabbae9
52 files changed
+7535 -560

No files matched your search

+24 -7
View File
@@ -1027,14 +1027,31 @@ fn party_totals_for_a_customer_a_member_and_a_prepaid() {
assert_eq!(t["received"], "2000.00", "a contribution");
assert_eq!(t["paid"], "500.00", "a distribution");
// A prepaid bought with a member's card: an asset, paid by a liability.
m.add_party("Insurer", &[]);
m.post(
"2026-04-01",
json!({"party": "Insurer"}),
&[("1300", "debit", "1200.00"), ("2100", "credit", "1200.00")],
// A prepaid bought with a member's card: an asset, paid through what
// the members advanced. That is money when it is a financing account
// (rules.md B-35 item 5, P3 defect 24); unlisted, Due to Members is a
// promise like any other liability, counted when the member is paid
// back.
let prepaid = |m: &mut Mcp| {
m.add_party("Insurer", &[]);
m.post(
"2026-04-01",
json!({"party": "Insurer"}),
&[("1300", "debit", "1200.00"), ("2100", "credit", "1200.00")],
);
m.party("Insurer", 2026)["totals"].clone()
};
let t = prepaid(&mut m);
assert_eq!(
(t["paid"].clone(), t["received"].clone()),
(json!("0.00"), json!("0.00"))
);
let t = m.party("Insurer", 2026)["totals"].clone();
let dir = test_dir("totals-financing");
let toml = books_toml(&dir, "Spec Co", "financing_accounts = [\"2100\"]\n");
let mut f = Mcp::start(&dir, &toml);
f.accounts(CHART);
f.books_dir = Some(dir);
let t = prepaid(&mut f);
assert_eq!(t["paid"], "1200.00");
assert_eq!(t["received"], "0.00");
}