當您在東歐版 Microsoft Dynamics NAV 2009 R2 中,為銷售訂單貼出部分出貨時,「訂單 [number] 上有未公布的預付款金額」錯誤訊息

套用到
Dynamics NAV 2009

本文適用於Microsoft Dynamics 東歐 (EE) 區域的 NAV。

症狀

當您在 Microsoft Dynamics NAV 2009 R2 東歐版本中為銷售訂單進行部分出貨時,您會收到以下錯誤訊息:

注意

訂單 號碼上有未公布的預付款金額。

此問題發生在銷售訂單中指定並處理預付款時。

解決方式

Hotfix 資訊

Microsoft 現在已經支援熱修補程式。 然而,這僅是為了修正本文所描述的問題。 只應用在遇到這個特定問題的系統上。 此熱修補可能會進行額外測試。 因此,如果你沒有受到這個問題嚴重影響,我們建議你等待下一個包含此熱修補的 Microsoft Dynamics NAV 服務包或下一個 Microsoft Dynamics NAV 版本。

注意:在特殊情況下,若 Microsoft Dynamics 及相關產品的技術支援專業人員判斷特定更新能解決您的問題,通常因支援電話而產生的費用可能會被取消。 一般來說,如果有所描述之特定更新無法解決的其他支援問題,才會收取支援費用。

            
          

安裝資訊

Microsoft 僅提供圖例的程式設計範例,不含明示或暗示的擔保。 這包括 (但不限於) 適用于特定目的之可操作性或適用性的暗示擔保。 本文假設您熟悉正在示範的程式設計語言,以及用來建立和進行程式偵錯工具的工具。 Microsoft 技術支援工程師可以協助說明特定程序的功能,但不會修改這些範例以提供附加功能或建構程序來滿足您的特定需求。

注意:安裝此熱修補程式前,請確認所有 Microsoft Navision 用戶端使用者都已登出系統。 這包括Microsoft Navision 應用服務 (NAS) 用戶端使用者。 當你實施這個熱修補時,應該只有你一個登入的客戶端使用者。

要實作這個熱修補,你必須擁有開發者授權。

我們建議在 Windows 登入視窗或資料庫登入視窗中,將使用者帳號分配「SUPER」角色 ID。 若使用者帳號無法被指派「SUPER」角色 ID,您必須驗證該帳號擁有以下權限:

  • 你要更改的物件的修改權限。
  • 系統物件 ID 5210 的執行權限,以及系統物件 ID 9015 的執行權限。

                
注意:除非你必須進行資料修復,否則你不必擁有資料儲存的權利。

法規變更

注意:在將修正程式套用到生產電腦之前,務必在受控環境中測試修正。
如果要解決這個問題,請依照下列步驟執行。

  1. 在審核管理代碼單元 (439) 中,在 TestSalesPrepayment 函式中更改代碼如下:
    現有程式碼

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

    替換代碼

    ...
    // 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. 在核准管理代碼單元 (439中,) 更改 TestPurchasePrepayment 函式中的代碼如下:
    現有程式碼

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

    替換代碼

    ...
    // 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. 在「銷售-貼文」代碼單元 (80) 中,將 OnRun 觸發器的代碼變更如下:
    現有程式碼

    ...
    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;
    ...
    

    替換代碼

    ...
    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. 在「銷售-發佈」碼單元 (80) 建立一個新的 TestPrepmtAmount 函式,內容如下:

    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. 在「Purch.-Post」碼單元的 TestPrepmtAmount 函式中刪除以下本地變數 (90) :

    • 剩餘金額
    • 剩餘數量
  6. 在「Purch.-Post」碼單元的 TestPrepmtAmount 函式中新增一個本地變數, (90) ,然後指定該變數如下:

    • 名稱:AllowedQtyToReceive
    • 資料型態: 十進位
  7. 在「Purch.-Post」碼單元中, (90) 的 TestPrepmtAmount 函式中,將程式碼變更如下:
    現有程式碼

    ...
    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;
    ...
    

    替換代碼

    ...
    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. 將預備稅(Prepmt Amt)中的代碼改為銷售線表 (37 Deduct-OnValidate 觸發碼,) 如下:
    現有程式碼

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

    替換代碼

    ...
    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. 在銷售線表中 37) (刪除以下本地變數

    • PrepmtPct(預備電腦)
    • 絕對修正
  10. 將銷售線表中 CalcPrepaymentToDeduct 函式中的 37) (變更如下:
    現有程式碼

    ...
    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
    ...
    

    替換代碼

    ... 
    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. 在銷售線表 (37) 建立一個新的預付稅扣除函數,如下:

    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. 在購買行表 (39) 中,將預備稅額的代碼改為扣除 - 驗證觸發,如下:
    現有程式碼

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

    替換代碼

    ...
    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. 在購買行表中刪除以下本地變數 (39) :

    • PrepmtPct(預備電腦)
    • 絕對修正
  14. 在購買行表中 (39) 中,將CalcPrepaymentToDeduct函數中的代碼更改如下:
    現有程式碼

    ...
    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
    ...
    

    替換代碼

    ...
    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. 在購買行表 (39) 建立一個新的預付扣款功能,如下:

    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;
    

先決條件

你必須安裝東歐版的 Microsoft Dynamics NAV 2009 R2 才能套用這個熱修補。

移除資訊

你無法移除這個熱修正。

狀態

Microsoft 已確認這是「適用對象」一節中列出的 Microsoft 產品中的問題。

注意本文為 Microsoft 支援單位內部直接建立的「快速發佈」文章。 此處包含的資訊是以其現況提供,用於回應新產生的問題。 由於快速發佈,資料可能包含拼字錯誤,並可能會隨時修訂,不另行通知。 請參閱使用條款以瞭解其他相關考量。