All tables
tables · table

tempsalecustwise

The tempsalecustwise table is a temporary or reporting-layer table used to store aggregated sales data categorized by customer and item. It serves as a flattened data structure for generating customer-wise sales reports, containing both identifiers (codes) and descriptive attributes (names) to reduce the need for complex joins during final report rendering.

Row count
3
Last entry
Source
tables

Columns

11
ColumnTypeNullableMeaning
indexintegerNoPrimary Key / Row Identifier
compcodestringYesCompany Code
custcodestringYesUnique Customer Identifier
custnamestringYesCustomer Name (Denormalized)
itemcodestringYesInternal Item Identifier
itemnamestringYesItem Description
partnostringYesManufacturer Part Number
saleqtyintegerYesTotal Quantity Sold
uomstringYesUnit of Measure
basicvaluenumberYesBasic Sale Value (Pre-tax)
ebasicvaluenumberYesLikely Export/Extra Basic Value

Full documentation

### 1) Overview
 The `tempsalecustwise` table is a temporary or reporting-layer table used to store aggregated sales data categorized by customer and item. It serves as a flattened data structure for generating customer-wise sales reports, containing both identifiers (codes) and descriptive attributes (names) to reduce the need for complex joins during final report rendering.
 
 ### 2) Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | No | Primary Key / Row Identifier | Auto-incrementing integers | `WHERE index = 0` |
 | **compcode** | string | Yes | Company Code | e.g., "DAS" | `JOIN dbo.company ON ...` |
 | **custcode** | string | Yes | Unique Customer Identifier | e.g., "MITSU(GU)" | `JOIN dbo.cust ON ...` |
 | **custname** | string | Yes | Customer Name (Denormalized) | | Display only |
 | **itemcode** | string | Yes | Internal Item Identifier | e.g., "BSETT" | `JOIN dbo.itemmas ON ...` |
 | **itemname** | string | Yes | Item Description | | Display only |
 | **partno** | string | Yes | Manufacturer Part Number | e.g., "A4881-863-00" | Filtering/Search |
 | **saleqty** | integer | Yes | Total Quantity Sold | Positive integers | `SUM(saleqty)` |
 | **uom** | string | Yes | Unit of Measure | e.g., "Nos", "Kgs" | `JOIN dbo.UoMMaster ON ...` |
 | **basicvalue** | number | Yes | Basic Sale Value (Pre-tax) | Decimal values | Financial Reporting |
 | **ebasicvalue** | number | Yes | Likely Export/Extra Basic Value | | Likely used for specific tax types |
 
 ### 3) Relationships & Join Map
 
 This table is primarily a destination for data from transactional sales tables and a source for reporting.
 
 #### Primary Joins (Authoritative):
 * **dbo.cust**: Join via `compcode` and `custcode` to retrieve full customer profiles, credit terms, or addresses.
 * **dbo.itemmas**: Join via `compcode` and `itemcode` to access technical specifications, weight details, or drawing numbers.
 * **dbo.invhdr / dbo.invdtl**: This table likely aggregates data from these physical invoice tables based on `compcode`, `custcode`, and `itemcode`.
 
 #### Potential Joins (Likely):
 * **dbo.TEMPSALEREGISTER**: Join via `compcode` and `custcode` to compare customer-wise totals against the general sales register.
 * **dbo.UoMMaster**: Join via `compcode` and `uom` to handle unit conversions.
 * **dbo.monthwisesale**: Join via `compcode`, `custcode`, and `itemcode` to perform period-over-period analysis.