Overtimes in Tasks
Contents
[
Hide
Show
]Microsoft Project lets users assign overtime to tasks. Aspose.Tasks for .NET supports this functionality through two properties in the Task class.
Overtime
The Tsk exposes several properties for working with overtime:
- OvertimeCost: reads and writes the sum of a task’s actual and remaining overtime cost (double).
- OvertimeWork: reads and writes the amount of overtime scheduled for a task (TimeSpan).
Microsoft Project view of task overtime
To see a task’s overtime work and cost properties:
- In the Task Entry form, select the Insert menu and then Column.
- Add the overtime columns.
Getting task overtimes in Aspose.Tasks
The following examples show how to get the overtime cost and work associated with a task with Aspose.Tasks.
1Project project = new Project("New Project.mpp");
2// Read overtime and percentage completion for tasks
3foreach (Task task in project.RootTask.Children)
4{
5 Console.WriteLine(task.Get(Tsk.OvertimeCost));
6 Console.WriteLine(task.Get(Tsk.OvertimeWork).ToString());
7 Console.WriteLine(task.Get(Tsk.PercentComplete));
8 Console.WriteLine(task.Get(Tsk.PercentWorkComplete).ToString());
9 Console.WriteLine(task.Get(Tsk.PhysicalPercentComplete).ToString());
10
11 // Set percent complete
12 task.Set(Tsk.PercentComplete, 100);
13}