End-to-end flow

Appointment → visit → sales order → invoice

How a booking becomes money owed. The appointment is the booking, the visit is the encounter, the sales order collects charges at the desk, and the clinic invoice freezes them under the Legal Entity.

Appointment, visit, sales order, invoice issue shipped Payments later

Overview

Appointment (scheduled) Schedule appointments.manage │ check-in ── or ── walk-in (no appointment) ▼ Visit (checked_in → in_room ⇄ waiting) Whiteboard visits.manage │ SOAP note, diagnostic orders (lab works), treatment plans │ owner approves plan ─────────────┐ ▼ │ charges Visit (ready_to_bill) ── Checkout ──► SalesOrder (open) Checkout checkout.manage │ │ split / merge / void / discounts ▼ ▼ Visit (completed) Invoice (built) per Legal Entity │ ▼ Payment (intended) per Location drawer
RecordCodeStatusesScope
Appointment—scheduled | checked-in | canceled | no-showLocation
VisitVI-000123checked_in → in_room ⇄ waiting → ready_to_bill → completedLocation
TreatmentPlanTP-000123draft → pending_approval → approved | rejectedPatient, origin Location
LabWorkvia orderrequested … completed | cancelledDiagnostic order
SalesOrderSO-000123open | merged | voided | invoicedLocation (one Legal Entity, one currency)
InvoiceINV-000123issuedLegal Entity header, Location attribution

1. Book

2. Arrive

3. Care

The visit moves across the Whiteboard (in_room in any room; waiting when seen and sent back to the waiting room). The clinical documents linked to the visit decide what will be charged:

DocumentBillable whenCharge
SOAP noteNeverClinical record only
Treatment plan (visit-linked)approved by the owner (email link / QR) or by staffOne line per plan item at its snapshotted price; plus an adjustment line if the final price was overridden (price − items_total, may be negative)
Lab work on a visit-linked diagnostic orderHas a catalog item and is not cancelledOne line at the Location-effective catalog price at checkout time

Draft, pending, and rejected plans are never charged. Chart-origin plans (no visit) are not picked up by checkout.

4. Ready to bill

5. Checkout (sales order)

POST /app/visits/:id/checkout picks the target order, appends every visit charge not already on an order, and redirects to it.

  1. The visit’s linked open sales order (home), else
  2. an open order at this Location that already holds lines for the visit, else
  3. a new open order (payer = primary pet parent, opened_by = current Staff).

Each visit gets its own order by default. Staff merge or split at the desk when charges should share a bill. After a partial split a visit may span several open orders: auto-charges stay on the home order; the visit cart can add a line to another associated open order without changing the home link. Full merge/split retargets the home when all of a visit’s lines move. Lines are grouped by patient and show the visit code.

Keeping the order in sync

EventEffect on open orders
Checkout clicked againNothing new (idempotent)
Visit-linked plan approved after checkoutIts lines are appended automatically to the open order already holding that visit
Lab work cancelledIts line is removed from any open order
Sync charges on the orderRe-scans every visit on the order and appends missing charges
Catalog price changedExisting lines keep their snapshotted price

At the desk

Split and merge keep the combined total to the cent. Details: docs/functional/checkout.md.

6. Invoice Built (issue)

Clinic AR vs SaaS Clinic invoices live under Clinic → Invoices (invoices.*). BillingInvoice / Settings → Billing / billing.* remain SaaS (TaskPaws charging the clinic). Payments, taxes, PDF, and cross-site AR alerts are still later.

See Billing and finance and docs/functional/clinic-invoices.md.

7. Complete

Key rules

Who does what

RoleBookCheck-in / move visitApprove planCheckoutInvoices
Organization administratorYesYesYesManageManage
Organization managerNoReadNoReadRead
Location administratorYesYesYesManageManage
ReceptionistYesYesNoManageManage
VeterinarianNoYesYesReadRead

Plan approval by staff needs soap.manage; owners approve from the emailed link without a session. Full grants: RBAC.

Related: Appointments · Visits · SOAP notes · Catalog and pricing · Billing and finance.