# SalePro E2E Inventory Verification

- Run ID: `20260625013322`
- Prefix: `E2E-INV-20260625013322`
- Result: `FAIL`
- Persistence: `rolled back after report`

## Products
- standard: ID `31`, code `E2E-INV-20260625013322-STD`, type `standard`
- variantProduct: ID `32`, code `E2E-INV-20260625013322-VAR`, type `standard`
- combo: ID `35`, code `E2E-INV-20260625013322-COMBO`, type `combo`
- componentA: ID `33`, code `E2E-INV-20260625013322-CMPA`, type `standard`
- componentB: ID `34`, code `E2E-INV-20260625013322-CMPB`, type `standard`
- variant code: `E2E-INV-20260625013322-VAR-RED`

## References
- `E2E-INV-20260625013322-PUR`
- `E2E-INV-20260625013322-SALE`
- `E2E-INV-20260625013322-SRET`
- `E2E-INV-20260625013322-PRET`

## Flow Summary
- Setup: Created deterministic products and reference master data.
  Context: `{"standard":"E2E-INV-20260625013322-STD","variant":"E2E-INV-20260625013322-VAR-RED","combo":"E2E-INV-20260625013322-COMBO","components":["E2E-INV-20260625013322-CMPA","E2E-INV-20260625013322-CMPB"]}`
- Purchase: Purchased standard, variant, and combo component products.
  Context: `{"reference":"E2E-INV-20260625013322-PUR","grand_total":405,"supplier_due_delta":405}`
- Sale: Sold standard, variant, and combo product.
  Context: `{"reference":"E2E-INV-20260625013322-SALE","paid":100,"due":40}`
- Stock Transfer: Transferred standard, variant, and combo component stock. Direct combo transfer is not used because combo stock is component-derived.
  Context: `{"reference":"salepro20260625-013323"}`
- Sale Return: Returned standard, variant, and combo product from completed sale.
  Context: `{"reference":"E2E-INV-20260625013322-SRET","customer_due_delta":-45}`
- Purchase Return: Returned standard and variant purchase quantities. Combo purchase return was not direct-tested because combo stock is component-derived in this verification.
  Context: `{"reference":"E2E-INV-20260625013322-PRET","supplier_due_delta":-30}`
- Damage / Adjustment: Recorded adjustment and damaged stock. Direct combo damage is treated as unsupported for this verification; component damage was verified.
  Context: `{"adjustment_id":2,"damage_id":1}`
- Sale Exchange: Performed exchange involving standard, variant, and combo products.
  Context: `{"exchange_id":null}`
- Listings and Reports: Verified transaction listings and report-equivalent totals from the same persisted tables used by reports.
  Context: `{"purchase_total":405,"sale_total":140,"sale_return_total":0,"purchase_return_total":0,"customer_due":-5,"supplier_due":375}`

## Checks
- [PASS] Purchase listing contains the verification purchase.
  Context: `{"reference":"E2E-INV-20260625013322-PUR"}`
- [PASS] Purchase standard product stock
  Context: `{"product":"E2E-INV-20260625013322-STD","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":20,"actual":20}`
- [PASS] Purchase variant product stock in warehouse
  Context: `{"product":"E2E-INV-20260625013322-VAR","variant":"E2E-INV-20260625013322-Red","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":15,"actual":15}`
- [PASS] Purchase variant product stock global variant quantity matches warehouse total
  Context: `{"expected":15,"actual":15}`
- [PASS] Purchase combo component A stock
  Context: `{"product":"E2E-INV-20260625013322-CMPA","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":12,"actual":12}`
- [PASS] Purchase combo component B stock
  Context: `{"product":"E2E-INV-20260625013322-CMPB","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":10,"actual":10}`
- [PASS] Combo product has no direct purchased warehouse stock
  Context: `{"product":"E2E-INV-20260625013322-COMBO","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":0,"actual":0}`
- [PASS] Sale listing contains the verification sale.
  Context: `{"reference":"E2E-INV-20260625013322-SALE"}`
- [PASS] Sale deducts standard product stock
  Context: `{"product":"E2E-INV-20260625013322-STD","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":17,"actual":17}`
- [PASS] Sale deducts variant stock in warehouse
  Context: `{"product":"E2E-INV-20260625013322-VAR","variant":"E2E-INV-20260625013322-Red","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":11,"actual":11}`
- [PASS] Sale deducts variant stock global variant quantity matches warehouse total
  Context: `{"expected":11,"actual":11}`
- [PASS] Sale deducts combo component A stock
  Context: `{"product":"E2E-INV-20260625013322-CMPA","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":8,"actual":8}`
- [PASS] Sale deducts combo component B stock
  Context: `{"product":"E2E-INV-20260625013322-CMPB","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":8,"actual":8}`
- [PASS] Sale paid and due amounts are correct.
  Context: `{"grand_total":140,"paid_amount":100,"due":40}`
- [PASS] Transfer listing contains the verification transfer.
  Context: `{"reference":"salepro20260625-013323"}`
- [PASS] Transfer decreases standard source warehouse
  Context: `{"product":"E2E-INV-20260625013322-STD","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":12,"actual":12}`
- [PASS] Transfer increases standard destination warehouse
  Context: `{"product":"E2E-INV-20260625013322-STD","warehouse":"E2E-INV-20260625013322-Warehouse-B","expected":5,"actual":5}`
- [PASS] Transfer decreases variant source warehouse in warehouse
  Context: `{"product":"E2E-INV-20260625013322-VAR","variant":"E2E-INV-20260625013322-Red","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":8,"actual":8}`
- [PASS] Transfer decreases variant source warehouse global variant quantity matches warehouse total
  Context: `{"expected":11,"actual":11}`
- [PASS] Transfer increases variant destination warehouse in warehouse
  Context: `{"product":"E2E-INV-20260625013322-VAR","variant":"E2E-INV-20260625013322-Red","warehouse":"E2E-INV-20260625013322-Warehouse-B","expected":3,"actual":3}`
- [PASS] Transfer increases variant destination warehouse global variant quantity matches warehouse total
  Context: `{"expected":11,"actual":11}`
- [PASS] Component transfer used instead of direct combo transfer
  Context: `{"product":"E2E-INV-20260625013322-CMPA","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":6,"actual":6}`
- [PASS] Component transfer reaches destination warehouse
  Context: `{"product":"E2E-INV-20260625013322-CMPA","warehouse":"E2E-INV-20260625013322-Warehouse-B","expected":2,"actual":2}`
- [FAIL] Sale return listing contains the verification return.
  Context: `{"reference":"E2E-INV-20260625013322-SRET"}`
- [PASS] Sale return restores standard stock
  Context: `{"product":"E2E-INV-20260625013322-STD","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":13,"actual":13}`
- [PASS] Sale return restores variant stock in warehouse
  Context: `{"product":"E2E-INV-20260625013322-VAR","variant":"E2E-INV-20260625013322-Red","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":9,"actual":9}`
- [PASS] Sale return restores variant stock global variant quantity matches warehouse total
  Context: `{"expected":12,"actual":12}`
- [PASS] Sale return restores combo component A
  Context: `{"product":"E2E-INV-20260625013322-CMPA","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":8,"actual":8}`
- [PASS] Sale return restores combo component B
  Context: `{"product":"E2E-INV-20260625013322-CMPB","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":9,"actual":9}`
- [FAIL] Purchase return listing contains the verification return.
  Context: `{"reference":"E2E-INV-20260625013322-PRET"}`
- [PASS] Purchase return decreases standard stock
  Context: `{"product":"E2E-INV-20260625013322-STD","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":11,"actual":11}`
- [PASS] Purchase return decreases variant stock in warehouse
  Context: `{"product":"E2E-INV-20260625013322-VAR","variant":"E2E-INV-20260625013322-Red","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":7,"actual":7}`
- [PASS] Purchase return decreases variant stock global variant quantity matches warehouse total
  Context: `{"expected":10,"actual":10}`
- [PASS] Adjustment listing contains standard and variant adjustment rows.
  Context: `{"adjustment_id":2}`
- [PASS] Adjustment decreases standard stock
  Context: `{"product":"E2E-INV-20260625013322-STD","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":10,"actual":10}`
- [PASS] Adjustment decreases variant stock in warehouse
  Context: `{"product":"E2E-INV-20260625013322-VAR","variant":"E2E-INV-20260625013322-Red","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":6,"actual":6}`
- [PASS] Adjustment decreases variant stock global variant quantity matches warehouse total
  Context: `{"expected":9,"actual":9}`
- [PASS] Damage listing contains standard, variant, and component rows.
  Context: `{"damage_stock_id":1}`
- [PASS] Damage decreases standard stock
  Context: `{"product":"E2E-INV-20260625013322-STD","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":9,"actual":9}`
- [PASS] Damage decreases variant stock in warehouse
  Context: `{"product":"E2E-INV-20260625013322-VAR","variant":"E2E-INV-20260625013322-Red","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":5,"actual":5}`
- [PASS] Damage decreases variant stock global variant quantity matches warehouse total
  Context: `{"expected":8,"actual":8}`
- [PASS] Damage uses component stock instead of direct combo damage
  Context: `{"product":"E2E-INV-20260625013322-CMPB","warehouse":"E2E-INV-20260625013322-Warehouse-A","expected":8,"actual":8}`
- [FAIL] Sale exchange listing contains returned and new product rows.
  Context: `{"exchange_id":null}`
- [PASS] Sale exchange has no net duplicate movement for standard product.
  Context: `{"before":9,"after":9}`
- [PASS] Sale exchange has no net duplicate movement for variant product.
  Context: `{"before":5,"after":5}`
- [PASS] Sale exchange handles combo as component stock with no direct combo movement.
  Context: `{"componentA_before":8,"componentA_after":8,"componentB_before":8,"componentB_after":8,"combo_before":0,"combo_after":0}`
- [PASS] Purchase report total includes verification purchase.
  Context: `{"total":405}`
- [PASS] Sale report total includes verification sale.
  Context: `{"total":140}`
- [FAIL] Sale return report total includes verification return.
  Context: `{"total":0}`
- [FAIL] Purchase return report total includes verification return.
  Context: `{"total":0}`
- [PASS] Customer due report reflects sale, payment, and return impact.
  Context: `{"due":-5}`
- [PASS] Supplier due report reflects purchase and purchase return impact.
  Context: `{"due":375}`
- [PASS] Warehouse stock report has rows for verification stock.
  Context: `{"warehouse":"E2E-INV-20260625013322-Warehouse-A"}`

## Bugs Found
- None.

## Commands
- Run and roll back data: `php artisan verify:e2e-inventory-flow`
- Run and keep data for manual UI checks: `php artisan verify:e2e-inventory-flow --commit`
