public static void SummarySalesPriceEstimates()
{
ProjWBSUpdateController controllerLoc;
HierarchyIdBase hierarchyIdLoc;
HierarchyTreeTable hierarchyTreeTableLoc;
str recordWBSId;
smmActivities smmActivitiesLoc;
ProjTable projTableLoc;
CalendarId calendarIdLoc;
PSAActivityEstimates localPSAActivityEstimates;
HierarchyTreeTable localHierarchyTreeTable;
smmActivities localSmmActivities;
HierarchyPath descendantsRangeValue;
SalesPrice summarySalesPriceLoc;
CostPrice summaryCostPriceLoc;
#Characters
descendantsRangeValue = hierarchyTreeTable.Path + hierarchyTreeTable.ElementNumber + #sharp + "*";
smmActivities = smmActivities::find("CDC-008005");
hierarchyTreeTableLoc = hierarchyTreeTable::findRefRecId(smmActivities.RecId);
calendarId = ProjTable::find(smmActivities.projId()).PSASchedCalendarId;
hierarchyId = hierarchyTreeTable.HierarchyId;
controller = new ProjWBSUpdateController(hierarchyId,calendarId);
controller.updateOutlineNumbersAndPublishInPreOrder();
recordWBSId = controller.outlineNumberFor(hierarchyTreeTable.ElementNumber);
if (!controller.hasChildren(hierarchyTreeTable))
{
// Get sum for the task itself.
select sum(TotalSalesPrice), sum(TotalCostPrice) from localPSAActivityEstimates
where localPSAActivityEstimates.ActivityNumber == smmActivities.ActivityNumber;
summarySalesPrice = localPSAActivityEstimates.TotalSalesPrice;
summaryCostPrice = localPSAActivityEstimates.TotalCostPrice;
}
else
{
// Include sum for the selected summary task's descendents.
select sum(TotalSalesPrice), sum(TotalCostPrice) from localPSAActivityEstimates
join RecId from localSmmActivities
where localSmmActivities.ActivityNumber == localPSAActivityEstimates.ActivityNumber
join RecId from localHierarchyTreeTable
where localHierarchyTreeTable.RefRecId == localSmmActivities.RecId
&& localHierarchyTreeTable.Path like descendantsRangeValue;
summarySalesPrice = localPSAActivityEstimates.TotalSalesPrice;
summaryCostPrice = localPSAActivityEstimates.TotalCostPrice;
}
info(recordWBSId);
info(strFmt("%1-%2",summarySalesPrice,summaryCostPrice));
}
{
ProjWBSUpdateController controllerLoc;
HierarchyIdBase hierarchyIdLoc;
HierarchyTreeTable hierarchyTreeTableLoc;
str recordWBSId;
smmActivities smmActivitiesLoc;
ProjTable projTableLoc;
CalendarId calendarIdLoc;
PSAActivityEstimates localPSAActivityEstimates;
HierarchyTreeTable localHierarchyTreeTable;
smmActivities localSmmActivities;
HierarchyPath descendantsRangeValue;
SalesPrice summarySalesPriceLoc;
CostPrice summaryCostPriceLoc;
#Characters
descendantsRangeValue = hierarchyTreeTable.Path + hierarchyTreeTable.ElementNumber + #sharp + "*";
smmActivities = smmActivities::find("CDC-008005");
hierarchyTreeTableLoc = hierarchyTreeTable::findRefRecId(smmActivities.RecId);
calendarId = ProjTable::find(smmActivities.projId()).PSASchedCalendarId;
hierarchyId = hierarchyTreeTable.HierarchyId;
controller = new ProjWBSUpdateController(hierarchyId,calendarId);
controller.updateOutlineNumbersAndPublishInPreOrder();
recordWBSId = controller.outlineNumberFor(hierarchyTreeTable.ElementNumber);
if (!controller.hasChildren(hierarchyTreeTable))
{
// Get sum for the task itself.
select sum(TotalSalesPrice), sum(TotalCostPrice) from localPSAActivityEstimates
where localPSAActivityEstimates.ActivityNumber == smmActivities.ActivityNumber;
summarySalesPrice = localPSAActivityEstimates.TotalSalesPrice;
summaryCostPrice = localPSAActivityEstimates.TotalCostPrice;
}
else
{
// Include sum for the selected summary task's descendents.
select sum(TotalSalesPrice), sum(TotalCostPrice) from localPSAActivityEstimates
join RecId from localSmmActivities
where localSmmActivities.ActivityNumber == localPSAActivityEstimates.ActivityNumber
join RecId from localHierarchyTreeTable
where localHierarchyTreeTable.RefRecId == localSmmActivities.RecId
&& localHierarchyTreeTable.Path like descendantsRangeValue;
summarySalesPrice = localPSAActivityEstimates.TotalSalesPrice;
summaryCostPrice = localPSAActivityEstimates.TotalCostPrice;
}
info(recordWBSId);
info(strFmt("%1-%2",summarySalesPrice,summaryCostPrice));
}
No comments:
Post a Comment