Managing Task Costs
Contents
[
Hide
Show
]To estimate the cost of a project, tasks are associated with costs. Aspose.Tasks for .NET supports this feature of Microsoft Project with a range of properties.
Working with Task Cost
The Tsk exposes a number of properties for working with task cost:
- Cost: a task’s projected or scheduled cost (double).
- BCWP: the budgeted cost of the work performed to date (double).
- BCWS: the budgeted cost of scheduled work (double).
- FixedCost: the fixed cost associated with a task (single).
- FixedCostAccrual: the fixed cost accrued for a task (CostAccrualType).
Viewing Task Costs in Microsoft Project
To view task costs in Microsoft Project:
- On the Task Entry form, go to the Insert menu and select Columns.
- Add the cost columns.
Getting Task Costs
The following examples show how to get a task’s cost using Aspose.Tasks.
1// Create new project
2Project project = new Project();
3
4// Add task and set cost
5Task task = project.RootTask.Children.Add("Task");
6task.Set(Tsk.Cost, 800);
7
8// Display cost related properties of task
9Console.WriteLine(task.Get(Tsk.RemainingCost));
10Console.WriteLine(task.Get(Tsk.FixedCost));
11Console.WriteLine(task.Get(Tsk.CostVariance));
12Console.WriteLine(project.RootTask.Get(Tsk.Cost));
13Console.WriteLine(project.RootTask.Get(Tsk.FixedCost));
14Console.WriteLine(project.RootTask.Get(Tsk.RemainingCost));
15Console.WriteLine(project.RootTask.Get(Tsk.CostVariance));