Thursday, March 15, 2018

Resetting and Recalculating Tax amount for sales Order in DAX

//Resetting and Recalculating Tax amount for sales Order in DAX

static void San_Reset_RecalculateSalesTaxValue(Args _args)
{
    SalesTable                  salesTable;
    TaxRegulation            taxRegulation;
    SalesTotals                 salesTotals;
    SalesId                        salesId ="";
    ;
    salesTable = SalesTable::find(SalesId);
    if (salesTable)
    {
        salesTotals = SalesTotals::construct(salesTable, SalesUpdate::All);
        salesTotals.calc();
        taxRegulation = TaxRegulation::newTaxRegulation(salesTotals.tax(), null,salestable.TableId, salestable.RecId);
        if (taxRegulation.taxLinesExist())
        {
            taxRegulation.resetTaxRegulation();
            taxRegulation.saveTaxRegulation();
            info("Tax Amount resetted and recalculated for new lines");
        }
    }
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...