Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summary band on multi-page report 2

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB
I have a report (Sales Invoice) which includes information at the end, like the total value(s) and various captions and declarations.

I can put this into the page footer, and that works fine in most cases. However, if the document runs to two or more pages, it would be nice if only the last page included the invoice value &c.

I have tried creating a summary band, by right-clicking the report preview and selecting ‘Optional bands’, then choosing ‘Report includes summary band’ and ‘Include page footer with summary‘; this resolves the matter up to a point : the invoice totals &c are shown only at the end of a 2+ page document.

But this information is printed right after the last detail line. Is there a way of making this appear at the end of the last page – where the page footer would normally be?

Thanks. Andrew Mozley
 
The summary band does not position at the footer as you find; nor is there a setting that I know of to accomplish this. Instead, it always positions at the end of the detail band. The challenge would be to determine how many blank detail rows to add at the end of the detail band to force the positioning of the summary band lower. You would need to know how much space the detail rows take up each and then calculate how much space is used. Then you would need to know how much space the summary band uses; the difference would then be the number of blank rows to be added to the report cursor.
 
Another option would be to put the totals, etc. in the page footer, but to add a Print When clause, specifying they should only be printed when [tt]_pageno = _pagetotal[/tt].

(I'm assuming that each invoice is a separate report.)

Keep in mind too that this might slow down the printing, as it will require the report engine to make two passes of the report.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you gGreen (how do people address you!) for your very prompt reply. I think that would do the trick.

It happens (I never mentioned it) that I also have ruled vertical lines round the detail lines – in fact a box - (starting in the page header and ending in the page footer). But that would not be affected by your solution.

And thank you Mike. I think that your solution is best (each invoice is indeed a separate report), because I do not then need to do any calculation.

I was aware of the ‘Print when’ option in the report designer, but lacked the ingenuity to apply it in this case!

Andrew M.
 
The page footer now only prints on the last (2nd) page. That is good. But I notice two matters which I would like to resolve (although they are less important) :

1. The page footer is about 8cm. I find that on the first page, that 8cm space is still left blank at the bottom of the page, Is there a way of not only suppressing the page footer on the first page, but reducing the space it occupies? So that the detail lines can continue a bit further down the first page.

2. There is one field (a couple of lines, legal stuff) on the page footer, which is not present on most invoices. So (greatly simplified), the page footer looks like :

Page footer Info line #1
Legal stuff
Page footer Info line #2

I have marked that field on the report designer, so that ‘Remove line if blank’ is ticked.

If the legal stuff is suppressed, that sort-of has the desired affect. The lines before and after it in the page footer close up., so that part of the last page looks like :

Page footer Info line #1
Page footer Info line #2

But the page footer seems to remain the same size - there is an extra blank line before the Line #1, so that Line #1 just starts further down the page footer.

Is there a way of making the total height of the page footer shrink, when the ’Remove line if blank’ function kicks in?

Thank you again.
 
I do not know a way. The footer size is set at design time in the report designer and is not calculated at run-time. So, I don't think there is an easy solution for this. Just using the ’Remove line if blank' setting does not change the height of the band (footer); it only affects the positioning of the next line in the band.

BTW -- ggreen is 'short' for Greg Green
 
Andrew,

Glad to hear that the original problem is solved. I'm sorry I didn't notice your follow-up question.

But I agree with Greg. Basically, you can't vary the overall height of the footer band at run time. The best you can do is to squash up the lines of data, which you already know.

Greg: Have you considered creating a signature for your posts, to include your actual name? It's not essential, of course, but it would make it easier for folk who wouldn't otherwise know your name to address you. Just a thought.


Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Andrew,

One trick I used in some of my reports is to add enough blank records in your base cursor
of the report in order to push the summary to the bottom of the page.

For this, you will have to identify the number of lines accommodatable in your page
(basically content of your Detail Band), the height of your Summary Band (represented in terms of number of lines as per Detail Band)
and then do some calculations to find out how many blank records you need to add.

I believe, below is what I'd done.

For example,
1. Suppose without Title and Summary bands, your Detail Band prints 50 lines on your page.
2. Your Title height, represented in terms of the same Detail Band line, is 15 lines
3. Your Summary height, represented in terms of the same Detail Band line, is 10 lines
4. Your base cursor for report has 110 records

5. Now, page 1 will contain (or can accommodate), 35 records (i.e., 50 - title band)
6. page 2 will contain 50 records (utilizes full page height)
7. Now, for page 3 (last page), only 25 records are left. But here, your summary will take 10 lines.

So, to push summary to bottom, you will add 15 blank records.
The code to do this, you can add in the INIT of report form.
See that, the number of lines in a page need to be hardcoded into the calculation (I don't know a way to auto identify it!)

Does this make sense?

Rajesh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top