Reports - Agent

Production Tracking

Path/production-tracking
Statuslive
Drill-down pages/production-tracking-report/detail /production-tracking-report/detail/column
Pop-ups—
TabsReport · Summary (`?view=`)
API routes/api/production-tracking
/api/production-tracking/detail
/api/production-tracking/detail/cell

What's on the page

  • Views (switch at the top, kept in the page link as ?view=): Report (needs the Production Tracking — Report access) and Summary (needs the Summary access). Someone with only one access sees only that view.
  • Report view:
    • Cards: Net Production, Gross Production, Collections, Success % — all MTD.
    • Table: Office Name (stays in view sideways) · Net Production, Gross Production, Total Collections, each for Yesterday / Today / Last Month / MTD · Success % (MTD) · All Offices row at the bottom.
    • Sort: click any header; All Offices stays at the bottom.
    • Links: every non-zero Net or Collections cell opens BY PROVIDER for that office and period; there, every non-zero Procedure Charges / Charge Adj. / Credit Adj. / Payments figure opens the column drill-down. Gross cells and zeros are plain text. Both drill-down pages have a back arrow to the page that opened them.
  • Summary view:
    • Period buttons: Yesterday, Today, MTD (default), Last Month, Custom Range with From / To date pickers (picking a date switches to Custom). Kept in the page link.
    • Cards for the chosen period: Net, Gross, Collections, % Collected.
    • Table: Office Name, Net Production, Gross Production, Total Collections, Success %; biggest producer first; click a header to sort; All Offices at the bottom.
  • Reload button; Export CSV (Report: every office with the 12 period columns and Success %; Summary: the chosen period).
  • Dentrix report data as of: when the scraper last ran. "Data through <day> — today's figures appear as the day is scraped" shows after 6 AM Pacific when the newest day is older than today.
  • Old links /production-tracking-report and /production-summary open the matching view.

Business rules

Data comes from: Dentrix agent (scraper). Each run it saves Dentrix's Provider AR Detail - by Office report: one row per office, day and provider, with every ledger category (agent_provider_ar_detail). The money columns are worked out once in the provider_ar_daily view. No Dentrix API calls. Offices are matched by office id; the name is only the label. Data starts 01 July 2026.

How the numbers are worked out:

  • Net Production: the report's Production Total (procedures after charge and credit adjustments).
  • Gross Production: all procedure categories added up (the report has no gross column).
  • Collections: Collection Total less Patient Refund (our extractor counts that column twice). Shown as a positive amount.
  • Success %: Collections ÷ Net Production for the same window, rounded; "—" when there is no production. It can be over 100% (money collected now is often for older work).
  • Periods (Pacific time): Yesterday, Today, Last Month, MTD (1st of this month to today), YTD (report only in the data), Custom Range (Summary only, up to 400 days).
  • All Offices: the offices added up. Every active office is listed, at 0.00 when nothing happened.
  • BY PROVIDER (cell drill-down): the same rows split by provider — Procedure Charges, Charge Adj., Credit Adj., Production Total, Payments (guarantor + insurance), Charge Adj., Credit Adj., Collection Total — so the provider lines add up to the cell. Providers are matched by the name the report shows (the report has no provider id).
  • Column drill-down: one provider figure split by ledger category (with how many days each appeared on) and by day (every day of the window; quiet days show "—"). Both add up to the figure.

Database tables & columns

TableColumns used
provider_ar_daily viewcollection, collection_charge_adj, collection_credit_adj, date, gross_production, net_production, office_id, payments, procedure_charges, production_charge_adj, production_credit_adj, provider
agent_provider_ar_detaildate, metrics, office_id, provider
dentrix_officesactive, app, dentrix_id, id, name

File structure

Its own files

  • apps/
    • web/
      • src/
        • features/
          • production-tracking/
            • components/
              • shared.tsx
              • ViewToggle.tsx
            • pages/
              • CellDetailPage.tsx
              • ColumnDaysPage.tsx
              • ProductionTrackingPage.tsx
              • ReportView.tsx
              • SummaryRedirect.tsx
              • SummaryView.tsx
            • api.ts
            • index.ts
    • worker/
      • src/
        • features/
          • production-tracking/
            • __tests__/
              • service.test.ts
            • index.ts
            • queries.ts
            • routes.ts
            • service.ts

Shared code it uses (followed through its imports and the helpers its API calls; sign-in/access plumbing and UI primitives left out)

  • apps/
    • web/
      • src/
        • components/
          • forms/
            • DatePicker.tsx
          • reports/
            • DataAsOf.tsx
            • DentrixSourceNote.tsx
            • HowItWorksNote.tsx
            • ReportHeader.tsx
            • sortable-grid.tsx
        • contexts/
          • AuthContext.tsx
        • hooks/
          • useApi.ts
        • lib/
          • csv.ts
          • dates.ts
          • money.ts
        • services/
          • api.ts
    • worker/
      • src/
        • lib/
          • dates.ts
        • utils/
          • timestamps.ts