0
votes

I have a report created with Digital Metaphors ReportBuilder (VCL edition, in Delphi XE3). It's an invoice, with header, detail and footer bands.

When the data fits in one page, all is well. If I have more data, that fills, lets say for the sake of argument, 2 pages, I would requires:

  1. Footer band only in the last page
  2. On all other pages, the footer band should be replaced with only the running amount from the detail band, up until that page (from the first one).
  3. On all but the first, the header should include the running totals of all previous pages.

Something like:

Page 1: - (Header) - Detail - "Value until now: (Sum of one the the fields present in the detail band)"

Page 2: - (Header) - "Value until now: (Sum of one the the fields present in the detail band) of previous pages" - Detail - Footer

I've tried to investigate group totals, using a DBCalc component, but those aren't aware of the page. It only shows the total in the end, and not at the end of the page.

Any pointers of how I could do this? Thank you

1

1 Answers

2
votes

You will need to make some use of the Calc tab, in order to decide when you want certain bands to be shown or hidden. The Report has a PageNo property which you can use to decide when to show a header or a footer, in the header or footer's BeforePrint event.

As for showing a running total at the bottom of each page, you could use a ppRegion component (which is the ReportBuilder equivalent of a Panel). Again, you can use the BeforePrint event to decide when this shows.

The running totals themselves should be done using ppVariables. As you traverse through the data, add values into each variable that you need. Put these variables in the Region mentioned above, and they will display the value as it is at the end of each page. Timing can play a part here, so you may need to adjust the Variable's CalcType, ResetType, CalcComponent and ResetComponent properties to fit your needs.

I have been using ReportBuilder for almost 10 years and believe me, everything can be done, but some operations may just take time to perfect. We now use it exclusively in our software, both for the standard reports that we issue with our product (over 300) and for users to create their own reports.