Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The system unexpectedly populates incorrect amounts in the general ledger (G/L) entries after you post the correction for a payroll document in the Russian version of Microsoft Dynamics NAV 2009 R2


View products that this article applies to.

This article applies to Microsoft Dynamics NAV for the Russian (ru) language locale.

↑ Back to the top


Symptoms

Assume that you install the local critical update PS59774 and local critical update PS60060 for the Russian version of Microsoft Dynamics NAV 2009 R2. For more information, visit the following Microsoft websites:
After you post the correction for a payroll document, the system populates amounts in the general ledger (G/L) entries for the correction. However, the amounts differ from the amounts in the G/L entries for the original payroll document.

↑ Back to the top


Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is only intended to correct the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Dynamics NAV 2009 service pack or the next Microsoft Dynamics NAV version that contains this hotfix.

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Technical Support Professional for Microsoft Dynamics and related products determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

↑ Back to the top



Installation information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Note Before you install this hotfix, verify that all Microsoft Navision client users are logged off the system. This includes Microsoft Navision Application Services (NAS) client users. You should be the only client user who is logged on when you implement this hotfix.

To implement this hotfix, you must have a developer license.

We recommend that the user account in the Windows Logins window or in the Database Logins window be assigned the "SUPER" role ID. If the user account cannot be assigned the "SUPER" role ID, you must verify that the user account has the following permissions:
  • The Modify permission for the object that you will be changing.
  • The Execute permission for the System Object ID 5210 object and for the System Object ID 9015 object.

Note You do not have to have rights to the data stores unless you have to perform data repair.

Code changes

