Invoices / Billing

A complete guide to the Invoices module — creating invoices, managing line items, applying discounts and tax, tracking payment status, and linking invoices to appointments.

Written By Dev010

Last updated 19 days ago

The Invoices module manages the complete billing workflow for patient visits. Invoices can be linked to appointments, include multiple line items, apply discounts and tax, and track payment status from unpaid through to paid. Together with the Payments and Expenses modules, Invoices forms the financial backbone of CareNova.

Accessing the Module

Sidebar → Invoices

Direct URL:

https://yourdomain.com/dashboard/invoices

Who can access:

Action

Admin

Doctor

Receptionist

Nurse

View invoices

Create invoice

Edit invoice

Delete invoice

Export invoices

Invoices are accessible to Admin and Receptionist roles by default. Doctors and Nurses do not see the Invoices module in the sidebar. Adjust in Dashboard → Permissions if needed.

Invoice List

The main invoices page shows a paginated, searchable list of all clinic invoices.

Each row displays:

  • Invoice number

  • Patient name

  • Doctor

  • Service

  • Total amount

  • Discount

  • Tax

  • Status badge

  • Issue date

  • Due date

  • Action buttons (view, edit, delete)

Search

The search bar filters invoices by:

  • Invoice number

  • Patient name

  • Doctor name

Results update as you type.

Invoice Statuses

Every invoice has one of three statuses:

Status

Description

Badge Color

unpaid

Invoice issued — payment not yet received

Yellow

paid

Full payment has been recorded

Green

cancelled

Invoice has been voided

Red

Status flows in a typical billing workflow:

unpaid → paid
   ↓
cancelled

An invoice marked paid should have a corresponding payment record in the Payments module. Status is not automatically updated when a payment is recorded — it must be updated manually or at the time of payment entry.

Creating an Invoice

Click the New Invoice button on the invoices list page.

Direct URL:

https://yourdomain.com/dashboard/invoices/new

Required Fields

Field

Notes

Patient

Search and select from registered patients

Total Amount

Final total after discounts and tax

Issued At

Date the invoice is issued — defaults to today

Status

Defaults to unpaid

Optional Fields

Clinical Link:

Field

Notes

Appointment

Link to a specific appointment — one invoice per appointment (unique constraint)

Doctor

Attending doctor

Service

Primary service being billed

Financial:

Field

Notes

Discount

Flat discount amount deducted from total

Tax Percent

Tax rate as a percentage (e.g. 10 for 10%)

Payment Method

Cash, Card, Bank Transfer, Insurance, etc.

Due Date

Payment due date

Paid At

Date payment was received (set when marking as paid)

Insurance:

Field

Notes

Insurance Provider

Name of the patient's insurance company

Insurance Policy Number

Patient's policy reference number

Notes:

Field

Notes

Notes

Internal billing notes — not shown to patient

Invoice Line Items

Below the main invoice fields, add one or more line items to detail exactly what is being charged:

Field

Notes

Description

What the line item covers (e.g. Consultation, Medication, X-Ray)

Item Type

Category of item (e.g. Service, Medication, Procedure, Equipment)

Quantity

Number of units

Unit Price

Price per unit

The line item total is calculated automatically: quantity × unit_price.

Multiple line items can be added to a single invoice — for example a consultation fee, a procedure charge, and a medication cost all on the same invoice.

The Total Amount field on the invoice header is the final billed amount and is set manually. It should reflect the sum of all line items minus any discount plus tax. CareNova displays line items for reference but the header total is the binding amount.

Invoice Number

Invoice numbers are assigned automatically using a unique identifier format when the invoice is created. The format ensures each invoice has a unique, traceable reference number.

You can view and search invoices by their invoice number in the invoices list.

Saving the Invoice

Click Create Invoice to save. The invoice appears immediately in the list with unpaid status and is linked to the patient's billing history.

Invoice Detail Page

Each invoice has a dedicated detail page showing the complete invoice breakdown.

Direct URL:

https://yourdomain.com/dashboard/invoices/[id]

The detail page shows:

  • Invoice header — number, patient, doctor, service, dates, status

  • Financial summary — subtotal, discount, tax, total

  • Line items table — all itemized charges

  • Insurance information

  • Notes

  • Payment history if payments have been recorded

