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:
52 files changed
+7535
-560
No files matched your search
@@ -172,17 +172,16 @@ fn the_last_months_of_a_span() {
|
||||
fn a_partys_part_of_a_split_entry_is_its_fraction_of_what_was_bought() {
|
||||
let f = fixture("what-for");
|
||||
let e = f.books.ledger.get_entry(f.entry).unwrap();
|
||||
let money = money_accounts(&f.books.ledger, &[f.cash]);
|
||||
let money = money_accounts(&f.books.ledger, &[f.cash], &[]);
|
||||
let flow = entry_flow(e, &money).unwrap();
|
||||
let dec = |c: i64| Decimal::new(c, 2);
|
||||
assert_eq!(
|
||||
f.books.party_what_for(e, f.sam, &flow),
|
||||
vec![(f.rent, dec(4_200)), (f.fees, dec(1_800))]
|
||||
);
|
||||
assert_eq!(
|
||||
f.books.party_what_for(e, f.riley, &flow),
|
||||
vec![(f.rent, dec(2_800)), (f.fees, dec(1_200))]
|
||||
);
|
||||
let sam = f.books.party_what_for(e, f.sam);
|
||||
let riley = f.books.party_what_for(e, f.riley);
|
||||
assert_eq!(sam, vec![(f.rent, dec(4_200)), (f.fees, dec(1_800))]);
|
||||
assert_eq!(riley, vec![(f.rent, dec(2_800)), (f.fees, dec(1_200))]);
|
||||
// Together, the entry's whole breakdown.
|
||||
let total: Decimal = sam.iter().chain(&riley).map(|(_, v)| *v).sum();
|
||||
assert_eq!(total, flow.net);
|
||||
}
|
||||
|
||||
/// share_of_what_for doc: the whole what-for for the whole net; nothing
|
||||
|
||||
Reference in new issue
Block a user