All tables
tables · table

srnduty

The srnduty table serves as a granular financial ledger for duties and taxes applied to specific material receipts. It operates as a child table to material transaction headers (such as rmincoming, fghdr, and jobhdr), breaking down a total voucher amount into specific tax components (Excise, VAT, GST, etc.) based on defined duty codes. This table is essential for tax reporting, generating purchase registers, and VAT/GST reconciliations.

Row count
30,946
Last entry
Source
tables

Columns

9
ColumnTypeNullableMeaning
indexintegerNoPrimary Key
compcodestringNoCompany Code
mrpnointegerNoMaterial Receipt Number
duty_codeintegerNoTax/Duty Category ID
amountnumberNoFinancial value of the tax component
duty_perstringYesTax Percentage rate
remarksstringYesTransaction comments
snostringYesSerial Number/Line identifier
voudescstringYesVoucher Description

Full documentation

### 1) Overview
 The `srnduty` table serves as a granular financial ledger for duties and taxes applied to specific material receipts. It operates as a child table to material transaction headers (such as `rmincoming`, `fghdr`, and `jobhdr`), breaking down a total voucher amount into specific tax components (Excise, VAT, GST, etc.) based on defined duty codes. This table is essential for tax reporting, generating purchase registers, and VAT/GST reconciliations.
 
 ### 2) Column Dictionary
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | No | Primary Key | | Internal unique ID |
 | **compcode** | string | No | Company Code | e.g., "DAS" | Join key for multi-tenant isolation |
 | **mrpno** | integer | No | Material Receipt Number | | Join key to `rmincoming`, `fghdr`, `jobhdr` |
 | **duty_code** | integer | No | Tax/Duty Category ID | 1 (Excise), 21 (VAT/GST), 51 (SGST), 52 (CGST), 53 (IGST) | Join key to `dutymas` |
 | **amount** | number | No | Financial value of the tax component | | Aggregate for tax totals |
 | **duty_per** | string | Yes | Tax Percentage rate | | Informational; often stored as string |
 | **remarks** | string | Yes | Transaction comments | | Audit notes |
 | **sno** | string | Yes | Serial Number/Line identifier | | Ordering within a receipt |
 | **voudesc** | string | Yes | Voucher Description | | Used for linking in specific ledger procedures |
 
 ### 3) Relationships & Join Map
 
 #### Primary Header Relationships (Authoritative)
 - **dbo.rmincoming (mrpno, compcode)**: Joins to raw material incoming receipts. Used to calculate RM purchase tax.
 - **dbo.fghdr (mrpno, compcode)**: Joins to finished goods receipts. Used for FG tax reporting.
 - **dbo.incomconitem (mrpno, compcode)**: Joins for consumable item receipts (as inferred from views like `viewlp7`).
 - **dbo.Debithdr (mrpno, compcode)**: Likely joins to track taxes on debit notes.
 
 #### Reference Lookup Relationships
 - **dbo.dutymas (duty_code, compcode)**: Authority for tax names (e.g., fetching "CGST" or "VAT" for `duty_code` 52 or 21).
 - **dbo.appdutymas (duty_code, compcode)**: Mapping of applicable duties.
 
 #### Join Examples
 ```sql
 -- Calculate total CGST and SGST for a specific receipt
 SELECT 
  mrpno,
  SUM(CASE WHEN duty_code = 51 THEN amount ELSE 0 END) AS Total_SGST,
  SUM(CASE WHEN duty_code = 52 THEN amount ELSE 0 END) AS Total_CGST
 FROM dbo.srnduty
 WHERE compcode = 'DAS'
 GROUP BY mrpno;
 
 -- Join with Tax Master to get names
 SELECT a.mrpno, b.duty_name, a.amount
 FROM dbo.srnduty a
 JOIN dbo.dutymas b ON a.duty_code = b.duty_code AND a.compcode = b.compcode;
 ```