Editing an Invoice

Click the Edit button on any invoice row or the detail page.

All fields are editable including line items, amounts, dates, and status.

Edit with care on invoices that already have payments recorded against them. Changing the total amount on a paid invoice does not automatically update or reverse the payment records.

Discounts and Tax

Discount

The Discount field applies a flat amount deduction to the invoice:

Total = Subtotal - Discount + Tax Amount

Example:

Subtotal:  500.00
Discount:  -50.00
Tax (10%): +45.00
Total:     495.00

Discounts are useful for:

  • Returning patient loyalty discounts

  • Insurance negotiated rates

  • Staff discounts

  • Promotional offers

Tax

The Tax Percent field applies a percentage-based tax on the post-discount amount:

Tax Amount = (Subtotal - Discount) × (Tax Percent / 100)

Set to 0 if your clinic does not charge tax on medical services. Tax rules vary by jurisdiction — configure according to your local requirements.

Insurance Billing

For patients with insurance coverage, record the insurance details on the invoice:

  1. Insurance Provider — enter the insurance company name

  2. Insurance Policy Number — enter the patient's policy reference

  3. Payment Method — set to Insurance

  4. Adjust the total amount to reflect the insured portion

CareNova does not integrate with insurance billing systems or automatically calculate covered amounts. Insurance details are recorded for reference and manual reconciliation purposes.

Marking an Invoice as Paid

When a patient pays their invoice:

Option A — Update status directly:

  1. Edit the invoice

  2. Set Status to paid

  3. Set Paid At to the payment date

  4. Set Payment Method if not already set

  5. Save

Option B — Record via Payments module:

  1. Sidebar → Payments → Record Payment

  2. Select the patient and link to this invoice

  3. Enter the amount and payment method

  4. Save the payment

  5. Return to the invoice and manually update status to paid

Recording a payment in the Payments module does not automatically update the invoice status. Both steps must be completed for accurate financial reporting. See the Payments guide for full details.

Overdue Invoices

The Admin dashboard includes an Overdue Invoice Banner that appears when invoices are past their due date (due_at < now()) and still have unpaid status.

The banner shows:

  • Count of overdue invoices

  • Total overdue amount outstanding

To review all overdue invoices:

SELECT invoice_number, 
       p.full_name as patient,
       total_amount, due_at,
       CURRENT_DATE - due_at::date as days_overdue
FROM invoices i
JOIN patients p ON i.patient_id = p.id
WHERE i.status = 'unpaid'
  AND i.due_at < now()
ORDER BY due_at ASC;

Cancelling an Invoice

If an invoice was created in error or a visit was cancelled:

  1. Edit the invoice

  2. Set Status to cancelled

  3. Save

Cancelled invoices are preserved in the database for audit purposes. They appear in the list with a red status badge and are excluded from revenue calculations.

Deleting an Invoice

Click the Delete option from the invoice row action menu.

A confirmation dialog appears before deletion.

⚠️ Deleting an invoice also deletes all linked invoice line items (ON DELETE CASCADE). Payment records linked to this invoice have invoice_id set to null (ON DELETE SET NULL) — they are preserved but lose the invoice reference. Cancel instead of delete to preserve a complete audit trail.

One Invoice Per Appointment

Each appointment can have at most one linked invoice. This is enforced by a unique constraint on invoices.appointment_id.

If you need to bill multiple services from a single visit, add them as separate line items on one invoice rather than creating multiple invoices for the same appointment.

Financial Analytics

Invoice data feeds directly into the Admin dashboard financial charts:

Chart / Widget

Data Source

Monthly Revenue

Sum of paid invoices per month

Outstanding Amount

Sum of unpaid invoice totals

Revenue vs Expenses chart

Paid invoices vs recorded expenses

Overdue Banner

Unpaid invoices past due date

Receptionist billing queue

Count of unpaid invoices

Database Schema Reference

invoices

Column

Type

Description

id

uuid

Unique invoice ID

patient_id

uuid

FK → patients (set null on delete)

appointment_id

uuid

FK → appointments — unique constraint

doctor_id

uuid

FK → users (set null on delete)

service_id

uuid

