# inbound-shipment-detail

## Overview

Displays full details of a single inbound shipment including header information, line items with quantity breakdown, and PO delivery status summary. Available actions vary by inbound shipment status.

## Screen Type

DetailView

### DetailView Details

#### Displayed Fields

The header info card is always shown. Below it, a tab switches between the line items (Lines / 明細) and the costing journal (Journal / 仕訳).

- **Header** (always visible)
  - Shipment Number (`docNumber`, native `ISH-%d` serial)
  - Status (`status`) — Badge: DRAFT (neutral), POSTED (success), CANCELLED (error)
  - PO Reference — resolved from the first line's `sourceDocumentId` (`sourceDocumentType = PURCHASE_ORDER`), link to PO detail
  - Receiving Site — derived from the first line's resolved `storageLocation.site`
  - Receipt Date (`effectiveDate`)
  - Created At (`createdAt`) — formatted as medium date
- **Lines tab** (明細) — line items table
  - Item (`item.name`)
  - SKU (`item.sku`)
  - Ordered — from the PO line resolved via `sourceLineId`
  - Other Receipts — computed: sum of qty received on other POSTED inbound shipments for the same PO line (excludes this inbound shipment)
  - This Receipt (`quantity`) — header is dynamic: "To Receive" when DRAFT, "This Receipt" when POSTED
  - Open Remaining — computed: `ordered − otherReceipts − thisReceipt`. Green when 0, amber when > 0.
  - UoM (`unit.symbol`)

Ordered, Other Receipts, and Open Remaining are PO-line-derived. The native `InboundShipmentLine` carries the source-document link (`sourceDocumentType = PURCHASE_ORDER`, `sourceDocumentId`, `sourceLineId`), so the page resolves the PO lines by id (for Ordered) and sums posted received quantity across the PO's other inbound shipments (cross-inbound-shipment received totals). Only POSTED inbound shipments are counted; the current inbound shipment is excluded from Other Receipts. Every receipt line references a PO line — manual (non-PO) receipts are not supported in 0.45.

- **Journal tab** (仕訳) — the costing journal(s) this shipment posted (empty until POSTED). Reached via `InventoryLedger` (`sourceType = INBOUND_SHIPMENT`) → `INVENTORY_LEDGER` journals. Each entry can be viewed as List (flat: Account / Description / Debit / Credit) or Voucher (debit/credit T-account) via a capsule toggle; the entry date and status sit in the card header.

#### Available Actions

| Action | Condition | Requires Input | Confirmation |
|---|---|---|---|
| Edit | status is DRAFT | — | — |
| Post / Settle | status is DRAFT | — | dialog |
| Cancel | status is DRAFT | — | dialog |
| Create Inbound Shipment for Remaining | status is POSTED, receiptStatus ≠ RECEIVED | — | — |
| View Purchase Order | status is POSTED, has backing PO | — | — |
| Back | — | — | — |

## Access Control

- [purchaser](../actor/purchaser.md)
