This is a migrated thread and some comments may be shown as answers.

Getting sum of sub report for use in master report

3 Answers 249 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
imaginarylight
Top achievements
Rank 1
imaginarylight asked on 08 Jan 2008, 01:27 AM
Hi,

I have an report that I am creating to show invoice information. On this report I use 2 sub reports for 1) items the person has purchased and 2) for payments they have applied to the invoice. All is working well but I would like to perform a calculation on the main report that takes the sum of the items purchased and subtracts the sum of the payments applied to show the balance owing. What would be the best way to approach this?

Thanks

John

3 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 09 Jan 2008, 12:44 PM
Hi John,

Attached you can find a sample solution that should help in your scenario.

Brief description:
  • WindowsApplication1 project - windows form report viewer to show report;
  • ClassLibrary1 - actually the master and the detail reports:
    • DummyDataTable - a programmatically created DataTable with all the purchased items;
    • ReportDetail1 - a sub report with all the purchased items (paid and not paid);
    • ReportDetail2 - a sub report with only already paid items;
    • ReportMaster - a master report, the placeholder of two sub reports mentioned above, the summary values of their price fields and the calculation of not paid items.
Please note that:
  • Both sub reports are exposing their summary values through public ReportSum property. This value was initialized in the ItemDataBound event handler of aggregate field (sum) placed in the subreports' footer;
  • Both sub reports have same data source, only ReportDetails2 have filter on Payment field in addition;
  • Master report uses three text items to display the price of all items, the price of already paid items and the price of non paid items (sum1, sum2 and sumDiff textBox items). All of them are initialized through their ItemDataBound event handlers. Please note how we cast the sender argument to the Telerik.Reporting.Processing.TextBox type.
Kind regards,
Ivan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mark
Top achievements
Rank 1
answered on 05 May 2014, 05:02 PM
Hello Ivan,
This is exactly what I was looking for but: 
I tried this example but could not get it to run on my computer so I tried to apply the code to my situation. I am using C#, VS 2010 with Telerik Reports Q 2014 and the error is that in the main report it knows nothing of the ReportSum:
Error 1 'Telerik.Reporting.SubReport' does not contain a definition for 'ReportSum' and no extension method 'ReportSum' accepting a first argument of type 'Telerik.Reporting.SubReport' could be found (are you missing a using directive or an assembly reference?) C:\Users\MWyatt\Documents\Visual Studio 2010\Projects\cReports\cReports\ConsolidatedMatList.cs 35 49 cReports

Is there any way you could help me out please?
Thank you,
Mark Wyatt
mwyatt@eaglemetal.com
0
Stef
Telerik team
answered on 08 May 2014, 08:20 AM
Hello Mark,

Please refer to the following forum thread and the suggested approaches: TextBox ItemDataBound problem.

I hope this information helps you.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
imaginarylight
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Mark
Top achievements
Rank 1
Stef
Telerik team
Share this question
or