﻿---
title: SAIF.Business.Claim.Bill business rules
summary: Enumerated business rules for SAIF.Business.Claim.Bill.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-30
library: SAIF.Business.Claim.Bill
reference_type: package
---

# SAIF.Business.Claim.Bill business rules

This page captures business rules enforced by `SAIF.Business.Claim.Bill`.

## BR-001: Bill ID must be valid (non-zero)

| Field | Value |
| --- | --- |
| **Statement** | Bill ID must be valid (non-zero) |
| **Trigger** | BillID property |
| **Enforcement** | ``clsMCOBill.validbill`` |
| **Outcome** | Error: "Invalid bill" |
| **Confidence** | Verified |
| **Source** | `Business\SAIF.Business.Claim.Bill\MCOSupport\clsMCOBill.vb` (`validbill`) |

---

## BR-002: Bill ID must be non-zero

| Field | Value |
| --- | --- |
| **Statement** | Bill ID must be non-zero |
| **Trigger** | BillID property |
| **Enforcement** | ``clsBill.AddBusinessRules` (CommonBusinessRules.NonZeroDecimalRequired)` |
| **Outcome** | Error: "Invalid Bill ID" |
| **Confidence** | Verified |
| **Source** | `Business\SAIF.Business.Claim.Bill\Core\clsBill.vb` (`AddBusinessRules`) |

---

## BR-003: National drug code must resolve to valid information

| Field | Value |
| --- | --- |
| **Statement** | National drug code must resolve to valid information |
| **Trigger** | NationalDrugCode property |
| **Enforcement** | ``clsNationalDrug.ValidateCode`` |
| **Outcome** | Error: "Information not found for \<code\>" |
| **Confidence** | Verified |
| **Source** | `Business\SAIF.Business.Claim.Bill\AuditSupport\Services\clsNationalDrug.vb` (`ValidateCode`) |

---

## BR-004: Optimistic concurrency updates fail if RowsAffected does not equal 1

| Field | Value |
| --- | --- |
| **Statement** | Insert, update, and delete calls against `CBP_BILL`, its child collections (diagnosis, procedure, service, status), the `CBP_AUDIT` aggregate (audit header, audited services, adjustments, messages), and `CBP_BILL_PAYMENT_REQUEST` must affect exactly one row; any other row count is treated as a failure |
| **Trigger** | `AfterInsert` / `AfterUpdate` / `AfterDelete` on `clsBill`, `clsBillDiagnosis`, `clsBillProcedure`, `clsBillService`, `clsBillStatus`, `clsAudit`, `clsAuditedService`, `clsAuditedServiceAdjustment`, `clsAuditMessage`, and `clsCBPBillPaymentRequest` after each insert/update/delete `IDataRequest` executes |
| **Enforcement** | Each class checks `RowsAffected = 1` after the data request runs |
| **Outcome** | Error: `"Insert Failed"` on a failed insert; error using `clsConstants.Messages.DBContentionError` on a failed update or delete, indicating another user updated or deleted the row first |
| **Confidence** | Verified |
| **Source** | `Business\SAIF.Business.Claim.Bill\Core\clsBill.vb` (`AfterInsert`, `AfterUpdate`, `AfterDelete`), `Business\SAIF.Business.Claim.Bill\Core\clsAudit.vb`, `Business\SAIF.Business.Claim.Bill\Core\clsAuditedService.vb`, `Business\SAIF.Business.Claim.Bill\Core\clsAuditedServiceAdjustment.vb`, `Business\SAIF.Business.Claim.Bill\Core\clsAuditMessage.vb`, `Business\SAIF.Business.Claim.Bill\clsCBPBillPaymentRequest.vb` |

---

## BR-005: Duplicate audited service line for the same service ID is rejected

| Field | Value |
| --- | --- |
| **Statement** | An audited-service line cannot be created for a service ID that already exists on the audit |
| **Trigger** | `clsAuditedServiceCollection.NewAuditedService(inServiceID)` is called with a service ID already present in the collection |
| **Enforcement** | `clsAuditedServiceCollection.NewAuditedService(inServiceID)` checks the collection for an existing item with that `ServiceID` before creating a new one |
| **Outcome** | Exception: `"Attempt to generate new Audit Service Line for service #<id> failed. - Service already exists."` |
| **Confidence** | Verified |
| **Source** | `Business\SAIF.Business.Claim.Bill\Core\clsAuditedServiceCollection.vb` (`NewAuditedService`) |

---

## BR-006: MCO location submitted must match the location assigned to the provider-type admin fee

