Hello, just an example below. It is wrong at least on one point that it is totalling Amount, not Amount (LCY), so it will total $, £, etc alike. But I hope it gives you some ideas where to start:
pageextension 50101 OrderTotals extends "Sales Order List"
{
layout
{
// Add changes to page layout here
}
actions
{
addfirst("F&unctions")
{
action(GetTotal)
{
ApplicationArea = all;
Caption = 'Get Total';
trigger OnAction()
var
SalesHeader: Record "Sales Header";
Total: Decimal;
begin
Total := 0;
SalesHeader.copy(Rec);
if SalesHeader.FindSet() then
repeat
total := total + SalesHeader.Amount;
until SalesHeader.Next() = 0;
Message(Format(Total));
end;
}
}
// Add changes to page actions here
}
var
myInt: Integer;
}