"There are non posted Prepayment Amounts on Order [number]" error message when you post partial shipment for a sales order in the East European version of Microsoft Dynamics NAV 2009 R2

This article applies to Microsoft Dynamics NAV for the Eastern Europe (EE) region.

Symptoms

When you post partial shipment for a sales order in the East European version of Microsoft Dynamics NAV 2009 R2, you receive the following error message:

There are non posted Prepayment Amounts on Order number.

This problem occurs when a prepayment is specified and processed for the sales order.

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 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, 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 TestSalesPrepayment function in the Approvals Management codeunit (439) as follows:
    Existing code

    ...
    SalesLines.SETRANGE("Document Type",SalesHeader."Document Type");
    SalesLines.SETRANGE("Document No.",SalesHeader."No.");
    SalesLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);
    ...

    Replacement code

    ...
    // Add the following lines.
    IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN
    EXIT(FALSE);
    // End of the lines.

    SalesLines.SETRANGE("Document Type",SalesHeader."Document Type");
    SalesLines.SETRANGE("Document No.",SalesHeader."No.");
    SalesLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);
    ...
  2. Change the code in the TestPurchasePrepayment function in the Approvals Management codeunit (439) as follows:
    Existing code

    ...
    PurchaseLines.SETRANGE("Document Type",PurchaseHeader."Document Type");
    PurchaseLines.SETRANGE("Document No.",PurchaseHeader."No.");
    PurchaseLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);
    ...

    Replacement code

    ...
    // Add the following lines.
    IF PurchaseHeader."Prepayment Type" = PurchaseHeader."Prepayment Type"::Advance THEN
    EXIT(FALSE);
    // End of the lines.

    PurchaseLines.SETRANGE("Document Type",PurchaseHeader."Document Type");
    PurchaseLines.SETRANGE("Document No.",PurchaseHeader."No.");
    PurchaseLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);
    ...
  3. Change the code in the OnRun trigger in the "Sales-Post" codeunit (80) as follows:
    Existing code

    ...
    Window.UPDATE(2,LineCount);
    IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THEN
    SalesLine."VAT Date" := "VAT Date";
    IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGIN
    SalesLine.TESTFIELD(Amount);
    SalesLine.TESTFIELD("Job No.",'');
    SalesLine.TESTFIELD("Job Contract Entry No.",0);
    END;
    ...

    Replacement code

    ...
    Window.UPDATE(2,LineCount);
    IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THEN
    SalesLine."VAT Date" := "VAT Date";

    // Add the following lines.
    IF Invoice THEN
    TestPrepmtAmount;
    // End of the lines.

    IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGIN
    SalesLine.TESTFIELD(Amount);
    SalesLine.TESTFIELD("Job No.",'');
    SalesLine.TESTFIELD("Job Contract Entry No.",0);
    END;
    ...
  4. Create a new TestPrepmtAmount function in the "Sales-Post" codeunit (80) as follows:

    PROCEDURE TestPrepmtAmount@1470003();
    VAR
    AllowedQtyToShip@1470000 : Decimal;
    BEGIN
    WITH SalesLine DO BEGIN
    IF ("Prepmt. Line Amount" = 0) OR (Quantity = 0) THEN
    EXIT;

    AllowedQtyToShip :=
    ROUND(
    ("Line Amount" - "Prepmt. Line Amount" + "Prepmt. Amt. Inv.") /
    "Line Amount" * Quantity - "Quantity Invoiced",0.00001);
    IF "Qty. to Ship" > AllowedQtyToShip THEN
    FIELDERROR("Qty. to Ship",STRSUBSTNO(Text047,AllowedQtyToShip));
    END;
    END;
  5. Delete the following local variables in the TestPrepmtAmount function in the "Purch.-Post" codeunit (90):

    • RemainingAmount

    • RemainingQty

  6. Add a new local variable in the TestPrepmtAmount function in the "Purch.-Post" codeunit (90), and then specify the variable as follows:

    • Name: AllowedQtyToReceive

    • DataType: Decimal

  7. Change the code in the TestPrepmtAmount function in the "Purch.-Post" codeunit (90) as follows:
    Existing code

    ...
    WITH PurchLine DO BEGIN

    // Delete the following lines.
    IF "Prepmt. Line Amount" = 0 THEN
    EXIT;
    IF NOT PurchHeader.Receive AND ("Qty. to Invoice" = Quantity - "Quantity Invoiced") THEN BEGIN
    IF "Qty. Rcd. Not Invoiced" + "Quantity Received" = Quantity THEN
    RemainingAmount := 0
    ELSE BEGIN
    RemainingQty := "Qty. to Receive";
    RemainingAmount :=
    ROUND(RemainingQty * "Direct Unit Cost" * (1 - "Line Discount %" / 100),Currency."Amount Rounding Precision");
    END;
    END ELSE BEGIN
    IF "Qty. to Invoice" + "Quantity Invoiced" = Quantity THEN
    RemainingAmount := 0
    ELSE BEGIN
    RemainingQty := Quantity - "Qty. to Invoice" - "Quantity Invoiced";
    RemainingAmount :=
    ROUND(RemainingQty * "Direct Unit Cost" * (1 - "Line Discount %" / 100),Currency."Amount Rounding Precision");
    END;
    END;
    IF RemainingAmount < "Prepmt. Line Amount" - "Prepmt Amt to Deduct" - "Prepmt Amt Deducted" THEN
    FIELDERROR("Prepmt. Line Amount",STRSUBSTNO(Text049,"Qty. to Invoice"));
    // End of the lines.

    END;
    ...

    Replacement code

    ...
    WITH PurchLine DO BEGIN

    // Add the following lines.
    IF ("Prepmt. Line Amount" = 0) OR (Quantity = 0) THEN
    EXIT;

    AllowedQtyToReceive :=
    ROUND(
    ("Line Amount" - "Prepmt. Line Amount" + "Prepmt. Amt. Inv.") /
    "Line Amount" * Quantity - "Quantity Invoiced",0.00001);
    IF "Qty. to Receive" > AllowedQtyToReceive THEN
    FIELDERROR("Qty. to Receive",STRSUBSTNO(Text047,AllowedQtyToReceive));
    // End of the lines.

    END;
    ...
  8. Change the code in the Prepmt Amt to Deduct-OnValidate trigger in the Sales Line table (37) as follows:
    Existing code

    ...
    IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN
    TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted");
    ...

    Replacement code

    ...
    IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN
    TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted");

    // Add the following lines.
    GetSalesHeader;
    IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGIN
    VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");
    IF VATPostingSetup."Adv. Invoice Correction Type" <> 0 THEN
    VATPostingSetup.TESTFIELD("Adv. Invoice Correction Type",VATPostingSetup."Adv. Invoice Correction Type"::Percentage);
    END;
    // End of the lines.
    ...
  9. Delete the following local variables in the CalcPrepaymentToDeduct function in the Sales Line table (37):

    • PrepmtPct

    • AbsoluteAdvCorrection

  10. Change the code in the CalcPrepaymentToDeduct function in the Sales Line table (37) as follows:
    Existing code

    ...
    IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGIN
    VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");

    // Delete the following lines.
    AbsoluteAdvCorrection :=
    VATPostingSetup."Adv. Invoice Correction Type" = VATPostingSetup."Adv. Invoice Correction Type"::Absolute;
    IF AbsoluteAdvCorrection THEN BEGIN
    PrepmtPct := "Prepayment %";
    "Prepayment %" := 100;
    END;
    END;
    IF SalesHeader."Prices Including VAT" THEN
    "Prepmt Amt to Deduct" :=
    ROUND(
    ROUND(
    ROUND(
    ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
    (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
    ("Prepayment %" / 100) / (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") *
    (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision")
    ELSE
    "Prepmt Amt to Deduct" :=
    ROUND(
    ROUND(
    ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
    (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
    "Prepayment %" / 100 ,Currency."Amount Rounding Precision");
    IF AbsoluteAdvCorrection THEN BEGIN
    "Prepayment %" := PrepmtPct;
    IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN
    "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted";
    END;
    // End of the lines.

    END ELSE
    "Prepmt Amt to Deduct" := 0
    ...

    Replacement code

    ... 
    IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGIN
    VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");

    // Add the following lines.
    CASE VATPostingSetup."Adv. Invoice Correction Type" OF
    VATPostingSetup."Adv. Invoice Correction Type"::Percentage:
    "Prepmt Amt to Deduct" :=
    ROUND("Qty. to Invoice" / (Quantity - "Quantity Invoiced") *
    ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted"),Currency."Amount Rounding Precision");
    VATPostingSetup."Adv. Invoice Correction Type"::Absolute:
    BEGIN
    "Prepmt Amt to Deduct" := PrepmtAmtToDeduct(SalesHeader."Prices Including VAT",100);
    IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN
    "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted";
    END;
    VATPostingSetup."Adv. Invoice Correction Type"::"Fully Invoiced":
    IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN
    "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted"
    ELSE
    "Prepmt Amt to Deduct" := 0;
    END;
    END ELSE
    "Prepmt Amt to Deduct" := PrepmtAmtToDeduct(SalesHeader."Prices Including VAT","Prepayment %");
    // End of the lines.

    END ELSE
    "Prepmt Amt to Deduct" := 0
    ...
  11. Create a new PrepmtAmtToDeduct function in the Sales Line table (37) as follows:

    PROCEDURE PrepmtAmtToDeduct@1470002(PricesIncludingVAT@1470000 : Boolean;PrepaymentPct@1470001 : Decimal) : Decimal;
    VAR
    VATPct@1470002 : Decimal;
    BEGIN
    IF PricesIncludingVAT THEN
    VATPct := "VAT %"
    ELSE
    VATPct := 0;
    EXIT(
    ROUND(
    ROUND(
    ROUND(
    ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
    (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
    (PrepaymentPct / 100) / (1 + (VATPct / 100)),Currency."Amount Rounding Precision") *
    (1 + (VATPct / 100)),Currency."Amount Rounding Precision"));
    END;
  12. Change the code in the Prepmt Amt to Deduct - OnValidate trigger in the Purchase Line table (39) as follows:
    Existing code

    ...
    IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN
    TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted");
    ...

    Replacement code

    ...
    IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN
    TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted");

    // Add the following lines.
    GetPurchHeader;
    IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGIN
    VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");
    IF VATPostingSetup."Adv. Invoice Correction Type" <> 0 THEN
    VATPostingSetup.TESTFIELD("Adv. Invoice Correction Type",VATPostingSetup."Adv. Invoice Correction Type"::Percentage);
    END;
    // End of the lines.
    ...
  13. Delete the following local variables in the CalcPrepaymentToDeduct function in the Purchase Line table (39):

    • PrepmtPct

    • AbsoluteAdvCorrection

  14. Change the code in the CalcPrepaymentToDeduct function in the Purchase Line table (39) as follows:
    Existing code

    ...
    IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGIN
    VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");

    // Delete the following lines.
    AbsoluteAdvCorrection :=
    VATPostingSetup."Adv. Invoice Correction Type" = VATPostingSetup."Adv. Invoice Correction Type"::Absolute;
    IF AbsoluteAdvCorrection THEN BEGIN
    PrepmtPct := "Prepayment %";
    "Prepayment %" := 100;
    END;
    END;
    IF PurchHeader."Prices Including VAT" THEN
    "Prepmt Amt to Deduct" :=
    ROUND(
    ROUND(
    ROUND(
    ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
    (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
    ("Prepayment %" / 100) / (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") *
    (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision")
    ELSE
    "Prepmt Amt to Deduct" :=
    ROUND(
    ROUND(
    ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
    (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
    "Prepayment %" / 100,Currency."Amount Rounding Precision");
    IF AbsoluteAdvCorrection THEN BEGIN
    "Prepayment %" := PrepmtPct;
    IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN
    "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted";
    END;
    // End of the lines.

    END ELSE
    "Prepmt Amt to Deduct" := 0
    ...

    Replacement code

    ...
    IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGIN
    VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");

    // Add the following lines.
    CASE VATPostingSetup."Adv. Invoice Correction Type" OF
    VATPostingSetup."Adv. Invoice Correction Type"::Percentage:
    "Prepmt Amt to Deduct" :=
    ROUND("Qty. to Invoice" / (Quantity - "Quantity Invoiced") *
    ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted"),Currency."Amount Rounding Precision");
    VATPostingSetup."Adv. Invoice Correction Type"::Absolute:
    BEGIN
    "Prepmt Amt to Deduct" := PrepmtAmtToDeduct(PurchHeader."Prices Including VAT",100);
    IF "Prepmt Amt to Deduct" > ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") THEN
    "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted";
    END;
    VATPostingSetup."Adv. Invoice Correction Type"::"Fully Invoiced":
    IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN
    "Prepmt Amt to Deduct" := "Prepmt. Amt. Inv." - "Prepmt Amt Deducted"
    ELSE
    "Prepmt Amt to Deduct" := 0;
    END;
    END ELSE
    "Prepmt Amt to Deduct" := PrepmtAmtToDeduct(PurchHeader."Prices Including VAT","Prepayment %");
    // End of the lines.

    END ELSE
    "Prepmt Amt to Deduct" := 0
    ...
  15. Create a new PrepmtAmtToDeduct function in the Purchase Line table (39) as follows:

    PROCEDURE PrepmtAmtToDeduct@1470002(PricesIncludingVAT@1470000 : Boolean;PrepaymentPct@1470001 : Decimal) : Decimal;
    VAR
    VATPct@1470002 : Decimal;
    BEGIN
    IF PricesIncludingVAT THEN
    VATPct := "VAT %"
    ELSE
    VATPct := 0;
    EXIT(
    ROUND(
    ROUND(
    ROUND(
    ROUND("Direct Unit Cost" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
    (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
    (PrepaymentPct / 100) / (1 + (VATPct / 100)),Currency."Amount Rounding Precision") *
    (1 + (VATPct / 100)),Currency."Amount Rounding Precision"));
    END;

Prerequisites

You must have the East 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 Use for other considerations.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×