Reports - Agent

Adjustment Summary EOD

Path/adjustment-summary-eod
Statuslive
Drill-down pages—
Pop-upsSend email confirm
TabsSummary · Detail (`?view=`)
API routes/api/adjustment-summary-eod
/api/adjustment-summary-eod/email-large
/api/adjustment-summary-eod/email-large/preview

What's on the page

  • Period buttons, Custom Range with From / To date pickers, Summary / Detail switch. Window, filters, view, sort and page are kept in the page link.
  • Show Adjustments Over $500 (button, or click the red card) narrows the list to large adjustments.
  • Send email (enabled when the window and location have large adjustments, whatever the Category filter): confirm box with the count and total that will really be sent (worked out by the send code with nothing sent; it leaves out old adjustments it finds Dentrix re-posted, and says how many), then one email per adjustment over $500 for the dates and location on screen, to the recipients on the "Adjustments over $500" template plus anyone ticked on Email Management. The server re-reads the lines. The daily cron sends the same emails on its own.
  • Location and Category filters.
  • Cards: Amount, Ledger lines, Patients, Adjustments Over $500 (amount and count, within the Category filter).
  • Summary: Production, Collection and Ledger Lines per office, biggest production first, sortable, All Offices row.
  • Detail: the export's columns (Description, User, Patient, Date Modified / Posted / Service, Provider, Location, Proc. Code, Amount, Count, Average Write-off, Applied Credit Adjustments), merged down runs like the sheet; click a header to sort (asc → desc → back to the sheet's order; numbers start biggest first); Total row for every filtered line; 200 lines a page (100 / 200 / 500).
  • Export CSV: every filtered line in the same order, with a Note column (re-posts) and a Total row.
  • Reload, data-as-of time, and "Data through <day>" when the window ends after the newest scraped day.

Business rules

Data comes from: agent_adjustment_summary_eod, the Power Reporting Adjustment Summary EOD export at patient grain (one row per patient, procedure code, ledger category and day), replaced by day by the agent (3:00 AM Pacific). Access: Adjustment Summary EOD.

How it works:

  • Window (Pacific): Yesterday (default; EOD = the day just closed), Today, MTD, Last Month, Custom Range (From / To; one date (From or To) = that day; reversed dates are swapped; up to 400 days).
  • Hidden lines: $0 lines, and insurance write-offs Dentrix posted by itself when a claim payment was entered (every matching ledger adjustment automatic). The count of each is shown under the header.
  • User: who posted the line, from the Dentrix ledger (the export has no user).
  • Re-posted: an old adjustment Dentrix cancelled and posted again when a payment landed is kept but marked "Re-posted, originally posted on M/D"; Date (Posted) is the original date.
  • Large adjustment: a charge or credit adjustment of $500 or more either way. Payments and procedures never count.
  • Signs: Detail keeps Dentrix's signs (credits and payments negative). Summary shows collections as money taken in (sign flipped).
  • Location filter is by office id: each line's office_id (dentrix_offices.dentrix_id) is filled from the office name the export carries (migration 172). Same rows as the old name filter for every office (checked 27 Nov: staging 9/9, live 12/12). It is the shared Location filter every report uses; this report covers every office.

Database tables & columns

TableColumns used
adjustment_repostslocation_id, original_date, patient_id, reposted_on
agent_adjustment_summary_eodamount, category, count, date, office_id, office_name, patient_name, proc_code, provider, service_date
dentrix_officesapp, dentrix_id, id, name
dh_ledger_transactionsamount, is_active, is_auto_posted, ledger_type, location_id, online_user_id, patient_id, transaction_date
dh_online_usersname, user_id
dh_patientsdentrix_id, first_name, first_name_encrypted, id, last_name, last_name_encrypted
email_recipientsactive, email, email_type, notify_types
email_sendsapp, error, lang, provider, recipients, ref, sent_by, status, subject, subject_encrypted, template_key, to_email, to_email_encrypted, to_email_hash
email_templatesactive, bcc_emails, body_en, body_es, from_email, key, reply_to, subject_en, subject_es, to_emails

File structure

Its own files

  • apps/
    • web/
      • src/
        • features/
          • adjustment-summary-eod/
            • lib/
              • eod.test.ts
              • eod.ts
              • pivot.test.ts
              • pivot.ts
            • pages/
              • AdjustmentSummaryEODPage.tsx
            • api.ts
            • index.ts
    • worker/
      • src/
        • features/
          • adjustment-summary-eod/
            • __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
            • SearchableSelect.tsx
          • reports/
            • DataAsOf.tsx
            • DentrixSourceNote.tsx
            • FilterSelect.tsx
            • HowItWorksNote.tsx
            • OfficeFilter.tsx
            • ReportHeader.tsx
            • SearchableFilter.tsx
            • sortable-grid.tsx
          • TablePagination.tsx
        • hooks/
          • useApi.ts
        • lib/
          • csv.ts
          • money.ts
          • office.ts
        • services/
          • api.ts
    • worker/
      • src/
        • db/
          • index.ts
        • lib/
          • dates.ts
          • office-filter.ts
        • services/
          • adjustment-reposts.ts
          • adjustment-users.ts
          • adjustments-over-1k.ts
          • email-templates.ts
          • phi-read.ts
        • utils/
          • crypto.ts
          • email.ts
          • phi-access.ts
          • phi-crypto.ts
          • timestamps.ts