All tables
tables · table

Statemas

The Statemas table serves as the primary lookup for Indian states and union territories. It maps 2-digit numeric state codes (consistent with GST state codes) to their respective names. This table is a critical reference for tax reporting (GST), employee payroll localization, and supply chain logistics (E-way bills).

Row count
38
Last entry
Source
tables

Columns

3
ColumnTypeNullableMeaning
statecodestringNoThe 2-digit numeric code representing a state (Standard GST State Code).
StateNamestringNoThe full descriptive name of the state or union territory.
indexintegerNoTechnical row identifier (Pandas artifact).

Full documentation

### 1. Overview
 The `Statemas` table serves as the primary lookup for Indian states and union territories. It maps 2-digit numeric state codes (consistent with GST state codes) to their respective names. This table is a critical reference for tax reporting (GST), employee payroll localization, and supply chain logistics (E-way bills).
 
 ### 2. Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **statecode** | string | No | The 2-digit numeric code representing a state (Standard GST State Code). | "01" (J&K), "07" (Delhi), "09" (UP), etc. | Primary key used for joining with customers, vendors, and invoice headers. |
 | **StateName** | string | No | The full descriptive name of the state or union territory. | "Bihar", "Maharashtra", "Punjab" | Used in report headers and UI displays. |
 | **index** | integer | No | Technical row identifier (Pandas artifact). | | Internal use only. |
 
 ### 3. Relationships & Join Map
 
 The `Statemas` table is a highly referenced master table across modules (Sales, Purchase, Payroll).
 
 #### Direct Joins (via SCHEMA_MAP)
 * **dbo.vendmas** / **dbo.suppmas**: Join on `statecode` to identify the tax jurisdiction of a vendor or supplier.
 * **dbo.invhdr** / **dbo.Performainvhdr**: Join on `statecode` (Seller State) or `Cstatecode` (Buyer/Consignee State) to determine IGST vs. CGST/SGST applicability.
 * **dbo.Debithdr**: Join on `statecode` or `Cstatecode` for debit note tax calculations.
 * **dbo.location**: Join on `statecode` to define the geographic location of company branch offices.
 * **dbo.empmas**: Join on `StateName` (Likely) to track employee residential states for payroll/compliance.
 
 #### Inferred Joins (via REFERENCE_JSON & Logic)
 * **dbo.cust**: Join on `istate` (Likely) $\rightarrow$ `Statemas.statecode`. Standard practice in this schema uses `istate` for customer state codes as seen in `GstRegisterOutPut`.
 * **dbo.company**: Join on `substring(company.gst, 1, 2)` $\rightarrow$ `Statemas.statecode`. This identifies the home state of the company based on the GSTIN prefix.
 
 #### Join Example
 ```sql
 SELECT 
  H.invno, 
  C.custname, 
  S.StateName AS CustomerState
 FROM dbo.invhdr H
 INNER JOIN dbo.cust C ON H.custcode = C.custcode AND H.compcode = C.compcode
 LEFT JOIN dbo.Statemas S ON C.istate = S.statecode;
 ```