Hello Users,
I am overriding posted sales tax value on line level using below code:
private void taxCalcLine(SalesTable _salesTable, SalesLine _salesLine, real _salesTax)
{
TaxTmpWorkTransForm taxTmpWorkTransForm ;
SalesTotals salesTotals;
TmpTaxRegulation tmpTaxRegulation, tmpTaxRegulation2;
TmpTaxWorkTrans tmpTaxWorkTrans;
TransDate localDateOfVATRegister;
CurrencyExchangeRate localSalesTaxExchangeRate;
TaxRegulationDetail taxRegulationDetail;
int salesTaxCodes;
SalesParmTable salesParmTable;
TaxRegulation taxRegulation;
salesTotals = SalesTotals::construct(_salesTable);
salesTotals.calc();
taxRegulation = TaxRegulation::newTaxRegulation(SalesTotals.Tax(), null, tableNum(SalesLine), _salesLine.RecId);
tmpTaxRegulation2 = TaxRegulation.tmpTaxRegulationDetail();
taxRegulation.updateTaxRegulationAmount(tmpTaxRegulation2,_salesTax,true);
TaxRegulation.saveTaxRegulation();
}
This code is updating the default sales tax value in the sales order with the _salesTax value provided by us. However I am using this following code in multithreaded approach and this code is impacting the performance of batch job.
Without overriding the sales tax the batch job takes around 9 mins but for the same data and the overriding code the batch job takes around 21 mins.
Is there any alternative approach for overriding the sales tax which can improve batch job performance ?