This article applies to Microsoft Dynamics NAV for the Eastern European (EE) language locale.
Symptoms
Assume that you apply hotfix 2672643 in the Eastern European version of Microsoft Dynamics NAV 2009 R2. You post an advance letter for a sales order that contains prepayments. In this situation, when you ship and invoice the sales order, you receive the following error message:
Qty. to Ship cannot be more than 0,9. in Sales Line Document Type='Order',Document No.='Number',Line No.='Number'.
Therefore, you cannot post the sales order. For more information about hotfix 2672643, click the following article number to view the article in the Microsoft Knowledge Base:
2672643 "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
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:-
Change the code in the Prepmt Amt to Deduct - OnValidate trigger in the "Sales Line" table (37) as follows:
Existing code...
"Prepmt Amt to Deduct", STRSUBSTNO(Text045,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted")); IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN // Delete the following line. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted"); ...Replacement code
...
"Prepmt Amt to Deduct", STRSUBSTNO(Text045,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted")); IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN // Add the following lines. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted"); GetSalesHeader; IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN BEGIN VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group"); VATPostingSetup.TESTFIELD("Adv. Invoice Correction Type",VATPostingSetup."Adv. Invoice Correction Type"::Percentage); END; // End of the added lines. ... -
Change the code in the CalcPrepaymentToDeduct function in the "Sales Line" table (37) as follows:
-
Delete the following local variables:
PrepmtPct: Decimal;
AbsoluteAdvCorrection : Boolean; -
Change the code as follows:
Existing code...
IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN GetSalesHeader; 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 ELSE "Prepmt Amt to Deduct" := 0 // End of the deleted lines. ...Replacement code
...
IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN GetSalesHeader; 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 ELSE "Prepmt Amt to Deduct" := 0 // End of the added lines. ...
-
-
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; -
Change the code in the Prepmt Amt to Deduct - OnValidate trigger in the "Purchase Line" table (39) as follows:
Existing code...
FIELDERROR( "Prepmt Amt to Deduct", STRSUBSTNO(Text039,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted")); IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN // Delete the following line. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted"); ...Replacement code
...
FIELDERROR( "Prepmt Amt to Deduct", STRSUBSTNO(Text039,"Prepmt. Amt. Inv." - "Prepmt Amt Deducted")); IF "Qty. to Invoice" = Quantity - "Quantity Invoiced" THEN // Add the following lines. TESTFIELD("Prepmt Amt to Deduct","Prepmt. Amt. Inv." - "Prepmt Amt Deducted"); GetPurchHeader; IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN BEGIN VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group"); VATPostingSetup.TESTFIELD("Adv. Invoice Correction Type",VATPostingSetup."Adv. Invoice Correction Type"::Percentage); END; // End of the added lines. ... -
Change the code in the CalcPrepaymentToDeduct function in the "Purchase Line" table (39). To do this, follow these steps:
-
Delete the following local variables:
PrepmtPct@ : Decimal;
AbsoluteAdvCorrection@ : Boolean; -
Change the code as follows:
Existing code...
IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN GetPurchHeader; 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 ELSE "Prepmt Amt to Deduct" := 0 // End of the deleted lines. ...Replacement code
...
IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN GetPurchHeader; 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 ELSE "Prepmt Amt to Deduct" := 0 // End of the added lines. ...
-
-
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; -
Change the code in the OnRun trigger in the "Sales-Post" codeunit (80) as follows:
Existing code...
ItemJnlRollRndg := FALSE; LineCount := LineCount + 1; 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
...
ItemJnlRollRndg := FALSE; LineCount := LineCount + 1; 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 IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN TestPrepmtAmount; // End of the added 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; ... -
Create a new TestPrepmtAmount function in the "Sales-Post" codeunit (80) as follows:
PROCEDURE TestPrepmtAmount@1470003();
VAR AllowedQtyToShip@1470000 : Decimal; SalesAdvLetterHeader@1470001 : Record 26585; BEGIN WITH SalesLine DO BEGIN IF ("Prepmt. Line Amount" = 0) OR (Quantity = 0) THEN EXIT; SalesAdvLetterHeader.SETRANGE("Order No.","Document No."); IF NOT SalesAdvLetterHeader.ISEMPTY THEN BEGIN 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; END; -
Change the code in the OnRun trigger in the "Purch.-Post" codeunit (90) as follows:
Existing code...
IF GUIALLOWED THEN Window.UPDATE(2,LineCount); IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THEN PurchLine."VAT Date" := "VAT Date"; IF Invoice THEN TestPrepmtAmount; IF PurchLine.Type = PurchLine.Type::"Charge (Item)" THEN BEGIN PurchLine.TESTFIELD(Amount); PurchLine.TESTFIELD("Job No.",''); END; ...Replacement code
...
IF GUIALLOWED THEN Window.UPDATE(2,LineCount); IF Invoice AND (NOT GLSetup."Allow VAT Date Change in Lines") THEN PurchLine."VAT Date" := "VAT Date"; IF Invoice THEN // Add the following line. IF PurchHeader."Prepayment Type" = PurchHeader."Prepayment Type"::Advance THEN TestPrepmtAmount; IF PurchLine.Type = PurchLine.Type::"Charge (Item)" THEN BEGIN PurchLine.TESTFIELD(Amount); PurchLine.TESTFIELD("Job No.",''); END; ... -
Delete the TestPrepmtAmount function and create it again in the "Sales-Post" codeunit (80) as follows:
LOCAL PROCEDURE TestPrepmtAmount@55();
VAR AllowedQtyToReceive@1470000 : Decimal; PurchAdvLetterHeader@147001 : Record 26587; BEGIN WITH PurchLine DO BEGIN IF ("Prepmt. Line Amount" = 0) OR (Quantity = 0) THEN EXIT; PurchAdvLetterHeader.SETRANGE("Order No.","Document No."); IF NOT PurchAdvLetterHeader.ISEMPTY THEN BEGIN 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; END; END; -
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); IF SalesLines.FIND('-') THEN BEGIN REPEAT ...Replacement code
...
// Add the following lines. IF SalesHeader."Prepayment Type" = SalesHeader."Prepayment Type"::Advance THEN EXIT(IsNotInvoicedSalesAdvLetter(SalesHeader."No.")); // End of the added lines. SalesLines.SETRANGE("Document Type",SalesHeader."Document Type"); SalesLines.SETRANGE("Document No.",SalesHeader."No."); SalesLines.SETFILTER("Prepmt. Line Amount",'<>%1',0); IF SalesLines.FIND('-') THEN BEGIN REPEAT ... -
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); IF PurchaseLines.FIND('-') THEN BEGIN REPEAT ...Replacement code
...
// Add the following lines. IF PurchaseHeader."Prepayment Type" = PurchaseHeader."Prepayment Type"::Advance THEN EXIT(IsNotInvoicedPurchAdvLetter(PurchaseHeader."No.")); // End of the added lines. PurchaseLines.SETRANGE("Document Type",PurchaseHeader."Document Type"); PurchaseLines.SETRANGE("Document No.",PurchaseHeader."No."); PurchaseLines.SETFILTER("Prepmt. Line Amount",'<>%1',0); IF PurchaseLines.FIND('-') THEN BEGIN REPEAT ... -
Create a new IsNotInvoicedSalesAdvLetter local function in the "Approvals Management" codeunit (439) as follows:
LOCAL PROCEDURE IsNotInvoicedSalesAdvLetter@38(SalesOrderNo@1170000000 : Code[30]) : Boolean;
VAR SalesAdvLetterHeader@1001 : Record 26585; SalesAdvLetterLine@1002 : Record 26586; BEGIN WITH SalesAdvLetterHeader DO BEGIN SETRANGE("Order No.",SalesOrderNo); IF FIND('-') THEN REPEAT SalesAdvLetterLine.SETRANGE("Letter No.","No."); IF SalesAdvLetterLine.FIND('-') THEN REPEAT IF SalesAdvLetterLine."Amount Including VAT" <> SalesAdvLetterLine."Amount Invoiced" THEN EXIT(TRUE); UNTIL SalesAdvLetterLine.NEXT = 0; UNTIL NEXT = 0; END; END; -
Create a new IsNotInvoicedPurchAdvLetter local function in the "Approvals Management" codeunit (439) as follows:
LOCAL PROCEDURE IsNotInvoicedPurchAdvLetter@39(PurchOrderNo@1170000000 : Code[30]) : Boolean;
VAR PurchAdvLetterHeader@1001 : Record 26587; PurchAdvLetterLine@1002 : Record 26588; BEGIN WITH PurchAdvLetterHeader DO BEGIN SETRANGE("Order No.",PurchOrderNo); IF FIND('-') THEN REPEAT PurchAdvLetterLine.SETRANGE("Letter No.","No."); IF PurchAdvLetterLine.FIND('-') THEN REPEAT IF PurchAdvLetterLine."Amount Including VAT" <> PurchAdvLetterLine."Amount Invoiced" THEN EXIT(TRUE); UNTIL PurchAdvLetterLine.NEXT = 0; UNTIL NEXT = 0; END; END;
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 Use for other considerations.