# SalesInvoiceLine

## Description

SalesInvoiceLine stores the specific billed quantity, price, tax basis, and order reference included on one invoice line. It is the unit against which cumulative invoicing and later credit-note corrections are validated.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [createSalesInvoice](../commands/CreateSalesInvoice.md) - Create draft invoice lines from selected sales-order lines.
- [updateSalesInvoice](../commands/UpdateSalesInvoice.md) - Correct draft invoice quantities or references before issue.
- [issueSalesInvoice](../commands/IssueSalesInvoice.md) - Freeze billed quantity, price, and tax basis at issue time.

### Query Definitions

- [getSalesInvoice](../queries/GetSalesInvoice.md) - Return line-level billed quantities and references for one invoice.
- [listSalesInvoicesBySalesOrder](../queries/ListSalesInvoicesBySalesOrder.md) - Summarize billed line history for a selected order.

### Models

- SalesInvoiceLine

### Invariants

- Every invoice line belongs to exactly one sales invoice and references exactly one sales-order line.
- Invoice quantity must be greater than zero and cannot exceed the allowed order-based or shipment-based billing quantity without an explicit override policy.
- Issued invoice lines preserve the order price snapshot rather than re-resolving live price rules.

### Relationships

- **Belongs To SalesInvoice**: `salesInvoiceId` ties the line to its parent invoice.
- **References SalesOrderLine**: `salesOrderLineId` validates billed quantity and price against the originating order line.
- **Optionally References ShipmentLine**: Shipment-gated billing may store shipment evidence at line level.
- **Referenced By SalesCreditNoteLine**: Credit notes point back to issued invoice lines they correct.
