preloader-matrix

Alfasith

Get cost to complete, Cost at complete in Project WBS in AX 2012

static void AlfasithProjWBSCost(Args _args)
{
    hierarchyTreeTable          hierarchyTreeTablePre;
    smmActivities               smmActivitiesPre;
    psaActivitySetup            psaActivitySetupPre;
    ProjWBSUpdateController     controller;
    while    select hierarchyTreeTablePre  where hierarchyTreeTablePre.HierarchyId  == ‘EWIG-00032’
    {
        smmActivitiesPre  = smmActivities::findWithRecId(hierarchyTreeTablePre.RefRecId);
        psaActivitySetupPre = PSAActivitySetup::findActivityNumber(smmActivitiesPre.ActivityNumber);
        controller = new ProjWBSUpdateController(hierarchyTreeTablePre.HierarchyId,
                psaActivitySetupPre.CalendarId,
                null,
                null,
                null,
                null,
                false,
                ProjViewType::CostTrackingView,
                null,
                null,
                true);
        controller.updateOutlineNumbersAndPublishInPreOrder();
        print controller.outlineNumberFor(hierarchyTreeTablePre.ElementNumber);
        //Cost estimnation View
        print controller.actualCostFor(hierarchyTreeTablePre.ElementNumber);
        print controller.costAtCompleteFor(hierarchyTreeTablePre.ElementNumber);
        print controller.plannedCostFor(hierarchyTreeTablePre.ElementNumber);

        /*Total actualCost = controller.actualCostFor(_hierarchyTreeTable.ElementNumber);
        Total costAtComplete = controller.costAtCompleteFor(_hierarchyTreeTable.ElementNumber);
        Total costToCompleteAmount = costAtComplete – actualCost;
        */
    }
    pause;

}

Leave a Reply

Your email address will not be published.