Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

"Amount (LCY) must have the same sign as Amount in Gen. Journal Line" error message when you post an invoice for a partly shipped sales order or purchase order in which the "Prepayment%" field is set to 100 in Microsoft Dynamics NAV...


View products that this article applies to.

This article applies to Microsoft Dynamics NAV for all countries and all language locales.

↑ Back to the top


Symptoms

Assume that you create a sales order that has the Prepayment% field set to 100 in Microsoft Dynamics NAV 2009. Then you post the prepayment invoice for the sales order. Next, you post the shipment partly for the sales order. In this situation, when you post the invoice for the sales order, you receive the following error message:
Amount (LCY) must have the same sign as Amount in Gen. Journal Line.

This problem also occurs when you post an invoice for a partly shipped purchase order in which the Prepayment% field set to 100.
This problem occurs in the following products:
  • Microsoft Dynamics NAV 2009 R2
  • Microsoft Dynamics NAV 2009 Service Pack 1

↑ Back to the top


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.

↑ Back to the top




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, but 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 Navision client users are logged off the system. This includes Microsoft Navision Application Services (NAS) client users. 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 the CalcVATAmountLines@35 procedure in the "Sales Line" table (37) as follows:
    Existing code
    ...
    END ELSE BEGIN
    CASE "VAT Calculation Type" OF
    "VAT Calculation Type"::"Normal VAT",
    "VAT Calculation Type"::"Reverse Charge VAT":
    BEGIN
    "VAT Base" := "Line Amount" - "Invoice Discount Amount";
    "VAT Amount" :=
    "VAT Difference" +
    ROUND(
    PrevVatAmountLine."VAT Amount" +
    "VAT Base" * "VAT %" / 100 * (1 - SalesHeader."VAT Base Discount %" / 100),
    Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount" + "VAT Amount";
    IF Positive THEN
    PrevVatAmountLine.INIT

    // Delete the following lines.
    ELSE BEGIN
    PrevVatAmountLine := VATAmountLine;
    PrevVatAmountLine."VAT Amount" :=
    ROUND(PrevVatAmountLine."VAT Amount" -
    "VAT Base" * "VAT %" / 100 * (1 - SalesHeader."VAT Base Discount %" / 100),
    Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    END;
    // End of the lines.
    ...
    Replacement code
    ...
    END ELSE BEGIN
    CASE "VAT Calculation Type" OF
    "VAT Calculation Type"::"Normal VAT",
    "VAT Calculation Type"::"Reverse Charge VAT":
    BEGIN
    "VAT Base" := "Line Amount" - "Invoice Discount Amount";
    "VAT Amount" :=
    "VAT Difference" +
    ROUND(
    PrevVatAmountLine."VAT Amount" +
    "VAT Base" * "VAT %" / 100 * (1 - SalesHeader."VAT Base Discount %" / 100),
    Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount" + "VAT Amount";
    IF Positive THEN
    PrevVatAmountLine.INIT

    // Add the following lines.
    ELSE
    IF NOT "Includes Prepayment" THEN BEGIN
    PrevVatAmountLine := VATAmountLine;
    PrevVatAmountLine."VAT Amount" :=
    "VAT Base" * "VAT %" / 100 * (1 - SalesHeader."VAT Base Discount %" / 100);
    PrevVatAmountLine."VAT Amount" :=
    PrevVatAmountLine."VAT Amount" -
    ROUND(PrevVatAmountLine."VAT Amount",Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    END;
    // End of the lines.
    ...
  2. Change the code in the CalcVATAmountLines@24 procedure in the "Purchase Line" table (39) as follows:
    Existing code
    ...
    CASE "VAT Calculation Type" OF
    "VAT Calculation Type"::"Normal VAT",
    "VAT Calculation Type"::"Reverse Charge VAT":
    BEGIN
    "VAT Base" := "Line Amount" - "Invoice Discount Amount";
    "VAT Amount" :=
    "VAT Difference" +
    ROUND(
    PrevVatAmountLine."VAT Amount" +
    "VAT Base" * "VAT %" / 100 * (1 - PurchHeader."VAT Base Discount %" / 100),
    Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount" + "VAT Amount";
    IF Positive THEN
    PrevVatAmountLine.INIT

    // Delete the following lines.
    ELSE BEGIN
    PrevVatAmountLine := VATAmountLine;
    PrevVatAmountLine."VAT Amount" :=
    "VAT Base" * "VAT %" / 100 * (1 - PurchHeader."VAT Base Discount %" / 100);
    PrevVatAmountLine."VAT Amount" :=
    PrevVatAmountLine."VAT Amount" -
    ROUND(PrevVatAmountLine."VAT Amount",Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    END;
    // End of the lines.
    ...
    Replacement code
    ...
    CASE "VAT Calculation Type" OF
    "VAT Calculation Type"::"Normal VAT",
    "VAT Calculation Type"::"Reverse Charge VAT":
    BEGIN
    "VAT Base" := "Line Amount" - "Invoice Discount Amount";
    "VAT Amount" :=
    "VAT Difference" +
    ROUND(
    PrevVatAmountLine."VAT Amount" +
    "VAT Base" * "VAT %" / 100 * (1 - PurchHeader."VAT Base Discount %" / 100),
    Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    "Amount Including VAT" := "Line Amount" - "Invoice Discount Amount" + "VAT Amount";
    IF Positive THEN
    PrevVatAmountLine.INIT

    // Add the following lines.
    ELSE
    IF NOT "Includes Prepayment" THEN BEGIN
    PrevVatAmountLine := VATAmountLine;
    PrevVatAmountLine."VAT Amount" :=
    "VAT Base" * "VAT %" / 100 * (1 - PurchHeader."VAT Base Discount %" / 100);
    PrevVatAmountLine."VAT Amount" :=
    PrevVatAmountLine."VAT Amount" -
    ROUND(PrevVatAmountLine."VAT Amount",Currency."Amount Rounding Precision",Currency.VATRoundingDirection);
    END;
    // End of the lines.
    ...
  3. Change the code in the OnRun trigger in the "Sales-Post" codeunit (80) as follows:
    Existing code 1
    ...
    RemQtyToBeInvoiced := RemQtyToBeInvoiced - QtyToBeInvoiced;
    RemQtyToBeInvoicedBase := RemQtyToBeInvoicedBase - QtyToBeInvoicedBase;
    ReturnRcptLine."Quantity Invoiced" :=
    ReturnRcptLine."Quantity Invoiced" + QtyToBeInvoiced;
    ReturnRcptLine."Qty. Invoiced (Base)" :=
    ReturnRcptLine."Qty. Invoiced (Base)" + QtyToBeInvoicedBase;
    ReturnRcptLine."Return Qty. Rcd. Not Invd." :=
    ReturnRcptLine.Quantity - ReturnRcptLine."Quantity Invoiced";
    ReturnRcptLine.MODIFY;
    IF SalesLine.Type = SalesLine.Type::Item THEN
    PostItemJnlLine(
    SalesLine,
    0,0,
    QtyToBeInvoiced,
    QtyToBeInvoicedBase,

    // Delete the following line.
    {ReturnRcptLine."Item Rcpt. Entry No."}

    ItemEntryRelation."Item Entry No.",'',TempInvoicingSpecification);
    IF TrackingSpecificationExists THEN
    EndLoop := (TempInvoicingSpecification.NEXT = 0)
    ELSE
    EndLoop :=
    (ReturnRcptLine.NEXT = 0) OR (ABS(RemQtyToBeInvoiced) <= ABS(SalesLine."Return Qty. to Receive"));
    UNTIL EndLoop;
    END ELSE
    ERROR(
    Text025,
    SalesLine."Return Receipt Line No.",SalesLine."Return Receipt No.");
    END;
    ...
    Replacement code 1
    ...
    RemQtyToBeInvoiced := RemQtyToBeInvoiced - QtyToBeInvoiced;
    RemQtyToBeInvoicedBase := RemQtyToBeInvoicedBase - QtyToBeInvoicedBase;
    ReturnRcptLine."Quantity Invoiced" :=
    ReturnRcptLine."Quantity Invoiced" + QtyToBeInvoiced;
    ReturnRcptLine."Qty. Invoiced (Base)" :=
    ReturnRcptLine."Qty. Invoiced (Base)" + QtyToBeInvoicedBase;
    ReturnRcptLine."Return Qty. Rcd. Not Invd." :=
    ReturnRcptLine.Quantity - ReturnRcptLine."Quantity Invoiced";
    ReturnRcptLine.MODIFY;
    IF SalesLine.Type = SalesLine.Type::Item THEN
    PostItemJnlLine(
    SalesLine,
    0,0,
    QtyToBeInvoiced,
    QtyToBeInvoicedBase,
    ItemEntryRelation."Item Entry No.",'',TempInvoicingSpecification);
    IF TrackingSpecificationExists THEN
    EndLoop := (TempInvoicingSpecification.NEXT = 0)
    ELSE
    EndLoop :=
    (ReturnRcptLine.NEXT = 0) OR (ABS(RemQtyToBeInvoiced) <= ABS(SalesLine."Return Qty. to Receive"));
    UNTIL EndLoop;
    END ELSE
    ERROR(
    Text025,
    SalesLine."Return Receipt Line No.",SalesLine."Return Receipt No.");
    END;
    ...
    Existing code 2
    ...
    RemQtyToBeInvoiced := RemQtyToBeInvoiced - QtyToBeInvoiced;
    RemQtyToBeInvoicedBase := RemQtyToBeInvoicedBase - QtyToBeInvoicedBase;
    SalesShptLine."Quantity Invoiced" :=
    SalesShptLine."Quantity Invoiced" - QtyToBeInvoiced;
    SalesShptLine."Qty. Invoiced (Base)" :=
    SalesShptLine."Qty. Invoiced (Base)" - QtyToBeInvoicedBase;
    SalesShptLine."Qty. Shipped Not Invoiced" :=
    SalesShptLine.Quantity - SalesShptLine."Quantity Invoiced";
    SalesShptLine.MODIFY;
    IF SalesLine.Type = SalesLine.Type::Item THEN
    PostItemJnlLine(
    SalesLine,
    0,0,
    QtyToBeInvoiced,
    QtyToBeInvoicedBase,

    // Delete the following line.
    {SalesShptLine."Item Shpt. Entry No."}

    ItemEntryRelation."Item Entry No.",'',TempInvoicingSpecification);
    IF TrackingSpecificationExists THEN
    EndLoop := (TempInvoicingSpecification.NEXT = 0)
    ELSE
    EndLoop :=
    (SalesShptLine.NEXT = 0) OR (ABS(RemQtyToBeInvoiced) <= ABS(SalesLine."Qty. to Ship"))
    UNTIL EndLoop;
    END ELSE
    ERROR(
    Text026,
    SalesLine."Shipment Line No.",SalesLine."Shipment No.");
    END;
    Replacement code 2
    ...
    RemQtyToBeInvoiced := RemQtyToBeInvoiced - QtyToBeInvoiced;
    RemQtyToBeInvoicedBase := RemQtyToBeInvoicedBase - QtyToBeInvoicedBase;
    SalesShptLine."Quantity Invoiced" :=
    SalesShptLine."Quantity Invoiced" - QtyToBeInvoiced;
    SalesShptLine."Qty. Invoiced (Base)" :=
    SalesShptLine."Qty. Invoiced (Base)" - QtyToBeInvoicedBase;
    SalesShptLine."Qty. Shipped Not Invoiced" :=
    SalesShptLine.Quantity - SalesShptLine."Quantity Invoiced";
    SalesShptLine.MODIFY;
    IF SalesLine.Type = SalesLine.Type::Item THEN
    PostItemJnlLine(
    SalesLine,
    0,0,
    QtyToBeInvoiced,
    QtyToBeInvoicedBase,
    ItemEntryRelation."Item Entry No.",'',TempInvoicingSpecification);
    IF TrackingSpecificationExists THEN
    EndLoop := (TempInvoicingSpecification.NEXT = 0)
    ELSE
    EndLoop :=
    (SalesShptLine.NEXT = 0) OR (ABS(RemQtyToBeInvoiced) <= ABS(SalesLine."Qty. to Ship"))
    UNTIL EndLoop;
    END ELSE
    ERROR(
    Text026,
    SalesLine."Shipment Line No.",SalesLine."Shipment No.");
    END;
    ...
  4. Change the code in the AdjustPrepmtAmountLCY@84 local procedure in the "Sales-Post" codeunit (80) as follows:
    Existing code 1
    ...
    TempPrepmtDeductLCYSalesLine.SETRANGE("Attached to Line No.",PrepmtSalesLine."Line No.");
    IF TempPrepmtDeductLCYSalesLine.FINDSET(TRUE) THEN
    REPEAT
    SalesLine := TempPrepmtDeductLCYSalesLine;
    SalesLine.FIND;
    IF SalesLine."Document Type" = SalesLine."Document Type"::Invoice THEN
    GetSalesOrderLine(SalesLine,SalesLine);
    DeductionFactor :=
    SalesLine."Prepmt Amt to Deduct" /
    (SalesLine."Prepmt. Amt. Inv." - SalesLine."Prepmt Amt Deducted");
    ...
    Replacement code 1
    ...
    TempPrepmtDeductLCYSalesLine.SETRANGE("Attached to Line No.",PrepmtSalesLine."Line No.");
    IF TempPrepmtDeductLCYSalesLine.FINDSET(TRUE) THEN
    REPEAT
    SalesLine := TempPrepmtDeductLCYSalesLine;
    SalesLine.FIND;
    IF SalesLine."Document Type" = SalesLine."Document Type"::Invoice THEN
    GetSalesOrderLine(SalesLine,SalesLine);

    // Add the following line.
    SalesLine."Prepmt Amt to Deduct" := CalcPrepmtAmtToDeduct(SalesLine);

    DeductionFactor :=
    SalesLine."Prepmt Amt to Deduct" /
    (SalesLine."Prepmt. Amt. Inv." - SalesLine."Prepmt Amt Deducted");
    ...
    Existing code 2
    ...
    IF ABS(TotalPrepmtVATAmtLCYDifference) <= GLSetup."Amount Rounding Precision" THEN
    TotalPrepmtVATAmtLCYDifference := 0;
    PrepmtSalesLine."Prepmt. VAT Amount Inv. (LCY)" := TotalPrepmtVATAmtLCYDifference;
    NewAmountIncludingVAT := PrepmtSalesLine.Amount + TotalPrepmtVATAmtLCY + TotalPrepmtVATAmtLCYDifference;
    Increment(TotalSalesLineLCY."Amount Including VAT",PrepmtSalesLine."Amount Including VAT" - NewAmountIncludingVAT);
    PrepmtSalesLine."Amount Including VAT" := NewAmountIncludingVAT;
    END;
    END;
    LOCAL PROCEDURE GetSalesOrderLine@85(VAR SalesOrderLine@1000 : Record 37;SalesLine@1001 : Record 37);
    ...
    Replacement code 2
    ...
    IF ABS(TotalPrepmtVATAmtLCYDifference) <= GLSetup."Amount Rounding Precision" THEN
    TotalPrepmtVATAmtLCYDifference := 0;
    PrepmtSalesLine."Prepmt. VAT Amount Inv. (LCY)" := TotalPrepmtVATAmtLCYDifference;
    NewAmountIncludingVAT := PrepmtSalesLine.Amount + TotalPrepmtVATAmtLCY + TotalPrepmtVATAmtLCYDifference;
    Increment(TotalSalesLineLCY."Amount Including VAT",PrepmtSalesLine."Amount Including VAT" - NewAmountIncludingVAT);

    // Add the following lines.
    IF SalesLine."Currency Code" = '' THEN
    TotalSalesLine."Amount Including VAT" := TotalSalesLineLCY."Amount Including VAT";
    // End of the lines.

    PrepmtSalesLine."Amount Including VAT" := NewAmountIncludingVAT;
    END;
    END;

    // Add the following lines.
    PROCEDURE CalcPrepmtAmtToDeduct@71(SalesLine@1000 : Record 37) : Decimal;
    VAR
    AllowedQtyToInvoice@1001 : Decimal;
    BEGIN
    WITH SalesLine DO BEGIN
    AllowedQtyToInvoice := "Qty. Shipped Not Invoiced";
    IF SalesHeader.Ship THEN
    AllowedQtyToInvoice := AllowedQtyToInvoice + "Qty. to Ship";
    IF "Qty. to Invoice" > AllowedQtyToInvoice THEN BEGIN
    "Qty. to Invoice" := AllowedQtyToInvoice;
    CalcPrepaymentToDeduct;
    END;
    EXIT("Prepmt Amt to Deduct");
    END;
    END;
    // End of the lines.

    LOCAL PROCEDURE GetSalesOrderLine@85(VAR SalesOrderLine@1000 : Record 37;SalesLine@1001 : Record 37);
    ...
  5. Change the code in the OnRun trigger in the "Purch.-Post" codeunit (90) as follows:
    Existing code 1
    ...
    RemQtyToBeInvoiced := RemQtyToBeInvoiced - QtyToBeInvoiced;
    RemQtyToBeInvoicedBase := RemQtyToBeInvoicedBase - QtyToBeInvoicedBase;
    ReturnShptLine."Quantity Invoiced" :=
    ReturnShptLine."Quantity Invoiced" - QtyToBeInvoiced;
    ReturnShptLine."Qty. Invoiced (Base)" :=
    ReturnShptLine."Qty. Invoiced (Base)" - QtyToBeInvoicedBase;
    ReturnShptLine."Return Qty. Shipped Not Invd." :=
    ReturnShptLine.Quantity - ReturnShptLine."Quantity Invoiced";
    ReturnShptLine.MODIFY;
    IF PurchLine.Type = PurchLine.Type::Item THEN
    PostItemJnlLine(
    PurchLine,
    0,0,
    QtyToBeInvoiced,QtyToBeInvoicedBase,

    // Delete the following line.
    {ReturnShptLine."Item Shpt. Entry No."}

    ItemEntryRelation."Item Entry No.",'',TempInvoicingSpecification);
    IF TrackingSpecificationExists THEN
    ...
    Replacement code 1
    ...
    RemQtyToBeInvoiced := RemQtyToBeInvoiced - QtyToBeInvoiced;
    RemQtyToBeInvoicedBase := RemQtyToBeInvoicedBase - QtyToBeInvoicedBase;
    ReturnShptLine."Quantity Invoiced" :=
    ReturnShptLine."Quantity Invoiced" - QtyToBeInvoiced;
    ReturnShptLine."Qty. Invoiced (Base)" :=
    ReturnShptLine."Qty. Invoiced (Base)" - QtyToBeInvoicedBase;
    ReturnShptLine."Return Qty. Shipped Not Invd." :=
    ReturnShptLine.Quantity - ReturnShptLine."Quantity Invoiced";
    ReturnShptLine.MODIFY;
    IF PurchLine.Type = PurchLine.Type::Item THEN
    PostItemJnlLine(
    PurchLine,
    0,0,
    QtyToBeInvoiced,QtyToBeInvoicedBase,
    ItemEntryRelation."Item Entry No.",'',TempInvoicingSpecification);
    IF TrackingSpecificationExists THEN
    ...
    Existing code 2
    ...
    RemQtyToBeInvoiced := RemQtyToBeInvoiced - QtyToBeInvoiced;
    RemQtyToBeInvoicedBase := RemQtyToBeInvoicedBase - QtyToBeInvoicedBase;
    PurchRcptLine."Quantity Invoiced" := PurchRcptLine."Quantity Invoiced" + QtyToBeInvoiced;
    PurchRcptLine."Qty. Invoiced (Base)" := PurchRcptLine."Qty. Invoiced (Base)" + QtyToBeInvoicedBase;
    PurchRcptLine."Qty. Rcd. Not Invoiced" :=
    PurchRcptLine.Quantity - PurchRcptLine."Quantity Invoiced";
    PurchRcptLine.MODIFY;
    IF PurchLine.Type = PurchLine.Type::Item THEN
    PostItemJnlLine(
    PurchLine,
    0,0,
    QtyToBeInvoiced,QtyToBeInvoicedBase,

    // Delete the following line.
    {PurchRcptLine."Item Rcpt. Entry No."}

    ItemEntryRelation."Item Entry No.",'',TempInvoicingSpecification);
    IF TrackingSpecificationExists THEN
    ...
    Replacement code 2
    ...
    RemQtyToBeInvoiced := RemQtyToBeInvoiced - QtyToBeInvoiced;
    RemQtyToBeInvoicedBase := RemQtyToBeInvoicedBase - QtyToBeInvoicedBase;
    PurchRcptLine."Quantity Invoiced" := PurchRcptLine."Quantity Invoiced" + QtyToBeInvoiced;
    PurchRcptLine."Qty. Invoiced (Base)" := PurchRcptLine."Qty. Invoiced (Base)" + QtyToBeInvoicedBase;
    PurchRcptLine."Qty. Rcd. Not Invoiced" :=
    PurchRcptLine.Quantity - PurchRcptLine."Quantity Invoiced";
    PurchRcptLine.MODIFY;
    IF PurchLine.Type = PurchLine.Type::Item THEN
    PostItemJnlLine(
    PurchLine,
    0,0,
    QtyToBeInvoiced,QtyToBeInvoicedBase,
    ItemEntryRelation."Item Entry No.",'',TempInvoicingSpecification);
    IF TrackingSpecificationExists THEN
    ...
  6. Change the code in the AdjustPrepmtAmountLCY@84 local procedure in the "Purch.-Post" codeunit (90) as follows:
    Existing code 1
    ...
    TempPrepmtDeductLCYPurchLine.SETRANGE("Attached to Line No.",PrepmtPurchLine."Line No.");
    IF TempPrepmtDeductLCYPurchLine.FINDSET(TRUE) THEN
    REPEAT
    PurchLine := TempPrepmtDeductLCYPurchLine;
    PurchLine.FIND;
    IF PurchLine."Document Type" = PurchLine."Document Type"::Invoice THEN
    GetPurchOrderLine(PurchLine,PurchLine);
    DeductionFactor :=
    PurchLine."Prepmt Amt to Deduct" /
    (PurchLine."Prepmt. Amt. Inv." - PurchLine."Prepmt Amt Deducted");
    PrepmtAmtLCYDifference :=
    ...
    Replacement code 1
    ...
    TempPrepmtDeductLCYPurchLine.SETRANGE("Attached to Line No.",PrepmtPurchLine."Line No.");
    IF TempPrepmtDeductLCYPurchLine.FINDSET(TRUE) THEN
    REPEAT
    PurchLine := TempPrepmtDeductLCYPurchLine;
    PurchLine.FIND;
    IF PurchLine."Document Type" = PurchLine."Document Type"::Invoice THEN
    GetPurchOrderLine(PurchLine,PurchLine);

    // Add the following line.
    PurchLine."Prepmt Amt to Deduct" := CalcPrepmtAmtToDeduct(PurchLine);

    DeductionFactor :=
    PurchLine."Prepmt Amt to Deduct" /
    (PurchLine."Prepmt. Amt. Inv." - PurchLine."Prepmt Amt Deducted");
    PrepmtAmtLCYDifference :=
    ...
    Existing code 2
    ...
    IF ABS(TotalPrepmtVATAmtLCYDifference) <= GLSetup."Amount Rounding Precision" THEN
    TotalPrepmtVATAmtLCYDifference := 0;
    PrepmtPurchLine."Prepmt. VAT Amount Inv. (LCY)" := -TotalPrepmtVATAmtLCYDifference;
    NewAmountIncludingVAT := PrepmtPurchLine.Amount - (TotalPrepmtVATAmtLCY + TotalPrepmtVATAmtLCYDifference);
    Increment(TotalPurchLineLCY."Amount Including VAT",-(PrepmtPurchLine."Amount Including VAT" - NewAmountIncludingVAT));
    PrepmtPurchLine."Amount Including VAT" := NewAmountIncludingVAT;
    END;
    END;
    LOCAL PROCEDURE GetPurchOrderLine@85(VAR PurchOrderLine@1000 : Record 39;PurchLine@1001 : Record 39);
    ...
    Replacement code 2
    ...
    IF ABS(TotalPrepmtVATAmtLCYDifference) <= GLSetup."Amount Rounding Precision" THEN
    TotalPrepmtVATAmtLCYDifference := 0;
    PrepmtPurchLine."Prepmt. VAT Amount Inv. (LCY)" := -TotalPrepmtVATAmtLCYDifference;
    NewAmountIncludingVAT := PrepmtPurchLine.Amount - (TotalPrepmtVATAmtLCY + TotalPrepmtVATAmtLCYDifference);
    Increment(TotalPurchLineLCY."Amount Including VAT",-(PrepmtPurchLine."Amount Including VAT" - NewAmountIncludingVAT));

    // Add the following lines.
    IF PurchLine."Currency Code" = '' THEN
    TotalPurchLine."Amount Including VAT" := TotalPurchLineLCY."Amount Including VAT";
    // End of the lines.

    PrepmtPurchLine."Amount Including VAT" := NewAmountIncludingVAT;
    END;
    END;

    // Add the following lines.
    LOCAL PROCEDURE CalcPrepmtAmtToDeduct@71(PurchLine@1000 : Record 39) : Decimal;
    VAR
    AllowedQtyToInvoice@1001 : Decimal;
    BEGIN
    WITH PurchLine DO BEGIN
    AllowedQtyToInvoice := "Qty. Rcd. Not Invoiced";
    IF PurchHeader.Receive THEN
    AllowedQtyToInvoice := AllowedQtyToInvoice + "Qty. to Receive";
    IF "Qty. to Invoice" > AllowedQtyToInvoice THEN BEGIN
    "Qty. to Invoice" := AllowedQtyToInvoice;
    CalcPrepaymentToDeduct;
    END;
    EXIT("Prepmt Amt to Deduct");
    END;
    END;
    // End of the lines.

    LOCAL PROCEDURE GetPurchOrderLine@85(VAR PurchOrderLine@1000 : Record 39;PurchLine@1001 : Record 39);
    ...

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.

↑ Back to the top


Status

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

↑ Back to the top


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 Use for other considerations.

↑ Back to the top


Keywords: kbmbscodefix, kbnoloc, kbsurveynew, kbmbsquickpub, kbfix, kbmbspartner, kb, kbqfe, kbmbsmigrate

↑ Back to the top

Article Info
Article ID : 2751381
Revision : 1
Created on : 1/7/2017
Published on : 1/11/2013
Exists online : False
Views : 256