== invoices : id, tenant_id, patient_id, service_tariff_id, reference, amount, paid_amount, status, payment_channel, transaction_reference, change_note, created_by, updated_by, issued_at, paid_at, voided_at, created_at, updated_at, product_item_id
== payment_point_transactions : id, tenant_id, payment_point_id, wallet_id, wallet_transaction_id, invoice_id, amount, method, status, reference, qr_scanned, collected_by, created_at, updated_at, payer_id, refund_method, collection_reference, cashier_shift_id
== credit_notes : id, tenant_id, invoice_id, reference, amount, status, reason, change_note, issued_by, voided_by, created_at, updated_at
== deposits : id, tenant_id, patient_id, payer_id, payment_point_id, cashier_shift_id, transaction_id, amount, status, collected_by, created_at, updated_at
== refund_requests : id, tenant_id, invoice_id, transaction_id, amount, original_amount, status, reason, change_note, requested_by, decided_by, decided_at, created_at, updated_at
== cashier_shifts : id, tenant_id, payment_point_id, user_id, status, opening_float, opened_at, expected_cash, counted_cash, over_short, close_note, closed_by, closed_at, created_at, updated_at
== appointments : id, tenant_id, facility_id, department_id, patient_id, clinician_user_id, room_id, appointment_type, scheduled_at, duration_minutes, status, source, notes, cancellation_reason, cancelled_at, rescheduled_from_id, booked_by_user_id, created_by, updated_by, created_at, updated_at
== patients : id, tenant_id, facility_id, mrn, family_name, given_name, middle_name, preferred_name, sex, date_of_birth, dob_precision, phone, email, address_line_1, city, state, country, blood_group, blood_group_status, preferred_language, occupation, status, photo_path, administrative_notes, is_temporary_identity, merged_into_id, merged_at, merged_by, merge_reason, unmerge_reason, deceased_at, created_by, updated_by, created_at, updated_at, emergency_contact_name, emergency_contact_phone, emergency_contact_relationship, health_status, medical_history_notes, treatment_status
== attendance_records : id, tenant_id, employee_id, work_date, status, check_in, check_out, corrected_by, correction_reason, created_by, created_at, updated_at
== roster_assignments : id, tenant_id, employee_id, duty_date, start_time, end_time, label, status, change_note, amended_by, created_by, created_at, updated_at

== FINANCE (tenant 1)
invoices rows: 12 sum_amount: 1,456,400.00 sum_paid: 1,270,200.00
  status draft: 1 rows, amount 3,000.00, paid 0.00
  status issued: 2 rows, amount 23,500.00, paid 0.00
  status paid: 4 rows, amount 679,200.00, paid 679,200.00
  status part_paid: 5 rows, amount 750,700.00, paid 591,000.00
register rows: 9 sum: 1,270,200.00
  positive sum: 1,270,200.00 (9 rows)
  negative sum: 0.00 (0 rows)
  null invoice_id: 0 sum 0.00
  with invoice_id: 9 sum 1,270,200.00
  status completed: 9 rows, 1,270,200.00
credit_notes: 0 active sum: 0.00 voided sum: 0.00
deposits: 0
refund_requests: 0
shifts: 0

identity parts (non-voided): invoiced 1456400 | paid 1270200 | balance(before credits) 186200
paid + balance - invoiced = 0

== OPS (tenant 1)
appointments total: 10
  booked: 9
  cancelled: 1
appointment date range: 2026-10-20 08:00:00 .. 2026-10-26 10:00:00
attendance rows: 80
  absent: 1
  excused: 1
  half_day: 1
  late: 1
  present: 76
  derived hours total: 660.92 (from 78 rows with both times)
rosters: 27
  active: 25
  cancelled: 2
patients: 4
  sex female: 2
  sex male: 2
age-band x sex x appointment counts:
  Unknown / female: 6
  Unknown / male: 4

== tenant 2 (pharmacy): appointments 2, invoices 0, register 0