Note Always test code fixes in a controlled environment before you apply the fixes to your production computers.
To resolve this problem, follow these steps:
  1. Change the code in the Payroll Document – Calculatecodeunit (17404). To do this, follows these steps:
    1. Create a new function as follows:
      LOCAL PROCEDURE IsCorrDocument@1210011(DocumentNo@1210000 : Code[20]) : Boolean;
      VAR
      PayrollDocument@1210001 : Record 17414;
      BEGIN
      IF PayrollDocument.GET(DocumentNo) THEN
      EXIT(PayrollDocument.Correction);
      END;
    2. Change the code in the Withholding function. To do this, follow these steps:
      1. Add a local variable, and then specify the variable as follows:
        • Name: Sign
        • Datatype: Integer
      2. Change the code as follows:
        Existing code 1
        ...
        IF RangeHeader.FIND('+') THEN;
        FundTax := (PayrollDocLine."Element Type" = PayrollDocLine."Element Type"::Funds);
        ...
        Replacement code 1
        ...
        IF RangeHeader.FIND('+') THEN;

        // Add the following lines.
        IF TaxableGross >= 0 THEN
        Sign := 1
        ELSE
        Sign := -1;
        // End of the added lines

        FundTax := (PayrollDocLine."Element Type" = PayrollDocLine."Element Type"::Funds);
        ...
        Existing code 2
        ...

        // Delete the following line.
        SETFILTER("Over Amount",'<%1',TaxableGross);

        IF NOT FIND('+') THEN BEGIN
        SETRANGE("Over Amount");
        IF NOT FIND('-') THEN
        EXIT(0);
        END;

        // Delete the following lines.
        ReturnValue := "Tax Amount" +
        ((TaxableGross - "Over Amount") * "Tax %" / 100.0);
        IF ReturnValue < 0 THEN
        ReturnValue := 0;
        IF ("Max Deduction" > 0) AND (ReturnValue > "Max Deduction") THEN
        ReturnValue := "Max Deduction";
        // End of the deleted lines.

        ...
        Replacement code 2
        ...

        // Add the following line.
        SETFILTER("Over Amount",'<%1',ABS(TaxableGross));

        IF NOT FIND('+') THEN BEGIN
        SETRANGE("Over Amount");
        IF NOT FIND('-') THEN
        EXIT(0);
        END;

        // Add the following lines.
        ReturnValue := "Tax Amount" +
        ((TaxableGross - Sign * "Over Amount") * "Tax %" / 100.0);
        IF (ReturnValue < 0) AND NOT IsCorrDocument(PayrollDocLine."Document No.") THEN
        ReturnValue := 0
        ELSE
        IF ("Max Deduction" > 0) AND (ABS(ReturnValue) > "Max Deduction") THEN
        ReturnValue := Sign * "Max Deduction";
        // End of the added lines.

        ...
  2. Change the code in the Payroll Document – Post codeunit (17405). To do this, follow these steps:
    1. Create a new function as follows:
      ...
      LOCAL PROCEDURE GetSignFactor@1210010(Amount@1170000000 : Decimal) : Integer;
      BEGIN
      IF Amount >= 0 THEN
      EXIT(1);
      EXIT(-1);
      END;
      ...
    2. Change the code in the Onrun trigger as follows:
      Existing code
      ...
      PostedPayrDocLineToGenJnlLine(PostedPayrollDocLine,GenJnlLine);

      // Delete the following lines.
      IF Correction THEN
      GenJnlLine.VALIDATE(Amount,-PayrollDocBuffer."Tax Amount")
      ELSE
      GenJnlLine.VALIDATE(Amount,PayrollDocBuffer."Tax Amount");
      // End of deleted lines.

      PayrollElement.GET(PayrollDocBuffer."Element Code");
      ...
      Replacement code
      ...
      PostedPayrDocLineToGenJnlLine(PostedPayrollDocLine,GenJnlLine);

      // Add the following line.
      GenJnlLine.VALIDATE(Amount,PayrollDocBuffer."Tax Amount");

      ...
    3. Change the code in the Aggregate Taxes function. To do this, follow these steps:
      1. Add a local variable, and then specify the variable as follows:
        • Name: Sign
        • Datatype: Integer
      2. Change the code as follows:
        Existing code
        ...
        PayrollDocBuffer.RESET;
        PayrollDocBuffer.SETRANGE("Element Code",PayrollDocLineFund."Element Code");
        IF PayrollDocBuffer.FINDSET THEN
        REPEAT

        // Delete the following line.
        YTDTaxableAmount := YTDTaxableAmount + PayrollDocBuffer."Base Amount";

        TempPayrollDocLine2."Employee No." := PayrollDocLineFund."Employee No.";
        TempPayrollDocLine2."Period Code" := PayrollDocLineFund."Period Code";
        TempPayrollDocLine2."Element Code" := PayrollDocLineFund."Element Code";
        YTDTaxAmount := PayrollDocCalculate.Withholding(TempPayrollDocLine2,YTDTaxableAmount);

        // Delete the following line.
        CurrPeriodTaxAmount := YTDTaxAmount + YTDPostedTaxAmount;

        PayrollDocBuffer."Tax Amount" := CurrPeriodTaxAmount;
        PayrollDocBuffer.MODIFY;

        // Delete the following line.
        YTDPostedTaxAmount := YTDPostedTaxAmount - CurrPeriodTaxAmount;

        UNTIL PayrollDocBuffer.NEXT = 0;
        ...
        Replacement code
        ...
        PayrollDocBuffer.RESET;
        PayrollDocBuffer.SETRANGE("Element Code",PayrollDocLineFund."Element Code");
        IF PayrollDocBuffer.FINDSET THEN
        REPEAT

        // Add the following lines.
        Sign := GetSignFactor(PayrollDocBuffer."Base Amount");
        YTDTaxableAmount := YTDTaxableAmount + Sign * PayrollDocBuffer."Base Amount";
        // End of the added lines.

        TempPayrollDocLine2."Document No." := PayrollDocLineFund."Document No.";
        TempPayrollDocLine2."Employee No." := PayrollDocLineFund."Employee No.";
        TempPayrollDocLine2."Period Code" := PayrollDocLineFund."Period Code";
        TempPayrollDocLine2."Element Code" := PayrollDocLineFund."Element Code";
        YTDTaxAmount := PayrollDocCalculate.Withholding(TempPayrollDocLine2,YTDTaxableAmount);

        // Add the following line.
        CurrPeriodTaxAmount := Sign * YTDTaxAmount + Sign * YTDPostedTaxAmount;

        PayrollDocBuffer."Tax Amount" := CurrPeriodTaxAmount;
        PayrollDocBuffer.MODIFY;

        // Add the following line.
        YTDPostedTaxAmount := YTDPostedTaxAmount - Sign * CurrPeriodTaxAmount;

        UNTIL PayrollDocBuffer.NEXT = 0;
        ...

Prerequisites

You must have the Russian version of Microsoft Dynamics NAV 2009 R2 installed to apply this hotfix.

Removal information

You cannot remove this hotfix.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

↑ Back to the top


Keywords: kbqfe, kbmbsmigrate, kbmbspartner, kbmbscodefix, kbmbsquickpub, kbsurveynew, kbnoloc, kb

↑ Back to the top

Article Info
Article ID : 2682820
Revision : 1
Created on : 1/7/2017
Published on : 3/23/2012
Exists online : False
Views : 173