R32391 Activity Time Interval - Set Execution Complete Percent (Recalc)

Code 32391
Entity General.Activities.ActivityTimeIntervals Entity
Name SetExecutionCompletePercent
Attribute ExecutionCompletePercent
Layer Front-End
Events AttributeChanged(Date, EndTime, ExecutionCompletePercent, StartTime, Activity)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action Convert(IIF((Activity.PlannedDurationMinutes == Convert(0, Nullable1)), 0, Min(0.9, Round(Max(0, (Transaction.Clone().Query().Where(ti => (ti.Activity == Activity)).ToList(). Where(ti => ((ti != obj) AndAlso (ti.Date.Add(ti.EndTime) <= Date.Add(EndTime)))). OrderBy(ti => ti.Date.Add(ti.EndTime)).Select(ti => ti.ExecutionCompletePercent). LastOrDefault() + Convert((Convert((EndTime - StartTime).TotalMinutes, Nullable1) / Convert(Activity.PlannedDurationMinutes, Nullable`1)), Decimal))), 2))), Object)
Description Calculates the accumulated Execution Complete Percent by adding its relative execution percent to the Execution Complete Percent of the last Activity Time Interval, located just before this one. The maximum value of this calculation is capped to 90%.
Message
Version
Revocable YES

* This is auto generated code. Don't change it.