web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
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.

(0) ShareShare
ReportReport
Posted on by 234

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.';
                    }

                }
            }

        }
    }
I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans