Calculation of total duration

How can I calculate the total duration of all subtasks taking into account working hours, working days and holidays?

For the moment there is no function to immediately return this value.
I'll add it to our feature list to have some helper functions implemented in the future.

But at the moment it can be done in the following way:

procedure TForm3.Button1Click(Sender: TObject);
var
  d: TDateTime;
  h: Integer;
  t: TTMSFNCGanttTask;
begin
  t := TMSFNCGanttChart1.Project.Tasks[0];
  d := TMSFNCGanttChart1.Project.WorkTime.GetWorkTimeDifference(t.ScheduledStart, t.ScheduledEnd);
  h := HoursBetween(d,0);

  Label1.Text := h.ToString + ' Working hours';
end;

To get working days you can use the value TMSFNCGanttChart1.Project.WorkTime.WorkingHours.GetDaySpan, which returns the number of seconds in one workday

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.