---
name: getting-paid
description: See who owes your clinic money, how long it's been owed, and where to focus your chasing — including insurance money still outstanding. Use when the user asks about unpaid invoices, debtors, overdue accounts, or cash collection.
---

# Getting Paid — Money Owed to Your Clinic

## What this does for you

Every clinic has money sitting in unpaid invoices. This helps you see exactly
who owes what, how long it's been outstanding, and who to contact first — the
same information as an "aged debtors" report, but you just ask for it.

## Ways to start (copy and paste one of these)

- "**Who owes us money?** Run my debtors check."
- "Give me **this week's chase list**."
- "**How's our cash collection** looking?"

## Try asking

- "How much money are we owed right now?"
- "Who are our top 10 clients by amount owed?"
- "How much has been owed for more than 90 days?"
- "How much are we waiting on from insurance companies?"
- "Give me a chase list: everyone owing more than €200 for over 60 days."
- "On average, how long do clients take to pay us?"

## Good to know

- Amounts are grouped into standard ageing buckets: current, 1–30 days,
  31–60, 61–90, and over 90 days overdue.
- Insurance money is shown separately from what clients owe directly.
- The chase list gives you names and amounts — contacting the client is
  still done by you, outside this tool.

---

## Instructions for the AI assistant

You are helping a veterinary clinic owner or practice manager who is **not
technical**. Data comes from the Provet MCP (`ch_run_query`, ClickHouse SQL,
database `production`).

**Core tables** (purpose-built for this — prefer them over raw invoices)
- `production.aged_debtors_debtor_summary` — one row per client owing money:
  `client_name`, `total_outstanding`, `insurance_outstanding`,
  `bucket_current`, `bucket_1_30`, `bucket_31_60`, `bucket_61_90`,
  `bucket_90_plus`, `oldest_overdue_days`, `last_payment_date`,
  `has_credit_notes`.
- `production.aged_debtors_invoice_detail` — the individual unpaid invoices
  behind those balances: `invoice_number`, `invoice_due_date`,
  `days_overdue`, `outstanding_balance`, `payer_name`, `age_bucket`.
- `production.invoice_payments` — payments received: `paid_amount`,
  `payment_date`, `days_to_payment`, `payment_method_name`, `is_refund`,
  `is_from_bank_import`.

**Rules that prevent wrong numbers**
1. Yes/no columns are numbers: write `has_credit_notes = 1`, `is_refund = 0`.
2. For "how long do clients take to pay", use `days_to_payment` on
   `invoice_payments`, excluding refunds (`is_refund = 0`).
3. Present insurance and client amounts separately when both exist —
   clinics chase them differently.
4. A chase list should be sorted by amount owed (largest first) and include:
   client name, total owed, oldest overdue days, last payment date.
5. Say when the snapshot is from (`snapshot_date`) so the user knows how
   fresh the numbers are.

**Standard run**: if the user says "run my debtors check" (or similar) with
no specifics, produce this fixed mini-report: total outstanding; split by
ageing bucket; insurance vs client share; top 5 debtors by amount with
oldest-overdue days; and average days-to-payment over the last 3 months.
End by offering the full chase list.

**Response style**: headline first ("You're owed €X in total; €Y of that is
over 90 days old"), then the breakdown. Be matter-of-fact, not alarmist —
large 90+ buckets are common. Suggest one practical next step, e.g. "Want
the list of invoices behind the top three?"
