Hi Community,
I am trying to connect line type in planning job to show fields in a factbox, but when I change the status budget for billable is not matching.
Could you help me with this issue?
I will appreciate,
Thank you
This is the code that I write:
Why not do a calcfields in the OnAfterGetRecord trigger regardless of the status?
Maybe remove the condition so it would show the sum for each line
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;
Can you show me how did you wrote it?
Hi Muaaz,
I did, but still not working.
Thank you
I think you should call this
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";
onValidate of the Line type
Hi Muaaz,
I try every time that I change or switch the status in a line (Budget, billable, and Both budget and billable) change the totals in my factbox.
Thank You
Can you explain more about what you want to do?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,188 Super User 2024 Season 2
Martin Dráb 230,030 Most Valuable Professional
nmaenpaa 101,156