All tables
tables · table

invdtl

The invdtl table serves as the primary line-item detail repository for sales invoices within the ERP system. It records specific transaction data for each item sold, including quantities, unit rates, discounts, and item-level tax distributions (CGST, SGST, IGST).

Row count
255,126
Last entry
2026-01-15
Source
tables

Columns

47
ColumnTypeNullableMeaning
indexintegerNoPrimary Key
compcodestringNoCompany Identifier
invnointegerNoInvoice Number
invyearintegerNoFinancial Year of Invoice
itemcodestringNoUnique Item/Product Code
partnostringYesCustomer Part Number
itemqtynumberYesQuantity invoiced
itemratenumberYesUnit price per item
uomstringYesUnit of Measure
itemdiscnumberYesDiscount percentage or amount
itemamtnumberYesTotal amount for the line item (Pre-tax)
noofcasesintegerYesNumber of packing cases/cartons
snointegerYesSerial Number (Line sequence)
pagenostringYesReference page in invoice documents
ct3nostringYesCT-3 certificate number (Exemption)
packdetailstringYesPackaging specifics
packmodestringYesMode of packing
pitemcodestringYesParent Item Code (Likely)
ponostringYesCustomer Purchase Order Reference
noofboxstringYesNumber of boxes
mrpnointegerYesMaterial Receipt/RM Batch reference
cgst_perstringYesCGST Tax Percentage
cgst_amtstringYesCGST Tax Amount
sgst_perstringYesSGST Tax Percentage
sgst_amtstringYesSGST Tax Amount
igst_perstringYesIGST Tax Percentage
igst_amtstringYesIGST Tax Amount
hsnstringYesHarmonized System Nomenclature code
taxableamountstringYesNet taxable value after discounts
invclosestringYesStatus flag for item closure
lotnostringYesManufacturing Lot Number
custcodestringYesCustomer Identifier
SuplitemratestringYesSupplementary Item Rate
SuplamndnostringYesSupplementary Amendment Number
amndnostringYesAmendment Number
amnddatestringYesAmendment Date
PDIRNostringYesPre-Despatch Inspection Report Number
PDIRDatestringYesPDIR Date
HeatNostringYesRaw Material Heat Number
tcsamtnumberYesTax Collected at Source Amount
Gross_RatenumberYesRate including certain components
ItemNamestringYesProduct Description
RMCstringYesRaw Material Cost (Likely)
RMC_RMRatestringYesRate of RM used in product
RMC_ConvChargesstringYesConversion charges for product
ManufacturingDatestringYesDate of manufacture
ExpiryDatestringYesProduct expiry date

Full documentation

### 1) Overview
 The `invdtl` table serves as the primary line-item detail repository for sales invoices within the ERP system. It records specific transaction data for each item sold, including quantities, unit rates, discounts, and item-level tax distributions (CGST, SGST, IGST).
 
 The table is fundamentally linked to `invhdr` (Invoice Header) via a composite key of `compcode`, `invno`, and `invyear`. It supports various business processes including domestic sales, export sales, raw material sales, and job work-related invoicing. Traceability features such as `lotno`, `HeatNo`, and `PDIRNo` (Pre-Despatch Inspection Report) are included to ensure quality control standards are met during the shipping process.
 
 ### 2) Column Dictionary
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | No | Primary Key | | Filter: `WHERE index = ...` |
 | **compcode** | string | No | Company Identifier | e.g., "DAS", "BAM" | Join: `invhdr`, `saleitemmas` |
 | **invno** | integer | No | Invoice Number | | Join: `invhdr`, `invtax` |
 | **invyear** | integer | No | Financial Year of Invoice | e.g., 2013, 2024 | Join: `invhdr`, `invtax` |
 | **itemcode** | string | No | Unique Item/Product Code | e.g., "CP-088" | Join: `saleitemmas`, `itemmas` |
 | **partno** | string | Yes | Customer Part Number | | Joins/Display |
 | **itemqty** | number | Yes | Quantity invoiced | | Aggregation: `SUM(itemqty)` |
 | **itemrate** | number | Yes | Unit price per item | | Calculation: `itemqty * itemrate` |
 | **uom** | string | Yes | Unit of Measure | e.g., "Nos", "PCS", "KGS" | Join logic (KGS/MTR vs Nos) |
 | **itemdisc** | number | Yes | Discount percentage or amount | | Calculation |
 | **itemamt** | number | Yes | Total amount for the line item (Pre-tax) | | Aggregation: `SUM(itemamt)` |
 | **noofcases** | integer | Yes | Number of packing cases/cartons | | Calculation |
 | **sno** | integer | Yes | Serial Number (Line sequence) | | Sorting |
 | **pageno** | string | Yes | Reference page in invoice documents | | Display |
 | **ct3no** | string | Yes | CT-3 certificate number (Exemption) | | Regulatory reporting |
 | **packdetail** | string | Yes | Packaging specifics | | Display |
 | **packmode** | string | Yes | Mode of packing | | Filter |
 | **pitemcode** | string | Yes | Parent Item Code (Likely) | | Relationship logic |
 | **pono** | string | Yes | Customer Purchase Order Reference | | Join: `podtl` |
 | **noofbox** | string | Yes | Number of boxes | | Display |
 | **mrpno** | integer | Yes | Material Receipt/RM Batch reference | | Join: `rmincoming`, `rmjobrec1st` |
 | **cgst_per** | string | Yes | CGST Tax Percentage | | Calculation |
 | **cgst_amt** | string | Yes | CGST Tax Amount | | Aggregation |
 | **sgst_per** | string | Yes | SGST Tax Percentage | | Calculation |
 | **sgst_amt** | string | Yes | SGST Tax Amount | | Aggregation |
 | **igst_per** | string | Yes | IGST Tax Percentage | | Calculation |
 | **igst_amt** | string | Yes | IGST Tax Amount | | Aggregation |
 | **hsn** | string | Yes | Harmonized System Nomenclature code | e.g., "87089900" | Join: `chapter` |
 | **taxableamount** | string | Yes | Net taxable value after discounts | | Aggregation |
 | **invclose** | string | Yes | Status flag for item closure | 'Y', 'N' | Filter |
 | **lotno** | string | Yes | Manufacturing Lot Number | | Traceability |
 | **custcode** | string | Yes | Customer Identifier | e.g., "APL" | Join: `cust` |
 | **Suplitemrate** | string | Yes | Supplementary Item Rate | | Display |
 | **Suplamndno** | string | Yes | Supplementary Amendment Number | | Display |
 | **amndno** | string | Yes | Amendment Number | | Versioning |
 | **amnddate** | string | Yes | Amendment Date | | Versioning |
 | **PDIRNo** | string | Yes | Pre-Despatch Inspection Report Number | | Traceability |
 | **PDIRDate** | string | Yes | PDIR Date | | Display |
 | **HeatNo** | string | Yes | Raw Material Heat Number | | Traceability |
 | **tcsamt** | number | Yes | Tax Collected at Source Amount | | Aggregation |
 | **Gross_Rate** | number | Yes | Rate including certain components | | Display |
 | **ItemName** | string | Yes | Product Description | | Display |
 | **RMC** | string | Yes | Raw Material Cost (Likely) | | Analysis |
 | **RMC_RMRate** | string | Yes | Rate of RM used in product | | Analysis |
 | **RMC_ConvCharges** | string | Yes | Conversion charges for product | | Analysis |
 | **ManufacturingDate**| string | Yes | Date of manufacture | | Traceability |
 | **ExpiryDate** | string | Yes | Product expiry date | | Traceability |
 
 ### 3) Relationships & Join Map
 
 #### Authoritative Joins (Schema Map)
 * **invhdr**: Join via `compcode`, `invno`, and `invyear`. This provides access to invoice dates, customer details, and invoice status flags.
 * **saleitemmas**: Join via `compcode` and `itemcode`. Used to retrieve master product descriptions (`salesname`), weights (`finishwt`), and category information.
 * **cust**: Join via `compcode` and `custcode` to get customer names, addresses, and GST status.
 * **invtax**: Join via `compcode`, `invno`, `invyear`, and `sno`. This is used to link specific tax duties associated with the invoice line.
 * **podtl**: Join via `compcode`, `custcode`, `pono`, and `itemcode` to reconcile against the original Customer Purchase Order.
 
 #### Functional Joins (Likely)
 * **rmincoming**: Join via `compcode` and `mrpno` (matching `mrpno` in `invdtl`). Primarily used when selling raw materials or items with strict RM traceability.
 * **rmjobrec1st**: Join via `compcode` and `mrpno`. Used in Job Work scenarios to track the return of processed material to the customer.
 * **pdiinspectionhdr**: Join via `compcode`, `invno`, and `invyear`. Links to pre-despatch inspection metadata.
 * **invlotdetail**: Join via `compcode`, `invno`, `invyear`, and `itemcode`. Provides granular lot tracking for specific items.
 
 ---