在印度版 Microsoft Dynamics NAV 2009 中启用了价格不含税的销售订单中,“Inv.折扣金额”、“单价不包括增值税”和“行金额不包括增值税”值不正确

应用对象
Dynamics NAV 2009

本文适用于) 语言区域设置中印度 (的 Microsoft Dynamics NAV。

症状

假设你有一个销售订单,该订单在 Microsoft Dynamics NAV 2009 的印度版本中启用了价格税。 运行 “计算结构值” 函数后, Inv.折扣金额单价(不含增值税 )和 行金额(不包括增值税) 值不正确。 
以下产品中会出现此问题:

  • Microsoft Dynamics NAV 2009 R2 的印度版本
  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1) 的印度版本

解决方法

修补程序信息

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. 更改 Sales Line 表中的“行折扣百分比 - OnValidate”触发器中的代码 (37) 如下所示:
    现有代码

    ...
    "Line Discount %" := 100;
    
    // Delete the following line.
    IF NOT "Price Inclusive of Tax" THEN
    
    "Line Discount Amount" :=
    ROUND(ROUND(Quantity * "Unit Price",Currency."Amount Rounding Precision") * "Line Discount %" / 100,
    Currency."Amount Rounding Precision")
    
    // Delete the following lines.
    ELSE
    "Line Discount Amount" := ROUND(ROUND(Quantity * "Unit Price Incl. of Tax",Currency."Amount Rounding Precision") *
    "Line Discount %" / 100,Currency."Amount Rounding Precision");
    // End of the lines.
    ...
    

    替换代码

    ...
    
    "Line Discount %" := 100;
    
    "Line Discount Amount" :=
    ROUND(ROUND(Quantity * "Unit Price",Currency."Amount Rounding Precision") * "Line Discount %" / 100,
    Currency."Amount Rounding Precision");
    ...
    
  2. 更改 Sales Line 表中的“行折扣金额 - OnValidate”触发器中的代码 (37) ,如下所示:
    现有代码

    ...
    TESTFIELD(Quantity);
    
    // Delete the following line.
    IF NOT "Price Inclusive of Tax" THEN
    
    IF ROUND(Quantity * "Unit Price",Currency."Amount Rounding Precision") <> 0 THEN
    "Line Discount %" :=
    ROUND(
    "Line Discount Amount" / ROUND(Quantity * "Unit Price",Currency."Amount Rounding Precision") * 100,
    0.00001)
    ELSE
    "Line Discount %" := 0
    
    // Delete the following lines.
    ELSE
    IF ROUND(Quantity * "Unit Price Incl. of Tax",Currency."Amount Rounding Precision") <> 0 THEN
    "Line Discount %" :=
    ROUND(
    "Line Discount Amount" / ROUND(Quantity * "Unit Price Incl. of Tax",Currency."Amount Rounding Precision") * 100,
    0.00001)
    ELSE
    "Line Discount %" := 0;
    // End of the lines.
    
    "Inv. Discount Amount" := 0;
    ...
    

    替换代码

    ...
    TESTFIELD(Quantity);
    IF ROUND(Quantity * "Unit Price",Currency."Amount Rounding Precision") <> 0 THEN
    "Line Discount %" :=
    ROUND(
    "Line Discount Amount" / ROUND(Quantity * "Unit Price",Currency."Amount Rounding Precision") * 100,
    0.00001)
    ELSE
    "Line Discount %" := 0;
    "Inv. Discount Amount" := 0;
    ...
    
  3. 更改 Sales Line 表中 GetSalesPriceExclusiveTaxes 函数中的代码 (37) ,如下所示:
    现有代码

    ...
    IF StrOrderDetails."Include Base" THEN
    BaseAmountVariable := BaseAmountVariable + Quantity;
    
    // Delete the following lines.
    IF StrOrderDetails."Include Line Discount" THEN
    BaseAmountFixed := BaseAmountFixed - "Line Discount Amount";
    IF StrOrderDetails."Include Invoice Discount" THEN BEGIN
    BaseAmountFixed := BaseAmountFixed + "Inv Discount Fixed";
    BaseAmountVariable := BaseAmountVariable - "Inv Discount Variable";
    END;
    // End of the lines.
    
    IF SalesHeader."Currency Factor" <> 0 THEN
    ...
    

    替换代码

    ...
    IF StrOrderDetails."Include Base" THEN
    BaseAmountVariable := BaseAmountVariable + Quantity;
    
    IF SalesHeader."Currency Factor" <> 0 THEN
    ...
    
  4. 更改 Sales Line 表中 CalculateStructuresPIT 函数中的代码 (37) ,如下所示:
    现有代码

    ...
    SalesLine.MODIFY;
    
    // Delete the following lines.
    IF i < 3 THEN BEGIN
    FixedAmt := 0;
    VariableAmt := 0;
    AdjustedAmt := 0;
    DiffAdjustmentAmt := 0;
    FixedAmt := SalesLine."Unit Price Incl. of Tax" * SalesLine.Quantity;
    VariableAmt := SalesLine.Quantity;
    StrOrderLineDetails.RESET;
    StrOrderLineDetails.SETCURRENTKEY(Type,"Document Type","Document No.","Structure Code","Item No.","Line No.");
    StrOrderLineDetails.SETRANGE(Type,StrOrderLineDetails.Type::Sale);
    StrOrderLineDetails.SETRANGE("Document Type",SalesLine."Document Type");
    StrOrderLineDetails.SETRANGE("Document No.",SalesLine."Document No.");
    StrOrderLineDetails.SETRANGE("Structure Code",SalesLine."PIT Structure");
    StrOrderLineDetails.SETRANGE("Item No.",SalesLine."No.");
    StrOrderLineDetails.SETRANGE("Line No.",SalesLine."Line No.");
    StrOrderLineDetails.SETRANGE("Include PIT Calculation",TRUE);
    IF StrOrderLineDetails.FIND('-') THEN
    REPEAT
    FixedAmt -= StrOrderLineDetails.Amount;
    AdjustedAmt := AdjustedAmt + StrOrderLineDetails.Amount;
    UNTIL StrOrderLineDetails.NEXT = 0;
    
    SalesLine."Unit Price" := 0;
    IF VariableAmt <> 0 THEN BEGIN
    SalesLine."Unit Price" := ROUND((FixedAmt / VariableAmt),GetRoundingPrecisionUnitPrice);
    IF SalesLine."Unit Price" < 0 THEN
    SalesLine.FIELDERROR("Unit Price");
    IF (i = 2) AND (FixedAmt <> 0) AND (SalesLine.Quantity <> 0) THEN BEGIN
    AdjustedAmt := AdjustedAmt + (SalesLine."Unit Price" * SalesLine.Quantity);
    FixedAmt := SalesLine."Unit Price Incl. of Tax" * SalesLine.Quantity;
    DiffAdjustmentAmt := ((FixedAmt - AdjustedAmt)/SalesLine.Quantity) *
    (SalesLine."Unit Price" * SalesLine.Quantity) / (FixedAmt );
    SalesLine."Unit Price" := ROUND(SalesLine."Unit Price" - DiffAdjustmentAmt,GetRoundingPrecisionUnitPrice);
    IF SalesLine."Unit Price" < 0 THEN
    SalesLine.FIELDERROR("Unit Price");
    END;
    SalesLine.ValidateUnitPrice;
    SalesLine.ChkQtyUpdatioAfterDDPLA;
    SalesLine.MODIFY;
    IF SalesHeader."Calc. Inv. Discount (%)" THEN
    CalcInvDis.CalculateWithSalesHeader(SalesHeader,SalesLine);
    SalesLine.GET(SalesLine."Document Type",SalesLine."Document No.",SalesLine."Line No.");
    END;
    END;
    // End of the lines.
    ...
    

    替换代码

    ...
    SalesLine.MODIFY;
    ...
    
  5. 更改 Sales Line 表中 UpdateSalesLinesPIT 函数中的代码 (37) 如下所示:
    现有代码

    ...
    "Service Tax Amount" + "Service Tax eCess Amount" + "Service Tax SHE Cess Amount";
    MODIFY;
    ...
    

    替换代码

    ...
    
    "Service Tax Amount" + "Service Tax eCess Amount" + "Service Tax SHE Cess Amount";
    
    // Add the following lines.
    "Amount To Customer UPIT" := 
    "Line Amount" - "Inv. Discount Amount" + "Excise Amount" + "Tax Amount" + "Charges To Customer"; 
    // End of the lines.
    
    MODIFY;
    ...
    
  6. 将 Sales Line 表的 ValidateUnitPrice 函数中的代码更改为 (37) ,如下所示:
    现有代码

    ...
    "Line Discount %" := 100;
    
    // Delete the following line.
    IF NOT "Price Inclusive of Tax" THEN
    
    "Line Discount Amount" := ROUND(ROUND(Quantity * "Unit Price",Currency."Amount Rounding Precision") * "Line Discount %" / 100,
    Currency."Amount Rounding Precision")
    
    // Delete the following lines.
    ELSE
    "Line Discount Amount" := ROUND(ROUND(Quantity * "Unit Price Incl. of Tax",Currency."Amount Rounding Precision") *
    "Line Discount %" / 100,Currency."Amount Rounding Precision");
    // End of the lines.
    
    "Inv. Discount Amount" := 0;
    ...
    

    替换代码

    ...
    
    "Line Discount %" := 100;
    "Line Discount Amount" := ROUND(ROUND(Quantity * "Unit Price",Currency."Amount Rounding Precision") * "Line Discount %" / 100,
    Currency."Amount Rounding Precision");
    "Inv. Discount Amount" := 0;
    ...
    
  7. 更改 Sales - Post codeunit (80) 中的 DivideAmount 函数中的代码,如下所示:
    现有代码 1

    ...
    IF SalesLineQty <> Quantity THEN
    
    // Delete the following lines.
    IF "Price Inclusive of Tax" THEN
    "Line Discount Amount" :=
    ROUND((SalesLineQty * "Unit Price Incl. of Tax") * "Line Discount %" / 100,Currency."Amount Rounding Precision")
    ELSE
    // End of the lines.
    
    "Line Discount Amount" :=
    ROUND("Line Amount" * "Line Discount %" / 100,Currency."Amount Rounding Precision");
    "Line Amount" := "Line Amount" - "Line Discount Amount";
    ...
    

    替换代码 1

    ...
    IF SalesLineQty <> Quantity THEN
    "Line Discount Amount" :=
    ROUND("Line Amount" * "Line Discount %" / 100,Currency."Amount Rounding Precision");
    "Line Amount" := "Line Amount" - "Line Discount Amount";
    ...
    

    现有代码 2

    ...
    "Bal. TDS/TCS Including SHECESS",Currency."Amount Rounding Precision");
    
    // Delete the following lines.
    IF "Price Inclusive of Tax" THEN BEGIN
    "Amount To Customer UPIT" := SalesLineQty * "Unit Price";
    GLSetup.GET;
    StrOrdLineDetails2.RESET;
    StrOrdLineDetails2.SETRANGE(Type,StrOrdLineDetails2.Type::Sale);
    StrOrdLineDetails2.SETRANGE("Document Type","Document Type");
    StrOrdLineDetails2.SETRANGE("Document No.","Document No.");
    StrOrdLineDetails2.SETRANGE("Line No.","Line No.");
    StrOrdLineDetails2.SETRANGE("Include PIT Calculation",TRUE);
    IF StrOrdLineDetails2.FINDSET THEN
    REPEAT
    SalesLine2.GET("Document Type","Document No.","Line No.");
    IF StrOrdLineDetails2."Tax/Charge Type" = StrOrdLineDetails2."Tax/Charge Type"::Excise THEN
    "Amount To Customer UPIT" += "Excise Amount";
    IF StrOrdLineDetails2."Tax/Charge Type" = StrOrdLineDetails2."Tax/Charge Type"::"Sales Tax" THEN
    "Amount To Customer UPIT" += "Tax Amount";
    IF StrOrdLineDetails2."Tax/Charge Type" = StrOrdLineDetails2."Tax/Charge Type"::Charges THEN BEGIN
    IF QuantityType = QuantityType::General THEN
    "Amount To Customer UPIT" += ROUND(StrOrdLineDetails2.Amount * SalesLineQty / Quantity,
    Currency."Amount Rounding Precision");
    IF QuantityType = QuantityType::Invoicing THEN
    "Amount To Customer UPIT" += ROUND(StrOrdLineDetails2.Amount * SalesLine2."Qty. to Invoice" / SalesLine2.Quantity,
    Currency."Amount Rounding Precision");
    IF QuantityType = QuantityType::Shipping THEN
    "Amount To Customer UPIT" += ROUND(StrOrdLineDetails2.Amount * SalesLine2."Qty. to Ship" / SalesLine2.Quantity,
    Currency."Amount Rounding Precision");
    END;
    UNTIL StrOrdLineDetails2.NEXT = 0;
    "Total UPIT Amount" := ROUND("Total UPIT Amount" * SalesLineQty / Quantity,Currency."Amount Rounding Precision");
    END;
    // End of the lines.
    
    END;
    END;
    ...
    

    替换代码 2

    ...
    "Bal. TDS/TCS Including SHECESS",Currency."Amount Rounding Precision");
    
    // Add the following lines.
    IF "Price Inclusive of Tax" THEN
    "Amount To Customer UPIT" :=
    ROUND("Line Amount" - "Inv. Discount Amount" + "Excise Amount" + "Tax Amount" +
    "Charges To Customer", Currency."Amount Rounding Precision");
    // End of the lines.
    
    END;
    END;
    ...
    
  8. 在 Sales - Post codeunit (80) 中更改 RoundAmount 函数中的代码,如下所示:
    现有代码

    ...
    TotalSalesLineLCY."Amount To Customer";
    "Charges To Customer" :=
    ...
    

    替换代码

    ...
    TotalSalesLineLCY."Amount To Customer";
    
    // Add the following lines.
    "Amount To Customer UPIT" :=
    ROUND(
    CurrExchRate.ExchangeAmtFCYToLCY(
    UseDate,SalesHeader."Currency Code",
    TotalSalesLine."Amount To Customer UPIT",SalesHeader."Currency Factor")) -
    TotalSalesLineLCY."Amount To Customer UPIT";
    "Total UPIT Amount" :=
    ROUND(
    CurrExchRate.ExchangeAmtFCYToLCY(
    UseDate,SalesHeader."Currency Code",
    TotalSalesLine."Total UPIT Amount",SalesHeader."Currency Factor")) -
    TotalSalesLineLCY."Total UPIT Amount";
    // End of the lines.
    
    "Charges To Customer" :=
    ...
    
  9. 更改 Sales - Post codeunit (80) ReverseAmount 函数中的代码,如下所示:
    现有代码

    ...
    "Amount To Customer" := -"Amount To Customer";
    "Charges To Customer" := -"Charges To Customer";
    ...
    

    替换代码

    ...
    "Amount To Customer" := -"Amount To Customer";
    
    // Add the following lines.
    Amount To Customer UPIT" := -"Amount To Customer UPIT";
    Total UPIT Amount" := -"Total UPIT Amount";
    // End of the lines.
    
    "Charges To Customer" := -"Charges To Customer";
    ...
    
  10. 更改 Sales - Post codeunit (80) InvoiceUPITRounding 函数中的代码,如下所示:
    现有代码 1

    ...
    EXIT;
    
    // Delete the following line.
    UPITRoundingAmount := TotalSalesLine."Total UPIT Amount" - ROUND(TotalSalesLine."Amount To Customer UPIT");
    
    IF UPITRoundingAmount <> 0 THEN BEGIN
    ...
    

    替换代码 1

    ...
    EXIT;
    
    // Add the following line.
    UPITRoundingAmount := TotalSalesLine."Amount To Customer UPIT" - ROUND(TotalSalesLine."Amount To Customer UPIT");
    
    IF UPITRoundingAmount <> 0 THEN BEGIN
    ...
    

    现有代码 2

    ...
    "UPIT Rounding Inserted" := TRUE;
    
    // Delete the following line.
    IF SalesHeader."Prices Including VAT" THEN
    
    VALIDATE("Unit Price",UPITRoundingAmount)
    ...
    

    替换代码 2

    ...
    "UPIT Rounding Inserted" := TRUE;
    
    // Add the following line.
    IF SalesHeader."Price Inclusive of Taxes" THEN
    
    VALIDATE("Unit Price",UPITRoundingAmount)
    ...
    

先决条件

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

  • Microsoft Dynamics NAV 2009 R2 的印度版本
  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1) 的印度版本

删除信息

无法删除此修补程序。

状态

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

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