在義大利版 Microsoft Dynamics NAV 中建立 Intrastat 日記帳時,信用備忘錄的費用項目不會被加入

套用到
Dynamics NAV 2009 Dynamics NAV 2009 Service Pack 1 Microsoft Dynamics NAV 5.0 Service Pack 1

本文適用於義大利語 (Microsoft Dynamics NAV,) 語言地點。

症狀

假設你建立一張發票,使用義大利版 Microsoft Dynamics NAV 的商品費用,並將發票連結到歐盟 (歐盟) 客戶的現有貨運。 當你建立 Intrastat 日記帳時,信用備忘錄的費用項目不會被加入 Intrastat 日記帳中。
此問題發生於以下產品:

  • Microsoft Dynamics NAV 2009 Service Pack 1 的義大利版本
  • Microsoft Dynamics NAV 2009 的義大利版本
  • Microsoft Dynamics NAV 5.0 Service Pack 1 的義大利版本

解決方式

Hotfix 資訊

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

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

            
          

安裝資訊

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

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

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

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

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

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

法規變更

注意:在將修正程式套用到生產電腦之前,務必在受控環境中測試修正。
要解決此問題,請將「取得項目分類帳分錄」報告中的程式碼 (594) 。 若要這麼做,請按照下列步驟進行:

  1. 請將項目帳本項目 - OnPreDataItem 觸發器的程式碼更改如下:
    現有程式碼

    ...
    END;
    
    IntrastatJnlLine2.SETCURRENTKEY("Source Type","Source Entry No.");
    IntrastatJnlLine2.SETRANGE("Source Type",IntrastatJnlLine2."Source Type"::"Item entry");
    
    WITH ValueEntry DO BEGIN
      SETCURRENTKEY("Item Ledger Entry No.");
    
    // Delete the following line.
      SETRANGE("Valuation Date",StartDate,EndDate);
    
      SETRANGE("Entry Type","Entry Type"::"Direct Cost");
    ...
    
    

    替換代碼

    ...
    END;
    
    // Add the following line.
    IntrastatJnlLine2.SETRANGE(IntrastatJnlLine2."Journal Batch Name",IntrastatJnlBatch.Name); 
    
    IntrastatJnlLine2.SETCURRENTKEY("Source Type","Source Entry No.");
    IntrastatJnlLine2.SETRANGE("Source Type",IntrastatJnlLine2."Source Type"::"Item entry");
    
    WITH ValueEntry DO BEGIN
      SETCURRENTKEY("Item Ledger Entry No.");
    
    // Add the following line.
      SETRANGE("Posting Date",StartDate,EndDate);
    
      SETRANGE("Entry Type","Entry Type"::"Direct Cost");
    ...
    
    
  2. 從項目帳本項目 - OnAfterGetRecord 觸發器中刪除具有以下屬性的本地變數:

    • 姓名地點
    • DataTypeRecord
    • 子類型地點
  3. 從項目帳本項目 - OnAfterGetRecord 觸發器中刪除具有以下屬性的本地變數:

    • 名稱ItemLedgEntry
    • DataTypeRecord
    • 子類型項目分類帳條目
  4. 從項目帳本項目 - OnAfterGetRecord 觸發器中刪除具有以下屬性的本地變數:

    • 名稱包含
    • DataTypeBoolean
  5. 請將項目帳本項目項目 - OnAfterGetRecord 觸發器的代碼更改如下:
    現有程式碼

    ...
    IntrastatJnlLine2.SETRANGE("Source Entry No.","Entry No.");
    IF IntrastatJnlLine2.FINDFIRST THEN
      CurrReport.SKIP;
    
    // Delete the following lines.
                               IF "Drop Shipment" THEN BEGIN
                                 IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR
                                    ("Country/Region Code" = '')
                                 THEN
                                   CurrReport.SKIP;
                                 IF "Applies-to Entry" = 0 THEN BEGIN
                                   ItemLedgEntry.SETCURRENTKEY("Item No.","Posting Date");
                                   ItemLedgEntry.SETRANGE("Item No.","Item No.");
                                   ItemLedgEntry.SETRANGE("Posting Date","Posting Date");
                                   ItemLedgEntry.SETRANGE("Applies-to Entry","Entry No.");
                                   ItemLedgEntry.FINDFIRST;
                                 END ELSE
                                   ItemLedgEntry.GET("Applies-to Entry");
                                 IF (ItemLedgEntry."Country/Region Code" <> CompanyInfo."Country/Region Code") AND
                                    (ItemLedgEntry."Country/Region Code" <> '')
                                 THEN
                                   CurrReport.SKIP;
                               END ELSE IF "Entry Type" = "Entry Type"::Transfer THEN BEGIN
                                 IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR
                                    ("Country/Region Code" = '')
                                 THEN
                                   CurrReport.SKIP;
                                 IF "Transfer Order No." = '' THEN BEGIN
                                   Location.GET("Location Code");
                                   IF (Location."Country/Region Code" <> '') AND
                                      (Location."Country/Region Code" <> CompanyInfo."Country/Region Code")
                                   THEN
                                     CurrReport.SKIP;
                                 END ELSE BEGIN
                                   ItemLedgEntry.SETRANGE("Transfer Order No.","Transfer Order No.");
                                   ItemLedgEntry.SETFILTER("Country/Region Code",'%1 | %2','',CompanyInfo."Country/Region Code");
                                   IF ItemLedgEntry.FINDSET THEN
                                     REPEAT
                                       Location.GET(ItemLedgEntry."Location Code");
                                       IF Location."Use As In-Transit" THEN
                                         Include:= TRUE;
                                     UNTIL Include OR (ItemLedgEntry.NEXT = 0);
                                   IF NOT Include THEN
                                     CurrReport.SKIP;
                                 END;
                               END ELSE IF "Location Code" <> '' THEN BEGIN
                                 Location.GET("Location Code");
                                 CheckILE(Location."Country/Region Code");
                               END ELSE BEGIN
                                   IF "Entry Type" = "Entry Type"::Purchase THEN
                                     CheckILE(CompanyInfo."Ship-to Country/Region Code");
                                   IF "Entry Type" = "Entry Type"::Sale THEN
                                     CheckILE(CompanyInfo."Country/Region Code");
                               END;
    // End of the lines.
    
    TotalInvoicedQty := 0;
    ...
    
    

    替換代碼

    ...
    IntrastatJnlLine2.SETRANGE("Source Entry No.","Entry No.");
    IF IntrastatJnlLine2.FINDFIRST THEN
      CurrReport.SKIP;
    
    
    TotalInvoicedQty := 0;
    ....
    
    Create a new DataItem as follow:
    DataItem Name
    Value Entry <Value Entry>
    
    Click Propriety and set:
    DataItemTableView = SORTING(Entry No.)
    
    In the Value Entry - OnPreDataItem() add the following code lines:
    
    SETRANGE("Posting Date",StartDate,EndDate);
    SETFILTER("Item Charge No.",'<> %1','');
    "Item Ledger Entry".SETRANGE("Posting Date");
    
    IntrastatJnlLine2.SETRANGE(IntrastatJnlLine2."Journal Batch Name",IntrastatJnlBatch.Name);
    IntrastatJnlLine2.SETCURRENTKEY("Source Type","Source Entry No.");
    IntrastatJnlLine2.SETRANGE("Source Type",IntrastatJnlLine2."Source Type"::"Item entry");
    
    In the Value Entry - OnAfterGetRecord() trigger add the following code lines:
    
    
    IntrastatJnlLine2.SETRANGE("Source Entry No.","Item Ledger Entry No.");
    IF IntrastatJnlLine2.FINDFIRST THEN
      CurrReport.SKIP;
    
    IF "Item Ledger Entry".GET("Item Ledger Entry No.")
    THEN BEGIN
      IF ("Item Ledger Entry"."Posting Date" > StartDate) AND ("Item Ledger Entry"."Posting Date" < EndDate) THEN
        CurrReport.SKIP;
      IF "Country/Region".GET("Item Ledger Entry"."Country/Region Code") THEN
        IF "Country/Region"."EU Country/Region Code" = '' THEN
          CurrReport.SKIP;
      TestILE("Item Ledger Entry");
    
    InsertValueEntryLine;
    END;
    ...
    
    
  6. 在 CheckILE 函式中更改程式碼如下:
    現有程式碼

    ...
    // Delete the following lines.
    IF NOT ((("Item Ledger Entry"."Country/Region Code" = CompanyInfo."Country/Region Code") 
    OR  
                 ("Item Ledger Entry"."Country/Region Code" = '')) XOR   
                 ((CountryRegionCode = CompanyInfo."Country/Region Code") OR 
                 (CountryRegionCode = '')))  
    // End of the lines.
    
    
    THEN
    ...
    
    

    替換代碼

    ...
    // Add the following lines.
    IF ("Item Ledger Entry"."Country/Region Code" IN [CompanyInfo."Country/Region Code",'']) =  
       (CountryRegionCode IN [CompanyInfo."Country/Region Code",''])  
    // End of the lines.
    
    THEN
    ...
    
    
  7. 建立 TestILE 全域函式。 若要這麼做,請按照下列步驟進行:

    1. 新增參數,然後指定該參數如下:

      • Var沒有
      • 名稱:ILE
      • DataTypeRecord
      • 子類型項目分類帳分錄
    2. 新增一個局部變數,然後指定該變數如下:

      • 名稱:ItemLedgEntry
      • DataTypeRecord
      • 子類型項目分類帳條目
    3. 新增一個局部變數,然後指定該變數如下:

      • 姓名:地點
      • DataTypeRecord
      • 子類型地點
    4. 新增一個局部變數,然後指定該變數如下:

      • 名稱:包含
      • DataTypeBoolean
    5. 程式碼加入如下:

      WITH ILE DO BEGIN
        IF "Drop Shipment" THEN BEGIN
          IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR
             ("Country/Region Code" = '')
          THEN
            CurrReport.SKIP;
          IF "Applies-to Entry" = 0 THEN BEGIN
            ItemLedgEntry.SETCURRENTKEY("Item No.","Posting Date");
            ItemLedgEntry.SETRANGE("Item No.","Item No.");
            ItemLedgEntry.SETRANGE("Posting Date","Posting Date");
            ItemLedgEntry.SETRANGE("Applies-to Entry","Entry No.");
            ItemLedgEntry.FINDFIRST;
          END ELSE
            ItemLedgEntry.GET("Applies-to Entry");
          IF (ItemLedgEntry."Country/Region Code" <> CompanyInfo."Country/Region Code") AND
             (ItemLedgEntry."Country/Region Code" <> '')
          THEN
            CurrReport.SKIP;
        END ELSE IF "Entry Type" = "Entry Type"::Transfer THEN BEGIN
          IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR
             ("Country/Region Code" = '')
          THEN
            CurrReport.SKIP;
          IF "Transfer Order No." = '' THEN BEGIN
            Location.GET("Location Code");
            IF (Location."Country/Region Code" <> '') AND
               (Location."Country/Region Code" <> CompanyInfo."Country/Region Code")
            THEN
              CurrReport.SKIP;
          END ELSE BEGIN
            ItemLedgEntry.SETRANGE("Transfer Order No.","Transfer Order No.");
            ItemLedgEntry.SETFILTER("Country/Region Code",'%1 | %2','',CompanyInfo."Country/Region Code");
            IF ItemLedgEntry.FINDSET THEN
              REPEAT
                Location.GET(ItemLedgEntry."Location Code");
                IF Location."Use As In-Transit" THEN
                  Include:= TRUE;
              UNTIL Include OR (ItemLedgEntry.NEXT = 0);
            IF NOT Include THEN
              CurrReport.SKIP;
          END;
        END ELSE IF "Location Code" <> '' THEN BEGIN
          Location.GET("Location Code");
          CheckILE(Location."Country/Region Code");
        END ELSE BEGIN
          IF "Entry Type" = "Entry Type"::Purchase THEN
            CheckILE(CompanyInfo."Ship-to Country/Region Code");
          IF "Entry Type" = "Entry Type"::Sale THEN
            CheckILE(CompanyInfo."Country/Region Code");
        END;
      END;
      
      
  8. 建立 InsertValueEntryLine 全域函式。 若要這麼做,請按照下列步驟進行:

    1. 新增一個局部變數,然後指定該變數如下:

      • 姓名:地點
      • DataTypeRecord
      • 子類型地點
    2. 程式碼加入如下:

      GetGLSetup;
      WITH IntrastatJnlLine DO BEGIN
        INIT;
        "Line No." := "Line No." + 10000;
        Date := "Value Entry"."Posting Date";
        "Country/Region Code" := "Item Ledger Entry"."Country/Region Code";
        "Transaction Type" := "Item Ledger Entry"."Transaction Type";
        "Transport Method" := "Item Ledger Entry"."Transport Method";
        "Source Entry No." := "Item Ledger Entry"."Entry No.";
        Quantity := "Item Ledger Entry".Quantity;
        "Document No." := "Value Entry"."Document No.";
        "Item No." := "Item Ledger Entry"."Item No.";
        "Entry/Exit Point" := "Item Ledger Entry"."Entry/Exit Point";
        Area := "Item Ledger Entry".Area;
        "Transaction Specification" := "Item Ledger Entry"."Transaction Specification";
        Amount := ROUND(ABS("Value Entry"."Sales Amount (Actual)"),1);
      
        IF Quantity < 0 THEN
          Type := Type::Shipment
        ELSE
          Type := Type::Receipt;
      
        IF ("Country/Region Code" = '') OR
           ("Country/Region Code" = CompanyInfo."Country/Region Code")
        THEN BEGIN
          IF "Item Ledger Entry"."Location Code" = '' THEN
            "Country/Region Code" := CompanyInfo."Ship-to Country/Region Code"
          ELSE BEGIN
            Location.GET("Item Ledger Entry"."Location Code");
            "Country/Region Code" := Location."Country/Region Code"
          END;
        END;
      
        VALIDATE("Item No.");
        "Source Type" := "Source Type"::"Item entry";
        VALIDATE(Quantity,ROUND(ABS(Quantity),0.00001));
        VALIDATE("Cost Regulation %",IndirectCostPctReq);
      
        INSERT;
      END;
      
      

          

先決條件

您必須安裝以下其中一項產品才能套用此熱修補:

  • Microsoft Dynamics NAV 2009 Service Pack 1 的義大利版本
  • Microsoft Dynamics NAV 2009 的義大利版本
  • Microsoft Dynamics NAV 5.0 Service Pack 1 的義大利版本

移除資訊

你無法移除這個熱修正。

狀態

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

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