FK → services (set null on delete)

invoice_number

text

Unique invoice reference — auto-generated

total_amount

numeric

Final billed amount

status

enum

unpaid / paid / cancelled

discount

numeric

Flat discount amount

tax_percent

numeric

Tax rate percentage

notes

text

Internal billing notes

insurance_provider

text

Insurance company name

insurance_policy_number

text

Policy reference number

payment_method

text

Payment method used

paid_at

timestamptz

Payment received timestamp

issued_at

timestamptz

Invoice issue date

due_at

timestamptz

Payment due date

created_at

timestamptz

Record creation timestamp

invoice_items

Column

Type

Description

id

uuid

Unique line item ID

invoice_id

uuid

FK → invoices (cascade delete)

description

text

Line item description

item_type

text

Category of charge

quantity

integer

Number of units

unit_price

numeric

Price per unit

created_at

timestamptz

Creation timestamp

Indexes are set on patient_id, appointment_id, doctor_id, service_id, and invoice_number for fast filtering and lookup.

Relationship to Other Modules

Module

Relationship

Patients

Every invoice belongs to one patient

Appointments

Optional one-to-one link per appointment

Payments

Payments recorded against invoices

Services

Primary service referenced on invoice

Dashboard

Revenue data fed to Admin financial charts

Workflow Examples

Creating an invoice after a completed appointment:

  1. Sidebar → Invoices → New Invoice

  2. Select patient

  3. Link to the completed appointment

  4. Select doctor and service

  5. Add line items:

    • Consultation fee: 1 × 50.00

    • Procedure charge: 1 × 120.00

    • Medication: 2 × 15.00

  6. Set total amount: 200.00

  7. Set discount if applicable: 20.00

  8. Set tax percent if applicable: 10

  9. Set due date: 30 days from today

  10. Save — invoice created with unpaid status

Processing payment at the front desk:

  1. Patient arrives to pay

  2. Sidebar → Invoices

  3. Find invoice by patient name or invoice number

  4. Click Edit

  5. Set Status to paid

  6. Set Paid At to today

  7. Set Payment Method to Cash or Card

  8. Save

  9. Also record in Payments module for complete financial tracking

Applying an insurance claim:

  1. Create invoice as normal

  2. Set Payment Method to Insurance

  3. Fill in Insurance Provider and Policy Number

  4. Adjust total to reflect insured amount

  5. When insurer pays, update status to paid

Reviewing unpaid invoices for follow-up:

  1. Admin dashboard → Overdue Invoice Banner

  2. Or Sidebar → Invoices

  3. Scan for unpaid status badges

  4. Contact patients for payment

  5. Update status when paid

Issuing a corrected invoice:

  1. Cancel the incorrect invoice — Edit → Status: cancelled → Save

  2. Create a new invoice with the correct amounts

  3. Add a note referencing the cancelled invoice number

Troubleshooting

Invoices not visible in sidebar:

  • Confirm your role has billing.view permission in Dashboard → Permissions

  • Doctor and Nurse do not have billing access by default

Cannot link appointment to invoice — appointment already has an invoice:

  • Each appointment can only have one linked invoice

  • Check if an invoice already exists for that appointment — search by appointment in Supabase → Table Editor → invoices

  • Use line items on the existing invoice instead of creating a second one

Invoice total not matching line item sum:

  • The header total amount is set manually and is independent of line items

  • Recalculate: sum all line item totals, subtract discount, add tax amount

  • Update the total amount field to match the correct calculation

Overdue banner not appearing on Admin dashboard:

  • Confirm invoices have a due_at date set — invoices without a due date do not trigger the overdue banner

  • Confirm the invoice status is unpaid — paid and cancelled invoices are excluded

  • Hard refresh the dashboard

Cannot delete an invoice:

  • Invoice deletion is Admin only

  • Receptionist can create and edit but not delete invoices

  • Consider cancelling instead of deleting

Revenue chart showing incorrect amounts:

  • Revenue is calculated from invoices with status = 'paid'

  • Confirm paid invoices have their status correctly set to paid

  • Confirm paid_at date is within the chart's date range

Next Step

Continue to the Payments module guide to learn how to record and track patient payments against invoices in CareNova.