web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Override calculated vat for pending vendor invoice

(0) ShareShare
ReportReport
Posted on by 815

Version: AX2012 R3

Pending vendor invoice is created through X++ from PO.

Below tables were used:

vendInvoiceInfoTable

vendInvoiceInfoSubTable

vendInvoiceInfoLine

VAT is calculated.

User will provide the VAT amount to override the calculated amount.

We can usually use ledgerJournalEngine.CorrectTaxamount() etc for journals but how to re-calculate or override the VAT amount using X++ for pending vendor invoice?

Thanks,

*This post is locked for comments

I have the same question (0)
  • Nadeem Profile Picture
    815 on at
    RE: Override calculated vat for pending vendor invoice

    I have used below code to override the calculated VAT amount.

    TaxAmountCur        taxAmount;

    TaxRegulation         taxRegulation;

    Tax                          tax;

    PurchTotals             purchTotals;

    if (taxAmount > 0 || taxAmount < 0)  //  TaxAmount is provided in the CSV file.

    {

      // totals are only needed if price includes tax

      purchTotals = PurchTotals::newParmTable(vendInvoiceInfoTable,

                                  PurchUpdate::All,

                                  AccountOrder::None,

                                  vendInvoiceInfoTable.ParmId,

                                  vendInvoiceInfoTable.PurchId,

                                  vendInvoiceInfoTable.Ordering);

      purchTotals.calc(false, false, true);

      tax = purchTotals.tax();

      taxRegulation = TaxRegulation::newTaxRegulation(tax, null, tableName2id("VendInvoiceTable"),vendInvoiceInfoTable.RecId);

                                   taxRegulation.allocateAmount(taxAmount);

                                   taxRegulation.saveTaxRegulation();

    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Rahul Shah Profile Picture

Rahul Shah 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans