All tables
tables · table

groupitem

The groupitem table serves as a Bill of Materials (BOM) or Kit Definition mapping within the ERP system. It defines the relationship between a "Group" or "Assembly" item (represented by groupcode) and its constituent "Child" or component items (represented by itemcode).

Row count
17
Last entry
Source
tables

Columns

5
ColumnTypeNullableMeaning
indexintegerNoPrimary key; unique record identifier.
compcodestringNoCompany code for multi-tenant isolation.
groupcodestringNoThe code representing the Parent Item, Kit, or Assembly.
itemcodestringNoThe code representing the Child Item or Component.
itemqtynumberYesThe quantity of the component required for one unit of the group.

Full documentation

### 1. Overview
 The `groupitem` table serves as a **Bill of Materials (BOM)** or **Kit Definition** mapping within the ERP system. It defines the relationship between a "Group" or "Assembly" item (represented by `groupcode`) and its constituent "Child" or component items (represented by `itemcode`). 
 
 In production logic (specifically within `FGStock` and `TotalItemStock` stored procedures), this table is used to calculate "Used in Assembly" quantities. When an assembly item is received via `goodreceipt`, the system references `groupitem` to determine the specific component items that were consumed to create that assembly.
 
 ### 2. Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | No | Primary key; unique record identifier. | | `PRIMARY KEY` |
 | **compcode** | string | No | Company code for multi-tenant isolation. | e.g., "DAS", "BAM" | `JOIN`, `WHERE` |
 | **groupcode** | string | No | The code representing the Parent Item, Kit, or Assembly. | e.g., "LERVERKVE" | `JOIN` (to `itemmas.itemcode` or `goodreceipt.itemcode`) |
 | **itemcode** | string | No | The code representing the Child Item or Component. | e.g., "CP-301" | `JOIN` (to `itemmas.itemcode`) |
 | **itemqty** | number | Yes | The quantity of the component required for one unit of the group. | e.g., 1.0, 2.5 | `SUM`, `CALCULATION` |
 
 ### 3. Relationships & Join Map
 
 Based on the `SCHEMA_MAP` and logic extracted from `REFERENCE_JSON`, the following joins are authoritative:
 
 #### Strict Physical Joins (SCHEMA_MAP Verified)
 * **dbo.itemmas**: Join on `compcode` and `itemcode`. Used to retrieve technical specifications (finish weight, name) for component items.
 * **dbo.groupmas**: Join on `compcode` and `groupcode`. Used to retrieve master details for the parent assembly group.
 * **dbo.goodreceipt**: Join `goodreceipt.itemcode` = `groupitem.groupcode`. This is used to explode assembly receipts into component consumption.
 * **dbo.invdtl**: Join on `compcode` and `itemcode`. Used to track which specific components are being moved or sold via parent groups.
 
 #### Logic Join Patterns
 ```sql
 -- Pattern used in FGStock to find components consumed for Assemblies
 SELECT 
  q.itemcode, 
  SUM(p.aqtystore * q.itemqty) as ComponentConsumed
 FROM dbo.goodreceipt p
 INNER JOIN dbo.groupitem q 
  ON p.itemcode = q.groupcode 
  AND p.compcode = q.compcode
 WHERE p.itemflag = 'A'; -- 'A' usually denotes Assembly in this context
 ```