HALO CRM research
Real and working
Domain 4 · money · ~5,600 LOC

Creator invoicing

Raises per-cycle invoices against creator net sales, in the creator's payout currency, at an FX rate frozen when the invoice is raised. Four billing cycles a month (CYCLE_START_DAYS [1,8,16,24]).

What it is and how it feeds the rest

Mechanically

Raises per-cycle invoices against creator net sales, in the creator's payout currency, at an FX rate frozen when the invoice is raised. Four billing cycles a month (CYCLE_START_DAYS [1,8,16,24]).

How it connects

Consumes net-sales entries; emits invoices that the payment log settles against. Shares the currencyRates cache with referral invoicing.

Pages

  • src/pages/CreatorInvoicing.tsx
  • src/pages/CreatorInvoice.tsx

Components

  • src/components/creator-invoicing/

Convex modules

  • invoicing.ts
  • currency.ts

Tables

  • creatorInvoicing
  • currencyRates

Findings that touch this domain

high All money is float64; 2 rounding calls in 11,274 LOC, none in invoicing/referrals/payroll

convex/schema.ts:103,132,153,393,703

medium percentage ?? 50 silently assumes a 50/50 split when a creator's rate was never set

convex/invoicing.ts:34,65,250

high migrateToPeriodCycles is public and merges duplicate invoices by summing then deleting; re-running on migrated data silently re-merges real money

convex/invoicing.ts:628, merge-delete at :665-680

The decision — what we do here

TRANSPLANT+FIX — port a trust-liability double-entry ledger (medici model + dinero); collapse creator+referral invoicing into one block; kill the silent 50/50 default. Preserve complete workflow parity, but use the strongest UI rather than preserving Camron's screen by default.

Repos we analyzed for this domain

LIFT flash-oss/medici

Double-entry ledger engine (Node/TS). Port behind PaymentLog; earnings = liability not revenue.

LIFT dinerojs/dinero.js

Integer minor units + allocate() — kills the float/rounding bug across all money math.

LIFT = copy the code into the fork · WRAP = run underneath as a service · STUDY = architecture only. Verdicts from the OFM sourcing campaign.

Open questions

Research priority for this domain is low. Agent findings splice in below this line and survive regeneration.