Hi Muaaz
something like this
thank for help me, I am beginner AL.
field("Total Cost"; TotalCostPlanningLine)
{
ApplicationArea = Basic, Suite;
Caption = 'Total Budget Cost';
ToolTip = 'Show total Budget Cost for current job planning lines.';
Visible = true;
Editable = false;
}
field("Line Amount"; TotalBudgetLineAmount)
{
ApplicationArea = Basic, Suite;
Caption = 'Total Budget Billable';
ToolTip = 'Show total amount for current job planning lines.';
Visible = true;
Editable = false;
}
field("Net Margin"; TotalNetMargin)
{
ApplicationArea = Basic, Suite;
Caption = 'Total Net Margin';
ToolTip = 'Show Net Margin for current job planning lines.';
Visible = true;
Editable = false;
AutoFormatType = 10;
AutoFormatExpression = '<precision, 2:2><standard format,0>%';
}
field(LineBillableAmount; TotalBillableLineAmount)
{
ApplicationArea = Basic, Suite;
Caption = 'Total Real Billable Amount';
ToolTip = 'Show total amount for current job planning lines.';
Visible = true;
Editable = false;
}
field("Line Type";Rec."Line Type")
{
ApplicationArea = Basic, Suite;
Visible = true;
Editable = false;
trigger OnValidate() // after get a record sum totals
begin
if rec."Line Type" = Rec."Line Type"::Budget then begin
Rec.CalcSums("Total Cost");
Rec.CalcSums("Line Amount");
Rec.CalcSums("Net Margin");
//Rec.CalcSums("Invoiced Amount (LCY)");
TotalCostPlanningLine := Rec."Total Cost";
TotalBudgetLineAmount := Rec."Line Amount";
TotalNetMargin := Rec."Net Margin";
end;
end;
}
}
}
trigger OnInit() //initialize the page equal 0
begin
TotalBudgetLineAmount := 0;
TotalBillableLineAmount := 0;
TotalNetMargin := 0;
TotalCostPlanningLine := 0;
end;
trigger OnAfterGetCurrRecord() // after get a record sum totals
begin
if rec."Line Type" = Rec."Line Type"::Budget then begin
Rec.CalcSums("Total Cost");
Rec.CalcSums("Line Amount");
Rec.CalcSums("Net Margin");
//Rec.CalcSums("Invoiced Amount (LCY)");
TotalCostPlanningLine := Rec."Total Cost";
TotalBudgetLineAmount := Rec."Line Amount";
TotalNetMargin := Rec."Net Margin";
end;
end;
var //Globals variables
TotalBudgetLineAmount: Decimal;
TotalBillableLineAmount: Decimal;
//TotalUnitPrice: Decimal;
TotalCostPlanningLine: Decimal;
TotalNetMargin: Decimal;