All tables
tables · table

rejaccept_dtl

The rejaccept_dtl table serves as the granular transaction log for Sales Returns (Rejection Acceptance) within the ERP system. It records the specific items returned by customers, detailing the quantities received, accepted (OK), scrapped, or marked for rework. This table is critical for Finished Goods (FG) and Work-in-Progress (WIP) stock calculations, as it reconciles physical returns against original invoices (invno, invyear) to update inventory levels and potentially trigger credit note processes.

Row count
2,772
Last entry
2026-01-14
Source
tables

Columns

21
ColumnTypeNullableMeaning
indexintegerNOPrimary Key
compcodestringNOCompany Identifier
rejaccept_nointegerNOTransaction Header Number
rejaccept_datedatetimeNODate of rejection receipt
billqtyintegerYESQuantity per customer document
recdqtyintegerYESTotal quantity physically received
okqtyintegerYESQuantity accepted back into stock
scrapqtyintegerYESQuantity rejected and scrapped
reworkqtyintegerYESQuantity requiring internal rework
itemcodestringNOInternal Item Identifier
reasonrejstringYESText description of defect
typestringYESItem Category Flag
ratenumberYESUnit rate of the item
salecodestringYESOriginal Sale Item Code
invnostringYESOriginal Invoice Number
invyearstringYESInvoice Financial Year
saleqtystringYESOriginal quantity sold
LotnostringYESProduction Batch Identifier
heatnostringYESRaw Material Heat Code
mrpnostringYESManufacturing Reference Number
invtypeintegerYESType of original invoice

Full documentation

### 1) Overview
 The `rejaccept_dtl` table serves as the granular transaction log for Sales Returns (Rejection Acceptance) within the ERP system. It records the specific items returned by customers, detailing the quantities received, accepted (OK), scrapped, or marked for rework. This table is critical for Finished Goods (FG) and Work-in-Progress (WIP) stock calculations, as it reconciles physical returns against original invoices (`invno`, `invyear`) to update inventory levels and potentially trigger credit note processes.
 
 ### 2) Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | NO | Primary Key | Auto-incrementing ID | `WHERE [index] = 10` |
 | **compcode** | string | NO | Company Identifier | e.g., "DAS", "BAM" | `JOIN ... ON a.compcode = b.compcode` |
 | **rejaccept_no** | integer | NO | Transaction Header Number | Unique per company/year | `JOIN rejaccept_hdr ON ...` |
 | **rejaccept_date** | datetime | NO | Date of rejection receipt | ISO Date | `WHERE rejaccept_date BETWEEN ...` |
 | **billqty** | integer | YES | Quantity per customer document | Positive Integers | `SUM(billqty)` |
 | **recdqty** | integer | YES | Total quantity physically received | Positive Integers | `SUM(recdqty)` |
 | **okqty** | integer | YES | Quantity accepted back into stock | Positive Integers | Inventory addition calculations |
 | **scrapqty** | integer | YES | Quantity rejected and scrapped | Positive Integers | Scrap reporting |
 | **reworkqty** | integer | YES | Quantity requiring internal rework | Positive Integers | WIP tracking |
 | **itemcode** | string | NO | Internal Item Identifier | Linked to `itemmas` | `JOIN itemmas ON ...` |
 | **reasonrej** | string | YES | Text description of defect | e.g., "ID BURR", "RUSTY" | Quality analytics |
 | **type** | string | YES | Item Category Flag | 'I' (Finished), 'R' (Raw) | `WHERE type = 'I'` |
 | **rate** | number | YES | Unit rate of the item | Decimals | Valuation of returns |
 | **salecode** | string | YES | Original Sale Item Code | Linked to `saleitemmas` | Joining to sales records |
 | **invno** | string | YES | Original Invoice Number | From `invhdr` | `JOIN invhdr ON ...` |
 | **invyear** | string | YES | Invoice Financial Year | e.g., "2013-2014" | Part of invoice composite key |
 | **saleqty** | string | YES | Original quantity sold | Numeric string | Reference only |
 | **Lotno** | string | YES | Production Batch Identifier | From `mchdr` | Traceability |
 | **heatno** | string | YES | Raw Material Heat Code | From `rmincoming` | Metallurgy tracking |
 | **mrpno** | string | YES | Manufacturing Reference Number | - | Production link |
 | **invtype** | integer | YES | Type of original invoice | 0, 1, 6 | Logic branching |
 
 ### 3) Relationships & Join Map
 
 Based on `SCHEMA_MAP` and logic within the `REFERENCE_JSON` stored procedures:
 
 #### Primary Joins (Explicit)
 * **rejaccept_hdr**: Linked by `(compcode, rejaccept_no)`. This is a Parent-Child relationship where the header contains the customer and location information.
 * **itemmas**: Linked by `(compcode, itemcode)`. Used to retrieve item descriptions, part numbers, and finished weights for inventory reporting.
 * **saleitemmas**: Linked by `(compcode, salecode)` (mapping `rejaccept_dtl.salecode` to `saleitemmas.itemcode`). This link is vital for reconciling the return against the original sales configuration.
 
 #### Document Traceability Joins (Grounded Inference)
 * **invhdr / invdtl**: Linked by `(compcode, invno, invyear)`. Used in `sale_custwise_detail` to compare returned quantities against original dispatched quantities.
 * **mchdr / product2**: Linked via `(compcode, Lotno)`. Provides traceability from the rejected item back to the specific production run.
 
 #### SQL Example
 ```sql
 SELECT 
  h.custcode, 
  d.itemcode, 
  d.okqty, 
  m.itemname 
 FROM dbo.rejaccept_dtl d
 INNER JOIN dbo.rejaccept_hdr h ON d.rejaccept_no = h.rejaccept_no AND d.compcode = h.compcode
 INNER JOIN dbo.itemmas m ON d.itemcode = m.itemcode AND d.compcode = m.compcode
 WHERE d.rejaccept_date >= '2024-01-01';
 ```