Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Wednesday, February 14, 2018

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;

}

No comments:

Post a Comment

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...