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| Column | Type | Nullable | Meaning |
|---|---|---|---|
index | integer | No | Primary key for the ledger record. |
compcode | string | No | Unique identifier for the company/unit. |
itemcode | string | No | The unique identifier for the product or raw material. |
type | string | Yes | Transaction category. |
doc | integer | Yes | Internal document number reference for the transaction. |
trndate | datetime | Yes | Date when the transaction was recorded in the ledger. |
opbal | integer | Yes | Opening Balance for the item at the start of the transaction. |
sfgpur | integer | Yes | Semi-Finished Goods purchase quantity. |
production | integer | Yes | Quantity produced in-house. |
jobist | number | Yes | Job Work Stage 1 Issues/Receipts (In-house). |
jobiind | number | Yes | Job Work Stage 2 Issues/Receipts (Subcontracting). |
custrej | number | Yes | Quantity rejected by the customer. |
fgtowip | number | Yes | Finished Goods converted back to Work-in-Progress. |
sale | integer | Yes | Quantity sold to customers (Finished Goods). |
sfgsale | integer | Yes | Quantity of Semi-Finished Goods sold. |
olscrap | integer | Yes | Quantity marked as online scrap during production. |
jobout | number | Yes | Quantity sent out for job work. |
rgpout | number | Yes | Quantity sent out via Returnable Gate Pass (RGP). |
status | string | Yes | Transaction status flag. |
description | string | Yes | Narrative detail, often containing the Party/Vendor name. |
billno | string | Yes | Reference number of the external bill or invoice. |
billdate | datetime | Yes | Date 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.