在Microsoft Dynamics NAV 中过帐撤消发货后,“成本金额 (预期) (ACY) ”和“成本金额” (“实际) (ACY) ”字段中的值不正确

应用对象
Dynamics NAV 2009 Microsoft Dynamics NAV 5.0

本文适用于所有语言区域设置的 Microsoft Dynamics NAV。

症状

假设你在 Microsoft Dynamics NAV 中的财务管理中的总帐设置中设置了其他报告货币。 发布撤消发货后,你注意到“ 成本金额 (预期) (ACY) ”和“ 成本金额 (实际) (ACY) ”字段中的值在“库存值条目/项目账本条目”中不正确。
以下产品中会出现此问题:

  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)
  • Microsoft Dynamics NAV 2009 R2
  • Microsoft Dynamics NAV 2009
  • Microsoft Dynamics NAV 5.0 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 权限。

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

代码更改

注意 在将修补程序应用到生产计算机之前,始终在受控环境中测试代码修复。
要解决此问题,请按照下列步骤操作:
注意 由于全球版本和北美版本的代码不同,因此这两个更改日志都列在“全球版本”或“北美版本”的特定标题下。

  1. 更改 Item Jnl.-Post Line 代码单元中的 InsertValueEntry 函数中的代码 (22) ,如下所示:
    对于 Microsoft Dynamics NAV 5.0 SP1、Microsoft Dynamics NAV 2009、Microsoft Dynamics NAV 2009 SP1 和 Microsoft Dynamics NAV 2009 R2 的全球版本
    现有代码

    ...
             ELSE
            InvoicedQty := ValueEntry."Valued Quantity";
        END ELSE
          InvoicedQty := ValueEntry."Invoiced Quantity";
        CalcExpectedCost(
          ItemLedgEntry."Entry No.",
          InvoicedQty,
          ItemLedgEntry.Quantity,
          ValueEntry."Cost Amount (Expected)",
          ValueEntry."Cost Amount (Expected) (ACY)",
          ValueEntry."Sales Amount (Expected)",
          ValueEntry."Purchase Amount (Expected)",
          ItemLedgEntry.Quantity = ItemLedgEntry."Invoiced Quantity");
    // Delete the following lines.
        IF (InvdValueEntry."Cost Amount (Expected)" <>0) AND (ValueEntry."Cost Amount (Expected)" <> 0) THEN
          ValueEntry."Cost Amount (Expected)" :=
           ValueEntry."Cost Amount (Expected)" - InvdValueEntry."Cost Amount (Expected)";
        IF (InvdValueEntry."Cost Amount (Expected) (ACY)" <> 0) AND (ValueEntry."Cost Amount (Expected) (ACY)"<>0) THEN
          ValueEntry."Cost Amount (Expected) (ACY)" :=
            ValueEntry."Cost Amount (Expected) (ACY)" - InvdValueEntry."Cost Amount (Expected) (ACY)";
    // End of the deleted lines.
      END;
    
      IF ValueEntry.Inventoriable THEN
        PostInventoryToGL(ValueEntry);
      IF  ItemLedgEntry."Job No." <> '' THEN BEGIN
    ...
    

    替换代码

    ...
           ELSE
            InvoicedQty := ValueEntry."Valued Quantity";
        END ELSE
          InvoicedQty := ValueEntry."Invoiced Quantity";
        CalcExpectedCost(
    
    // Add the following line.
          ValueEntry,
    // End of the added line.
    
          ItemLedgEntry."Entry No.",
          InvoicedQty,
          ItemLedgEntry.Quantity,
          ValueEntry."Cost Amount (Expected)",
          ValueEntry."Cost Amount (Expected) (ACY)",
          ValueEntry."Sales Amount (Expected)",
          ValueEntry."Purchase Amount (Expected)",
          ItemLedgEntry.Quantity = ItemLedgEntry."Invoiced Quantity");
      END;
    
      IF ValueEntry.Inventoriable THEN
        PostInventoryToGL(ValueEntry);
      IF  ItemLedgEntry."Job No." <> '' THEN BEGIN
    ...
    

    对于 Microsoft Dynamics NAV 5.0 SP1、Microsoft Dynamics NAV 2009、Microsoft Dynamics NAV 2009 SP1 和 Microsoft Dynamics NAV 2009 R2 的北美版本
    现有代码

    ...
          ELSE
            InvoicedQty := ValueEntry."Valued Quantity";
        END ELSE
          InvoicedQty := ValueEntry."Invoiced Quantity";
        IF NOT Kitting THEN BEGIN
          CalcExpectedCost(
            ItemLedgEntry."Entry No.",
            InvoicedQty,
            ItemLedgEntry.Quantity,
            ValueEntry."Cost Amount (Expected)",
            ValueEntry."Cost Amount (Expected) (ACY)",
            ValueEntry."Sales Amount (Expected)",
            ValueEntry."Purchase Amount (Expected)",
            ItemLedgEntry.Quantity = ItemLedgEntry."Invoiced Quantity");
    
    // Delete the following lines.
          IF (InvdValueEntry."Cost Amount (Expected)" <>0) AND (ValueEntry."Cost Amount (Expected)" <>0) THEN
            ValueEntry."Cost Amount (Expected)" :=
             ValueEntry."Cost Amount (Expected)" - InvdValueEntry."Cost Amount (Expected)";
          IF (InvdValueEntry."Cost Amount (Expected) (ACY)" <> 0) AND (ValueEntry."Cost Amount (Expected) (ACY)" <> 0) THEN
            ValueEntry."Cost Amount (Expected) (ACY)" :=
              ValueEntry."Cost Amount (Expected) (ACY)" - InvdValueEntry."Cost Amount (Expected) (ACY)";
    // End of the deleted lines.
    
        END;
      END;
    
      IF ValueEntry.Inventoriable THEN
        PostInventoryToGL(ValueEntry);
      IF  ItemLedgEntry."Job No." <>'' THEN BEGIN  
    ...
    

    替换代码

    ...
          ELSE
            InvoicedQty := ValueEntry."Valued Quantity";
        END ELSE
          InvoicedQty := ValueEntry."Invoiced Quantity";
        IF NOT Kitting THEN BEGIN
          CalcExpectedCost(
    // Add the following line.
            ValueEntry,
    // End of the added line.
    
            ItemLedgEntry."Entry No.",
            InvoicedQty,
            ItemLedgEntry.Quantity,
            ValueEntry."Cost Amount (Expected)",
            ValueEntry."Cost Amount (Expected) (ACY)",
            ValueEntry."Sales Amount (Expected)",
            ValueEntry."Purchase Amount (Expected)",
            ItemLedgEntry.Quantity = ItemLedgEntry."Invoiced Quantity");
        END;
      END;
    
      IF ValueEntry.Inventoriable THEN
        PostInventoryToGL(ValueEntry);
      IF  ItemLedgEntry."Job No."<>'' THEN BEGIN
    ...
    
  2. 更改 Item Jnl.-Post Line codeunit (22) CalcExpectedCost 函数中的代码,如下所示:
    对于 Microsoft Dynamics NAV 5.0 SP1、Microsoft Dynamics NAV 2009、Microsoft Dynamics NAV 2009 SP1 和 Microsoft Dynamics NAV 2009 R2 的全球版本和北美版本
    现有代码 1

    ...
           LOCAL PROCEDURE CalcExpectedCost@60(ItemLedgEntryNo@1003 : Integer;InvoicedQty@1006 : Decimal;Quantity@1005 : Decimal;VAR ExpectedCost@1001 : Decimal;VAR ExpectedCostACY@1002 : Decimal;VAR ExpectedSalesAmt@1007 : Decimal;VAR ExpectedPurchAmt@1008 : Decimal;CalcReminder@1004 : Boolean);  
    ...
    

    替换代码 1

    ...
          LOCAL PROCEDURE CalcExpectedCost@60(VAR InvdValueEntry@1009 : Record 5802;ItemLedgEntryNo@1003 : Integer;InvoicedQty@1006 : Decimal;Quantity@1005 : Decimal;VAR ExpectedCost@1001 : Decimal;VAR ExpectedCostACY@1002 : Decimal;VAR ExpectedSalesAmt@1007 : Decimal;VAR ExpectedPurchAmt@1008 : Decimal;CalcReminder@1004 : Boolean);
    ...
    

    适用于 Microsoft Dynamics NAV 5.0 SP1 和 Microsoft Dynamics NAV 2009 的现有代码 2

    ...
              "Sales Amount (Expected)","Purchase Amount (Expected)");
          ExpectedCost :=  -"Cost Amount (Expected)";
          ExpectedCostACY := -"Cost Amount (Expected) (ACY)";
          ExpectedSalesAmt := -"Sales Amount (Expected)";
          ExpectedPurchAmt := -"Purchase Amount (Expected)";
        END ELSE BEGIN
          REPEAT
            IF "Expected Cost" THEN BEGIN
              ExpectedCost := ExpectedCost + "Cost Amount (Expected)";
              ExpectedCostACY := ExpectedCostACY + "Cost Amount (Expected) (ACY)"         
    ...
    

    Microsoft Dynamics NAV 5.0 SP1 和 Microsoft Dynamics NAV 2009 的替换代码 2

    ...
                "Sales Amount (Expected)","Purchase Amount (Expected)");
          ExpectedCost :=  -"Cost Amount (Expected)";
          ExpectedCostACY := -"Cost Amount (Expected) (ACY)";
          ExpectedSalesAmt := -"Sales Amount (Expected)";
          ExpectedPurchAmt := -"Purchase Amount (Expected)";
    
    // Add the following lines.
        END ELSE
          IF InvdValueEntry.Adjustment AND
             (InvdValueEntry."Entry Type" = InvdValueEntry."Entry Type"::"Direct Cost")
          THEN BEGIN
            ExpectedCost := -InvdValueEntry."Cost Amount (Actual)";
            ExpectedCostACY := -InvdValueEntry."Cost Amount (Actual) (ACY)";
            IF NOT CalledFromAdjustment THEN BEGIN
              ExpectedSalesAmt := -InvdValueEntry."Sales Amount (Actual)";
              ExpectedPurchAmt := -InvdValueEntry."Purchase Amount (Actual)";
            END
    // End of the added lines.
    
        END ELSE BEGIN
          REPEAT
            IF "Expected Cost" THEN BEGIN
              ExpectedCost := ExpectedCost + "Cost Amount (Expected)";
              ExpectedCostACY := ExpectedCostACY + "Cost Amount (Expected) (ACY)";
    ...
    

    Microsoft Dynamics NAV 2009 SP1 和 Microsoft Dynamics NAV 2009 R2 的现有代码 3

    …
    IF FINDSET AND "Expected Cost" THEN
      IF CalcReminder THEN BEGIN
        CALCSUMS(
             "Cost Amount (Expected)","Cost Amount (Expected) (ACY)",
             "Sales Amount (Expected)","Purchase Amount (Expected)");
        ExpectedCost :=  -"Cost Amount (Expected)";
        ExpectedCostACY := -"Cost Amount (Expected) (ACY)";
        IF NOT CalledFromAdjustment THEN BEGIN
           ExpectedSalesAmt := -"Sales Amount (Expected)";
           ExpectedPurchAmt := -"Purchase Amount (Expected)";
        END
      END ELSE BEGIN
            REPEAT
               IF "Expected Cost" THEN BEGIN
                 ExpectedCost := ExpectedCost + "Cost Amount (Expected)";
                 ExpectedCostACY := ExpectedCostACY + "Cost Amount (Expected) (ACY)";
    …
    

    Microsoft Dynamics NAV 2009 SP1 和 Microsoft Dynamics NAV 2009 R2 的替换代码 3

    …
    IF FINDSET AND "Expected Cost" THEN
      IF CalcReminder THEN BEGIN
        CALCSUMS(
             "Cost Amount (Expected)","Cost Amount (Expected) (ACY)",
             "Sales Amount (Expected)","Purchase Amount (Expected)");
        ExpectedCost :=  -"Cost Amount (Expected)";
        ExpectedCostACY := -"Cost Amount (Expected) (ACY)";
        IF NOT CalledFromAdjustment THEN BEGIN
           ExpectedSalesAmt := -"Sales Amount (Expected)";
           ExpectedPurchAmt := -"Purchase Amount (Expected)";
        END
    
    // Add the following lines.   
         END ELSE
           IF InvdValueEntry.Adjustment AND
              (InvdValueEntry."Entry Type" = InvdValueEntry."Entry Type"::"Direct Cost")
           THEN BEGIN
             ExpectedCost := -InvdValueEntry."Cost Amount (Actual)";
             ExpectedCostACY := -InvdValueEntry."Cost Amount (Actual) (ACY)";
             IF NOT CalledFromAdjustment THEN BEGIN
               ExpectedSalesAmt := -InvdValueEntry."Sales Amount (Actual)";
               ExpectedPurchAmt := -InvdValueEntry."Purchase Amount (Actual)";
             END
    // End of the added lines.
    
      END ELSE BEGIN
           REPEAT
                IF "Expected Cost" THEN BEGIN
                  ExpectedCost := ExpectedCost + "Cost Amount (Expected)";
                  ExpectedCostACY := ExpectedCostACY + "Cost Amount (Expected) (ACY)";
    …
    
    

先决条件

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

  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)
  • Microsoft Dynamics NAV 2009 R2
  • Microsoft Dynamics NAV 2009
  • Microsoft Dynamics NAV 5.0 Service Pack 1 (SP1)

                
              

删除信息

无法删除此修补程序。

状态

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

参考资料

VSTF DynamicsNAV SE:266892

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