Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

This article applies to Microsoft Dynamics NAV for the Eastern European (EE) language locale.

Symptoms

When you set prices that include value-added tax (VAT) in the Eastern European version of Microsoft Dynamics NAV 2009 R2, the non-deductible VAT amount is calculated incorrectly on a purchase invoice. Therefore, the system posts incorrect VAT entries and General Ledger entries on the purchase invoice.

Cause

This problem occurs because the calculated non-deductible VAT amount is rounded incorrectly.

Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is only intended to correct the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Dynamics NAV 2009 service pack or the next Microsoft Dynamics NAV version that contains this hotfix.

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Technical Support Professional for Microsoft Dynamics and related products determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Installation information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Note Before you install this hotfix, verify that all Microsoft Dynamics NAV client users are logged off the system. This includes Microsoft Dynamics NAV Application Server (NAS) services. You should be the only client user who is logged on when you implement this hotfix.

To implement this hotfix, you must have a developer license.

We recommend that the user account in the Windows Logins window or in the Database Logins window be assigned the "SUPER" role ID. If the user account cannot be assigned the "SUPER" role ID, you must verify that the user account has the following permissions:

  • The Modify permission for the object that you will be changing.

  • The Execute permission for the System Object ID 5210 object and for the System Object ID 9015 object.

Note You do not have to have rights to the data stores unless you have to perform data repair.

Code changes

Note Always test code fixes in a controlled environment before you apply the fixes to your production computers.

