Tahap C implemented and live-verified: invoice conversion with frozen snapshots, server-side payment validation with automatic receipt numbering, token-gated public invoice sharing, and dashboard receivables KPIs
- —Implemented full Tahap C (Invoice, Payment, Receipt): accepted proposals convert into invoices as a frozen server-side snapshot (line items, totals, client identity from the accepted proposal; double-conversion rejected 409).
- —Invoice numbering INV-<year>-<seq> and receipt numbering RCP-<year>-<seq> allocated from persistent monotonic sequences in CommercialSetting (never reused after deletion).
- —Payments validated server-side (amount > 0, never above the remaining balance); amount_paid and paid/partially_paid status always recomputed server-side on every payment create/delete; paid invoices cannot be cancelled.
- —Public invoice share links: server-generated token only authorization; draft invoices cannot be shared (409); revoked links dead immediately (404); public view returns a whitelisted payload (provider, client, frozen items, totals, payments, balance) without the token.
- —Shared public-share helpers (todayStr/denied/shareActive) extracted to base44/shared/publicShareUtils.ts to remove duplication between publicProposal and publicInvoice.
- —Frontend: Invoices list (search/status filter/pagination, create-from-accepted-proposal dialog, PDF/share/cancel/delete actions), Invoice editor (draft-only edits for due date/terms/notes/PDF download flag; frozen line items; payment history with per-payment kwitansi PDF and delete), public /invoice/:token share page with download gating, PaymentDialog and InvoiceShareDialog.
- —CommercialDashboard adds Outstanding invoices KPI (outstanding, collected, overdue count) and an invoices-by-status panel, all traceable to live server aggregates; CommercialSettings adds invoice/receipt prefixes and default invoice due days.
- —ProposalEditor: accepted proposals now expose Create invoice (or View invoice once converted), so the full commercial lifecycle lead -> proposal -> acceptance -> invoice -> payment -> receipt runs end to end.
- —Security unchanged in shape: all commercial data remains RLS admin-only and every gateway action requires platform admin server-side; commercial audit events continue under the 'platform' organization sentinel.
tenantCommercial gateway (invoices_*, payments_* actions; server-side frozen snapshots, validation, sequence allocation)publicInvoice gateway (token-gated public invoice view; shared helpers extracted to base44/shared/publicShareUtils.ts)Commercial UI: Invoices list page, Invoice editor, public InvoiceShareView, InvoiceDocumentView / InvoiceShareDialog / PaymentDialog componentspdfInvoice.js (Invoice + Receipt kwitansi PDF generators, CBMS branding)CommercialDashboard (Outstanding invoices KPI, invoices-by-status panel)CommercialSettings (invoice/receipt prefixes, default invoice due days)ProposalEditor (Create invoice / View invoice on accepted proposals)