All tables
tables · table

itemreturn

The itemreturn table serves as a ledger for tracking materials and consumable items returned to the central store from various departments. It records the document number (retno), the specific item code, the quantity returned, and critically, the classification of the return (e.g., 'usable', 'Repairable', or 'Writeoff'). This data is primarily used in inventory reconciliation procedures (like itemledger_det) to adjust available stock levels for consumable items.

Row count
11,275
Last entry
2026-01-15
Source
tables

Columns

9
ColumnTypeNullableMeaning
indexintegerNoPrimary key, unique record identifier.
compcodestringNoInternal company identifier.
retnointegerYesReturn Document Number (Manual or System generated).
retdatedatetimeYesThe date and time the return was processed.
itemcodestringYesUnique identifier for the item being returned.
dpcodestringYesThe department code from which the item originated.
uomstringYesUnit of Measure for the quantity.
qtynumberYesThe numerical quantity of the items returned.
typestringYesThe status/condition of the item upon return.

Full documentation

### 1) Overview
 The `itemreturn` table serves as a ledger for tracking materials and consumable items returned to the central store from various departments. It records the document number (`retno`), the specific item code, the quantity returned, and critically, the classification of the return (e.g., 'usable', 'Repairable', or 'Writeoff'). This data is primarily used in inventory reconciliation procedures (like `itemledger_det`) to adjust available stock levels for consumable items.
 
 ### 2) Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | No | Primary key, unique record identifier. | | `PRIMARY KEY` |
 | **compcode** | string | No | Internal company identifier. | e.g., "DAS" | `JOIN`, `WHERE` |
 | **retno** | integer | Yes | Return Document Number (Manual or System generated). | | `ORDER BY` |
 | **retdate** | datetime | Yes | The date and time the return was processed. | | `WHERE` (Date Range) |
 | **itemcode** | string | Yes | Unique identifier for the item being returned. | e.g., "OIL012" | `JOIN` |
 | **dpcode** | string | Yes | The department code from which the item originated. | e.g., "03", "12" | `JOIN` |
 | **uom** | string | Yes | Unit of Measure for the quantity. | "LTR", "PCS", "SET" | `JOIN` |
 | **qty** | number | Yes | The numerical quantity of the items returned. | | `SUM()` |
 | **type** | string | Yes | The status/condition of the item upon return. | "usable", "Repairable", "Writeoff" | `WHERE` |
 
 ### 3) Relationships & Join Map
 
 Based on the `SCHEMA_MAP` and logic extracted from the `REFERENCE_JSON`, here are the grounded relationships:
 
 #### Primary Joins (Direct)
 * **Company**: `itemreturn.compcode` joins `dbo.company.compcode` to identify the legal entity.
 * **Item Master**: `itemreturn.itemcode` joins `dbo.itemmas.itemcode` to retrieve master item details.
 * **Department**: `itemreturn.dpcode` joins `dbo.dprt_mas.dpcode` to identify the returning department.
 * **Inventory Ledger**: `itemreturn.itemcode` joins `dbo.itemledger.itemcode` for stock movement tracking.
 
 #### Likely Joins (Inferred/Reference)
 * **Consumable Item Master**: `itemreturn.itemcode` joins `dbo.citemmas.citmcode` (Confirmed by SP `itemledger_det`).
 * **UOM Master**: `itemreturn.uom` joins `dbo.UoMMaster.PUoM` or `dbo.UoMMaster.CUoM` for unit conversions.
 * **Department (Alternative)**: `itemreturn.dpcode` joins `dbo.attandence.dpcode` to track department-wise resource usage.