report 50129 CustSaleLineHeaderItem
{
ApplicationArea = All;
Caption = 'profitability per customer';
UsageCategory = ReportsAndAnalysis;
DefaultLayout = RDLC;
RDLCLayout = '.alpackages\Practice.Reports\CustSalesLineItem.rdl';
dataset
{
dataitem(Customer; Customer)
{
column(Customer_No_; "No.")
{
Caption = 'Customer No.';
}
column(Cutomer_Name; Name)
{
Caption = 'Customer Name.';
}
column(InventoryItem; InventoryItem)
{
Caption = 'Inventory Item';
}
column(Non_InventoryItem; Non_InventoryItem)
{
Caption = 'Non_Inventory Item';
}
column(ServiceItem; ServiceItem)
{
Caption = 'Service Item';
}
column(TotalSales; TotalSales)
{
Caption = 'Total Sales';
}
dataitem("Sales Header"; "Sales Header")
{
DataItemLink = "Sell-to Customer No." = field("No.");
dataitem("Sales Line"; "Sales Line")
{
DataItemLink = "Document No." = field("No.");
trigger OnAfterGetRecord()
var
ItemRec: Record Item;
begin
if Type = Type::Item then
if ItemRec.get("No.") then begin
case ItemRec.Type of
ItemRec.Type::Inventory:
InventoryItem += "Line Amount";
ItemRec.Type::"Non-Inventory":
Non_InventoryItem += "Line Amount";
ItemRec.Type::Service:
ServiceItem += "Line Amount";
end;
SetRange(Type, "Sales Line".Type::Item);
TotalSales += "Line Amount";
end;
end;
}
trigger OnPreDataItem()
begin
if (StartingDate <> 0D) AND (EndingDate <> 0D) then
SetRange("Posting Date", StartingDate, EndingDate);
end;
}
trigger OnAfterGetRecord()
begin
TotalSales := 0;
InventoryItem := 0;
Non_InventoryItem := 0;
ServiceItem := 0;
end;
}
}
requestpage
{
layout
{
area(Content)
{
field(StartingDate; StartingDate)
{
Caption = 'Starting Date';
ApplicationArea = All;
}
field(EndingDate; EndingDate)
{
Caption = 'Ending Date';
ApplicationArea = All;
}
}
}
}
var
TotalSales: Decimal;
InventoryItem: Decimal;
Non_InventoryItem: Decimal;
ServiceItem: Decimal;
StartingDate: Date;
EndingDate: Date;
}