All tables
tables · table

invlotdetail

The invlotdetail table serves as a granular traceability layer within the sales and dispatch module. While invhdr and invdtl track the overall invoice and line-item quantities, invlotdetail breaks those dispatches down into specific manufacturing Lots and Heat Numbers. This table is critical for quality control, FIFO validation, and regulatory compliance, allowing the system to trace exactly which batch of raw material or production run was sent to a customer under a specific invoice number.

Row count
116,757
Last entry
Source
tables

Columns

10
ColumnTypeNullableMeaning
indexintegerNoPrimary key for the record.
compcodestringNoUnique identifier for the company/branch.
invnointegerNoThe invoice number associated with the dispatch.
invyearintegerNoThe financial year of the invoice.
itemcodestringNoInternal system code for the finished product.
selfpartnostringYesThe company's internal part number.
lotnostringNoThe specific manufacturing batch or lot identifier.
advdespqtynumberNoQuantity dispatched from this specific lot.
desptypestringYesClassification of the dispatch.
HeatNostringYesMetallurgical heat number for material tracking.

Full documentation

### 1. Overview
 The `invlotdetail` table serves as a granular traceability layer within the sales and dispatch module. While `invhdr` and `invdtl` track the overall invoice and line-item quantities, `invlotdetail` breaks those dispatches down into specific manufacturing **Lots** and **Heat Numbers**. This table is critical for quality control, FIFO validation, and regulatory compliance, allowing the system to trace exactly which batch of raw material or production run was sent to a customer under a specific invoice number.
 
 ### 2. Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | No | Primary key for the record. | | PK |
 | **compcode** | string | No | Unique identifier for the company/branch. | e.g., "DAS" | Join Key, Filter |
 | **invno** | integer | No | The invoice number associated with the dispatch. | | Join Key (with `invhdr`) |
 | **invyear** | integer | No | The financial year of the invoice. | e.g., 2021, 2022 | Join Key (with `invhdr`) |
 | **itemcode** | string | No | Internal system code for the finished product. | | Join Key, Grouping |
 | **selfpartno** | string | Yes | The company's internal part number. | | Display/Search |
 | **lotno** | string | No | The specific manufacturing batch or lot identifier. | | Join Key (Traceability) |
 | **advdespqty** | number | No | Quantity dispatched from this specific lot. | > 0 | Summation (Stock out) |
 | **desptype** | string | Yes | Classification of the dispatch. | e.g., "I" (Invoiced) | Filter |
 | **HeatNo** | string | Yes | Metallurgical heat number for material tracking. | | Quality Reporting |
 
 ### 3. Relationships & Join Map
 
 The table acts as a bridge between financial sales records and physical inventory batches.
 
 #### Primary Join Logic
 * **Sales Tracking:** Joins to `invhdr` and `invdtl` using `compcode`, `invno`, and `invyear`. This links specific lots to the customer's invoice.
 * **Inventory Traceability:** Joins to `goodreceipt` or `RMproduct1` using `compcode`, `itemcode`, and `lotno` to trace the origin of the material.
 * **Item Metadata:** Joins to `itemmas` or `saleitemmas` using `itemcode` and `compcode` for descriptive details.
 
 #### Physical Join Map (Based on SCHEMA_MAP)
 * **dbo.invhdr** (Header)
  * `invlotdetail.compcode` = `invhdr.compcode`
  * `invlotdetail.invno` = `invhdr.invno`
  * `invlotdetail.invyear` = `invhdr.invyear`
 * **dbo.invdtl** (Line Items)
  * `invlotdetail.compcode` = `invdtl.compcode`
  * `invlotdetail.invno` = `invdtl.invno`
  * `invlotdetail.invyear` = `invdtl.invyear`
  * `invlotdetail.itemcode` = `invdtl.itemcode`
 * **dbo.goodreceipt** (Stock In Origin)
  * `invlotdetail.compcode` = `goodreceipt.compcode`
  * `invlotdetail.itemcode` = `goodreceipt.itemcode`
  * `invlotdetail.lotno` = `goodreceipt.lotno`
 * **dbo.saleitemmas** (Sales Catalog)
  * `invlotdetail.compcode` = `saleitemmas.compcode`
  * `invlotdetail.itemcode` = `saleitemmas.itemcode` (Note: Often linked via `rmitemcode` in complex queries).