tables · table
tempsaleitemwise
The tempsaleitemwise table is a temporary reporting or staging table designed to store aggregated or itemized sales transaction data. It captures the intersection of customers and products, providing quantitative metrics such as sales quantity and total value. Given its prefix temp, it is likely populated during specific report generation cycles (e.g., Sales Analysis by Item) to facilitate high-speed data retrieval for UI grids or printed documents without taxing the primary transaction tables (invhdr/invdtl).
Row count
114
Last entry
—
Source
tables
Columns
11| Column | Type | Nullable | Meaning |
|---|---|---|---|
index | integer | No | Primary Key / Row identifier |
compcode | string | No | Company Code |
custcode | string | No | Unique Customer Identifier |
custname | string | Yes | Name of the customer |
itemcode | string | No | Internal Item Identifier |
itemname | string | Yes | Descriptive name of the product |
partno | string | Yes | Manufacturer or Customer Part Number |
saleqty | integer | Yes | Total quantity sold in the specific period |
uom | string | Yes | Unit of Measure |
salevalue | number | Yes | Total monetary value of the sale |
ebasicvalue | number | Yes | Likely "Ex-works" or "Estimated" Basic Value |
Full documentation
### 1) Overview The `tempsaleitemwise` table is a temporary reporting or staging table designed to store aggregated or itemized sales transaction data. It captures the intersection of customers and products, providing quantitative metrics such as sales quantity and total value. Given its prefix `temp`, it is likely populated during specific report generation cycles (e.g., Sales Analysis by Item) to facilitate high-speed data retrieval for UI grids or printed documents without taxing the primary transaction tables (`invhdr`/`invdtl`). ### 2) Column Dictionary | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage | | :--- | :--- | :--- | :--- | :--- | :--- | | **index** | integer | No | Primary Key / Row identifier | Auto-incrementing integers | `WHERE index = 10` | | **compcode** | string | No | Company Code | e.g., "DAS" | `JOIN dbo.cust ON ... AND t.compcode = c.compcode` | | **custcode** | string | No | Unique Customer Identifier | e.g., "HMCL(SPD)" | `GROUP BY custcode` | | **custname** | string | Yes | Name of the customer | | Display only | | **itemcode** | string | No | Internal Item Identifier | e.g., "AAW", ".4" | `JOIN dbo.itemmas ON ... AND t.itemcode = i.itemcode` | | **itemname** | string | Yes | Descriptive name of the product | | Display only | | **partno** | string | Yes | Manufacturer or Customer Part Number | e.g., "44301-AAW-0000" | Filtering/Searching | | **saleqty** | integer | Yes | Total quantity sold in the specific period | | `SUM(saleqty)` | | **uom** | string | Yes | Unit of Measure | e.g., "Nos" | `JOIN dbo.UoMMaster` | | **salevalue** | number | Yes | Total monetary value of the sale | | Financial reporting | | **ebasicvalue**| number | Yes | Likely "Ex-works" or "Estimated" Basic Value | Usually 0.0 in samples | Valuation analysis | ### 3) Relationships & Join Map #### Logical Parents (Master Data) * **dbo.cust**: Joined via `(compcode, custcode)`. Used to retrieve detailed customer geography (state, city) or tax profiles. * **dbo.itemmas**: Joined via `(compcode, itemcode)`. Used to categorize sales by `itemgroup` or `itemtype`. * **dbo.saleitemmas**: Joined via `(compcode, itemcode)`. Provides sales-specific attributes like `hsn` or `taxrate`. * **dbo.UoMMaster**: Joined via `(compcode, uom)`. Used for unit conversions. #### Peer Tables (Reporting Set) * **dbo.tempsalecustwise**: Often used in the same reporting module. Joinable via `(compcode, custcode, itemcode)`. * **dbo.TEMPSALEREGISTER**: Contains summary invoice-level data. Joinable via `(compcode, custcode)`. #### Join Example ```sql SELECT i.itemgroup, s.itemname, SUM(s.saleqty) as TotalQty, SUM(s.salevalue) as TotalRevenue FROM dbo.tempsaleitemwise s INNER JOIN dbo.itemmas i ON s.compcode = i.compcode AND s.itemcode = i.itemcode GROUP BY i.itemgroup, s.itemname; ```