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

# Financial Transaction

> Query the most granular billing financial movements in Elation Billing - the payments and adjustments applied to each charge and claim.

One row per financial movement recorded in Elation Billing - the payments and adjustments applied to charges and claims. This is the most granular billing record: each row carries its type, amount, and running balance, and links to the `charge`, `claim`, `payment`, `patient`, and `patient_insurance` it relates to, where known.

This table's columns and relationships are shown in the [Hosted Database schema](https://help.elationhealth.com/articles/hdb/schema.md).

> [!NOTE]
>
> The relational columns are all nullable - a transaction only carries the ones that apply to it, so `charge_id`, `claim_id`, `payment_id`, `patient_id`, and `patient_insurance_id` are frequently empty. `patient_id` and `patient_insurance_id` are also empty when the Elation Billing record does not map to an EHR entity.

**For reporting on but not limited to:**

* Payments vs. adjustments by practice or date (`type`)
* The full financial history behind a single claim or charge
* Adjustment reason codes (`code`) and their amounts
* Reconciling a payment against the transactions it produced

## Payments and adjustments by practice and month

Rolls up transaction counts and amounts by practice, month, and transaction type.

```sql sql theme={null}
select
    ft.practice_id
  , pr.name as practice_name
  , date_trunc('month', ft.created_timestamp) as transaction_month
  , ft.type
  , count(*) as transactions
  , sum(ft.amount) as total_amount
from financial_transaction ft
  join practice pr on pr.id = ft.practice_id
where ft.is_deleted = false
group by ft.practice_id, pr.name, transaction_month, ft.type
order by transaction_month desc, ft.practice_id;
```

## All financial movements for a claim

Returns every payment and adjustment recorded against a single claim, in the order they occurred, with the running balance after each.

```sql sql theme={null}
select
    ft.id
  , ft.type
  , ft.code
  , ft.description
  , ft.amount
  , ft.balance
  , ft.responsibility
  , ft.created_timestamp
from financial_transaction ft
where ft.is_deleted = false
  and ft.claim_id = 1234567890  -- Replace with actual claim ID
order by ft.created_timestamp;
```

## Transactions tied to a payment

Joins financial transactions to the payment they belong to, so you can see how a single payment was split across charges and claims.

```sql sql theme={null}
select
    ft.id as financial_transaction_id
  , ft.payment_id
  , p.pay_type
  , p.pay_method
  , ft.charge_id
  , ft.claim_id
  , ft.amount
  , ft.balance
from financial_transaction ft
  join payment p on p.id = ft.payment_id
where ft.is_deleted = false
  and p.is_deleted = false
order by ft.created_timestamp desc;
```

*If you have any questions about this topic please reach out to [Elation Support Portal](https://help.elationhealth.com/articles/support-portal-introduction.md) with the subject line HDB - \<your\_question>*
