All tables
tables · table

itemledger

The itemledger table serves as a comprehensive inventory transaction log, tracking every movement of a specific item across different stages of production, sales, and subcontracting. It records opening balances, production yields, job issue/receipt quantities (Stage 1 and Stage 2), scrap, customer rejections, and sales. It acts as the central point for auditing item-wise stock flow and reconciling physical stock with transaction history.

Row count
3,711
Last entry
2026-01-15
Source
tables

Columns

22
ColumnTypeNullableMeaning
indexintegerNoPrimary key for the ledger record.
compcodestringNoUnique identifier for the company/unit.
itemcodestringNoThe unique identifier for the product or raw material.
typestringYesTransaction category.
docintegerYesInternal document number reference for the transaction.
trndatedatetimeYesDate when the transaction was recorded in the ledger.
opbalintegerYesOpening Balance for the item at the start of the transaction.
sfgpurintegerYesSemi-Finished Goods purchase quantity.
productionintegerYesQuantity produced in-house.
jobistnumberYesJob Work Stage 1 Issues/Receipts (In-house).
jobiindnumberYesJob Work Stage 2 Issues/Receipts (Subcontracting).
custrejnumberYesQuantity rejected by the customer.
fgtowipnumberYesFinished Goods converted back to Work-in-Progress.
saleintegerYesQuantity sold to customers (Finished Goods).
sfgsaleintegerYesQuantity of Semi-Finished Goods sold.
olscrapintegerYesQuantity marked as online scrap during production.
joboutnumberYesQuantity sent out for job work.
rgpoutnumberYesQuantity sent out via Returnable Gate Pass (RGP).
statusstringYesTransaction status flag.
descriptionstringYesNarrative detail, often containing the Party/Vendor name.
billnostringYesReference number of the external bill or invoice.
billdatedatetimeYesDate of the associated external bill or invoice.

Full documentation

### 1) Overview
 The `itemledger` table serves as a comprehensive inventory transaction log, tracking every movement of a specific item across different stages of production, sales, and subcontracting. It records opening balances, production yields, job issue/receipt quantities (Stage 1 and Stage 2), scrap, customer rejections, and sales. It acts as the central point for auditing item-wise stock flow and reconciling physical stock with transaction history.
 
 ### 2) Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | No | Primary key for the ledger record. | Auto-incrementing | `WHERE index = 344` |
 | **compcode** | string | No | Unique identifier for the company/unit. | E.g., "DAS" | `JOIN dbo.company ON ...` |
 | **itemcode** | string | No | The unique identifier for the product or raw material. | E.g., "CSPLATE" | `JOIN dbo.itemmas ON ...` |
 | **type** | string | Yes | Transaction category. | `MRPIst`, `MRPIInd`, `Production`, `Sale` | `GROUP BY type` |
 | **doc** | integer | Yes | Internal document number reference for the transaction. | | `ORDER BY doc` |
 | **trndate** | datetime | Yes | Date when the transaction was recorded in the ledger. | | `WHERE trndate >= '2025-01-01'` |
 | **opbal** | integer | Yes | Opening Balance for the item at the start of the transaction. | | `SUM(opbal)` |
 | **sfgpur** | integer | Yes | Semi-Finished Goods purchase quantity. | | `SUM(sfgpur)` |
 | **production** | integer | Yes | Quantity produced in-house. | | `SUM(production)` |
 | **jobist** | number | Yes | Job Work Stage 1 Issues/Receipts (In-house). | | `SUM(jobist)` |
 | **jobiind** | number | Yes | Job Work Stage 2 Issues/Receipts (Subcontracting). | | `SUM(jobiind)` |
 | **custrej** | number | Yes | Quantity rejected by the customer. | | `AVG(custrej)` |
 | **fgtowip** | number | Yes | Finished Goods converted back to Work-in-Progress. | | `SUM(fgtowip)` |
 | **sale** | integer | Yes | Quantity sold to customers (Finished Goods). | | `SUM(sale)` |
 | **sfgsale** | integer | Yes | Quantity of Semi-Finished Goods sold. | | `SUM(sfgsale)` |
 | **olscrap** | integer | Yes | Quantity marked as online scrap during production. | | `SUM(olscrap)` |
 | **jobout** | number | Yes | Quantity sent out for job work. | | `SUM(jobout)` |
 | **rgpout** | number | Yes | Quantity sent out via Returnable Gate Pass (RGP). | | `SUM(rgpout)` |
 | **status** | string | Yes | Transaction status flag. | `*` (likely Closed/Verified), `NULL` | `WHERE status = '*'` |
 | **description** | string | Yes | Narrative detail, often containing the Party/Vendor name. | | `LIKE '%INDUSTRIES%'` |
 | **billno** | string | Yes | Reference number of the external bill or invoice. | | `WHERE billno = '41'` |
 | **billdate** | datetime | Yes | Date of the associated external bill or invoice. | | `WHERE billdate = trndate` |
 
 ### 3) Relationships & Join Map
 
 The `itemledger` table is a transaction-heavy table designed to link back to master data and specific transaction headers.
 
 #### Primary Joins
 * **dbo.itemmas (itemcode, compcode):** The authoritative join for item specifications (Part No, Drawing No).
 * **dbo.company (compcode):** To filter ledger data by specific legal entities.
 * **dbo.wipstock (itemcode, compcode):** Used to reconcile the ledger's calculated balance against the current WIP stock levels.
 
 #### Transactional Joins (Likely)
 * **dbo.invhdr (invno -> billno, compcode):** Likely join for sales records when `type` is related to sales.
 * **dbo.jobhdr (jobcardno -> doc, compcode):** Likely join for job-related transactions (ist/iind).
 * **dbo.suppmas (supcode -> description/logic):** While the table uses `description` for vendor names, formal joins to `suppmas` or `vendmas` should be handled carefully via `compcode` and logic as no direct `supcode` exists in the ledger schema.