To resolve this problem, follow these steps:

  1. hange the code in the VAT % (Non Deductible) - OnValidate trigger in the Purchase Line table (39). To do this, follow these steps:

    1. Create a new global text variable as follows:

      Text26586@ : TextConst 'ENU=<Day,2><Month,2><Year,2>'
    2. Change the code as follows:
      Existing code

      ...
      "VAT Base (Non Deductible)" :=

      // Delete the following line.
      ROUND("Line Amount" * "VAT % (Non Deductible)" / 100,Currency."Amount Rounding Precision");
      // End of the deleted line.

      "VAT Amount (Non Deductible)" :=
      ...

      Replacement code

      ...
      "VAT Base (Non Deductible)" :=

      // Add the following line.
      CalcAmountPart("Line Amount" - "Inv. Discount Amount","VAT % (Non Deductible)");
      // End of the added line.

      "VAT Amount (Non Deductible)" :=
      ...
  2. Change the code in the UpdateVATOnLines function in the "Purchase Line" table (39). To do this, follow these steps:

    1. Create new local variables as follows:

      NewVATBaseAmtNonDeduct : Decimal
      VATAmtNonDeduct : Decimal
      Factor : Decimal
    2. Change the code as follows:
      Existing code 1

      ...
      END ELSE BEGIN

      // Delete the following lines.
      VATAmount :=
      TempVATAmountLineRemainder."VAT Amount" +
      VATAmountLine."VAT Amount" *
      ("Line Amount" - "Inv. Discount Amount") /
      (VATAmountLine."Line Amount" - VATAmountLine."Invoice Discount Amount");
      NewAmountIncludingVAT :=
      TempVATAmountLineRemainder."Amount Including VAT" +
      VATAmountLine."Amount Including VAT" *
      ("Line Amount" - "Inv. Discount Amount") /
      (VATAmountLine."Line Amount" - VATAmountLine."Invoice Discount Amount");
      // End of the deleted lines.

      END;
      ...

      Replacement code 1

      ...
      END ELSE BEGIN

      // Add the following lines.
      Factor := VATAmountLine.CalcPurchLineAmountFactor(PurchLine);
      VATAmount :=
      TempVATAmountLineRemainder."VAT Amount" +
      VATAmountLine."VAT Amount" * Factor;
      NewAmountIncludingVAT :=
      VATAmountLine.CalcRoundedAmount(VATAmountLine."Amount Including VAT" * Factor,
      TempVATAmountLineRemainder."Amount Including VAT");
      NewVATBaseAmtNonDeduct :=
      VATAmountLine.CalcRoundedAmount(VATAmountLine."VAT Base (Non Deductible)" * Factor,
      TempVATAmountLineRemainder."VAT Base (Non Deductible)");
      VATAmtNonDeduct :=
      VATAmountLine.CalcRoundedAmount(VATAmountLine."VAT Amount (Non Deductible)" * Factor,
      TempVATAmountLineRemainder."VAT Amount (Non Deductible)");
      //End of the added lines.

      END;
      ...

      Existing code 2

      ...
      VATAmountLine."VAT Amount" * NewAmount / VATAmountLine."VAT Base";
      END;
      ...

      Replacement code 2

      ...
      VATAmountLine."VAT Amount" * NewAmount / VATAmountLine."VAT Base";

      // Add the following lines.
      NewVATBaseAmtNonDeduct :=
      ("Line Amount" - "Inv. Discount Amount") * "VAT % (Non Deductible)" / 100;
      IF NewVATBaseAmtNonDeduct = 0 THEN
      VATAmtNonDeduct:= 0
      ELSE
      VATAmtNonDeduct :=
      VATAmountLine.CalcRoundedAmount(
      VATAmountLine."VAT Amount (Non Deductible)" * NewAmount / VATAmountLine."VAT Base",
      TempVATAmountLineRemainder."VAT Amount (Non Deductible)");
      // End of the added lines.

      END;
      ...

      Existing code 3

      ...
      IF Type IN [Type::"G/L Account",Type::Item,Type::"Fixed Asset"] THEN BEGIN

      // Delete the following lines.
      "VAT Base (Non Deductible)" :=
      ROUND(
      "VAT Base Amount" * "VAT % (Non Deductible)" / 100,
      Currency."Amount Rounding Precision");
      "VAT Amount (Non Deductible)" :=
      ROUND(
      "VAT Base (Non Deductible)" * "VAT %" / 100,
      Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
      // End of the deleted lines.

      ...

      Replacement code 3

      ...
      IF Type IN [Type::"G/L Account",Type::Item,Type::"Fixed Asset"] THEN BEGIN

      // Add the following lines.
      "VAT Base (Non Deductible)" := ROUND(NewVATBaseAmtNonDeduct,Currency."Amount Rounding Precision");
      "VAT Amount (Non Deductible)" := ROUND(VATAmtNonDeduct,Currency."Amount Rounding Precision");
      // End of the added lines.

      END;
      ...

      Existing code 4

      ...

      // Delete the following lines.
      TempVATAmountLineRemainder."Amount Including VAT" :=
      NewAmountIncludingVAT - ROUND(NewAmountIncludingVAT,Currency."Amount Rounding Precision");
      // End of the deleted lines.

      TempVATAmountLineRemainder."VAT Amount" := VATAmount - NewAmountIncludingVAT + NewAmount;
      ...

      Replacement code 4

      ...
      TempVATAmountLineRemainder."VAT Amount" := VATAmount - NewAmountIncludingVAT + NewAmount;
      ...
  3. Change the code in the CalcVATAmountLines function in the Purchase Line table (39) as follows:
    Existing code 1

    ...
    VATAmountLine."Includes Prepayment" := TRUE;

    // Delete the following lines.
    IF Type IN [Type::"G/L Account",Type::Item,Type::"Fixed Asset"] THEN BEGIN
    VATAmountLine."VAT Base (Non Deductible)" :=
    VATAmountLine."VAT Base (Non Deductible)" + "VAT Base (Non Deductible)";
    VATAmountLine."VAT Amount (Non Deductible)" :=
    VATAmountLine."VAT Amount (Non Deductible)" + "VAT Amount (Non Deductible)";
    END;
    // End of the deleted lines.

    VATAmountLine.MODIFY;
    ...

    Replacement code 1

    ...
    VATAmountLine."Includes Prepayment" := TRUE;
    VATAmountLine.MODIFY;
    ...

    Existing code 2

    ...
    VATAmountLine."Includes Prepayment" := TRUE;

    // Delete the following lines.
    IF Type IN [Type::"G/L Account",Type::Item,Type::"Fixed Asset"] THEN BEGIN
    VATAmountLine."VAT Base (Non Deductible)" :=
    VATAmountLine."VAT Base (Non Deductible)" +
    ROUND("VAT Base (Non Deductible)",Currency."Amount Rounding Precision");
    VATAmountLine."VAT Amount (Non Deductible)" :=
    VATAmountLine."VAT Amount (Non Deductible)" +
    ROUND("VAT Amount (Non Deductible)",Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    END;
    // End of the deleted lines.

    VATAmountLine.MODIFY;
    ...

    Replacement code 2

    ...
    VATAmountLine."Includes Prepayment" := TRUE;
    VATAmountLine.MODIFY;
    ...

    Existing code 3

    ...
    "Amount Including VAT" := "VAT Base" + "VAT Amount";
    IF Positive THEN
    ...

    Replacement code 3

    ...
    "Amount Including VAT" := "VAT Base" + "VAT Amount";

    // Add the following lines.
    "VAT Base (Non Deductible)" := CalcAmountPart("VAT Base","VAT % (Non Deductible)");
    "VAT Amount (Non Deductible)" :=
    PrevVatAmountLine."VAT Amount (Non Deductible)" +
    CalcAmountPart("Line Amount" - "Invoice Discount Amount" - "VAT Base","VAT % (Non Deductible)");
    // End of the added lines.

    IF Positive THEN
    ...

    Existing code 4

    ...
    ROUND(PrevVatAmountLine."VAT Amount",Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    END;
    ...

    Replacement code 4

    ...
    ROUND(PrevVatAmountLine."VAT Amount",Currency."Amount Rounding Precision",Currency.VATRoundingDirection);

    // Add the following lines.
    PrevVatAmountLine."VAT Amount (Non Deductible)" :=
    CalcAmountPart("Line Amount" - "Invoice Discount Amount","VAT % (Non Deductible)") - "VAT Base (Non Deductible)";
    PrevVatAmountLine."VAT Amount (Non Deductible)" :=
    PrevVatAmountLine."VAT Amount (Non Deductible)" -
    ROUND(PrevVatAmountLine."VAT Amount (Non Deductible)",
    Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    //End of the added lines.

    END;
    ...

    Existing code 5

    ...
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount" + "VAT Amount";
    IF Positive THEN
    ...

    Replacement code 5

    ...
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount" + "VAT Amount";

    // Add the following lines.
    "VAT Base (Non Deductible)" := CalcAmountPart("VAT Base","VAT % (Non Deductible)");
    "VAT Amount (Non Deductible)" :=
    CalcAmountPart("VAT Difference","VAT % (Non Deductible)") +
    CalcAmountPart("VAT Base (Non Deductible)","VAT %");
    // End of the added lines.

    IF Positive THEN
    ...
  4. Change the code in the GetVATDeduction function in the Purchase Line table (39) as follows:
    Existing code

    ...
    NonDeductVATSetup.TESTFIELD("Non Deductible VAT %");
    EXIT(NonDeductVATSetup."Non Deductible VAT %");
    ...

    Replacement code

    ...
    NonDeductVATSetup.TESTFIELD("Non Deductible VAT %");

    // Add the following lines.
    "VAT Identifier" :=
    FORMAT(NonDeductVATSetup."From Date",0,Text26586) +
    '-' + FORMAT(NonDeductVATSetup."Non Deductible VAT %");
    // End of the added lines.

    EXIT(NonDeductVATSetup."Non Deductible VAT %");
    ...
  5. Create a new CalcAmountPart function in the Purchase Line table (39) as follows:

    LOCAL PROCEDURE CalcAmountPart@1470004(Amount@1470000 : Decimal;Percent@1470001 : Decimal) : Decimal;
    BEGIN
    EXIT(ROUND(Amount * Percent / 100,Currency."Amount Rounding Precision"));
    END;
  6. Create a new CalcRoundedAmount function in the VAT Amount Line table (290) as follows:

    PROCEDURE CalcRoundedAmount@1470002(Amount@1470000 : Decimal;VAR Reminder@1470001 : Decimal) AmountRnded : Decimal;
    BEGIN
    Amount := Amount + Reminder;
    AmountRnded := ROUND(Amount,Currency."Amount Rounding Precision");
    Reminder := Amount - AmountRnded;
    END;
  7. Create a new CalcPurchLineAmountFactor function in the VAT Amount Line table (290) as follows:

    PROCEDURE CalcPurchLineAmountFactor@1470003(PurchaseLine@1470000 : Record 39) : Decimal;
    BEGIN
    IF "Line Amount" - "Invoice Discount Amount" <> 0 THEN
    EXIT((PurchaseLine."Line Amount" - PurchaseLine."Inv. Discount Amount") /
    ("Line Amount" - "Invoice Discount Amount"));
    END;
  8. Change the code in the VAT Amount - OnValidate trigger in the VAT Specification Subform form (576) as follows:
    Existing code

    ...
    "Calc VAT Base Amount to Report" := "VAT Base Amt. to Report (LCY)";
    "VAT Base Amount to Report Diff" := 0;
    END ELSE
    "Amount Including VAT" := "VAT Amount" + "VAT Base";

    FormCheckVATDifference;
    ...

    Replacement code

    ...
    "Calc VAT Base Amount to Report" := "VAT Base Amt. to Report (LCY)";
    "VAT Base Amount to Report Diff" := 0;
    END ELSE
    "Amount Including VAT" := "VAT Amount" + "VAT Base";

    // Add the following lines.
    IF CurrencyCode = '' THEN
    Currency.InitRoundingPrecision
    ELSE
    Currency.GET(CurrencyCode);
    "VAT Base (Non Deductible)" :=
    ROUND("VAT Base" * "VAT % (Non Deductible)" / 100,Currency."Amount Rounding Precision");
    "VAT Amount (Non Deductible)" :=
    ROUND("VAT Amount" * "VAT % (Non Deductible)" / 100,Currency."Amount Rounding Precision");
    // End of the added lines.

    FormCheckVATDifference;
    ...
  9. Change the code in the DivideAmount function in the Purch.-Post codeunit (90). To do this, follow these steps:

    1. Create a new local variable as follows:

      Factor : Decimal
    2. Change the code as follows:
      Existing code 1

      ...
      END ELSE BEGIN

      // Delete the following lines.
      TempVATAmountLineRemainder."VAT Amount" :=
      TempVATAmountLineRemainder."VAT Amount" +
      TempVATAmountLine."VAT Amount" *
      ("Line Amount" - "Inv. Discount Amount") /
      (TempVATAmountLine."Line Amount" - TempVATAmountLine."Invoice Discount Amount");
      TempVATAmountLineRemainder."Amount Including VAT" :=
      TempVATAmountLineRemainder."Amount Including VAT" +
      TempVATAmountLine."Amount Including VAT" *
      ("Line Amount" - "Inv. Discount Amount") /
      (TempVATAmountLine."Line Amount" - TempVATAmountLine."Invoice Discount Amount");
      // End of the deleted lines.

      END;
      ...

      Replacement code 1

      ...
      END ELSE BEGIN

      // Add the following lines.
      Factor := TempVATAmountLine.CalcPurchLineAmountFactor(PurchLine);
      TempVATAmountLineRemainder."VAT Amount" :=
      TempVATAmountLineRemainder."VAT Amount" +
      TempVATAmountLine."VAT Amount" * Factor;
      TempVATAmountLineRemainder."Amount Including VAT" :=
      TempVATAmountLineRemainder."Amount Including VAT" +
      TempVATAmountLine."Amount Including VAT" * Factor;

      "VAT Base (Non Deductible)" :=
      TempVATAmountLine.CalcRoundedAmount(TempVATAmountLine."VAT Base (Non Deductible)" * Factor,
      TempVATAmountLineRemainder."VAT Base (Non Deductible)");
      "VAT Amount (Non Deductible)" :=
      TempVATAmountLine.CalcRoundedAmount(TempVATAmountLine."VAT Amount (Non Deductible)" * Factor,
      TempVATAmountLineRemainder."VAT Amount (Non Deductible)");
      // End of the added lines.

      END;
      ...

      Existing code 2

      ...
      END ELSE BEGIN

      // Add the following lines.
      Factor := TempVATAmountLine.CalcPurchLineAmountFactor(PurchLine);
      TempVATAmountLineRemainder."VAT Amount" :=
      TempVATAmountLineRemainder."VAT Amount" +
      TempVATAmountLine."VAT Amount" * Factor;
      TempVATAmountLineRemainder."Amount Including VAT" :=
      TempVATAmountLineRemainder."Amount Including VAT" +
      TempVATAmountLine."Amount Including VAT" * Factor;

      "VAT Base (Non Deductible)" :=
      TempVATAmountLine.CalcRoundedAmount(TempVATAmountLine."VAT Base (Non Deductible)" * Factor,
      TempVATAmountLineRemainder."VAT Base (Non Deductible)");
      "VAT Amount (Non Deductible)" :=
      TempVATAmountLine.CalcRoundedAmount(TempVATAmountLine."VAT Amount (Non Deductible)" * Factor,
      TempVATAmountLineRemainder."VAT Amount (Non Deductible)");
      // End of the added lines.

      END;
      ...

      Replacement code 2

      ...
      Amount * (1 - PurchHeader."VAT Base Discount %" / 100),Currency."Amount Rounding Precision");

      // Add the following lines.
      IF TempVATAmountLine."VAT Base" = 0 THEN BEGIN
      TempVATAmountLineRemainder."VAT Amount" := 0;
      TempVATAmountLineRemainder."VAT Amount (Non Deductible)" := 0;
      END ELSE BEGIN
      Factor := TempVATAmountLine.CalcPurchLineAmountFactor(PurchLine);
      TempVATAmountLineRemainder."VAT Amount" :=
      TempVATAmountLineRemainder."VAT Amount" +
      TempVATAmountLine."VAT Amount" * Factor;
      "VAT Base (Non Deductible)" :=
      TempVATAmountLine.CalcRoundedAmount(TempVATAmountLine."VAT Base (Non Deductible)" * Factor,
      TempVATAmountLineRemainder."VAT Base (Non Deductible)");
      "VAT Amount (Non Deductible)" :=
      TempVATAmountLine.CalcRoundedAmount(TempVATAmountLine."VAT Amount (Non Deductible)" * Factor,
      TempVATAmountLineRemainder."VAT Amount (Non Deductible)");
      END;
      // End of the added lines.

      "Amount Including VAT" :=
      ...

      Existing code 3

      ...

      // Delete the following lines.
      "VAT Base (Non Deductible)" :=
      ROUND("VAT Base Amount" * "VAT % (Non Deductible)" / 100,Currency."Amount Rounding Precision");
      "VAT Amount (Non Deductible)" :=
      ROUND("VAT Base (Non Deductible)" * "VAT %" / 100,Currency."Amount Rounding Precision");
      // End of the deleted lines.

      TempVATAmountLineRemainder.MODIFY;
      ...

      Replacement code 3

      ...
      TempVATAmountLineRemainder.MODIFY;
      ...


Prerequisites

You must have the Eastern European version of Microsoft Dynamics NAV 2009 R2 installed to apply this hotfix.

Removal information

You cannot remove this hotfix.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Usefor other considerations.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×