---
name: evolution-bom-hierarchy
description: "How a manufactured item's BOM is resolved across bom / quoteitems_bom / jobInventory_bom"
metadata: 
  node_type: memory
  type: reference
  originSessionId: e6d1528c-1abf-464c-9d30-c1d08076f87c
---

Evolution stores a manufactured item's Bill of Materials in three places; each **overrides** the prior when resolving the current BOM for an item on a job:

1. `bom` (master) — keyed by `bom.parent` = manufactured item's inventory id; `bom.inventoryId` = component. Default, attached at shop-floor-order creation.
2. `quoteitems_bom` — per quote-item override. Keyed by `qibqiid` = quote item id, `qibparent` = manufactured item id, `qibinventoryid` = component.
3. `jobInventory_bom` — per job-line override, **final source of truth**. Keyed by `jibjobinvid` = `jobInventory.id`; top-level components stored with **`jibparent = 0`**; latest batch = `MAX(jibdateadded)` per `jibjobinvid`.

Key mapping: **`jobInventory.referenceId` = the originating quote item id** (`= quoteitems.id = qibqiid`).

Canonical resolver: `library/inventory.php::getBomNested()` / `getChildren()` — read these before touching BOM logic. Resolution per job line: jobInventory_bom (if any rows) → quoteitems_bom (match `qibqiid = referenceId` AND `qibparent = inventoryId`) → master bom (`parent = inventoryId`).

Note: `jobInventory.bom` (JSON column) is a legacy override mechanism; the table `jobInventory_bom` is the current one.

Used in [[workspace_repos]] reports/invBomRestock.inc (BOM restocking demand report).
