Search your query

Tuesday, July 1, 2025

X++ code to fetch the Project total cost value from Project WBS based on Project ID

 X++ code to fetch Project total cost value from Project WBS based on Project ID


public static AmountMST findProjectWBSTotalCostValue(ProjTable _projTable)

{

    ProjTable                                       projTableLocal;

    AmountMST                                   totalWBSCost;

    PSAActivityEstimates                    projectActivityEstimates;

    SmmActivityParentLinkTable         activityParentLinkTable;

    SmmActivities                              smmActivities;


    if  (_projTable)

    {

        while select activityNumber from smmActivities

            exists join activityParentLinkTable

            where activityParentLinkTable.ActivityNumber == smmActivities.ActivityNumber

            exists join projTableLocal

            where projTableLocal.RecId == activityParentLinkTable.refRecId &&

                  activityParentLinkTable.parentType == smmActivityParentType::Project &&

                  projTableLocal.ProjId == _projTable.ProjId

        {

            while select projectActivityEstimates

            where projectActivityEstimates.ActivityNumber == smmActivities.ActivityNumber

            {

                    totalWBSCost += projectActivityEstimates.TotalCostPrice;

            }

        }

    }

    return totalWBSCost;

}

No comments:

Post a Comment