Extend Tax engine configurations for slab price
This article explains how to extend the Tax engine configuration for slab price. Before you extend the Tax engine (also referred to as GTE), you must complete the prerequisites.
Create extension configurations
To create extension configurations, first create a new taxable document that is derived from Taxable Document (India).
- Go to the Electronic reporting workspace, and select Tax configurations.
- Go to the Taxable Document (India) configuration, and select Create configuration.
- Select the Taxable document model derived from Name: Taxable Document (India), Microsoft option. Then enter a name and description for the derived taxable document.
- Select Create configuration to create a new tax document that is derived from Tax (India GST).
- Go to the Tax (India GST) configuration, and select Create configuration.
- Select the Tax configuration derived from name: Tax (India GST), Microsoft option. Then enter a name and description for the derived tax document.
- Select Create configuration.
Add the net price to Taxable document (India Contoso)
Go to the Taxable document (India Contoso) configuration, and select Designer.
Go to Tax document > Header > Lines, and select New to create a node.
Enter a name for the node, and select the item type:
- Name: Net Price
- Item type: Real
Open Map model to datasource to bind Net Price to the data model.
Select a document type, such as Sales order, and open the designer.
Expand Data model.
- Header = 'Sales order'.Header
- Lines = 'Sales order'.Header.Lines
In Net price, select Edit.
Select Go to @, find Net Price, and add the Net Price formula.
In the Configurations workspace, select Change status, and then select Complete.
Enter a description, such as Slab price, and then select OK.
If there are any errors, open the designer, select Validate, and fix the errors.
When the status is Complete, the configuration is ready for deployment.
Change the data model of Tax (India GST Contoso)
- Go to the Tax (India GST Contoso) configuration, and select Designer.
- Select Tax document, select Taxable document (India Contoso) as the data model, and specify 1 as the data model version.
- Select Save to save the configuration.
Modify rate/percentage lookups
Expand the CGST component node.
Select the Rate measure.
Go to Lookups, and select Columns to add Net Price as a condition of the rate table.
Select the same attributes that SGST has.
Note
Don't select Add. Values that you enter here don't affect the actual rate table. To complete the rate table, go to Tax > Tax configuration > Tax setup.
Save the tax document.
Complete the tax document configuration
- In the Configurations workspace, select Change status, and then select Complete.
- Enter a description, and then select OK.
- If there are any errors, open the designer, select Validate, and fix the errors.
After the status is Complete, the configuration is ready for deployment.
Import the configuration and deploy it to a specific company
Go to Tax > Setup > Tax configuration > Tax setup.
Select the current working tax setup.
Select Configurations.
Select Tax configuration > Available configurations, and then select New to create a tax configuration.
Note
Any tax configurations that you add are listed in the Available configurations grid.
Select the required configuration. For example, select version 1 of the Tax (India GST Contoso) configuration.
Select Save and then Synchronize.
Note
If you want to copy the tax setup data from the original configuration, select Copy tax setup data from, and then select the configuration to copy.
Select Activate.
On the Tax setup page, go to Companies, and select New.
In the Companies field, select INMF.
Select Save.
To activate the configuration for the company, select Activate.
To set up data for the new version, select Setup.
Modify the data provider in Microsoft Dynamics 365 Finance
Implement logic to determine the net price
In the Application Object Tree (AOT), open Classes > TaxEngineModelFields.
Add a new constant variable for the net price.
public static const str NetPrice = 'Net Price';
Add a new method for the
TaxModelDocLineBaseImpl_IN
class. In the method, implement the determination logic for the net price.public Amount getNetPrice() { if (this.getQuantity()) { return this.getLineAmount() / this.getQuantity(); } else { return this.getLineAmount(); } }
Pass the net price to GTE
Pass the net price to GTE in the
TaxableDocumentRowDataProviderLine_IN_Extension.fillInFields()
method.this.addFieldValue(_lineObj, TaxEngineModelFields::NetPrice, taxModelDocLineBaseImpl.getNetPrice());
Add the net price to the
TaxableDocumentRowDataProviderLine_IN_Extension.initValidFields()
method.validFields.add(TaxEngineModelFields::NetPrice, Types::Real);