| Field | Value |
| --- | --- |
| **Statement** | A location assigned to a provider-type admin fee record must match that record's own MCO ID |
| **Trigger** | `clsMCOProviderTypeAdminFee.SetLocation(inLocation)` is called |
| **Enforcement** | `SetLocation` compares `m_McoID.Trim.ToLower` to `m_MCOLocation.McoID.Trim.ToLower` after assigning the location |
| **Outcome** | Exception: `"MCO location submitted does not match location assigned."` |
| **Confidence** | Verified |
| **Source** | `Business\SAIF.Business.Claim.Bill\AuditSupport\MCO\clsMCOProviderTypeAdminFee.vb` (`SetLocation`) |

---

## Inherited business rules

Rules in this section are inherited from shared BOF framework behavior.

### From `clsBusinessBase` (`saif-framework-core`)

## INH-001: Framework rule execution

| Field | Value |
| --- | --- |
| **Statement** | Inherited BOF business objects evaluate property and object rules through the shared rules manager.* |
| **Trigger** | When a property setter or save path triggers rule evaluation |
| **Enforcement** | Inherited `clsBusinessBase` rules-manager flow |
| **Outcome** | Broken-rule state is captured and exposed to consumers.* |
| **Confidence** | Inherited |
| **Origin** | `saif-framework-core — clsBusinessBase` |
| **Source** | Retrieved from dependency documentation via Legends CLI |

---

## INH-002: Collection validation surfacing

| Field | Value |
| --- | --- |
| **Statement** | Inherited BOF collections surface aggregated validation state through `IDataErrorInfo`.* |
| **Trigger** | When child items or collection state contain broken rules |
| **Enforcement** | Inherited `clsBusinessCollectionBase` validation behavior |
| **Outcome** | Consumers can read collection-level error state without querying each child directly.* |
| **Confidence** | Inherited |
| **Origin** | `saif-framework-core — clsBusinessCollectionBase` |
| **Source** | Retrieved from dependency documentation via Legends CLI |

---

## Stored procedure business rules

Rules sourced from Oracle procedures referenced by this library.

## PR-001: Map intable values to the correct CBP sequence

| Field | Value |
| --- | --- |
| **Statement** | The procedure maps supported `intable` values to the correct CBP sequence |
| **Trigger** | `sp82385_get_next_bill_seqnum` receives `CBP_AUDIT_ERROR`, `CBP_BILL`, `CBP_BILL_STATUS`, `CBP_EOB_NOTE`, or `CBP_NOTE` |
| **Enforcement** | `sp82385_get_next_bill_seqnum` selects the matching Oracle sequence and returns the next value |
| **Outcome** | Callers receive a table-specific sequence value for new CBP records |
| **Confidence** | Verified |
| **Source** | `Business\SAIF.Business.Claim.Bill\AuditSupport\mdlCBPSupportingData.vb` (`GetNextCBPSeqNum` calls `sp82385_get_next_bill_seqnum`) |

## Notes
- Rule identifiers in this document are documentation identifiers for this generated library set.

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Database tables](database-tables.md)
- [SQL catalog](sql/index.md)
- [Procedures](procedures/index.md)
- [Configuration](configuration.md)
- [API reference](api/index.md)

> **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
- `Business\SAIF.Business.Claim.Bill\SAIF.BOF.Business.Claim.Bill.vbproj`
- `Business\SAIF.Business.Claim.Bill\SAIF.BOF.Business.Claim.Bill.nuspec`
- `Business\SAIF.Business.Claim.Bill\packages.config`
- `Business\SAIF.Business.Claim.Bill\clsCBPBillPaymentRequest.vb`
- `Business\SAIF.Business.Claim.Bill\clsCallImageApi.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsBill.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsAudit.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsAuditedService.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsAuditedServiceAdjustment.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsAuditMessage.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsBillDiagnosis.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsBillProcedure.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsBillService.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsBillStatus.vb`
- `Business\SAIF.Business.Claim.Bill\MCOSupport\clsMCOBill.vb`
- `Business\SAIF.Business.Claim.Bill\AuditSupport\Services\clsNationalDrug.vb`
- `Business\SAIF.Business.Claim.Bill\AuditSupport\mdlCBPSupportingData.vb`
- `Business\SAIF.Business.Claim.Bill\Core\clsAuditedServiceCollection.vb`
- `Business\SAIF.Business.Claim.Bill\AuditSupport\MCO\clsMCOProviderTypeAdminFee.vb`
- `Business\SAIF.Business.Claim.Bill\clsCBPBillPaymentRequest.vb`