当在 Microsoft Dynamics NAV 2009 中引用发票的不同时间段内为欧盟供应商过帐收费项目信用单时,信用单行不包括在内部统计日记帐中

应用对象
Microsoft Dynamics NAV 2009 R2 Dynamics NAV 2009 Service Pack 1

本文适用于所有国家/地区和所有语言区域设置的 Microsoft Dynamics NAV 2009。

症状

在 Microsoft Dynamics NAV 2009 R2 和 Microsoft Dynamics NAV 2009 Service Pack 1 (SP1) 中,在引用发票的不同时间段内为欧盟 (欧盟) 供应商过帐费用项信用单时,信用单行不包括在内部统计日记帐中。

解决方法

修补程序信息

Microsoft现在提供了受支持的修补程序。 但是,它仅用于更正本文中所述的问题。 仅将其应用于遇到此特定问题的系统。 此修补程序可能会收到其他测试。 因此,如果你没有受到此问题的严重影响,我们建议你等待下一个Microsoft Dynamics NAV 2009 Service Pack 或包含此修补程序的下一Microsoft Dynamics NAV 版本。

注意 在特殊情况下,如果 Microsoft Dynamics 和相关产品的技术支持专业人员确定特定更新将解决你的问题,则通常由支持呼叫产生的费用可能会被取消。 对于相关特定升级无法解决的其他支持问题和事项,将照常收取支持费用。

            
          

安装信息

Microsoft 的编程示例仅用于说明,不做任何明示或暗示的保证。 这包括但不限于特定用途的适销性或适用性的隐含保证。 本文假定你熟悉所演示的编程语言以及用于创建和调试过程的工具。 Microsoft 支持工程师可以帮助解释特定过程的功能,但他们不会修改这些示例以提供新增功能或构建步骤以满足你的特定需要。

注意 在安装此修补程序之前,请验证所有 Microsoft Navision 客户端用户是否已从系统注销。 这包括 Microsoft Navision Application Services (NAS) 客户端用户。 实现此修补程序时,应是唯一登录的客户端用户。

若要实现此修补程序,必须具有开发人员许可证。

建议为 Windows 登录窗口或数据库登录名窗口中的用户帐户分配“SUPER”角色 ID。 如果无法为用户帐户分配“SUPER”角色 ID,则必须验证该用户帐户是否具有以下权限:

  • 要更改的 对象的“修改”权限。
  • 系统对象 ID 5210 对象和系统对象 ID 9015 对象的 Execute 权限。

                
注意 除非必须执行数据修复,否则您不必拥有数据存储的权限。

代码更改

注意 在将修补程序应用到生产计算机之前,始终在受控环境中测试代码修复。
若要解决此问题,请更改获取项账本条目报表中的代码 (594) 。 请按以下步骤完成此操作:

  1. 更改数据项编号 2 的代码,如下所示:
    现有代码 1

    ...
    SETRANGE("Country/Region Code",'');
    END;
    
    IntrastatJnlLine2.SETCURRENTKEY("Source Type","Source Entry No.");
    IntrastatJnlLine2.SETRANGE("Source Type",IntrastatJnlLine2."Source Type"::"Item entry");
    ...
    
    

    替换代码 1

    ...
    SETRANGE("Country/Region Code",'');
    END;
    
    // Add the following line.
    IntrastatJnlLine2.SETRANGE("Journal Batch Name",IntrastatJnlBatch.Name);
    // End of the line.
    
    IntrastatJnlLine2.SETCURRENTKEY("Source Type","Source Entry No.");
    IntrastatJnlLine2.SETRANGE("Source Type",IntrastatJnlLine2."Source Type"::"Item entry");
    ...
    
    

    现有代码 2

    ...
    WITH ValueEntry DO BEGIN
    SETCURRENTKEY("Item Ledger Entry No.");
    
    // Delete the following line.
    SETRANGE("Valuation Date",StartDate,EndDate);
    // End of the line.
    
    SETRANGE("Entry Type","Entry Type"::"Direct Cost");
    SETFILTER(
    "Item Ledger Entry Type",'%1|%2|%3',
    ...
    
    

    替换代码 2

    ...
    WITH ValueEntry DO BEGIN
    SETCURRENTKEY("Item Ledger Entry No.");
    
    // Add the following line.
    SETRANGE("Posting Date",StartDate,EndDate);
    // End of the line.
    
    SETRANGE("Entry Type","Entry Type"::"Direct Cost");
    SETFILTER(
    "Item Ledger Entry Type",'%1|%2|%3',
    ...
    
    

    现有代码 3

    ...
    END;
    END;
    
    // Delete the following lines.
    OnAfterGetRecord=VAR
    Location@1000 : Record 14;
    ItemLedgEntry@1001 : Record 32;
    Include@1002 : Boolean;
    BEGIN
    // End of the lines.
    
    IntrastatJnlLine2.SETRANGE("Source Entry No.","Entry No.");
    IF IntrastatJnlLine2.FINDFIRST THEN
    CurrReport.SKIP;
    ...
    
    

    替换代码 3

    ...
    END;
    END;
    
    OnAfterGetRecord=BEGIN
    IntrastatJnlLine2.SETRANGE("Source Entry No.","Entry No.");
    IF IntrastatJnlLine2.FINDFIRST THEN
    CurrReport.SKIP;
    ...
    
    

    现有代码 4

    ...
    IF IntrastatJnlLine2.FINDFIRST THEN
    CurrReport.SKIP;
    
    // Delete the following lines.
    IF "Entry Type" IN ["Entry Type"::Sale,"Entry Type"::Purchase] THEN BEGIN
    ItemLedgEntry.RESET;
    ItemLedgEntry.SETCURRENTKEY("Document No.","Document Type");
    ItemLedgEntry.SETRANGE("Document No.","Document No.");
    ItemLedgEntry.SETRANGE("Item No.","Item No.");
    ItemLedgEntry.SETRANGE(Correction,TRUE);
    ItemLedgEntry.SETRANGE("Document Type","Document Type"::"Sales Shipment");
    IF NOT ItemLedgEntry.ISEMPTY THEN
    CurrReport.SKIP;
    
    ItemLedgEntry.SETRANGE("Document Type","Document Type"::"Sales Return Receipt");
    IF NOT ItemLedgEntry.ISEMPTY THEN
    CurrReport.SKIP;
    
    ItemLedgEntry.SETRANGE("Document Type","Document Type"::"Purchase Receipt");
    IF NOT ItemLedgEntry.ISEMPTY THEN
    CurrReport.SKIP;
    
    ItemLedgEntry.SETRANGE("Document Type","Document Type"::"Purchase Return Shipment");
    IF NOT ItemLedgEntry.ISEMPTY THEN
    CurrReport.SKIP;
    END;
    
    CASE TRUE OF
    "Drop Shipment":
    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;
    "Entry Type" = "Entry Type"::Transfer:
    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;
    "Location Code" <> '':
    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;
    // End of the lines.
    
    TotalInvoicedQty := 0;
    TotalAmt := 0;
    TotalAmtExpected := 0;
    ...
    
    

    替换代码 4

    ...
    IF IntrastatJnlLine2.FINDFIRST THEN
    CurrReport.SKIP;
    
    // Add the following line.
    TestILE("Item Ledger Entry");
    // End of the line.
    
    TotalInvoicedQty := 0;
    TotalAmt := 0;
    TotalAmtExpected := 0;
    ...
    
    
  2. 更改数据项编号 4 的代码,如下所示:
    现有代码

    ...
    {
    }
    }
    }
    REQUESTFORM
    {
    ...
    
    

    替换代码

    ...
    {
    }
    }
    
    // Add the following lines.
    { PROPERTIES
    {
    DataItemTable=Table5802;
    DataItemTableView=SORTING(Entry No.);
    OnPreDataItem=BEGIN
    SETRANGE("Posting Date",StartDate,EndDate);
    SETFILTER("Item Charge No.",'<> %1','');
    "Item Ledger Entry".SETRANGE("Posting Date");
    
    IntrastatJnlLine2.SETRANGE("Journal Batch Name",IntrastatJnlBatch.Name);
    IntrastatJnlLine2.SETCURRENTKEY("Source Type","Source Entry No.");
    IntrastatJnlLine2.SETRANGE("Source Type",IntrastatJnlLine2."Source Type"::"Item entry");
    END;
    
    OnAfterGetRecord=BEGIN
    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;
    END;
    
    }
    SECTIONS
    {
    { PROPERTIES
    {
    SectionType=Body;
    SectionWidth=12000;
    SectionHeight=846;
    }
    CONTROLS
    {
    }
    }
    }
    }
    // End of the lines.
    
    }
    REQUESTFORM
    {
    ...
    
    
  3. 更改 TestILE 函数中的代码,如下所示:
    现有代码

    ...
    END;
    END;
    
    BEGIN
    END.
    }
    ...
    
    

    替换代码

    ...
    END;
    END;
    
    // Add the following lines.
    PROCEDURE TestILE@5(ILE@1000 : Record 32);
    VAR
    ItemLedgEntry@1003 : Record 32;
    Location@1002 : Record 14;
    Include@1001 : Boolean;
    BEGIN
    WITH ILE DO BEGIN
    IF "Entry Type" IN ["Entry Type"::Sale,"Entry Type"::Purchase] THEN BEGIN
    ItemLedgEntry.RESET;
    ItemLedgEntry.SETCURRENTKEY("Document No.","Document Type");
    ItemLedgEntry.SETRANGE("Document No.","Document No.");
    ItemLedgEntry.SETRANGE("Item No.","Item No.");
    ItemLedgEntry.SETRANGE(Correction,TRUE);
    ItemLedgEntry.SETRANGE("Document Type","Document Type"::"Sales Shipment");
    IF NOT ItemLedgEntry.ISEMPTY THEN
    CurrReport.SKIP;
    
    ItemLedgEntry.SETRANGE("Document Type","Document Type"::"Sales Return Receipt");
    IF NOT ItemLedgEntry.ISEMPTY THEN
    CurrReport.SKIP;
    
    ItemLedgEntry.SETRANGE("Document Type","Document Type"::"Purchase Receipt");
    IF NOT ItemLedgEntry.ISEMPTY THEN
    CurrReport.SKIP;
    
    ItemLedgEntry.SETRANGE("Document Type","Document Type"::"Purchase Return Shipment");
    IF NOT ItemLedgEntry.ISEMPTY THEN
    CurrReport.SKIP;
    END;
    
    CASE TRUE OF
    "Drop Shipment":
    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;
    "Entry Type" = "Entry Type"::Transfer:
    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;
    "Location Code" <> '':
    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;
    END;
    END;
    
    PROCEDURE InsertValueEntryLine@6();
    VAR
    Location@1000 : Record 14;
    BEGIN
    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;
    END;
    // End of the lines.
    
    BEGIN
    END.
    }
    ...
    
    

先决条件

必须安装以下产品之一才能应用此修补程序:

  • Microsoft Dynamics NAV 2009 R2
  • Microsoft Dynamics NAV 2009 Service Pack 1

删除信息

无法删除此修补程序。

状态

Microsoft 已确认在 "适用于" 部分中所列的 Microsoft 产品中存在问题。

注意这是一篇由 Microsoft 支持组织直接创建的“快速发布”文章。 本文所包含的信息是按原样提供的,以应对新出现的问题。 由于发布速度较快,这些材料可能包含印刷错误,无需通知即可随时修改。 有关其他注意事项,请参阅使用条款