// Order Intake Report Page
report 50100 /Order Intake/
{
// The usage category makes the report available in the search
UsageCategory = ReportsAndAnalysis;
// This is where we define the layout of the report
RDLCLayout = './ReportLayout.rdlc';
dataset
{
// DataItem to hold Sales Header data
dataitem(SalesHeader; /Sales Header/)
{
// Filter to only include Sales Orders
DataItemTableView = SORTING(/Document Type/) WHERE(/Document Type/ = CONST(Order));
// Columns to display in the report
column(DocumentNo; /No./)
{
IncludeCaption = true;
}
column(SellToCustomerName; /Sell-to Customer Name/)
{
IncludeCaption = true;
}
column(SellToCustomerNo; /Sell-to Customer No./)
{
IncludeCaption = true;
}
column(TotalAmount; /Amount Including VAT/)
{
IncludeCaption = true;
}
column(CreatedAt; /SystemCreatedAt/)
{
IncludeCaption = true;
}
}
}
// Request page for the report, allowing the user to filter by the Created At date
requestpage
{
layout
{
area(content)
{
group(GroupName)
{
field(DateFilterFrom; DateFilterFrom)
{
ApplicationArea = All;
Caption = 'Created Date From';
ToolTip = 'Enter the start date to filter the Sales Orders.';
}
field(DateFilterTo; DateFilterTo)
{
ApplicationArea = All;
Caption = 'Created Date To';
ToolTip = 'Enter the end date to filter the Sales Orders.';
}
}
}
}
}
trigger OnPreReport()
begin
// Apply the date filter before the report is generated
if DateFilterFrom <> 0DT then
SalesHeader.SetRange(/SystemCreatedAt/, DateFilterFrom, DateFilterTo);
end;
var
DateFilterFrom: DateTime;
DateFilterTo: DateTime;
}