Hi Experts,
I am Trying to develop a Report Here.
The Requirement is
CustNo CustName InvoiceValue CreditNoteValue
Depends upon the Filtering on the Posting Date , The Report Should Give me the Consolidates Stats For the Customers.
I have written some Code But its Not Giving me the Exact Result. What am i Doing Wrong?
eport 50131 MyReport
{
UsageCategory = ReportsAndAnalysis;
ApplicationArea = All;
DefaultLayout = RDLC;
RDLCLayout = './SR2.rdl';
dataset
{
dataitem(Customer; Customer)
{
DataItemTableView = sorting("No.");
PrintOnlyIfDetail = true;
column(Name; Name)
{
}
column(No_; "No.")
{
}
column(CreditAmount; CreditAmount)
{
}
column(SalesAmount; SalesAmount)
{
}
dataitem("Cust. Ledger Entry"; "Cust. Ledger Entry")
{
DataItemLink = "Customer No." = field("No.");
column(Debit_Amount__LCY_; "Debit Amount (LCY)")
{
}
column(Credit_Amount__LCY_; "Credit Amount (LCY)")
{
}
trigger OnAfterGetRecord()
begin
"Cust. Ledger Entry"."Debit Amount (LCY)" := 0;
"Cust. Ledger Entry"."Credit Amount (LCY)" := 0;
"Cust. Ledger Entry".Reset();
"Cust. Ledger Entry".SetFilter("Document Type", '%1|%2', "Cust. Ledger Entry"."Document Type"::invoice, "Cust. Ledger Entry"."Document Type"::"Credit Memo");
"Cust. Ledger Entry".SetRange("Cust. Ledger Entry"."Posting Date", FromDates, ToDate);
"Cust. Ledger Entry".SetRange("Cust. Ledger Entry"."Customer No.", Customer."No.");
if "Cust. Ledger Entry".FindSet() then begin
repeat
"Cust. Ledger Entry".CalcFields("Debit Amount (LCY)","Credit Amount (LCY)");
"Cust. Ledger Entry"."Debit Amount (LCY)" := "Cust. Ledger Entry"."Debit Amount (LCY)" + "Cust. Ledger Entry"."Debit Amount (LCY)";
"Cust. Ledger Entry"."Credit Amount (LCY)" := "Cust. Ledger Entry"."Credit Amount (LCY)" + "Cust. Ledger Entry"."Credit Amount (LCY)";
until "Cust. Ledger Entry".Next = 0;
end;
//
end;
}
}
}
requestpage
{
layout
{
area(Content)
{
group(GroupName)
{
field("From Date"; FromDates)
{
ApplicationArea = All;
}
field("To Date"; ToDate)
{
ApplicationArea = All;
}
}
}
}
}
var
cust1: Record "Cust. Ledger Entry";
cust2: Record "Cust. Ledger Entry";
SalesAmount: Decimal;
CreditAmount: Decimal;
FromDates: Date;
ToDate: Date;
}
Thanks You