The "Vendor Statement" report shows an incorrect total amount when an invoice is applied by a payment where the payment discounts was deducted in the Portuguese version of Microsoft Dynamics NAV 2009. The payment discount amount is displayed as total balance. Follow the steps in the code changes section to solve this issue. This problem occurs in the following product:

  • The Portuguese version of Microsoft Dynamics NAV 2009 R2

  • The Portuguese version of Microsoft Dynamics NAV 2009 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. 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 Dynamics NAV client users are logged off the system. This includes Microsoft Dynamics NAV Application Server (NAS) services. 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. Before applying the change, please import all SEPA updates.

To resolve this problem, follow these steps:

  1. Change the code in the Data Item Number 1 in the Vendor Statement Report (13377) as follows:
    Existing code 1

    ...
    Currency2.INSERT;
    UNTIL Currency.NEXT = 0;
    END;

    // Delete the following line.
    OnAfterGetRecord=BEGIN
    // End of the deleted line.

    CurrReport.LANGUAGE := Language.GetLanguageID("Language Code");
    PrintLine := FALSE;
    Vend2 := Vendor;
    COPYFILTER("Currency Filter",Currency2.Code);
    ...

    Replacement code 1

    ...
    Currency2.INSERT;
    UNTIL Currency.NEXT = 0;
    END;

    // Add the following lines.
    OnAfterGetRecord=VAR
    VendLedgEntry@1000 : Record 25;
    BEGIN
    // End of the added lines.

    CurrReport.LANGUAGE := Language.GetLanguageID("Language Code");
    PrintLine := FALSE;
    Vend2 := Vendor;
    COPYFILTER("Currency Filter",Currency2.Code);
    ...

    Existing code 2

    ...
    PrintLine := Vend2."Net Change" <> 0;
    UNTIL (Currency2.NEXT = 0) OR PrintLine;
    END;
    IF (NOT PrintLine) AND PrintAllHavingEntry THEN BEGIN

    // Delete the following lines.
    "Vendor Ledger Entry".RESET;
    "Vendor Ledger Entry".SETCURRENTKEY("Vendor No.","Posting Date");
    "Vendor Ledger Entry".SETRANGE("Vendor No.",Vendor."No.");
    "Vendor Ledger Entry".SETRANGE("Posting Date",StartDate,EndDate);
    Vendor.COPYFILTER("Currency Filter","Vendor Ledger Entry"."Currency Code");
    PrintLine := "Vendor Ledger Entry".FIND('-');
    // End of the deleted lines.

    END;
    IF NOT PrintLine THEN
    CurrReport.SKIP;
    ...

    Replacement code 2

    ...
    PrintLine := Vend2."Net Change" <> 0;
    UNTIL (Currency2.NEXT = 0) OR PrintLine;
    END;
    IF (NOT PrintLine) AND PrintAllHavingEntry THEN BEGIN

    // Add the following lines.
    VendLedgEntry.SETCURRENTKEY("Vendor No.","Posting Date");
    VendLedgEntry.SETRANGE("Vendor No.",Vendor."No.");
    VendLedgEntry.SETRANGE("Posting Date",StartDate,EndDate);
    Vendor.COPYFILTER("Currency Filter",VendLedgEntry."Currency Code");
    PrintLine := NOT VendLedgEntry.ISEMPTY;
    // End of the added lines.

    END;
    IF NOT PrintLine THEN
    CurrReport.SKIP;
    ...
  2. Change the code in the Data Item Number 4 in the Vendor Statement Report (13377) as follows:
    Existing code 1

    ...
    }
    { PROPERTIES
    {
    DataItemIndent=3;

    // Delete the following lines.
    DataItemTable=Table25;
    DataItemTableView=SORTING(Vendor No.,Posting Date);
    OnPreDataItem=BEGIN
    SETRANGE("Posting Date",StartDate,EndDate);
    SETRANGE("Currency Code",Currency2.Code);
    CurrReport.CREATETOTALS("Remaining Amount");
    // End of the deleted lines.

    IF Currency2.Code = '' THEN BEGIN
    GLSetup.TESTFIELD("LCY Code");
    CurrencyCode3 := GLSetup."LCY Code"
    END ELSE
    ...

    Replacement code 1

    ...
    }
    { PROPERTIES
    {
    DataItemIndent=3;

    // Add the following lines.
    DataItemTable=Table2000000026;
    DataItemTableView=SORTING(Number)
    WHERE(Number=CONST(1));
    DataItemVarName=VendLedEntryHdr;
    PrintOnlyIfDetail=Yes;
    }
    SECTIONS
    {
    }
    }
    { PROPERTIES
    {
    DataItemIndent=4;
    DataItemTable=Table380;
    DataItemTableView=SORTING(Vendor No.,Posting Date,Entry Type,Currency Code)
    WHERE(Excluded from calculation=CONST(No),
    Entry Type=FILTER(<>Application&<>Redrawal));
    DataItemVarName=DtldVendLedgEntry;
    PrintOnlyIfDetail=No;
    OnPreDataItem=BEGIN
    SETRANGE("Vendor No.",Vendor."No.");
    SETRANGE("Posting Date",StartDate,EndDate);
    SETRANGE("Currency Code",Currency2.Code);

    // End of the added lines.

    IF Currency2.Code = '' THEN BEGIN
    GLSetup.TESTFIELD("LCY Code");
    CurrencyCode3 := GLSetup."LCY Code"
    END ELSE
    ...

    Existing code 2

    ...
    END ELSE
    CurrencyCode3 := Currency2.Code
    END;

    // Delete the following lines.
    OnAfterGetRecord=BEGIN
    // PT0002.begin
    // VendBalance := VendBalance + "Remaining Amount";
    VendBalance := VendBalance + "Original Amount";
    // PT0002.end
    // End of the deleted lines.

    END;

    DataItemLinkReference=Vendor;
    DataItemLink=Vendor No.=FIELD(No.);
    ...

    Replacement code 2

    ...
    END ELSE
    CurrencyCode3 := Currency2.Code
    END;

    // Add the following lines.
    OnAfterGetRecord=VAR
    VendLedgEntry@1000 : Record 25;
    DtldVendLedgEntry1@1001 : Record 380;
    BEGIN
    RemainingAmount := 0;
    PrintLine := TRUE;
    CASE "Entry Type" OF
    "Entry Type"::"Initial Entry":
    BEGIN
    VendLedgEntry.GET("Vendor Ledger Entry No.");
    Description := VendLedgEntry.Description;
    DueDate := VendLedgEntry."Due Date";
    VendLedgEntry.SETRANGE("Date Filter",0D, EndDate);
    VendLedgEntry.CALCFIELDS("Remaining Amount");
    RemainingAmount := VendLedgEntry."Remaining Amount";
    END;
    "Entry Type"::"Payment Discount",
    "Entry Type"::"Payment Discount (VAT Excl.)",
    "Entry Type"::"Payment Discount (VAT Adjustment)",
    "Entry Type"::"Payment Discount Tolerance",
    "Entry Type"::"Payment Discount Tolerance (VAT Excl.)",
    "Entry Type"::"Payment Discount Tolerance (VAT Adjustment)":
    BEGIN
    Description := Text006;
    DueDate := 0D;
    END;
    "Entry Type"::"Payment Tolerance",
    "Entry Type"::"Payment Tolerance (VAT Excl.)",
    "Entry Type"::"Payment Tolerance (VAT Adjustment)":
    BEGIN
    Description := Text014;
    DueDate := 0D;
    END;
    "Entry Type"::"Appln. Rounding",
    "Entry Type"::"Correction of Remaining Amount":
    BEGIN
    Description := Text007;
    DueDate := 0D;
    END;
    END;

    IF PrintLine THEN
    VendBalance := VendBalance + Amount;
    // End of the added lines.

    END;

    DataItemLinkReference=Vendor;
    DataItemLink=Vendor No.=FIELD(No.);
    ...
  3. Change the code in the Data Item Number 4 Sections in the Vendor Statement Report (13377) as follows:
    Existing code 1

    ...
    DataSetFieldName=Vendor_Ledger_Entry_Description }
    { 47 ;TextBox ;7980 ;0 ;1680 ;423 ;HorzAlign=Left;
    FontSize=9;
    CaptionML=ENU=Due Date;

    // Delete the following lines.
    SourceExpr=FORMAT("Due Date",0,4);
    DataSetFieldName=Vendor_Ledger_Entry__Due_Date_ }
    { 48 ;TextBox ;13230;0 ;2310 ;423 ;FontSize=9;
    CaptionML=ENU=Remaining Amount;
    SourceExpr="Remaining Amount";
    // End of the deleted lines.

    AutoFormatType=1;
    AutoFormatExpr="Currency Code";
    DataSetFieldName=Vendor_Ledger_Entry__Remaining_Amount_ }
    { 49 ;TextBox ;15750;0 ;2310 ;423 ;FontSize=9;
    ...

    Replacement code 1

    ...
    DataSetFieldName=Vendor_Ledger_Entry_Description }
    { 47 ;TextBox ;7980 ;0 ;1680 ;423 ;HorzAlign=Left;
    FontSize=9;
    CaptionML=ENU=Due Date;

    // Add the following lines.
    SourceExpr=FORMAT(DueDate,0,4);
    DataSetFieldName=Vendor_Ledger_Entry__Due_Date_ }
    { 48 ;TextBox ;13230;0 ;2310 ;423 ;FontSize=9;
    CaptionML=ENU=Remaining Amount;
    SourceExpr=RemainingAmount;
    // End of the added lines.

    AutoFormatType=1;
    AutoFormatExpr="Currency Code";
    DataSetFieldName=Vendor_Ledger_Entry__Remaining_Amount_ }
    { 49 ;TextBox ;15750;0 ;2310 ;423 ;FontSize=9;
    ...

    Existing code 2

    ...
    AutoFormatType=1;
    AutoFormatExpr="Currency Code";
    DataSetFieldName=VendBalance_Control49 }
    { 54 ;TextBox ;10710;0 ;2310 ;423 ;FontSize=9;

    // Delete the following line.
    SourceExpr="Original Amount";
    // End of the deleted line.

    AutoFormatType=1;
    AutoFormatExpr="Currency Code";
    DataSetFieldName=Vendor_Ledger_Entry__Original_Amount_ }
    { 78 ;TextBox ;9870 ;0 ;840 ;423 ;FontSize=9;
    ...

    Replacement code 2

    ...
    AutoFormatType=1;
    AutoFormatExpr="Currency Code";
    DataSetFieldName=VendBalance_Control49 }
    { 54 ;TextBox ;10710;0 ;2310 ;423 ;FontSize=9;

    // Add the following line.
    SourceExpr=Amount;
    // End of the added line.

    AutoFormatType=1;
    AutoFormatExpr="Currency Code";
    DataSetFieldName=Vendor_Ledger_Entry__Original_Amount_ }
    { 78 ;TextBox ;9870 ;0 ;840 ;423 ;FontSize=9;
    ...
  4. Change the code in the Data Item Number 5 in the Vendor Statement Report (13377) as follows:
    Existing code

    ...
    END;

    OnAfterGetRecord=BEGIN
    IF ISSERVICETIER THEN

    // Delete the following lines.
    VendBalance2 := VendBalance2 + "Remaining Amount"
    ELSE
    VendBalance := VendBalance + "Remaining Amount";
    // End of the deleted lines.

    END;

    DataItemLinkReference=Vendor;
    DataItemLink=Vendor No.=FIELD(No.);
    ...

    Replacement code

    ...
    END;

    OnAfterGetRecord=BEGIN
    IF ISSERVICETIER THEN

    // Add the following lines.
    VendBalance2 := VendBalance2 + RemainingAmount
    ELSE
    VendBalance := VendBalance + RemainingAmount;
    // End of the added lines.

    END;

    DataItemLinkReference=Vendor;
    DataItemLink=Vendor No.=FIELD(No.);
    ...
  5. Change the code in the Data Item Number 5 Sections in the Vendor Statement Report (13377) as follows:
    Existing code

    ...
    SourceExpr=Description;
    DataSetFieldName=VendorLedgEntry2_Description }
    { 60 ;TextBox ;7980 ;0 ;1680 ;423 ;HorzAlign=Left;
    FontSize=9;

    // Delete the following lines.
    SourceExpr=FORMAT("Due Date",0,4);
    DataSetFieldName=VendorLedgEntry2__Due_Date_ }
    { 61 ;TextBox ;13230;0 ;2310 ;423 ;FontSize=9;
    SourceExpr="Remaining Amount";
    // End of the deleted lines.

    AutoFormatType=1;
    AutoFormatExpr="Currency Code";
    DataSetFieldName=VendorLedgEntry2__Remaining_Amount_ }
    { 62 ;TextBox ;15750;0 ;2310 ;423 ;FontSize=9;
    ...

    Replacement code

    ...
    SourceExpr=Description;
    DataSetFieldName=VendorLedgEntry2_Description }
    { 60 ;TextBox ;7980 ;0 ;1680 ;423 ;HorzAlign=Left;
    FontSize=9;

    // Add the following lines.
    SourceExpr=FORMAT(DueDate,0,4);
    DataSetFieldName=VendorLedgEntry2__Due_Date_ }
    { 61 ;TextBox ;13230;0 ;2310 ;423 ;FontSize=9;
    SourceExpr=RemainingAmount;
    // End of the added lines.

    AutoFormatType=1;
    AutoFormatExpr="Currency Code";
    DataSetFieldName=VendorLedgEntry2__Remaining_Amount_ }
    { 62 ;TextBox ;15750;0 ;2310 ;423 ;FontSize=9;
    ...
  6. Change the code in the Global Variables in the Vendor Statement Report (13377) as follows:
    Existing code 1

    ...
    Text000@1000 : TextConst 'ENU=Page %1';
    Text001@1001 : TextConst 'ENU=Open Entries %1';
    Text002@1002 : TextConst 'ENU=Overdue Entries %1';
    Text003@1003 : TextConst 'ENU="Statement "';
    GLSetup@1004 : Record 98;
    CompanyInfo@1005 : Record 79;
    Vend2@1006 : Record 23;
    Currency@1007 : Record 4;
    ...

    Replacement code 1

    ...
    Text000@1000 : TextConst 'ENU=Page %1';
    Text001@1001 : TextConst 'ENU=Open Entries %1';
    Text002@1002 : TextConst 'ENU=Overdue Entries %1';
    Text003@1003 : TextConst 'ENU="Statement "';

    // Add the following lines.
    Text005@1030 : TextConst 'ENU=Multicurrency Application';
    Text006@1031 : TextConst 'ENU=Payment Discount';
    Text007@1032 : TextConst 'ENU=Rounding';
    Text014@1033 : TextConst 'ENU=Application Writeoffs';
    // End of the added lines.

    GLSetup@1004 : Record 98;
    CompanyInfo@1005 : Record 79;
    Vend2@1006 : Record 23;
    Currency@1007 : Record 4;
    ...

    Existing code 2

    ...
    PrintAllHavingEntry@1010 : Boolean;
    PrintAllHavingBal@1011 : Boolean;
    PrintEntriesDue@1012 : Boolean;
    PrintLine@1013 : Boolean;
    StartDate@1014 : Date;
    EndDate@1015 : Date;
    VendAddr@1016 : ARRAY [8] OF Text[50];
    CompanyAddr@1017 : ARRAY [8] OF Text[50];
    ...

    Replacement code 2

    ...

    PrintAllHavingEntry@1010 : Boolean;
    PrintAllHavingBal@1011 : Boolean;
    PrintEntriesDue@1012 : Boolean;
    PrintLine@1013 : Boolean;

    // Add the following line.
    DueDate@1038 : Date;
    // End of the added line.

    StartDate@1014 : Date;
    EndDate@1015 : Date;
    VendAddr@1016 : ARRAY [8] OF Text[50];
    CompanyAddr@1017 : ARRAY [8] OF Text[50];
    ...

    Existing code 3

    ...
    StartDate@1014 : Date;
    EndDate@1015 : Date;
    VendAddr@1016 : ARRAY [8] OF Text[50];
    CompanyAddr@1017 : ARRAY [8] OF Text[50];
    StartBalance@1018 : Decimal;
    VendBalance@1019 : Decimal;
    FormatAddr@1020 : Codeunit 365;
    CurrencyCode3@1022 : Code[10];
    ...

    Replacement code 3

    ...
    StartDate@1014 : Date;
    EndDate@1015 : Date;
    VendAddr@1016 : ARRAY [8] OF Text[50];
    CompanyAddr@1017 : ARRAY [8] OF Text[50];

    // Add the following lines.
    Description@1039 : Text[50];
    RemainingAmount@1040 : Decimal;
    // End of the added lines.

    StartBalance@1018 : Decimal;
    VendBalance@1019 : Decimal;
    FormatAddr@1020 : Codeunit 365;
    CurrencyCode3@1022 : Code[10];
    ...

    Existing code 4

    ...
    </ReportItems>
    </TableCell>
    </TableCells>
    <Visibility>

    // Delete the following line.
    <Hidden>=IIF(Fields!Vendor_Ledger_Entry_Vendor_No_.Value = "",TRUE,FALSE)</Hidden>
    // End of the deleted line.

    </Visibility>
    </TableRow>
    </TableRows>
    </Details>
    ...

    Replacement code 4

    ...
    </ReportItems>
    </TableCell>
    </TableCells>
    <Visibility>

    // Add the following line.
    <Hidden>=IIF(Fields!DtldVendLedgEntry_Vendor_No_.Value = "",TRUE,FALSE)</Hidden>
    // End of the added line.

    </Visibility>
    </TableRow>
    </TableRows>
    </Details>
    ...

    Existing code 5

    ...
    <FontWeight>700</FontWeight>
    <TextAlign>Right</TextAlign>
    <VerticalAlign>Middle</VerticalAlign>
    </Style>

    // Delete the following line.
    <Value>=iif(Last(Fields!Vendor_Ledger_Entry_Vendor_No_.Value) = "" ,Last(Fields!VendBalance_Control66Caption.Value),
    // End of the deleted line.

    Last(Fields!VendBalance_Control53Caption.Value))</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    ...

    Replacement code 5

    ...
    <FontWeight>700</FontWeight>
    <TextAlign>Right</TextAlign>
    <VerticalAlign>Middle</VerticalAlign>
    </Style>

    // Add the following line.
    <Value>=iif(Last(Fields!DtldVendLedgEntry_Vendor_No_.Value) = "" ,Last(Fields!VendBalance_Control66Caption.Value),
    // End of the added line.

    Last(Fields!VendBalance_Control53Caption.Value))</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    ...

    Existing code 6

    ...
    <FontWeight>700</FontWeight>
    <TextAlign>Right</TextAlign>
    <VerticalAlign>Middle</VerticalAlign>
    </Style>

    // Delete the following line.
    <Value>=iif(Last(Fields!Vendor_Ledger_Entry_Vendor_No_.Value) = "" ,Last(Fields!CurrencyCode3_Control73.Value),
    // End of the deleted line.

    Last(Fields!CurrencyCode3.Value))</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    ...

    Replacement code 6

    ...
    <FontWeight>700</FontWeight>
    <TextAlign>Right</TextAlign>
    <VerticalAlign>Middle</VerticalAlign>
    </Style>

    // Add the following line.
    <Value>=iif(Last(Fields!DtldVendLedgEntry_Vendor_No_.Value) = "" ,Last(Fields!CurrencyCode3_Control73.Value),
    // End of the added line.

    Last(Fields!CurrencyCode3.Value))</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    ...

    Existing code 7

    ...
    FontWeight>700</FontWeight>
    <Format>=Fields!VendBalance_Control49Format.Value</Format>
    <VerticalAlign>Middle</VerticalAlign>
    </Style>

    // Delete the following line.
    <Value>=iif(Last(Fields!Vendor_Ledger_Entry_Vendor_No_.Value) = "" ,Last(Fields!VendBalance_Control56.Value),
    // End of the deleted line.

    LAST(Fields!VendBalance.Value))</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    ...

    Replacement code 7

    ...
    <FontWeight>700</FontWeight>
    <Format>=Fields!VendBalance_Control49Format.Value</Format>
    <VerticalAlign>Middle</VerticalAlign>
    </Style>

    // Add the following line.
    <Value>=iif(Last(Fields!DtldVendLedgEntry_Vendor_No_.Value) = "" ,Last(Fields!VendBalance_Control56.Value),
    // End of the added line.

    LAST(Fields!VendBalance.Value))</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    ...

    Existing code 8

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

    // Delete the following lines.
    <Field Name="Vendor_Ledger_Entry_Entry_No_">
    <DataField>Vendor_Ledger_Entry_Entry_No_</DataField>
    </Field>
    <Field Name="Vendor_Ledger_Entry_Vendor_No_">
    <DataField>Vendor_Ledger_Entry_Vendor_No_</DataField>
    // End of the deleted lines.

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

    Replacement code 8

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

    // Add the following lines.
    <Field Name="DtldVendLedgEntry_Entry_No_">
    <DataField>DtldVendLedgEntry_Entry_No_</DataField>
    </Field>
    <Field Name="DtldVendLedgEntry_Vendor_No_">
    <DataField>DtldVendLedgEntry_Vendor_No_</DataField>
    // End of the added lines.
    </Field>
    <Field Name="STRSUBSTNO_Text002_Currency2_Code_">
    <DataField>STRSUBSTNO_Text002_Currency2_Code_</DataField>
    </Field>
    ...

Prerequisites

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

  • The Portuguese version of Microsoft Dynamics NAV 2009 R2

  • The Portuguese version of Microsoft Dynamics NAV 2009 SP1

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 Usefor 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!

×