web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Cost of all projects (SSRS Report)

(0) ShareShare
ReportReport
Posted on by 390

Hey team,

I have an SSRS Report where if the person selects Customer level report without giving the CustAccount number then I have to show the sum of all the estimates of all the projects of all the customers under the selected Division and Profit Center. 

My code:

ProjectEstimatesView projview;
if(!contract.parmCustomerCode())
            {

                int x=0;
               while select projview  where projview.Division == divisions && projview.ProfitCentre == profitcentre             
                {
                    select count(RecId) from projview1 where projview1.Division == projview.Division && projview1.ProfitCentre == projview.ProfitCentre && projview1.CustAccount == projview.CustAccount; 

                    numestimates = projview1.RecId;
                    ecost = estimatetmpclass.getTotalEngineFees(projview.EstimateRefRecId,startenginedate,fromdate,todate,pass);
                    thirdpartycost = estimatetmpclass.getthirdpartycost(projview.EstimateRefRecId,startthirdpartydate,fromdate,todate,pass2);
                    prodinsurance = estimatetmpclass.getproductionInsurance(thirdpartycost,projview.ProdInsurance);
                    csslevy = estimatetmpclass.getCSSLevy(ecost,thirdpartycost,prodinsurance,projview.CCSLevy);

                    projcalculationtmp.ProjId = projview.ProjId;
                    select firstonly projtable where projTable.ProjId == projview.ProjId;
                    projcalculationtmp.CustName = projTable.custName();
                    projcalculationtmp.CustAccountNumber = projview.CustAccount;
                    projcalculationtmp.EstimateCode = projview.EstimateCode;
                    projcalculationtmp.PotentialFee = ecost;
                    projcalculationtmp.thirdPartyCostTotal = thirdpartycost;
                    projcalculationtmp.IsProdInsurance = projview.IsProdInsurance;
                    if( projcalculationtmp.IsProdInsurance)
                    {
                        projcalculationtmp.ProdInsurance = prodinsurance;
                    }
                    else
                    {
                        projcalculationtmp.ProdInsurance = 0;
                    }

                    projcalculationtmp.IsCCSLevy = projview.IsCCSLevy;
                    if(projcalculationtmp.IsCCSLevy)
                    {
                        projcalculationtmp.CCSLevy = csslevy;
                    }

                    else
                    {
                        projcalculationtmp.CCSLevy = 0;
                    }                
                    projcalculationtmp.Total = e  thirdpartycost   prodinsurance   csslevy;

                    projcalculationtmp.insert();
                    x  ;

                    if(x==numestimates)
                    {

                    select sum(PotentialFee),sum(thirdPartyCostTotal),sum(CCSLevy),sum(ProdInsurance),sum(InvestmentEstimate),sum(Total),IsProdInsurance,IsCCSLevy
            from projcalculationtmp where projcalculationtmp.CustAccountNumber == projview.CustAccount;

                    select firstonly projtable2 where projTable2.ProjId == projview.ProjId;
                    projectEstimatesTmp.CustName = projtable2.custName();
                    projectEstimatesTmp.CustAccountNumber = projview.CustAccount;
                    projectEstimatesTmp.ProjId =projcalculationtmp.ProjId;   
                    projectEstimatesTmp.PotentialFee = projcalculationtmp.PotentialFee;
                    projectEstimatesTmp.thirdPartyCostTotal = projcalculationtmp.thirdPartyCostTotal;
                    projectEstimatesTmp.IsProdInsurance = projcalculationtmp.IsProdInsurance;
                    projectEstimatesTmp.ProdInsurance = projcalculationtmp.ProdInsurance;
                    projectEstimatesTmp.IsCCSLevy = projcalculationtmp.IsCCSLevy;
                    projectEstimatesTmp.CCSLevy = projcalculationtmp.CCSLevy;
                    projectEstimatesTmp.Total = projcalculationtmp.Total;

                    projectEstimatesTmp.insert();

                        x = 0;
                }
                }
   

            }
                }

but the problem is since there is no group by on the while loop so  when an estimate of different custaccount is selected by the while loop my logic for if(x==numestimate) is going wrong and some projects(and their cost) are not getting displayed. If I add group by it doesn't give me a value for "numestimate". Please help me resolve this issue. How can I get sum of all projects for each customer under a a particular Division and ProfitCentre.

I have the same question (0)
  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi skd,

    Do you really need to code such a report?

    If you have the customer, division, profit center and the project setup as findims then you can use the trial balance online form to analyze those data.

    Of course you could also use the finance reports if you like.

    Best regards,

    Ludwig

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans