Dev Helpers

Next.js / Billing reports

Receivables balance

Dev Helpers · July 5, 2025

Receivables reporting distinguishes invoiced, paid and outstanding amounts. Money values should retain a defined unit throughout the server calculation.

Worked example

// app/billing/page.tsx

export default function ReceivablesBalance() {
  const invoices = [
    { id: "A", cents: 3200, paid: true, due: "2028-01-10" },
    { id: "B", cents: 7900, paid: false, due: "2028-02-15" },
    { id: "C", cents: 4600, paid: false, due: "2028-03-20" },
  ];
  return (
    <output>
      Outstanding:{" "}
      {(invoices.filter((i) => !i.paid).reduce((s, i) => s + i.cents, 0) / 100).toFixed(
        2,
      )}
    </output>
  );
}

Implementation notes

A credit or overpayment can produce a negative balance. Decide whether that is a credit to display or a condition requiring reconciliation.

Try it yourself

Apply a partial payment and inspect the outstanding balance.

Open the Next.js example →

Editorial date July 5, 2025 · Published December 6, 2026

Related articles

Free bin volume

Free storage volume depends on consistent dimensions and units. Derive capacity and usage in the same unit before formatting a human-readable summary.

Draft preview indexing

Draft pages need deliberate indexing metadata. An indexing directive controls crawler intent, while access to unpublished material needs a separate permission check.

Party size allocation

Allocating a party into groups is an integer problem. The remainder determines whether another group is needed and how full it will be.