tables · table
invhdr
The invhdr table serves as the primary header repository for all sales invoices within the system. It tracks critical financial data (basic amounts, GST components), logistical details (vehicle numbers, removal times, E-way bill numbers), and compliance information (IRN, QR codes). It acts as the "parent" table to invdtl, forming the core of the Sales and Distribution module.
Row count
221,160
Last entry
2026-01-16
Source
tables
Columns
20| Column | Type | Nullable | Meaning |
|---|---|---|---|
index | integer | No | Internal primary key. |
compcode | string | No | Unique identifier for the company/branch. |
invtype | integer | No | Categorization of the invoice. |
invno | integer | No | Physical Invoice Number. |
invyear | integer | No | Financial/Accounting year of the invoice. |
invdate | datetime | No | Date the invoice was generated. |
custcode | string | No | Reference code for the customer. |
oano | integer | Yes | Order Acknowledgement Number reference. |
cancel_flag | string | Yes | Status flag indicating if the invoice is void. |
basic_amt | number | Yes | Taxable base value of goods. |
inv_amt | number | Yes | Grand total including taxes and charges. |
cgst_amt | number | Yes | Central GST amount. |
sgst_amt | number | Yes | State GST amount. |
igst_amt | number | Yes | Integrated GST amount. |
IRN | string | Yes | Invoice Reference Number for E-Invoicing compliance. |
EwayBillNo | string | Yes | Logistics compliance number for transport. |
totdespqty | number | Yes | Total quantity of items dispatched in this invoice. |
adviceno | number | Yes | Reference to the dispatch advice. |
sfrm | string | Yes | Sale Source identifier. |
invdoc | string | Yes | Formatted document string for printing. |
Full documentation
### 1. Overview The `invhdr` table serves as the primary header repository for all sales invoices within the system. It tracks critical financial data (basic amounts, GST components), logistical details (vehicle numbers, removal times, E-way bill numbers), and compliance information (IRN, QR codes). It acts as the "parent" table to `invdtl`, forming the core of the Sales and Distribution module. ### 2. Column Dictionary | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage | | :--- | :--- | :--- | :--- | :--- | :--- | | **index** | integer | No | Internal primary key. | Auto-incremented | Primary Key | | **compcode** | string | No | Unique identifier for the company/branch. | e.g., 'DAS', 'HFL' | Join, Filter | | **invtype** | integer | No | Categorization of the invoice. | 0 (Domestic), 1 (RM Sale), 2 (Scrap), 4 (Others) | Filter | | **invno** | integer | No | Physical Invoice Number. | Unique with Year | Join, Partition | | **invyear** | integer | No | Financial/Accounting year of the invoice. | e.g., 2024 | Join, Partition | | **invdate** | datetime | No | Date the invoice was generated. | | Range Filter | | **custcode** | string | No | Reference code for the customer. | Joins to `cust` | Join (custcode) | | **oano** | integer | Yes | Order Acknowledgement Number reference. | Joins to `oahdr` | Join (oano) | | **cancel_flag** | string | Yes | Status flag indicating if the invoice is void. | 'N' (Active), 'Y' (Cancelled) | Filter | | **basic_amt** | number | Yes | Taxable base value of goods. | | Aggregation | | **inv_amt** | number | Yes | Grand total including taxes and charges. | | Aggregation | | **cgst_amt** | number | Yes | Central GST amount. | | Financial Reporting | | **sgst_amt** | number | Yes | State GST amount. | | Financial Reporting | | **igst_amt** | number | Yes | Integrated GST amount. | | Financial Reporting | | **IRN** | string | Yes | Invoice Reference Number for E-Invoicing compliance. | 64-character hash | Compliance | | **EwayBillNo** | string | Yes | Logistics compliance number for transport. | | Compliance | | **totdespqty** | number | Yes | Total quantity of items dispatched in this invoice. | | Reporting | | **adviceno** | number | Yes | Reference to the dispatch advice. | Joins to `despadvicehdr` | Join (adviceno) | | **sfrm** | string | Yes | Sale Source identifier. | 'C', 'R', 'S' | Filter | | **invdoc** | string | Yes | Formatted document string for printing. | e.g., '2024-25/00001' | UI/Display | ### 3. Relationships & Join Map #### Authoritative Joins (Based on SCHEMA_MAP) * **invdtl**: Primary child relationship. Joined on `invno`, `invyear`, and `compcode`. * **cust**: Joins on `custcode` and `compcode` to retrieve customer master details (name, GSTIN, address). * **invtax**: Joins on `invno`, `invyear`, and `compcode` to retrieve granular duty/tax breakdowns. * **oahdr**: Joins on `oano` and `compcode` to link the invoice back to the sales order acknowledgement. * **despadvicehdr**: Joins on `adviceno` and `compcode` to trace the invoice back to its dispatch advice origin. * **invtype**: Joins on `invtype` and `compcode` to get descriptive names for invoice categories. * **suppmas**: Contextual Join (Likely). When `invtype = 2` (Scrap/Returns), `custcode` may link to `supcode` in `suppmas`. #### Logical Usage (Stored Procedures) * **Inventory Tracking**: The `FGStock` and `WIPStockSFR` procedures use `invhdr` (joined with `invdtl`) to subtract quantities from current stock balances during specific date ranges. * **GST Reporting**: `GstRegisterOutPut` aggregates `cgst_amt`, `sgst_amt`, and `igst_amt` from this table for tax filing reports. * **E-Invoicing API**: `E_Invoice_JsonAPI` extracts address, GSTIN, and IRN fields to construct the JSON payload for government portals.