Friday, May 8, 2026

Get or set adjust tax calculated amount using TAXDOCUMENT framework (Tax calculation service) in D365FO

 //Get or adjust tax calculation using TAXDOCUMENT framework (Tax calculation service)

TaxRegulation taxRegulationDetail;

TmpTaxRegulation  tmpTaxRegulationDetail;

SalesTotals salesTotals;


salesTotals = SalesTotals::construct(SalesTable::find(salesLineParentPOl.SalesId), SalesUpdate::All);

salesTotals.calc();


taxRegulationDetail = TaxRegulation::newTaxRegulation(salesTotals.tax());

tmpTaxRegulationDetail.setTmpData(taxRegulationDetail.tmpTaxRegulation()); // Get all current tax by order wise


//Get this buffer "tmpTaxRegulationDetail" to get all tax related data

//To adjust

TaxTable    taxTable;

select firstonly tmpTaxRegulationDetail

    where tmpTaxRegulationDetail.TaxCode

    join taxTable

        where taxTable.TaxCode == 'SAN_IPI';

if(tmpTaxRegulationDetail)

{

    taxRegulationDetail.updateTaxRegulationAmount(tmpTaxRegulationDetail, (<Updated tax amount after adjustment>), true); // to adjust use this call to do

    taxRegulationDetail.saveTaxRegulation(); //

}

No comments:

Post a Comment

Get or set adjust tax calculated amount using TAXDOCUMENT framework (Tax calculation service) in D365FO

 //Get or adjust tax calculation using TAXDOCUMENT framework (Tax calculation service) TaxRegulation taxRegulationDetail; TmpTaxRegulation  ...