Managing Task Costs
Contents
[
Hide
Show
]To estimate the cost of a project, tasks are associated with costs. Aspose.Tasks for Java supports this feature of Microsoft Project with a range of properties.
Working with Task Cost
The Task class exposes several 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).
- FIXED_COST: the fixed cost associated with a task (single).
- FIXED_COST_ACCRUAL: 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.
Task cost in Microsoft Project
Getting Task Costs
The following examples show how to get a task’s cost using Aspose.Tasks.
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(ManageTaskCost.class);
4
5Project project = new Project();
6Task task = project.getRootTask().getChildren().add("Task");
7
8task.set(Tsk.COST, BigDecimal.valueOf(800));
9
10System.out.println(task.get(Tsk.REMAINING_COST));
11System.out.println(task.get(Tsk.FIXED_COST));
12System.out.println(task.get(Tsk.COST_VARIANCE));
13System.out.println(project.getRootTask().get(Tsk.COST));
14System.out.println(project.getRootTask().get(Tsk.FIXED_COST));
15System.out.println(project.getRootTask().get(Tsk.REMAINING_COST));
16System.out.println(project.getRootTask().get(Tsk.COST_VARIANCE));