In the interrest of helping someone else here is what I came up with to show
Labor and Material colums. Thus is a Sub and not a function so it has to be
ran manaully everytime you want to calc the values. Thanks Jan for all your
help.
Sub CalcLaborMaterial()
Dim Job As Task
Dim Iemand As Resource
Dim WieDoenWat As Assignment
CustomFieldPropertiesEx FieldID:=pjCustomTaskCost1,
Attribute:=pjFieldAttributeNone, _
SummaryCalc:=pjCalcNone,
GraphicalIndicators:=False, _
AutomaticallyRolldownToAssn:=False
CustomFieldPropertiesEx FieldID:=pjCustomTaskCost2,
Attribute:=pjFieldAttributeNone, _
SummaryCalc:=pjCalcNone,
GraphicalIndicators:=False, _
AutomaticallyRolldownToAssn:=False
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
Job.Cost1 = 0
Job.Cost2 = 0
End If
Next Job
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
Job.Cost1 = 0
Job.Cost2 = 0
For Each WieDoenWat In Job.Assignments
If WieDoenWat.ResourceType = pjResourceTypeWork Then
Job.Cost1 = Job.Cost1 + WieDoenWat.Cost
End If
If WieDoenWat.ResourceType = pjResourceTypeMaterial Then
Job.Cost2 = Job.Cost2 + WieDoenWat.Cost
End If
Next WieDoenWat
End If
Next Job
CustomFieldPropertiesEx FieldID:=pjCustomTaskCost1,
Attribute:=pjFieldAttributeNone, _
SummaryCalc:=pjCalcRollupSum,
GraphicalIndicators:=False, _
AutomaticallyRolldownToAssn:=False
CustomFieldPropertiesEx FieldID:=pjCustomTaskCost2,
Attribute:=pjFieldAttributeNone, _
SummaryCalc:=pjCalcRollupSum,
GraphicalIndicators:=False, _
AutomaticallyRolldownToAssn:=False
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
Job.Text1 = "Labor:" & FormatCurrency(Job.Cost1, 0) & _
" <--> Material:" & FormatCurrency(Job.Cost2, 0)
End If
Next Job
End Sub