Invoices — Safety Caps, Payment Validation, Private Phones
Issue invoices that are guaranteed to be in range, blocked from typo-overpayments, and never print the patient’s phone on a document a third party will read. We rebuilt the invoice path because three different ticket types — typo totals, overpayment confusion and patient-data exposure — were all in the same file.What’s new
- Per-clinic safety caps on totals. Admins set a maximum invoice total in Settings → Documentation → Document Amount Limits. Anything above the cap is rejected with a friendly message before reaching the database.
- Overflow typos no longer leak raw errors. Typing
110000000instead of11,000used to bubble a database error to the toast. The server now returns “The amount you entered is too large…” instead. - Inline payment validation. Entering more than the invoice balance shows a clear inline error and disables the Confirm button until corrected. No more silent capping on blur.
- Receipts and payment history appear immediately. Once a payment is recorded, the receipt and the payment history row update without a page refresh. The activity timeline on the invoice refreshes automatically too.
- Bill To omits patient phone. The Bill To / Received From block on invoices, quotations and receipts (inline and PDF) shows only the patient name and email. Public shared-link responses no longer return the patient phone at all. The patient already knows their own phone number — printing it on a document a clinic shares with third parties is unnecessary.
- “Generated from Quotation #X” on the PDF. When an invoice was generated from an accepted quote, the PDF carries the linked quote number under the totals.
- A double-submit guard on Create Invoice. Rapid double-clicks no longer create the same invoice twice.
How to use it
- Set your safety caps once. Open Settings → Documentation → Document Amount Limits and enter sensible max values for invoice and quotation totals.
- Issue an invoice from an appointment’s Billing tab or from the Invoices module. The total is validated client-side and server-side against your cap.
- Record a payment. The amount field is validated against the outstanding balance — Confirm is greyed out if you try to overpay.
- The receipt is generated immediately. The patient’s phone is not on it.
- If the invoice came from a quotation, the linked quote number prints on the PDF.
What changed since the last revision
- Per-clinic safety caps prevent typo totals.
- Overflow errors are friendly, not raw.
- Overpayments are blocked inline instead of silently capped.
- Receipts and payment history appear without a refresh.
- Patient phone is never on the Bill To block.
- “Generated from Quotation #X” prints on the PDF.
- Create Invoice has a double-submit guard.

