All tables
tables · table

dutymas

The dutymas table serves as the central master repository for defining various taxes, levies, surcharges, and auxiliary charges (like freight, insurance, and discounts) used across the procurement and sales modules. It categorizes how each duty behaves (addition vs. deduction), its calculation sequence, and its association with accounting ledgers and HSN codes for GST compliance.

Row count
58
Last entry
Source
tables

Columns

13
ColumnTypeNullableMeaning
compcodestringNoUnique Company Identifier
duty_codeintegerNoUnique identifier for the tax/duty type
duty_namestringYesDescriptive name of the duty or charge
naturestringYesMathematical behavior in totals
usernamestringYesUser who created or last modified the record
sequenceintegerYesOrder in which the duty is applied in calculations
roffstringYesRound-off flag
duty_typestringYesClassification of the duty (usually for GST)
ledgercodeintegerYesInternal reference to the General Ledger account
aliasstringYesShort name or mnemonic for the duty
lock_flagstringYesIndicates if the master record is locked for editing
HSNstringYesHarmonized System of Nomenclature code
taxratenumberYesDefault percentage rate for the duty

Full documentation

### 1. Overview
 The `dutymas` table serves as the central master repository for defining various taxes, levies, surcharges, and auxiliary charges (like freight, insurance, and discounts) used across the procurement and sales modules. It categorizes how each duty behaves (addition vs. deduction), its calculation sequence, and its association with accounting ledgers and HSN codes for GST compliance.
 
 ### 2. Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **compcode** | string | No | Unique Company Identifier | e.g., "DAS", "PDS" | Primary Join Key |
 | **duty_code** | integer | No | Unique identifier for the tax/duty type | 0=PURCHASE, 51=SGST, 52=CGST, 53=IGST | Primary Join Key |
 | **duty_name** | string | Yes | Descriptive name of the duty or charge | e.g., "CGST", "FREIGHT", "DISCOUNT" | Display name |
 | **nature** | string | Yes | Mathematical behavior in totals | "+", "-" | Calculation logic |
 | **username** | string | Yes | User who created or last modified the record | | Audit |
 | **sequence** | integer | Yes | Order in which the duty is applied in calculations | 0, 1, 2, ... | Calculation Logic |
 | **roff** | string | Yes | Round-off flag | "Y", "N", NULL | Formatting |
 | **duty_type** | string | Yes | Classification of the duty (usually for GST) | " ", NULL | Filtering |
 | **ledgercode** | integer | Yes | Internal reference to the General Ledger account | | Finance Joins |
 | **alias** | string | Yes | Short name or mnemonic for the duty | | Reporting |
 | **lock_flag** | string | Yes | Indicates if the master record is locked for editing | "N", "Y" | System Control |
 | **HSN** | string | Yes | Harmonized System of Nomenclature code | | GST Reporting |
 | **taxrate** | number | Yes | Default percentage rate for the duty | | Calculations |
 
 ### 3. Relationships & Join Map
 
 The `dutymas` table is a foundational master table referenced by transaction "duty" and "tax" tables to provide descriptive names and calculation rules.
 
 #### Primary Keys
 * `compcode`, `duty_code` (Likely Composite PK)
 
 #### Peer Table (Mirror)
 * **cdutymas**: Likely a client-specific or alternate version of the duty master, sharing `duty_code` and `compcode`.
 
 #### Major Transactional Joins (Incoming/Outgoing Taxes)
 * **srnduty**: Joins on `(compcode, duty_code)`. Stores duty amounts for raw material incoming or finished goods receipts.
 * **invtax / invdesptax**: Joins on `(compcode, duty_code)`. Defines taxes applied to sales invoices.
 * **poduty / potax**: Joins on `(compcode, duty_code)`. Defines taxes/duties associated with Purchase Orders.
 * **rgpduty**: Joins on `(compcode, duty_code)`. Associated with Returnable Gate Passes.
 * **suptax / vendtax**: Joins on `(compcode, duty_code)`. Defines default tax structures per supplier/vendor.
 * **appdutymas / saleappdutymas**: Joins on `(compcode, duty_code)`. Maps which duties are "applicable" to specific transaction types.
 
 #### Join Example (View Generation)
 ```sql
 SELECT 
  r.duty_name, 
  SUM(q.amount) as TotalAmount 
 FROM rmincoming p
 JOIN srnduty q ON p.mrpno = q.mrpno AND p.compcode = q.compcode
 JOIN dutymas r ON q.duty_code = r.duty_code AND q.compcode = r.compcode
 WHERE p.vattype IN ('F','G')
 GROUP BY r.duty_name;
 ```