Skip to main content

Notifications

Small and medium business | Business Central, N...
Unanswered

I have written this code for a report in business central to fetch debit credit amount and opening and closing balance between two dates specified by user on request page.But report in preview mode is not opening at all.

Posted on by 208

I have written this code for a report in business central to fetch debit credit amount and opening and closing balance between two dates specified by user on request page.But report in preview mode is not opening at all.

report 90139 MyReport
{
    Caption = 'Ledger Confirmation Report';
    PreviewMode = PrintLayout;
    UsageCategory = Administration;
    ApplicationArea = All;
    DefaultLayout = RDLC;
    RDLCLayout = './Reports/LedgerConfirmationRepo.rdl';

    dataset
    {
        dataitem(Customer_table; Customer)
        {
            RequestFilterFields = "No.";

            column(OpeningBalance; OpeningBalance) { }

            column(ClosingBalance; ClosingBalance) { }

            dataitem(Cust_ledgerEntry; "Cust. Ledger Entry")
            {
                DataItemLink = "Customer No." = field("No.");
                column(Debit_Amount; Cust_ledgerEntry."Debit Amount") { }
                column(Credit_Amount; Cust_ledgerEntry."Credit Amount") { }
                column(Date; Cust_ledgerEntry."Posting Date") { }

                column(Particulars; Cust_ledgerEntry.Description) { }
            }
            trigger OnAfterGetRecord()
            begin
                CustLedgerEntry.Reset();
                CustLedgerEntry.SetRange("Customer No.", "No.");
                // CustLedgerEntry.SetFilter("Posting Date", '..%1', CalcDate('<-1D>', PostingDateFrom));
                // CustLedgerEntry.CalcSums(Amount);
                // OpeningBalance := CustLedgerEntry.Amount;
                CustLedgerEntry.SetFilter("Posting Date", '%1..%2', PostingDateFrom, PostingDateTo);
                CustLedgerEntry.CalcSums("Debit Amount", "Credit Amount");
                DebitAmount := CustLedgerEntry."Debit Amount";
                CreditAmount := CustLedgerEntry."Credit Amount";
                ClosingBalance := OpeningBalance + DebitAmount - CreditAmount;
               //C00050
            end;

        }
    }



    requestpage
    {
        SaveValues = true;
        layout
        {
            area(content)
            {
                group(GroupName)
                {
                    Caption = 'Date Filter';
                    field("Posting Date From"; "PostingDateFrom")
                    {
                        ApplicationArea = all;
                        Caption = 'Posting Date From';
                        ShowMandatory = true;
                        ToolTip = 'Specifies the date from you want the calculated for.';
                    }
                    field("Posting Date To"; "PostingDateTo")
                    {
                        ApplicationArea = all;
                        Caption = 'Posting Date To';
                        ShowMandatory = true;
                        ToolTip = 'Specifies the date to which you want the aging calculated for.';
                    }

                }
            }

        }
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans