IPrjTask.PlanPeriod

Syntax

PlanPeriod: IPrjTaskPeriod;

Description

The PlanPeriod property determines scheduled task execution period.

Comments

If the actual task execution period is selected, the scheduled period is not considered.

The property is relevant if manual planning type is used and at least two parameters of three are selected: duration of task execution period, start date of task execution, task end date. To determine parameters, use properties of the IPrjTaskPeriod interface. On project calculation, the forecasted task execution period matches the scheduled period.

Example

To execute the example, add a link to the ProjectPlanning system assembly.

Sub UserProc;
Var
    
Project: IPrjProject;
    Tasks: IPrjTaskCollection;
    Task: IPrjTask;
    Depend: IPrjTaskDependency;
    Plan, FPeriod: IPrjTaskPeriod;
    i: Integer;
Begin
    Project := 
New PrjProject.Create;
    
// Set project start date
    Project.StartDate := DateTime.Parse("20.02.2020");
    
// Get collection of project tasks
    Tasks := Project.Tasks;
    
// Add the first task
    Task := Tasks.Add;
    Task.WorkOutType := PrjTaskWorkOutTypes.ManualPlanning;
    Task.Key := 
1;
    Task.Name := 
"№1";
    
// Set the scheduled task execution period
    Plan := Task.PlanPeriod;
    Plan.StartDate := DateTime.Parse(
"22.02.2020");
    Plan.Duration := 
13;
    
// Add the second task
    Task := Tasks.Add;
    Task.Key := 
2;
    Task.Name := 
"№2";
    Task.PlanPeriod.Duration := 
11;
    Depend := Task.Dependencies.Add;
    Depend.PredecessorTaskKey := 
1;
    Depend.Lag := 
2;
    
// Run calculation
    Project.Plan;
    Debug.WriteLine(
"Project start date: " + Project.StartDate.ToString);
    
For i := 0 To Tasks.Count - 1 Do
        Task := Tasks.Item(i);
        FPeriod := Task.ForecastPeriod;
        Debug.WriteLine(
"  Task execution " + Task.Name + " from" + 
        FPeriod.StartDate.ToString + 
" to " + FPeriod.FinishDate.ToString + 
        
" (duration: " + FPeriod.Duration.ToString + " days)");
    
End For;
    Debug.WriteLine(
"Forecasted project end date: " + Project.EndDate.ToString);
End Sub UserProc;

After executing the example, the project will be calculated considering the specified conditions:

The console displays the calculation result:

Project start date: 20.02.2020 00:00:00

  The first task execution from 22.02.2020 00:00:00 to 05.03.2020 00:00:00 (duration: 13 days)

  The second task execution from 08.03.2020 00:00:00 to 18.03.2020 00:00:00 (duration: 11 days)

The forecasted project end date: 18.03.2020 00:00:00

See also:

IPrjTask