AX 2012 R3 - X++ CODE TO RESET THE ACTUAL VAT AMOUNT FOR SALES ORDER

AX 2012 R3 - X++ CODE TO RESET THE  ACTUAL VAT AMOUNT FOR SALES ORDER



static void RB_ResetVATAmount1(Args _args)
{

    #File

    IO                             iO;
 
   FilenameOpen           filename = "c:\\VAT1.csv";//file name here
   Container                   con;
   boolean                      first = true;
 
   SalesTable                  salesTable;

   SalesLine                     salesLine;

   SalesId                         salesId;

   int                                 cnt;
//Manually adjust sales taxes
TaxRegulation                  taxRegulation;

SalesTotals                       salesTotals;

TaxAmount                        taxAmount;

;
  
iO = new CommaTextIo(filename,#IO_Read);
if (! iO || iO.status() != IO_Status::Ok)
{
            throw error("@SYS19358");
 }
 
while (iO.status() == IO_Status::Ok)
{

     con = iO.read();// read file
     if (con)
     {
            if (first) //skip header
            {
                     first = false;
             }
             else
             {
                     salesId = conpeek(con, 1);
                     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()) // * needs to be true
                       {
                              //taxRegulation.allocateAmount(20); // manually specify the amount you wish and comment the next line i.e. //taxRegulation.resetTaxRegulation();
 
                               taxRegulation.resetTaxRegulation();

                               taxRegulation.saveTaxRegulation();
                       }

                       cnt++;

                   }

            }
       }

  }

 
      info(strFmt("Total number of records updated :- %1",cnt));
 
 
}

Install and Configure Zpl Printer on D365 F&O

  Setup Zpl Printer On D365 F&O Posted on Recently, I have had an opportunity review the possibilities to print license plates within D3...