# settleInboundShipment

## Overview

Settles (posts) a DRAFT inbound shipment (an `InboundShipment`). Posting goes through the purchase module's `postInboundShipment` wrapper, which transitions the inbound shipment to POSTED, creates inventory ledger entries, costs the receipt at each item's effective standard cost — creating and posting a balanced journal entry in financial-accounting (inventory at standard against the GR/IR accrual, actual-vs-standard difference to PPV) within the same transaction — updates incoming inventory, and rolls up the linked PO's receipt / billing status. Costing requires each item to have a published standard cost and a valuation policy in the receiving company (explicit `setItemValuationPolicy` assignment or the company's default policy, auto-assigned on first movement), plus an OPEN accounting period covering the posting date.

## Modules Commands Used

- [purchase] PostInboundShipment (wraps the inbound-shipment post + PO status roll-up)

## Exception Handling

| Error Code | Description |
| --- | --- |
| INBOUND_SHIPMENT_INVALID_STATUS | The inbound shipment is not in DRAFT status and cannot be posted. |
| INBOUND_SHIPMENT_EMPTY_SHIPMENT_LINES | The inbound shipment has no lines to post. |
| INSUFFICIENT_PERMISSION | The caller does not have permission to perform this operation. |
