意大利版 Microsoft Dynamics NAV 5.0 Service Pack 1 中的内部统计日志行中,国家/地区代码并不总是正确的

本文适用于) 语言区域设置的意大利语 (的 Microsoft Dynamics NAV。

在意大利版本的 Microsoft Dynamics NAV 5.0 Service Pack 1 (SP1) 中应用修补程序2275869后,内部统计日志行中的国家/地区代码并不总是正确。 

有关修补程序2275869的详细信息,请单击下面的序列号以查看Microsoft知识库中的文章:
2275869 “VAT 注册号”字段中的值错误地导出到意大利版 Microsoft Dynamics NAV 5.0 Service Pack 1 中的 Scambi.cee 文件中

症状

出现此问题是因为国家/地区代码取自项账本条目。 在某些特定情况下,国家/地区代码应取自“帐单到”字段或“付款”字段。

原因

修补程序信息

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

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

代码更改

注意 在将修补程序应用到生产计算机之前,始终在受控环境中测试代码修复。
要解决此问题,请按照下列步骤操作:

  1. 更改项编号中的代码。- Intrastat Jnl 中的 OnValidate 触发器。行表 (263) 如下所示:
    现有代码

    ...
    
    "Tariff No." := Item."Tariff No.";
    
    //Delete the following line.
    "Country/Region of Origin Code" := Item."Country/Region of Origin Code";
    
    GetItemDescription;
    

    替换代码

    ...
    
    "Tariff No." := Item."Tariff No.";
    
    //Add the following line.
    "Country/Region of Origin Code" := GetIntrastatCountryCode(Item."Country/Region of Origin Code");
    
    GetItemDescription;
    
  2. 更改 Intrastat Jnl 中 ValidateSourceEntryNo 函数中的代码。行表 (263) 如下所示:
    现有代码

    ...
    
    Date := VATEntry."Document Date"; 
    
    //Delete the following line.
    "Country/Region Code" := VATEntry."Country/Region Code"; 
    
    "VAT Registration No." := VATEntry."VAT Registration No.";
    ...
    

    替换代码

    ...
    
    Date := VATEntry."Document Date"; 
    
    //Add the following line.
    "Country/Region Code" := GetIntrastatCountryCode(VATEntry."Country/Region Code");
    
    "VAT Registration No." := VATEntry."VAT Registration No.";
    ...
    
  3. 创建一个新的 GetIntrastatCountryCode 函数,该函数使用 Code 类型和 10 作为 Intrastat Jnl 中的返回值的长度。行表 (263) 。 若要创建此函数,请执行以下步骤:

    1. 添加新的本地参数,然后指定参数,如下所示:

      • Var
      • 名称:CountryRegionCode
      • DataType代码
      • 长度:10
    2. 添加新的局部变量,然后指定变量,如下所示:

      • 名称:CountryRegion
      • DataTypeRecord
      • 子类型国家/地区
    3. 添加代码,如下所示:

      IF CountryRegion.GET(CountryRegionCode) THEN
      EXIT(CountryRegion."Intrastat Code");
      
  4. 更改 Get Item Ledger Entries 表的 InsertItemJnlLine 函数中的代码 (594) ,如下所示:
    现有代码 1

    ...
    
    WITH IntrastatJnlLine DO BEGIN
    INIT;
    "Line No." := "Line No." + 10000;
    Date := "Item Ledger Entry"."Last Invoice Date";
    
    //Delete the following line.
    "Country/Region Code" := "Item Ledger Entry"."Country/Region Code"; 
    
    "Transaction Type" := "Item Ledger Entry"."Transaction Type";
    ...
    

    替换代码 1

    ...
    
    WITH IntrastatJnlLine DO BEGIN
    INIT;
    "Line No." := "Line No." + 10000;
    Date := "Item Ledger Entry"."Last Invoice Date";
    
    //Add the following line.
    "Country/Region Code" := GetIntrastatCountryCode("Item Ledger Entry"."Country/Region Code");
    
    "Transaction Type" := "Item Ledger Entry"."Transaction Type";
    ...
    

    现有代码 2

    ...
    
    IF SalesShipHeader.GET("Item Ledger Entry"."Document No.") THEN BEGIN
    IF Customer.GET(SalesShipHeader."Bill-to Customer No.") THEN BEGIN 
    "VAT Registration No." := Customer."VAT Registration No.";
    
    //Delete the following line.
    "Country/Region Code" := Customer."Country/Region Code"; 
    
    END;
    END ELSE BEGIN
    SalesSetup.GET;
    IF NOT SalesSetup."Shipment on Invoice" THEN BEGIN
    IF SalesInvHeader.GET("Item Ledger Entry"."Document No.") THEN
    IF Customer.GET(SalesInvHeader."Bill-to Customer No.") THEN BEGIN 
    "VAT Registration No." := Customer."VAT Registration No.";
    
    //Delete the following line.
    "Country/Region Code" := Customer."Country/Region Code";
    
    END;
    END ELSE
    IF SalesCrMemoHeader.GET(ValueEntry."Document No.") THEN
    IF Customer.GET(SalesCrMemoHeader."Bill-to Customer No.") THEN BEGIN
    "VAT Registration No." := Customer."VAT Registration No.";
    
    //Delete the following line.
    "Country/Region Code" := Customer."Country/Region Code";
    
    END;
    END; 
    ...
    

    替换代码 2

    ...
    
    IF SalesShipHeader.GET("Item Ledger Entry"."Document No.") THEN BEGIN
    IF Customer.GET(SalesShipHeader."Bill-to Customer No.") THEN BEGIN 
    "VAT Registration No." := Customer."VAT Registration No.";
    
    //Add the following line.
    "Country/Region Code" := GetIntrastatCountryCode(Customer."Country/Region Code"); 
    
    END;
    END ELSE BEGIN
    SalesSetup.GET;
    IF NOT SalesSetup."Shipment on Invoice" THEN BEGIN
    IF SalesInvHeader.GET("Item Ledger Entry"."Document No.") THEN
    IF Customer.GET(SalesInvHeader."Bill-to Customer No.") THEN BEGIN 
    "VAT Registration No." := Customer."VAT Registration No.";
    
    //Add the following line.
    "Country/Region Code" := GetIntrastatCountryCode(Customer."Country/Region Code"); 
    
    END;
    END ELSE
    IF SalesCrMemoHeader.GET(ValueEntry."Document No.") THEN
    IF Customer.GET(SalesCrMemoHeader."Bill-to Customer No.") THEN BEGIN
    "VAT Registration No." := Customer."VAT Registration No.";
    
    //Add the following line.
    "Country/Region Code" := GetIntrastatCountryCode(Customer."Country/Region Code"); 
    
    END;
    END; 
    ...
    

    现有代码 3

    ...
    
    IF IntrastatJnlBatch.Type = IntrastatJnlBatch.Type :: Purchases THEN BEGIN
    IF (ItemVendor.GET("Item Ledger Entry"."Source No.","Item Ledger Entry"."Item No.","Item Ledger Entry"."Variant Code")) AND
    (ItemVendor."Country/Region of Origin Code" <> '') THEN
    
    //Delete the following line.
    "Country/Region of Origin Code" := ItemVendor."Country/Region of Origin Code"
    
    ELSE
    
    //Delete the following line.
    "Country/Region of Origin Code" := Item."Country/Region of Origin Code";
    
    FindSourceCurrency(
    "Item Ledger Entry"."Source No.","Item Ledger Entry"."Document Date","Item Ledger Entry"."Posting Date");
    END ELSE
    
    //Delete the following line.
    "Country/Region of Origin Code" := Item."Country/Region of Origin Code";
    
    
    "Source Type" := "Source Type"::"Item entry";
    ...
    

    替换代码 3

    ...
    
    IF IntrastatJnlBatch.Type = IntrastatJnlBatch.Type :: Purchases THEN BEGIN
    IF (ItemVendor.GET("Item Ledger Entry"."Source No.","Item Ledger Entry"."Item No.","Item Ledger Entry"."Variant Code")) AND
    (ItemVendor."Country/Region of Origin Code" <> '') THEN
    
    //Add the following line.
    "Country/Region of Origin Code" := GetIntrastatCountryCode(ItemVendor."Country/Region of Origin Code")
    
    ELSE
    
    //Add the following line.
    "Country/Region of Origin Code" := GetIntrastatCountryCode(Item."Country/Region of Origin Code");
    
    FindSourceCurrency(
    "Item Ledger Entry"."Source No.","Item Ledger Entry"."Document Date","Item Ledger Entry"."Posting Date");
    END ELSE
    
    //Add the following line.
    "Country/Region of Origin Code" := GetIntrastatCountryCode(Item."Country/Region of Origin Code");
    
    "Source Type" := "Source Type"::"Item entry";
    ...
    
  5. 将 Get Item Ledger Entries 表中的 InsertJobLedgerLine 函数中的代码更改为 594 (,) 如下所示:
    现有代码

    ...
    
    Date := "Job Ledger Entry"."Posting Date";
    
    //Delete the following line.
    "Country/Region Code" := "Job Ledger Entry"."Country/Region Code";
    
    "Transaction Type" := "Job Ledger Entry"."Transaction Type";
    ...
    

    替换代码

    ...
    
    Date := "Job Ledger Entry"."Posting Date";
    
    //Add the following line.
    "Country/Region Code" := GetIntrastatCountryCode("Job Ledger Entry"."Country/Region Code");
    
    "Transaction Type" := "Job Ledger Entry"."Transaction Type";
    ...
    

先决条件

必须安装意大利版 Microsoft Dynamics NAV 5.0 Service Pack 1 才能应用此修补程序。

删除信息

无法删除此修补程序。

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

状态

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