All tables
tables · table

CustGroupMas

The CustGroupMas (Customer Group Master) table defines logical groupings for customers within a specific company. It serves as a categorization entity used primarily for aggregate reporting in sales analytics, inventory tracking, and schedule management. It allows the system to group multiple customer accounts under a single descriptive category (e.g., "OEMs", "Export Clients", "Distributors").

Row count
1
Last entry
Source
tables

Columns

4
ColumnTypeNullableMeaning
CompCodestringNoUnique identifier for the company/entity.
CustGroupCodeintegerNoUnique identifier for the customer group.
CustGroupNamestringYesDescriptive name of the customer group.
UserNamestringYesThe system user who created or last modified the record.

Full documentation

### 1) Overview
 The `CustGroupMas` (Customer Group Master) table defines logical groupings for customers within a specific company. It serves as a categorization entity used primarily for aggregate reporting in sales analytics, inventory tracking, and schedule management. It allows the system to group multiple customer accounts under a single descriptive category (e.g., "OEMs", "Export Clients", "Distributors").
 
 ### 2) Column Dictionary
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **CompCode** | string | No | Unique identifier for the company/entity. | e.g., "DAS", "GEI" | Used in composite joins for multi-tenant data isolation. |
 | **CustGroupCode** | integer | No | Unique identifier for the customer group. | e.g., 1, 2 | Primary identifier for the group; used as a Foreign Key in customer masters. |
 | **CustGroupName** | string | Yes | Descriptive name of the customer group. | e.g., "Auto Division" | Used for display in reports and UI headers. |
 | **UserName** | string | Yes | The system user who created or last modified the record. | e.g., "system" | Audit trail for administrative changes. |
 
 ### 3) Relationships & Join Map
 
 The `CustGroupMas` table is a foundational lookup table referenced by customer-related entities to facilitate group-level filtering and analysis.
 
 #### Logical Joins:
 * **dbo.cust**: Joins on `CompCode` and `CustGroupCode`. This is the primary relationship used to link specific customer accounts to a group.
 * **dbo.itemmas**: Joins on `CompCode` and `custGroupcode`. Used to associate specific items with target customer groups (Likely for pricing or allocation).
 * **dbo.saleitemmas**: Joins on `compcode` and `custGroupcode`. Links sales-specific item attributes to customer categories.
 
 #### SQL Example from Reference:
 In reporting procedures like `TotalItemStock` and `PendingSchedule`, the join is typically implemented as follows to retrieve group names for specific customer transactions:
 
 ```sql
 SELECT m.CustGroupName, c.custname
 FROM dbo.cust c
 LEFT JOIN dbo.CustGroupMas m 
  ON c.custGroupcode = m.CustGroupCode 
  AND c.compcode = m.CompCode;
 ```