---
title: "SQL-025: Ebill status update to Indexed (Ebill)"
summary: Sets the ebill status to Indexed once its services have been resolved to provider locations.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Domain
reference_type: package
---

# SQL-025: Ebill status update to Indexed (Ebill)

`BillServiceIndexer.UpdateBillStatusToIndexed` sets the ebill's `Status` to Indexed once its services have been resolved to rendering/billing provider locations. The `UPDATE` runs via NHibernate dirty-check detection at flush*.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-025 |
| **Operation type** | Update* |
| **Execution method** | ORM (dirty-check flush*) |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | N/A — ORM (NHibernate generates SQL at runtime from the ClassMaps in `Data/SAIF.Data.NHibernate/Mappings/**`) |
| **Business object** | `BillServiceIndexer` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `UpdateBillStatusToIndexed` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [EBILL](../database-tables.md#ebill) | UPDATE | `UPDATE_NUM`, `CLEARINGHOUSE_CONTROL_NUM`, `STATEMENT_FROM_DATE`, `STATEMENT_THRU_DATE`, `INJURY_DATE`, `ADMISSION_DATE`, `DISCHARGE_DATE`, `ORIGINAL_BILL_ID`, `BILL_TOTAL_AMOUNT`, `UB_BILL_TYPE_CODE`, `SERVICE_LOCATION_CODE`, `FACILITY_NPI`, `SUBMITTER_CONTROL_NUM`, `TRANSACTION_SET_CONTROL_NUM`, `UPDATE_USER`, `UPDATE_DATE`, `CLEARINGHOUSE_RECEIVED_DATE`, `CBP_ADMISSION_TYPE_CODE`, `BILL_ID`, `EBILL_RECEIPT_BATCH_SEQ_NUM`, `EBILL_PATIENT_SEQ_NUM`, `EBILL_STATUS_CODE`, `FACILITY_ADDRESS_SEQ_NUM`, `EBILL_SET_TYPE_CODE`, `EBILL_FIRST_RESPONSE_SEQ_NUM`, `EBILL_LAST_RESPONSE_SEQ_NUM`, `EBILL_RESPONSE_SET_SEQ_NUM`, `EBILL_EOB_SEQ_NUM`, `EBILL_SEQ_NUM` |

## LINQ statement

Source: `Domain/SAIF.Domain/Claims/Ebilling/Indexing/BillServiceIndexer.cs:137`

```csharp
// Domain/SAIF.Domain/Claims/Ebilling/Indexing/BillServiceIndexer.cs:135-140
public static void UpdateBillStatusToIndexed(Ebill bill, IEbillingQueryProvider queryProvider, string updateUser)
{
    bill.Status = queryProvider.BillQueries.GetBillStatusIndexed();
    bill.UpdateDate = DateTime.Now;
    bill.UpdateUser = updateUser;
}
```

## Sample SQL

> **Inferred SQL:** This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
UPDATE EBILL
SET
  UPDATE_NUM = :newVersion,
  CLEARINGHOUSE_CONTROL_NUM = :ClearinghouseControlNumber,
  STATEMENT_FROM_DATE = :StatementFromDate,
  STATEMENT_THRU_DATE = :StatementThruDate,
  INJURY_DATE = :InjuryDate,
  ADMISSION_DATE = :AdmissionDate,
  DISCHARGE_DATE = :DischargeDate,
  ORIGINAL_BILL_ID = :OriginalBillId,
  BILL_TOTAL_AMOUNT = :TotalAmount,
  UB_BILL_TYPE_CODE = :UbBillTypeCode,
  SERVICE_LOCATION_CODE = :ServiceLocationCode,
  FACILITY_NPI = :FacilityNpi,
  SUBMITTER_CONTROL_NUM = :SubmitterControlNumber,
  TRANSACTION_SET_CONTROL_NUM = :TransactionSetControlNumber,
  UPDATE_USER = :UpdateUser,
  UPDATE_DATE = :UpdateDate,
  CLEARINGHOUSE_RECEIVED_DATE = :ClearinghouseReceivedDate,
  CBP_ADMISSION_TYPE_CODE = :CbpAdmissionTypeCode,
  BILL_ID = :Bill,
  EBILL_RECEIPT_BATCH_SEQ_NUM = :ReceiptBatch,
  EBILL_PATIENT_SEQ_NUM = :Patient,
  EBILL_STATUS_CODE = :Status,
  FACILITY_ADDRESS_SEQ_NUM = :FacilityAddress,
  EBILL_SET_TYPE_CODE = :SetType,
  EBILL_FIRST_RESPONSE_SEQ_NUM = :FirstResponseBatch,
  EBILL_LAST_RESPONSE_SEQ_NUM = :LastResponseBatch,
  EBILL_RESPONSE_SET_SEQ_NUM = :ResponseSet,
  EBILL_EOB_SEQ_NUM = :Eob
WHERE EBILL_SEQ_NUM = :Id
  AND UPDATE_NUM = :oldVersion
```

Translation notes:
- No explicit `Update()` call: under the stateful strategy `RepositoryBase.Update` is a no-op and the UPDATE is emitted by NHibernate dirty-checking at `Commit()` flush (Legends: SAIF.Framework.Data.NHibernate RepositoryBase / business-rules). The mapping declares no `DynamicUpdate()`, so NHibernate sends every updatable mapped column, not only the ones changed here.
- Version `UPDATE_NUM` (`EbillMap.cs:13`).
- Bind variables for `References` carry the referenced entity's identifier; values not changed by this call site are re-sent unchanged.
- The C# code assigns `DateTime.Now` client-side before flush; the value is bound as an ordinary parameter (no server date function).
- `GetBillStatusIndexed()` is a separate read. Prior page omitted `UPDATE_USER` (set at line 139).

## Operations and processes
- OP-DOM-05 BillServiceIndexer.IndexBillServices — sets the ebill status to Indexed after service indexing (see [Operations and processes](../operations-processes.md))

## Business rules
- [DOM-BR-043](../business-rules.md#dom-br-043-service-indexing)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- Domain/SAIF.Domain/Claims/Ebilling/Indexing/BillServiceIndexer.cs
