# GetSalesInvoice

## Overview

GetSalesInvoice retrieves one sales invoice with line, due-schedule, and status detail for billing or downstream AR handoff support.

## Business Rules

- Lookup by id performs an exact invoice match.
- The query returns DRAFT, ISSUED, SENT, and CANCELLED invoices.

## Process Flow

```mermaid
flowchart TD
    A[Receive invoice id] --> B[Query SalesInvoice and SalesInvoiceLine]
    B --> C{Found?}
    C -->|No| D[Return null]
    C -->|Yes| E[Return invoice with lines and schedule]
```

## External Dependencies

- None

## Error Scenarios

- None (returns null when no matching sales invoice exists)

## Test Cases

- returns invoice when found by id
- returns issued invoice with due schedule
- returns null when invoice is not found
