Overtimes in Tasks
In Microsoft Project, tasks can include overtime work and overtime costs to reflect additional effort beyond regular working hours.
Aspose.Tasks for .NET enables developers to programmatically read and update these overtime properties in both MPP and XML formats.
Understanding Task Overtime
The Tsk class provides properties for managing overtime values:
OvertimeCost Type: Double Purpose: Represents the sum of a task’s actual and remaining overtime cost.
OvertimeWork Type: TimeSpan Purpose: Represents the total overtime work hours scheduled for a task.
These properties help track extra project expenses and workload adjustments.
Microsoft Project Overtime Work fields
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 C# example demonstrates how to retrieve overtime-related values for 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}
Key Notes
- OvertimeWork is expressed as
TimeSpan
, making it easy to integrate with scheduling logic. - OvertimeCost is numeric, useful for project cost analysis and reporting.
- Both properties can be read and updated, allowing full control over project overtime values.
FAQ
Q: Can I set overtime values programmatically when creating tasks?
- Yes. You can assign
OvertimeWork
andOvertimeCost
to tasks directly with Aspose.Tasks.
Q: Do overtime properties affect the critical path?
- No. Overtime values are resource and cost-related but do not directly change task dependencies or critical path calculations.
Q: Are overtime values preserved in MPP and XML formats?
- Yes. Aspose.Tasks ensures consistent handling of overtime properties across supported Microsoft Project formats.