This article applies to Microsoft Dynamics NAV for the Italian (it) language locale.

Symptoms

Assume that you post a refund for a withholding taxes credit memo in the Italian version of Microsoft Dynamics NAV 2009 R2 and of Microsoft Dynamics NAV 2009 Service Pack 1 (SP1). When you run the Withh. Tax-Soc.Sec. function in the Payment Journal dialog box, you receive the following error message:

Document Type must be Payment type.

The withholding tax line cannot be calculated.
This problem occurs in the following products:

  • The Italian version of Microsoft Dynamics NAV 2009 R2

  • The Italian version of Micorosft Dynamics NAV 2009 Service Pack 1 (SP1)

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.



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, but 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 Controls in the Show Computed Withh. Contrib. form (12111) as follows:
    Existing code 1

    ...
    GenJnlLine2.SETRANGE("Line No.","Line No.");

    IF GenJnlLine2.FIND('-') THEN BEGIN

    // Delete the following lines.
    GenJnlLine2.VALIDATE(Amount,GenJnlLine2.Amount - "Withholding Tax Amount" + "Old Withholding Amount" -
    "Free-Lance Amount" + "Old Free-Lance Amount" -
    "INAIL Free-Lance Amount" + "Old INAIL Free-Lance Amount");
    // End of the lines.

    GenJnlLine2.MODIFY;
    GenJnlLine2.SETRANGE("Line No.");
    TmpGenJnlLine.COPY(GenJnlLine2);
    ...

    Replacement code 1

    ...
    GenJnlLine2.SETRANGE("Line No.","Line No.");

    IF GenJnlLine2.FIND('-') THEN BEGIN

    // Add the following lines.
    IF GenJnlLine2."Document Type" = GenJnlLine2."Document Type"::Payment THEN
    GenJnlLine2.VALIDATE(Amount,GenJnlLine2.Amount - "Withholding Tax Amount" + "Old Withholding Amount" -
    "Free-Lance Amount" + "Old Free-Lance Amount" -
    "INAIL Free-Lance Amount" + "Old INAIL Free-Lance Amount")
    ELSE
    GenJnlLine2.VALIDATE(Amount,GenJnlLine2.Amount + "Withholding Tax Amount" - "Old Withholding Amount" +
    "Free-Lance Amount" - "Old Free-Lance Amount" +
    "INAIL Free-Lance Amount" - "Old INAIL Free-Lance Amount");
    // End of the lines.

    GenJnlLine2.MODIFY;
    GenJnlLine2.SETRANGE("Line No.");
    TmpGenJnlLine.COPY(GenJnlLine2);
    ...

    Existing code 2

    ...
    GenJnlLine.SETRANGE("Line No.");
    END;
    GenJnlLine.VALIDATE("Account No.");

    // Delete the following line.
    GenJnlLine.VALIDATE(Amount,"Withholding Tax Amount");
    // End of the line.

    GenJnlLine."Bal. Account Type" := GenJnlLine."Bal. Account Type"::"G/L Account";
    GenJnlLine."Bal. Account No." := "Withholding Account";
    GenJnlLine.VALIDATE("Bal. Account No.","Withholding Account"); // IT006
    ...

    Replacement code 2

    ...
    GenJnlLine.SETRANGE("Line No.");
    END;
    GenJnlLine.VALIDATE("Account No.");

    // Add the following lines.
    IF GenJnlLine."Document Type" = GenJnlLine."Document Type"::Payment THEN
    GenJnlLine.VALIDATE(Amount,"Withholding Tax Amount")
    ELSE
    GenJnlLine.VALIDATE(Amount,-"Withholding Tax Amount");
    // End of the lines.

    GenJnlLine."Bal. Account Type" := GenJnlLine."Bal. Account Type"::"G/L Account";
    GenJnlLine."Bal. Account No." := "Withholding Account";
    GenJnlLine.VALIDATE("Bal. Account No.","Withholding Account"); // IT006
    ...
  2. Change the code in Data Item Number 2 in the Certifications report (12106) as follows:
    Existing code

    ...
    FORMAT(FromPaymentDate,0) + Text1041 + FORMAT(ToPaymentDate,0);

    Descr := Text1050 + Vendor.Name;
    IF ISSERVICETIER THEN
    IF NOT "Source-Withholding Tax" THEN
    Descr:= Text1047
    ...

    Replacement code

    ...
    FORMAT(FromPaymentDate,0) + Text1041 + FORMAT(ToPaymentDate,0);

    Descr := Text1050 + Vendor.Name;

    // Add the following line.
    WithholdTaxPercent := "Withholding Tax %";
    // End of the line.

    IF ISSERVICETIER THEN
    IF NOT "Source-Withholding Tax" THEN
    Descr:= Text1047
    ...
  3. Change the code in Data Item Number 2 Sections in the Certifications report (12106) as follows:
    Existing code 1

    ...
    VertAlign=Bottom;
    FontBold=Yes;
    MultiLine=Yes;
    DataSetFieldName=Withholding_Tax__Withholding_Tax___Caption }
    { 1130154;Label ;21600;846 ;1800 ;846 ;ParentControl=1130260;
    HorzAlign=Right;
    ...

    Replacement code 1

    ...
    VertAlign=Bottom;
    FontBold=Yes;
    MultiLine=Yes;

    // Add the following line.
    CaptionML=ENU=Withholding Tax %;
    // End of the line.

    DataSetFieldName=Withholding_Tax__Withholding_Tax___Caption }
    { 1130154;Label ;21600;846 ;1800 ;846 ;ParentControl=1130260;
    HorzAlign=Right;
    ...

    Existing code 2

    ...
    OnPreSection=BEGIN
    Descr :='';
    GroupType := '';
    CASE CurrReport.TOTALSCAUSEDBY OF
    FIELDNO("Withholding Tax Code"):
    CurrReport.SHOWOUTPUT(FALSE);
    ...

    Replacement code 2

    ...
    OnPreSection=BEGIN
    Descr :='';
    GroupType := '';

    // Add the following line.
    WithholdTaxPercent := "Withholding Tax %";
    // End of the line.

    CASE CurrReport.TOTALSCAUSEDBY OF
    FIELDNO("Withholding Tax Code"):
    CurrReport.SHOWOUTPUT(FALSE);
    ...

    Existing code 3

    ...
    FIELDNO("Withholding Tax Code"):
    CurrReport.SHOWOUTPUT(FALSE);
    FIELDNO("Source-Withholding Tax"):

    // Delete the following lines.
    IF NOT "Source-Withholding Tax" THEN
    Descr:= Text1047
    ELSE
    // End of the lines.

    CurrReport.SHOWOUTPUT(FALSE);
    FIELDNO("Withholding Tax %"):
    Descr:= ' ' + FORMAT("Withholding Tax %") + '% ' + WithholdTaxCode.Description;
    ...

    Replacement code 3

    ...
    FIELDNO("Withholding Tax Code"):
    CurrReport.SHOWOUTPUT(FALSE);
    FIELDNO("Source-Withholding Tax"):

    // Add the following lines.
    IF NOT "Source-Withholding Tax" THEN BEGIN
    Descr:= Text1047;
    WithholdTaxPercent := 0;
    END ELSE
    // End of the lines.

    CurrReport.SHOWOUTPUT(FALSE);
    FIELDNO("Withholding Tax %"):
    Descr:= ' ' + FORMAT("Withholding Tax %") + '% ' + WithholdTaxCode.Description;
    ...

    Existing code 4

    ...
    FIELDNO("Withholding Tax %"):
    Descr:= ' ' + FORMAT("Withholding Tax %") + '% ' + WithholdTaxCode.Description;
    FIELDNO("Recipient May Report Income"):

    // Delete the following line.
    IF "Source-Withholding Tax" THEN
    // End of the line.

    IF "Recipient May Report Income" THEN
    Descr:= Text1048
    ELSE
    ...

    Replacement code 4

    ...
    FIELDNO("Withholding Tax %"):
    Descr:= ' ' + FORMAT("Withholding Tax %") + '% ' + WithholdTaxCode.Description;
    FIELDNO("Recipient May Report Income"):

    // Add the following line.
    IF "Source-Withholding Tax" THEN BEGIN
    // End of the line.

    IF "Recipient May Report Income" THEN
    Descr:= Text1048
    ELSE
    ...

    Existing code 5

    ...
    IF "Recipient May Report Income" THEN
    Descr:= Text1048
    ELSE

    // Delete the following lines.
    Descr:= Text1049
    ELSE
    // End of the lines.

    CurrReport.SHOWOUTPUT(FALSE);
    END;
    END;
    ...

    Replacement code 5

    ...
    IF "Recipient May Report Income" THEN
    Descr:= Text1048
    ELSE

    // Add the following lines.
    Descr:= Text1049;
    WithholdTaxPercent := 0;
    END ELSE
    // End of the lines.

    CurrReport.SHOWOUTPUT(FALSE);
    END;
    END;
    ...

    Existing code 6

    ...
    { 1130250;TextBox ;0 ;0 ;8400 ;423 ;MultiLine=Yes;
    SourceExpr=Descr;
    DataSetFieldName=Descr_Control1130250 }

    // Delete the following line.
    { 1130207;TextBox ;19650;0 ;1800 ;423 ;SourceExpr="Withholding Tax %";
    // End of the line.

    DataSetFieldName=Withholding_Tax__Withholding_Tax___ }
    { 1130117;TextBox ;8400 ;0 ;150 ;423 ;Name=DescrWithHoldTax4;
    Visible=No;
    ...

    Replacement code 6

    ...
    { 1130250;TextBox ;0 ;0 ;8400 ;423 ;MultiLine=Yes;
    SourceExpr=Descr;
    DataSetFieldName=Descr_Control1130250 }

    // Add the following lines.
    { 1130207;TextBox ;19650;0 ;1800 ;423 ;BlankZero=Yes;
    SourceExpr=WithholdTaxPercent;
    // End of the lines.

    DataSetFieldName=Withholding_Tax__Withholding_Tax___ }
    { 1130117;TextBox ;8400 ;0 ;150 ;423 ;Name=DescrWithHoldTax4;
    Visible=No;
    ...

    Existing code 7

    ...
    SourceExpr="Withholding Tax Amount";
    AutoFormatType=1;
    DataSetFieldName=Withholding_Tax__Withholding_Tax_Amount__Control5 }

    // Delete the following lines.
    { 8 ;TextBox ;19650;423 ;1800 ;423 ;FontSize=8;
    FontBold=Yes;
    SourceExpr="Withholding Tax %";
    DataSetFieldName=Withholding_Tax__Withholding_Tax____Control8 }
    // End of the lines.

    { 11 ;TextBox ;17700;423 ;1800 ;423 ;FontSize=8;
    FontBold=Yes;
    SourceExpr="Taxable Base";
    ...

    Replacement code 7

    ...
    SourceExpr="Withholding Tax Amount";
    AutoFormatType=1;
    DataSetFieldName=Withholding_Tax__Withholding_Tax_Amount__Control5 }
    { 11 ;TextBox ;17700;423 ;1800 ;423 ;FontSize=8;
    FontBold=Yes;
    SourceExpr="Taxable Base";
    ...
  4. Add the following variable in the Certifications report (12106):

    • WithholdTaxPercent@1130058 : Decimal

  5. Change the code in Documentation in the Certifications report (12106) as follows:
    Existing code 1

    ...
    <TextAlign>Right</TextAlign>
    </Style>
    <Value>=Last(Fields!Withholding_Tax__Withholding_Tax___.Value)</Value>
    <ZIndex>40</ZIndex>
    </Textbox>
    </ReportItems>
    ...

    Replacement code 1

    ...
    <TextAlign>Right</TextAlign>
    </Style>
    <Value>=Last(Fields!Withholding_Tax__Withholding_Tax___.Value)</Value>

    // Add the following lines.
    <Visibility>
    <Hidden>true</Hidden>
    </Visibility>
    // End of the lines.

    <ZIndex>40</ZIndex>
    </Textbox>
    </ReportItems>
    ...

    Existing code 2

    ...
    <VerticalAlign>Middle</VerticalAlign>
    </Style>
    <Value>=Last(Fields!Withholding_Tax__Withholding_Tax___.Value)</Value>
    <ZIndex>11</ZIndex>
    </Textbox>
    </ReportItems>
    ...

    Replacement code 2

    ...
    <VerticalAlign>Middle</VerticalAlign>
    </Style>
    <Value>=Last(Fields!Withholding_Tax__Withholding_Tax___.Value)</Value>

    // Add the following lines.
    <Visibility>
    <Hidden>true</Hidden>
    </Visibility>
    // End of the lines.

    <ZIndex>11</ZIndex>
    </Textbox>
    </ReportItems>
    ...

    Existing code 3

    ...
    <VerticalAlign>Middle</VerticalAlign>
    </Style>
    <Value>=Last(Fields!Withholding_Tax__Withholding_Tax___.Value)</Value>
    <ZIndex>20</ZIndex>
    </Textbox>
    </ReportItems>
    ...

    Replacement code 3

    ...
    <VerticalAlign>Middle</VerticalAlign>
    </Style>
    <Value>=Last(Fields!Withholding_Tax__Withholding_Tax___.Value)</Value>

    // Add the following lines.
    <Visibility>
    <Hidden>true</Hidden>
    </Visibility>
    // End of the lines.

    <ZIndex>20</ZIndex>
    </Textbox>
    </ReportItems>
    ...

    Existing code 4

    ...
    <VerticalAlign>Middle</VerticalAlign>
    </Style>
    <Value>=Last(Fields!Withholding_Tax__Withholding_Tax___.Value)</Value>
    <ZIndex>29</ZIndex>
    </Textbox>
    </ReportItems>
    ...

    Replacement code 4

    ...
    <VerticalAlign>Middle</VerticalAlign>
    </Style>
    <Value>=Last(Fields!Withholding_Tax__Withholding_Tax___.Value)</Value>

    // Add the following lines.
    <Visibility>
    <Hidden>true</Hidden>
    </Visibility>
    // End of the lines.

    <ZIndex>29</ZIndex>
    </Textbox>
    </ReportItems>
    ...

    Existing code 5

    ...
    </Footer>
    <Grouping Name="table4_Group1">
    <GroupExpressions>

    // Delete the following line.
    <GroupExpression>=Fields!Withholding_Tax__Withholding_Tax___.Value</GroupExpression>
    // End of the line.

    </GroupExpressions>
    </Grouping>
    </TableGroup>
    ...

    Replacement code 5

    ...
    </Footer>
    <Grouping Name="table4_Group1">
    <GroupExpressions>

    // Add the following lines.
    <GroupExpression>=Fields!Withholding_Tax_Withholding_Tax_Code.Value</GroupExpression>
    <GroupExpression>=Fields!WithholdTaxCodeDescription.Value</GroupExpression>
    // End of the lines.

    </GroupExpressions>
    </Grouping>
    </TableGroup>
    ...

    Existing code 6

    ...
    </Footer>
    <Grouping Name="table4_Group2">
    <GroupExpressions>

    // Delete the following lines.
    <GroupExpression>=Fields!Withholding_Tax_Withholding_Tax_Code.Value</GroupExpression>
    <GroupExpression>=Fields!WithholdTaxCodeDescription.Value</GroupExpression>
    // End of the lines.

    </GroupExpressions>
    </Grouping>
    </TableGroup>
    ...

    Replacement code 6

    ...
    </Footer>
    <Grouping Name="table4_Group2">
    <GroupExpressions>

    // Add the following line.
    <GroupExpression>=Fields!Withholding_Tax__Withholding_Tax___.Value</GroupExpression>
    // End of the line.

    </GroupExpressions>
    </Grouping>
    </TableGroup>
    ...

    Existing code 7

    ...
    </Code>
    <DataSets>
    <DataSet Name="DataSet_Result">

    // Delete the following lines.
    <Query>
    <CommandText />
    <DataSourceName>DummyDataSource</DataSourceName>
    </Query>
    // End of the lines.

    <Fields>
    <Field Name="SubstituteData_NNC">
    <DataField>SubstituteData_NNC</DataField>
    ...

    Replacement code 7

    ...
    </Code>
    <DataSets>
    <DataSet Name="DataSet_Result">
    <Fields>
    <Field Name="SubstituteData_NNC">
    <DataField>SubstituteData_NNC</DataField>
    ...

    Existing code 8

    ...
    <Field Name="Withholding_Tax__Withholding_Tax_Amount__Control5Format">
    <DataField>Withholding_Tax__Withholding_Tax_Amount__Control5Format</DataField>
    </Field>

    // Delete the following lines.
    <Field Name="Withholding_Tax__Withholding_Tax____Control8Format">
    <DataField>Withholding_Tax__Withholding_Tax____Control8Format</DataField>
    </Field>
    // End of the lines.

    <Field Name="Withholding_Tax__Taxable_Base__Control11Format">
    <DataField>Withholding_Tax__Taxable_Base__Control11Format</DataField>
    </Field>
    ...

    Replacement code 8

    ...
    <Field Name="Withholding_Tax__Withholding_Tax_Amount__Control5Format">
    <DataField>Withholding_Tax__Withholding_Tax_Amount__Control5Format</DataField>
    </Field>
    <Field Name="Withholding_Tax__Taxable_Base__Control11Format">
    <DataField>Withholding_Tax__Taxable_Base__Control11Format</DataField>
    </Field>
    ...

    Existing code 9

    ...
    <Field Name="Withholding_Tax_Withholding_Tax_Code">
    <DataField>Withholding_Tax_Withholding_Tax_Code</DataField>
    </Field>
    <Field Name="Withholding_Tax_Vendor_No_">
    <DataField>Withholding_Tax_Vendor_No_</DataField>
    </Field>
    ...

    Replacement code 9

    ...
    <Field Name="Withholding_Tax_Withholding_Tax_Code">
    <DataField>Withholding_Tax_Withholding_Tax_Code</DataField>
    </Field>

    // Add the following lines.
    <Field Name="Withholding_Tax_Withholding_Tax__">
    <DataField>Withholding_Tax_Withholding_Tax__</DataField>
    </Field>
    <Field Name="Withholding_Tax_Withholding_Tax__Format">
    <DataField>Withholding_Tax_Withholding_Tax__Format</DataField>
    </Field>
    // End of the lines.

    <Field Name="Withholding_Tax_Vendor_No_">
    <DataField>Withholding_Tax_Vendor_No_</DataField>
    </Field>
    ...

    Existing code 10

    ...
    <DataField>INAIL_Vendor_No_</DataField>
    </Field>
    </Fields>
    <rd:DataSetInfo>
    <rd:DataSetName>DataSet</rd:DataSetName>
    <rd:TableName>Result</rd:TableName>
    ...

    Replacement code 10

    ...
    <DataField>INAIL_Vendor_No_</DataField>
    </Field>
    </Fields>

    // Add the following lines.
    <Query>
    <CommandText />
    <DataSourceName>DummyDataSource</DataSourceName>
    </Query>
    // End of the lines.

    <rd:DataSetInfo>
    <rd:DataSetName>DataSet</rd:DataSetName>
    <rd:TableName>Result</rd:TableName>
    ...
  6. Change the value of the Text1034@1130001 text constant in the Withholding - Contribution codeunit (12101) from the "ENU=Payment" value to the "ENU=Payment or Refund" value.

  7. Change the code in the PostPayments function in the Withholding - Contribution codeunit (12101) as follows:
    Existing code

    ...
    WithholdingTax."Withholding Tax Amount" := ROUND(CurrencyExchRate.ExchangeAmtFCYToLCY(
    GenJnlLine."Document Date","Currency Code","Withholding Tax Amount",GenJnlLine."Currency Factor"));
    END;
    IF WithholdCode.GET("Withholding Tax Code") THEN BEGIN
    WithholdingTax."Source-Withholding Tax" := WithholdCode."Source-Withholding Tax";
    WithholdingTax."Recipient May Report Income" := WithholdCode."Recipient May Report Income";
    ...

    Replacement code

    ...
    WithholdingTax."Withholding Tax Amount" := ROUND(CurrencyExchRate.ExchangeAmtFCYToLCY(
    GenJnlLine."Document Date","Currency Code","Withholding Tax Amount",GenJnlLine."Currency Factor"));
    END;

    // Add the following lines.
    IF GenJnlLine."Document Type" = GenJnlLine."Document Type"::Refund THEN BEGIN
    WithholdingTax."Total Amount" := -WithholdingTax."Total Amount";
    WithholdingTax."Base - Excluded Amount" := -WithholdingTax."Base - Excluded Amount";
    WithholdingTax."Non Taxable Amount By Treaty" := -WithholdingTax."Non Taxable Amount By Treaty";
    WithholdingTax."Non Taxable Amount" := -WithholdingTax."Non Taxable Amount";
    WithholdingTax."Taxable Base" := -WithholdingTax."Taxable Base";
    WithholdingTax."Withholding Tax Amount" := -WithholdingTax."Withholding Tax Amount";
    END;
    // End of the lines.

    IF WithholdCode.GET("Withholding Tax Code") THEN BEGIN
    WithholdingTax."Source-Withholding Tax" := WithholdCode."Source-Withholding Tax";
    WithholdingTax."Recipient May Report Income" := WithholdCode."Recipient May Report Income";
    ...
  8. Change the code in the CreateTmpWithhSocSec function in the Withholding - Contribution codeunit (12101) as follows:
    Existing code

    ...
    TmpWithholdingSocSec@1130005 : Record 12113;
    BEGIN
    WITH GenJnlLine DO BEGIN

    // Delete the following line.
    IF ("Document Type" <> "Document Type"::Payment) THEN
    // End of the line.

    ERROR(Text1033,FIELDCAPTION("Document Type"),Text1034);

    IF ("Account Type" <> "Account Type"::Vendor) THEN
    ...

    Replacement code

    ...
    TmpWithholdingSocSec@1130005 : Record 12113;
    BEGIN
    WITH GenJnlLine DO BEGIN

    // Add the following lines.
    IF ("Document Type" <> "Document Type"::Payment) AND
    ("Document Type" <> "Document Type"::Refund)
    THEN
    // End of the lines.

    ERROR(Text1033,FIELDCAPTION("Document Type"),Text1034);

    IF ("Account Type" <> "Account Type"::Vendor) THEN
    ...

Prerequisites

You must have one of the following products installed to apply this hotfix:

  • The Italian version of Microsoft Dynamics NAV 2009 R2

  • The Italian version of Microsoft Dynamics NAV 2009 Service Pack 1

Removal information

You cannot remove this hotfix.

Status

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

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.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×