> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Encounter Costs

> View and manage cost calculations for completed encounters, filterable by status and service line.

The Encounter Costs page (`/pm/encounter-costs`) displays cost accounting records tied to completed encounters, allowing review and status progression from draft through finalized.

## Overview

The Encounter Costs page reads from the `pm_encounter_costs` table, scoped to the current organization and ordered by service date descending. The page displays a table with columns for Date, Service Line, Total Cost, Charge, Margin, and Status. Margin values are color-coded using semantic tokens: positive margins render in a success color; negative margins render in a destructive color. Clicking **View** on any row opens the `EncounterCostDetailDialog`.

Two dropdowns filter the table: one for cost status and one for service line. Filters are applied client-side to the currently loaded dataset (up to 200 records).

## Who it's for

Requires permission: `PM_PERMISSIONS.COST_ACCOUNTING_VIEW` (`pm.cost_accounting.view`).

## Before you start

* Ensure you have the `pm.cost_accounting.view` permission.
* Cost records appear automatically once encounters are completed and costs are calculated. There is no manual creation entry point on this page.

## Steps

<Steps>
  <Step title="Open Encounter Costs">
    Navigate to `/pm/encounter-costs`. The table loads all encounter cost records for your organization, ordered by most recent service date first (up to 200 records).
  </Step>

  <Step title="Filter by status">
    Use the **All Statuses** dropdown to filter the table to a single status: `Draft`, `Calculated`, `Reviewed`, or `Finalized`.
  </Step>

  <Step title="Filter by service line">
    Use the **All Service Lines** dropdown to filter to a specific service line: `Outpatient`, `IOP`, `PHP`, `Residential`, `Detox`, or `Telehealth`.
  </Step>

  <Step title="Review a cost record">
    Click the **View** button on any table row to open the `EncounterCostDetailDialog` with full detail for that encounter cost record.
  </Step>
</Steps>

## Key concepts

**Cost statuses:** Records progress through `draft`, `calculated`, `reviewed`, and `finalized`. The `finalized` status renders a default (primary) badge; `reviewed` renders secondary; `calculated` renders outline; `draft` renders secondary.

**Margin:** The `margin` column shows the difference between `charge_amount` and `total_cost`. Displayed as `N/A` when the margin field is null.

**Service lines:** `outpatient`, `iop`, `php`, `residential`, `detox`, `telehealth`.

<AccordionGroup>
  <Accordion title="Empty state">
    When no cost records exist (or no records match the active filters): "Cost records will appear here once encounters are completed and costs are calculated."
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Practice Management" icon="briefcase" href="/pm/overview">
    Overview of the Practice Management core.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/pm.tsx
  * src/cores/pm/pages/EncounterCostsPage.tsx
  * src/cores/pm/hooks/useEncounterCosts.ts
</Accordion>
