IPrjTaskPeriod.FinishDate

Syntax

FinishDate: DateTime;

Description

The FinishDate property determines task end date.

Comments

On determining the scheduled period of task execution, the property is relevant if the manual planning type is used and the IPrjProject.UseStartDate property is set to True.

Example

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

Sub UserProc;
Var
    Project: IPrjProject;
    Tasks: IPrjTaskCollection;
    Task: IPrjTask;
    Plan, FPeriod: IPrjTaskPeriod;
Begin
    Project := 
New PrjProject.Create;
    
// Set project start date
    Project.StartDate := DateTime.Parse("20.02.2020");
    Project.UseStartDate := 
True;
    
// Get collection of project tasks
    Tasks := Project.Tasks;
    
// Add a task
    Task := Tasks.Add;
    Task.WorkOutType := PrjTaskWorkOutTypes.ManualPlanning;
    Task.Key := 
1;
    Task.Name := 
"№1";
    
// Set duration and task execution end date
    Plan := Task.PlanPeriod;
    Plan.FinishDate := DateTime.Parse(
"29.02.2020");
    Plan.Duration := 
7;
    
// Run calculation
    Project.Plan;
    FPeriod := Task.ForecastPeriod;
    Debug.WriteLine(
"Task execution " + Task.Name + " from " + 
    FPeriod.StartDate.ToString + 
" to " + FPeriod.FinishDate.ToString + 
    
" (duration: " + FPeriod.Duration.ToString + " days)");
End Sub UserProc;

After executing the example the project will be calculated. The task start date will be defined taking into account the specified duration and task end date.

The console displays the calculation result:

The first task execution from 23.02.2020 00:00:00 to 29.02.2020 00:00:00 (duration: 7 days)

See also:

IPrjTaskPeriod