# P4 Focus invoice archive foundation

Verified and applied on 2026-10-23.

## Delivered

- Manager-only /sales/focus-invoices upload and review workspace.
- Safe Focus ArrayOfTransaction XML parser with network access disabled and file, transaction and line limits.
- Exact source XML retention and SHA-256 duplicate protection per company.
- Immutable staging tables for Focus transaction headers and lines.
- Focus-to-ERP mapping foundations for voucher types, salespeople and company products.
- Manager-defined voucher classification (STI sales invoice or STR sales return); signs are never used to guess the type.
- Existing customer focus_code is used for customer matching.
- Parsed Focus values retain their original signs and precision.
- Staging has no stock, accounting, customer-balance or invoice-sequence side effects.
- A document is only ready_for_review when customer, salesperson and every product are mapped.
- No historical transaction can be posted or registered as an ERP invoice yet.

## Representative export observations

The supplied Transactions_0.xml contains one transaction:

- Focus voucher type: 3336
- Focus document number: W-3399
- Focus packed date: 132778516, decoded as 2026-10-20
- Source: API
- Authorization status: Pending
- Header net: -1924
- Lines: 24
- Focus account code: 373
- Focus book code: 5033
- Focus salesperson code: 43
- Currency ID: 7
- Raw quantity total: -27
- Raw gross total: 1924
- All 24 Focus product IDs are preserved for later mapping.

Focus packs dates as year/month/day bytes: year is the upper 16 bits, month the next byte, and day the last byte.

## Required business confirmation before posting

The sample is intentionally not classified automatically. Confirm in Focus that:

1. Voucher type 3336 is a sales invoice, return, or another transaction type.
2. Code 373 is the customer/account identity.
3. Book 5033 is a Focus book/register identifier and not the printed manual-book number.
4. W-3399 is the invoice number that must be displayed and preserved.
5. Negative quantity and net values are Focus's normal sales-invoice convention, rather than proof that the document is a return.

Once confirmed, the next implementation can add mapping screens, controlled acceptance into the central number registry and read-only historical invoice views. Financial and inventory posting should remain separate and explicit.
