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 all countries and all language locales.

Symptoms

Assume that you set the VAT Calculation Type field to Sales Tax for the VAT Bus. Posting GroupNATIONAL in which the VAT Prod. Posting Group value is NO VAT in the VAT Posting Setup Card dialog box in Microsoft Dynamics NAV 2009. You define a sales tax area code by using a sales tax jurisdiction code that has a maximum amount and create a customer by using the sales tax area code. Then, you add two sales order lines that have two different global dimensions to a sales order. In this situation, when you post the sales order for the customer by using the Ship and Invoice option, you receive the following error message:

The sales tax amount for the Code1 Tax Area Code and the Code2 Tax Group Code is incorrect. The calculated sales tax amount is Amount1, but was supposed to be Amount2.

This problem occurs in the following products:

  • Microsoft Dynamics NAV 2009 R2

  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)


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. Change the code in Global Variables in the table (37) as follows:
    Existing code

    ...
    Text046@1105 : TextConst 'ENU=You cannot return more than the %1 units that you have shipped for %2 %3.';
    Text047@1106 : TextConst 'ENU=must be positive when %1 is not 0.';
    TrackingBlocked@1107 : Boolean;
    Text048@1108 : TextConst 'ENU=You cannot use item tracking on a %1 created from a %2.';
    Text049@1139 : TextConst 'ENU=cannot be %1.';

    PROCEDURE InitOutstanding@16();
    BEGIN
    IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN BEGIN
    "Outstanding Quantity" := Quantity - "Return Qty. Received";
    ...

    Replacement code

    ...
    Text046@1105 : TextConst 'ENU=You cannot return more than the %1 units that you have shipped for %2 %3.';
    Text047@1106 : TextConst 'ENU=must be positive when %1 is not 0.';
    TrackingBlocked@1107 : Boolean;
    Text048@1108 : TextConst 'ENU=You cannot use item tracking on a %1 created from a %2.';
    Text049@1139 : TextConst 'ENU=cannot be %1.';

    // Add the following line.
    TotalAmountForTax@1117 : Decimal;
    // End of the added line.

    PROCEDURE InitOutstanding@16();
    BEGIN
    IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN BEGIN
    "Outstanding Quantity" := Quantity - "Return Qty. Received";
    ...
  2. Change the code in the CalcVATAmountLines function in the table (37) as follows:
    Existing code

    ...
    "Amount Including VAT" := "VAT Amount";
    END;
    "VAT Calculation Type"::"Sales Tax":
    BEGIN
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount";
    "VAT Base" :=
    ROUND(
    SalesTaxCalculate.ReverseCalculateTax(
    SalesHeader."Tax Area Code","Tax Group Code",SalesHeader."Tax Liable",
    SalesHeader."Posting Date","Amount Including VAT",Quantity,SalesHeader."Currency Factor"),
    ...

    Replacement code

    ...
    "Amount Including VAT" := "VAT Amount";
    END;
    "VAT Calculation Type"::"Sales Tax":
    BEGIN
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount";

    // Add the following line.
    TotalAmountForTax := TotalAmountForTax + "Amount Including VAT";
    // End of the added line.

    "VAT Base" :=
    ROUND(
    SalesTaxCalculate.ReverseCalculateTax(
    SalesHeader."Tax Area Code","Tax Group Code",SalesHeader."Tax Liable",
    SalesHeader."Posting Date","Amount Including VAT",Quantity,SalesHeader."Currency Factor"),
    ...
  3. Change the code in the GetTotalAmount function in the table (37) as follows:
    Existing code

    ...
    IF "Qty. to Invoice" = 0 THEN
    EXIT(TRUE);
    EXIT(FALSE);
    END;

    BEGIN
    END.
    }
    }
    ...

    Replacement code

    ...
    IF "Qty. to Invoice" = 0 THEN
    EXIT(TRUE);
    EXIT(FALSE);
    END;

    // Add the following lines.
    PROCEDURE GetTotalAmount@1112() : Decimal;
    BEGIN
    EXIT(TotalAmountForTax);
    END;
    // End of the added lines.

    BEGIN
    END.
    }
    }
    ...
  4. Change the code in Global Variables in the table (39) as follows:
    Existing code

    ...
    UnitCostCurrency@1063 : Decimal;
    UpdateFromVAT@1087 : Boolean;
    Text042@1088 : TextConst 'ENU=You cannot return more than the %1 units that you have received for %2 %3.';
    Text043@1089 : TextConst 'ENU=must be positive when %1 is not 0.';
    Text044@1080 : TextConst 'ENU=You cannot change %1 because this purchase order is associated with %2 %3.';

    PROCEDURE InitOutstanding@16();
    BEGIN
    IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN BEGIN
    "Outstanding Quantity" := Quantity - "Return Qty. Shipped";
    ...

    Replacement code

    ...
    UnitCostCurrency@1063 : Decimal;
    UpdateFromVAT@1087 : Boolean;
    Text042@1088 : TextConst 'ENU=You cannot return more than the %1 units that you have received for %2 %3.';
    Text043@1089 : TextConst 'ENU=must be positive when %1 is not 0.';
    Text044@1080 : TextConst 'ENU=You cannot change %1 because this purchase order is associated with %2 %3.';

    // Add the following line.
    TotalAmountForTax@1117 : Decimal;
    // End of the added line.

    PROCEDURE InitOutstanding@16();
    BEGIN
    IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN BEGIN
    "Outstanding Quantity" := Quantity - "Return Qty. Shipped";
    ...
  5. Change the code in the CalcVATAmountLines function in the table (39) as follows:
    Existing code

    ...
    "Amount Including VAT" := "VAT Amount";
    END;
    "VAT Calculation Type"::"Sales Tax":
    BEGIN
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount";
    IF "Use Tax" THEN
    "VAT Base" := "Amount Including VAT"
    ELSE
    "VAT Base" :=
    ROUND(
    ...

    Replacement code

    ...
    "Amount Including VAT" := "VAT Amount";
    END;
    "VAT Calculation Type"::"Sales Tax":
    BEGIN
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount";

    // Add the following line.
    TotalAmountForTax := TotalAmountForTax + "Amount Including VAT";
    // End of the added line.

    IF "Use Tax" THEN
    "VAT Base" := "Amount Including VAT"
    ELSE
    "VAT Base" :=
    ROUND(
    ...
  6. Change the code in the GetTotalAmount function in the table (39) as follows:
    Existing code

    ...
    IF "Qty. to Invoice" = 0 THEN
    EXIT(TRUE);
    EXIT(FALSE);
    END;

    BEGIN
    END.
    }
    }
    ...

    Replacement code

    ...
    IF "Qty. to Invoice" = 0 THEN
    EXIT(TRUE);
    EXIT(FALSE);
    END;

    // Add the following lines.
    PROCEDURE GetTotalAmount@1119() : Decimal;
    BEGIN
    EXIT(TotalAmountForTax);
    END;
    // End of the added lines.

    BEGIN
    END.
    }
    }
    ...
  7. Change the code in Global Variables in the codeunit (12) as follows:
    Existing code

    ...
    LastDocType@1072 : ' ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder';
    NextCheckEntryNo@1073 : Integer;
    AddCurrGLEntryVATAmt@1075 : Decimal;
    CurrencyDate@1076 : Date;
    CurrencyFactor@1077 : Decimal;
    UseCurrFactorOnly@1078 : Boolean;
    NonAddCurrCodeOccured@1079 : Boolean;
    FADimAlreadyChecked@1080 : Boolean;
    Text010@1008 : TextConst 'ENU=Residual caused by rounding of %1';
    Text013@1007 : TextConst 'ENU=A dimension used in %1 %2, %3, %4 has caused an error. %5';
    ...

    Replacement code

    ...
    LastDocType@1072 : ' ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder';
    NextCheckEntryNo@1073 : Integer;
    AddCurrGLEntryVATAmt@1075 : Decimal;
    CurrencyDate@1076 : Date;
    CurrencyFactor@1077 : Decimal;

    // Add the following line.
    TotalAmountForTax@1118 : Decimal;
    // End of the added line.

    UseCurrFactorOnly@1078 : Boolean;
    NonAddCurrCodeOccured@1079 : Boolean;
    FADimAlreadyChecked@1080 : Boolean;
    Text010@1008 : TextConst 'ENU=Residual caused by rounding of %1';
    Text013@1007 : TextConst 'ENU=A dimension used in %1 %2, %3, %4 has caused an error. %5';
    ...
  8. Change the code in the PostVAT function in the codeunit (12) as follows:
    Existing code

    ...
    InsertVAT(
    GLEntry.Amount,GLEntry."VAT Amount","VAT Base Amount (LCY)","Source Currency Code",
    "Source Curr. VAT Base Amount","Source Curr. VAT Amount","Source Curr. VAT Base Amount");
    END ELSE BEGIN
    CLEAR(SalesTaxCalculate);
    SalesTaxCalculate.InitSalesTaxLines(
    "Tax Area Code","Tax Group Code","Tax Liable",
    SalesTaxBaseAmount,Quantity,"Posting Date",GLEntry."VAT Amount");
    SrcCurrVATAmount := 0;
    SrcCurrSalesTaxBaseAmount := CalcLCYToAddCurr(SalesTaxBaseAmount);
    ...

    Replacement code

    ...
    InsertVAT(
    GLEntry.Amount,GLEntry."VAT Amount","VAT Base Amount (LCY)","Source Currency Code",
    "Source Curr. VAT Base Amount","Source Curr. VAT Amount","Source Curr. VAT Base Amount");
    END ELSE BEGIN
    CLEAR(SalesTaxCalculate);

    // Add the following line.
    SalesTaxCalculate.SetAmount(ABS(TotalAmountForTax),ABS(SalesTaxBaseAmount + GLEntry."VAT Amount"));
    // End of the added line.

    SalesTaxCalculate.InitSalesTaxLines(
    "Tax Area Code","Tax Group Code","Tax Liable",
    SalesTaxBaseAmount,Quantity,"Posting Date",GLEntry."VAT Amount");
    SrcCurrVATAmount := 0;
    SrcCurrSalesTaxBaseAmount := CalcLCYToAddCurr(SalesTaxBaseAmount);
    ...
  9. Change the code in the SetTotalAmountForTax function in the codeunit (12) as follows:
    Existing code

    ...
    IF ABS(Decimal1) < ABS(Decimal2) THEN
    EXIT(Decimal1);
    EXIT(Decimal2);
    END;

    BEGIN
    END.
    }
    }
    ...

    Replacement code

    ...
    IF ABS(Decimal1) < ABS(Decimal2) THEN
    EXIT(Decimal1);
    EXIT(Decimal2);
    END;

    // Add the following lines.
    PROCEDURE SetTotalAmountForTax@1122(TotalAmountForTax2@1107 : Decimal);
    BEGIN
    TotalAmountForTax := TotalAmountForTax2;
    END;
    // End of the added lines.

    BEGIN
    END.
    }
    }
    ...
  10. Change the code in Properties in the codeunit (80) as follows:
    Existing code 1

    ...
    PurchCommentLine@1018 : Record 43;
    UpdateAnalysisView@1002 : Codeunit 410;
    UpdateItemAnalysisView@1014 : Codeunit 7150;
    ICInOutBoxMgt@1008 : Codeunit 427;
    CostBaseAmount@1004 : Decimal;
    TrackingSpecificationExists@1007 : Boolean;
    EndLoop@1009 : Boolean;
    DocType@1022 : ' ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund,Shipment';
    TempJnlLineDim2@1023 : TEMPORARY Record 356;
    TempPrePmtAmtToDeduct@1003 : Decimal;
    ...

    Replacement code 2

    ...
    PurchCommentLine@1018 : Record 43;
    UpdateAnalysisView@1002 : Codeunit 410;
    UpdateItemAnalysisView@1014 : Codeunit 7150;
    ICInOutBoxMgt@1008 : Codeunit 427;
    CostBaseAmount@1004 : Decimal;

    // Add the following line.
    TotalAmountForTax@1117 : Decimal;
    // End of the added line.

    TrackingSpecificationExists@1007 : Boolean;
    EndLoop@1009 : Boolean;
    DocType@1022 : ' ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund,Shipment';
    TempJnlLineDim2@1023 : TEMPORARY Record 356;
    TempPrePmtAmtToDeduct@1003 : Decimal;
    ...

    Existing code 2

    ...
    RoundingLineInserted := FALSE;
    MergeSaleslines(SalesHeader,SalesLine,TempPrepaymentSalesLine,CombinedSalesLineTemp);

    TempVATAmountLineRemainder.DELETEALL;
    SalesLine.CalcVATAmountLines(1,SalesHeader,CombinedSalesLineTemp,TempVATAmountLine);
    IF SalesLine.FINDSET THEN
    REPEAT
    ItemJnlRollRndg := FALSE;
    LineCount := LineCount + 1;
    Window.UPDATE(2,LineCount);
    ...

    Replacement code 2

    ...
    RoundingLineInserted := FALSE;
    MergeSaleslines(SalesHeader,SalesLine,TempPrepaymentSalesLine,CombinedSalesLineTemp);

    TempVATAmountLineRemainder.DELETEALL;
    SalesLine.CalcVATAmountLines(1,SalesHeader,CombinedSalesLineTemp,TempVATAmountLine);

    // Add the following line.
    TotalAmountForTax := SalesLine.GetTotalAmount;
    // End of the added line.

    IF SalesLine.FINDSET THEN
    REPEAT
    ItemJnlRollRndg := FALSE;
    LineCount := LineCount + 1;
    Window.UPDATE(2,LineCount);
    ...

    Existing code 3

    ...
    UNTIL DropShipPostBuffer.NEXT = 0;

    IF Invoice THEN BEGIN
    // Post sales and VAT to G/L entries from posting buffer
    LineCount := 0;
    IF InvPostingBuffer[1].FIND('+') THEN
    REPEAT
    LineCount := LineCount + 1;
    Window.UPDATE(3,LineCount);
    ...

    Replacement code 3

    ...
    UNTIL DropShipPostBuffer.NEXT = 0;

    IF Invoice THEN BEGIN
    // Post sales and VAT to G/L entries from posting buffer
    LineCount := 0;

    // Add the following line.
    GenJnlPostLine.SetTotalAmountForTax(TotalAmountForTax);
    // End of the added line.

    IF InvPostingBuffer[1].FIND('+') THEN
    REPEAT
    LineCount := LineCount + 1;
    Window.UPDATE(3,LineCount);
    ...

    Existing code 4

    ...
    RunGenJnlPostLine(GenJnlLine,InvPostingBuffer[1]."Dimension Entry No.");
    GenJnlLine."Account Type" := GenJnlLine."Account Type"::"G/L Account";
    GenJnlLine.VALIDATE("FA Posting Type",GenJnlLine."FA Posting Type"::" ");

    UNTIL InvPostingBuffer[1].NEXT(-1) = 0;
    InvPostingBuffer[1].DELETEALL;

    // Post customer entry
    Window.UPDATE(4,1);
    GenJnlLine.INIT;
    ...

    Replacement code 4

    ...
    RunGenJnlPostLine(GenJnlLine,InvPostingBuffer[1]."Dimension Entry No.");
    GenJnlLine."Account Type" := GenJnlLine."Account Type"::"G/L Account";
    GenJnlLine.VALIDATE("FA Posting Type",GenJnlLine."FA Posting Type"::" ");

    UNTIL InvPostingBuffer[1].NEXT(-1) = 0;

    // Add the following lines.
    TotalAmountForTax := 0;
    GenJnlPostLine.SetTotalAmountForTax(TotalAmountForTax);
    // End of the added lines.

    InvPostingBuffer[1].DELETEALL;

    // Post customer entry
    Window.UPDATE(4,1);
    GenJnlLine.INIT;
    ...
  11. Change the code in Properties in the codeunit (90) as follows:
    Existing code 1

    ...
    ICInboxPurchHdr@1012 : Record 436;
    SalesHeader@1041 : Record 36;
    UpdateAnalysisView@1002 : Codeunit 410;
    UpdateItemAnalysisView@1008 : Codeunit 7150;
    CostBaseAmount@1003 : Decimal;
    TrackingSpecificationExists@1010 : Boolean;
    EndLoop@1009 : Boolean;
    TempPrePmtAmtToDeduct@1004 : Decimal;
    BEGIN
    IF PostingDateExists AND (ReplacePostingDate OR ("Posting Date" = 0D)) THEN BEGIN
    ...

    Replacement code 1

    ...
    ICInboxPurchHdr@1012 : Record 436;
    SalesHeader@1041 : Record 36;
    UpdateAnalysisView@1002 : Codeunit 410;
    UpdateItemAnalysisView@1008 : Codeunit 7150;
    CostBaseAmount@1003 : Decimal;

    // Add the following line.
    TotalAmountForTax@1217 : Decimal;
    // End of the added line.

    TrackingSpecificationExists@1010 : Boolean;
    EndLoop@1009 : Boolean;
    TempPrePmtAmtToDeduct@1004 : Decimal;
    BEGIN
    IF PostingDateExists AND (ReplacePostingDate OR ("Posting Date" = 0D)) THEN BEGIN
    ...

    Existing code 2

    ...
    RoundingLineInserted := FALSE;
    MergePurchLines(PurchHeader,PurchLine,TempPrepmtPurchLine,CombinedPurchLineTemp);

    TempVATAmountLineRemainder.DELETEALL;
    PurchLine.CalcVATAmountLines(1,PurchHeader,CombinedPurchLineTemp,TempVATAmountLine);
    IF PurchLine.FINDSET THEN
    REPEAT
    JobPurchLine := PurchLine;
    ItemJnlRollRndg := FALSE;
    LineCount := LineCount + 1;
    ...

    Replacement code 2

    ...
    RoundingLineInserted := FALSE;
    MergePurchLines(PurchHeader,PurchLine,TempPrepmtPurchLine,CombinedPurchLineTemp);

    TempVATAmountLineRemainder.DELETEALL;
    PurchLine.CalcVATAmountLines(1,PurchHeader,CombinedPurchLineTemp,TempVATAmountLine);

    // Add the following line.
    TotalAmountForTax := PurchLine.GetTotalAmount;
    // End of the added line.

    IF PurchLine.FINDSET THEN
    REPEAT
    JobPurchLine := PurchLine;
    ItemJnlRollRndg := FALSE;
    LineCount := LineCount + 1;
    ...

    Existing code 3

    ...
    UNTIL DropShptPostBuffer.NEXT = 0;

    IF Invoice THEN BEGIN
    // Post purchase and VAT to G/L entries from buffer
    LineCount := 0;
    IF InvPostingBuffer[1].FIND('+') THEN
    REPEAT
    LineCount := LineCount + 1;
    IF GUIALLOWED THEN
    Window.UPDATE(3,LineCount);
    ...

    Replacement code 3

    ...
    UNTIL DropShptPostBuffer.NEXT = 0;

    IF Invoice THEN BEGIN
    // Post purchase and VAT to G/L entries from buffer
    LineCount := 0;

    // Add the following line.
    GenJnlPostLine.SetTotalAmountForTax(TotalAmountForTax);
    // End of the added line.

    IF InvPostingBuffer[1].FIND('+') THEN
    REPEAT
    LineCount := LineCount + 1;
    IF GUIALLOWED THEN
    Window.UPDATE(3,LineCount);
    ...

    Existing code 4

    ...
    GenJnlLine."Use Duplication List" := InvPostingBuffer[1]."Use Duplication List";
    END;

    RunGenJnlPostLine(GenJnlLine,InvPostingBuffer[1]."Dimension Entry No.");
    UNTIL InvPostingBuffer[1].NEXT(-1) = 0;
    InvPostingBuffer[1].DELETEALL;

    // Check External Document number
    IF PurchSetup."Ext. Doc. No. Mandatory" OR
    (GenJnlLineExtDocNo <> '')
    ...

    Replacement code 4

    ...
    GenJnlLine."Use Duplication List" := InvPostingBuffer[1]."Use Duplication List";
    END;

    RunGenJnlPostLine(GenJnlLine,InvPostingBuffer[1]."Dimension Entry No.");
    UNTIL InvPostingBuffer[1].NEXT(-1) = 0;

    // Add the following lines.
    TotalAmountForTax := 0;
    GenJnlPostLine.SetTotalAmountForTax(TotalAmountForTax);
    // End of the added lines.

    InvPostingBuffer[1].DELETEALL;

    // Check External Document number
    IF PurchSetup."Ext. Doc. No. Mandatory" OR
    (GenJnlLineExtDocNo <> '')
    ...
  12. Change the code in Global Variables in the codeunit (398) as follows:
    Existing code

    ...
    TaxDetail@1006 : Record 322;
    TMPTaxDetail@1007 : TEMPORARY Record 322;
    ExchangeFactor@1008 : Decimal;
    TotalTaxAmountRounding@1009 : Decimal;
    TotalForAllocation@1010 : Decimal;
    RemainingTaxDetails@1011 : Integer;
    LastCalculationOrder@1012 : Integer;
    Initialised@1013 : Boolean;
    FirstLine@1014 : Boolean;
    TaxOnTaxCalculated@1015 : Boolean;
    ...

    Replacement code

    ...
    TaxDetail@1006 : Record 322;
    TMPTaxDetail@1007 : TEMPORARY Record 322;
    ExchangeFactor@1008 : Decimal;
    TotalTaxAmountRounding@1009 : Decimal;
    TotalForAllocation@1010 : Decimal;

    // Add the following lines.
    TotalAmountForTax@1117 : Decimal;
    TotalLineAmountForTax@1120 : Decimal;
    // End of the added lines.

    RemainingTaxDetails@1011 : Integer;
    LastCalculationOrder@1012 : Integer;
    Initialised@1013 : Boolean;
    FirstLine@1014 : Boolean;
    TaxOnTaxCalculated@1015 : Boolean;
    ...
  13. Change the code in the InitSalesTaxLines function in the codeunit (398) as follows:
    Existing code 1

    ...
    IF TaxDetail."Calculate Tax on Tax" THEN
    TaxBaseAmount := Amount + TaxAmount
    ELSE
    TaxBaseAmount := Amount;
    IF TaxLiable THEN BEGIN

    // Delete the following lines.
    IF (ABS(TaxBaseAmount) <= TaxDetail."Maximum Amount/Qty.") OR
    (TaxDetail."Maximum Amount/Qty." = 0)
    THEN
    AddedTaxAmount := TaxBaseAmount * TaxDetail."Tax Below Maximum" / 100
    ELSE BEGIN
    MaxAmount := TaxBaseAmount / ABS(TaxBaseAmount) * TaxDetail."Maximum Amount/Qty.";
    AddedTaxAmount :=
    ((MaxAmount * TaxDetail."Tax Below Maximum") +
    ((TaxBaseAmount - MaxAmount) * TaxDetail."Tax Above Maximum")) / 100;
    // End of the deleted lines.

    END;
    END ELSE
    AddedTaxAmount := 0;
    TaxAmount := TaxAmount + AddedTaxAmount;
    TMPTaxDetail := TaxDetail;
    ...

    Replacement code 1

    ...
    IF TaxDetail."Calculate Tax on Tax" THEN
    TaxBaseAmount := Amount + TaxAmount
    ELSE
    TaxBaseAmount := Amount;
    IF TaxLiable THEN BEGIN

    // Add the following lines.
    IF (TaxDetail."Maximum Amount/Qty." = 0) THEN
    AddedTaxAmount := TaxBaseAmount * TaxDetail."Tax Below Maximum" / 100
    ELSE BEGIN
    MaxAmount := TaxBaseAmount / ABS(TaxBaseAmount) * TaxDetail."Maximum Amount/Qty.";
    IF TotalAmountForTax = 0 THEN
    TotalAmountForTax := 1;
    AddedTaxAmount :=
    (((TaxDetail."Tax Below Maximum" - TaxDetail."Tax Above Maximum") * MaxAmount / 100) *
    TotalLineAmountForTax / TotalAmountForTax) + (TaxBaseAmount * TaxDetail."Tax Above Maximum") / 100
    // End of the added lines.

    END;
    END ELSE
    AddedTaxAmount := 0;
    TaxAmount := TaxAmount + AddedTaxAmount;
    TMPTaxDetail := TaxDetail;
    ...

    Existing code 2

    ...
    RemainingTaxDetails := RemainingTaxDetails + 1;
    END;
    TaxDetail.SETRANGE("Tax Type",TaxDetail."Tax Type"::"Excise Tax");
    IF TaxDetail.FIND('+') AND ((TaxDetail."Tax Below Maximum" <> 0) OR (TaxDetail."Tax Above Maximum" <> 0)) THEN BEGIN
    IF TaxLiable THEN BEGIN

    // Delete the following lines.
    IF (ABS(Quantity) <= TaxDetail."Maximum Amount/Qty.") OR
    (TaxDetail."Maximum Amount/Qty." = 0)
    THEN
    AddedTaxAmount := Quantity * TaxDetail."Tax Below Maximum"
    ELSE BEGIN
    MaxAmount := Quantity / ABS(Quantity) * TaxDetail."Maximum Amount/Qty.";
    AddedTaxAmount :=
    (MaxAmount * TaxDetail."Tax Below Maximum") +
    ((Quantity - MaxAmount) * TaxDetail."Tax Above Maximum");
    // End of the deleted lines.

    END;
    END ELSE
    AddedTaxAmount := 0;
    TaxAmount := TaxAmount + AddedTaxAmount;
    TMPTaxDetail := TaxDetail;
    ...

    Replacement code 2

    ...
    RemainingTaxDetails := RemainingTaxDetails + 1;
    END;
    TaxDetail.SETRANGE("Tax Type",TaxDetail."Tax Type"::"Excise Tax");
    IF TaxDetail.FIND('+') AND ((TaxDetail."Tax Below Maximum" <> 0) OR (TaxDetail."Tax Above Maximum" <> 0)) THEN BEGIN
    IF TaxLiable THEN BEGIN

    // Add the following lines.
    IF (TaxDetail."Maximum Amount/Qty." = 0) THEN
    AddedTaxAmount := Quantity * TaxDetail."Tax Below Maximum"
    ELSE BEGIN
    MaxAmount := Quantity / ABS(Quantity) * TaxDetail."Maximum Amount/Qty.";
    IF TotalAmountForTax = 0 THEN
    TotalAmountForTax := 1;
    AddedTaxAmount :=
    (((TaxDetail."Tax Below Maximum" - TaxDetail."Tax Above Maximum") * MaxAmount / 100) *
    TotalLineAmountForTax / TotalAmountForTax) + (Quantity * TaxDetail."Tax Above Maximum") / 100
    // End of the added lines.

    END;
    END ELSE
    AddedTaxAmount := 0;
    TaxAmount := TaxAmount + AddedTaxAmount;
    TMPTaxDetail := TaxDetail;
    ...
  14. Change the code in the SetAmount function in the codeunit (398) as follows:
    Existing code

    ...
    TaxDetail2 := TMPTaxDetail;

    EXIT(TRUE);
    END;

    BEGIN
    END.
    }
    }
    ...

    Replacement code

    ...
    TaxDetail2 := TMPTaxDetail;

    EXIT(TRUE);
    END;

    // Add the following lines.
    PROCEDURE SetAmount@1107(TotalAmountForTax2@1118 : Decimal;TotalLineAmountForTax2@1119 : Decimal);
    BEGIN
    TotalAmountForTax := TotalAmountForTax2;
    TotalLineAmountForTax := TotalLineAmountForTax2;
    END;
    // End of the added lines.

    BEGIN
    END.
    }
    }
    ...

Prerequisites

You must have one of the following products installed to apply this hotfix:

  • Microsoft Dynamics NAV 2009 R2

  • Microsoft Dynamics NAV 2009 Service Pack 1

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!

×