×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Printing Summary always at bottom of page

Printing Summary always at bottom of page

Printing Summary always at bottom of page

(OP)
Dear Team,

First of all, A Very Very Happy New Year to all of you guys!

I have a report form (an invoice) where I want to print the summary section, consisting of Invoice totals, a Terms & Conditions section (pure hard-coded text) and Delivery details, only at the last page. But, if I use Summary Band, it prints immediately after finishing the records of detail lines, ie may not always be at the bottom of page. If I use Page Footer with Print When as '_PAGENO == _PAGETOTAL' and 'Remove line if blank' checked, it prints only at the last page, but it leaves the footer spacing on every page. If my report runs into 5 pages, in each page (except last one) the height of footer section is always left blank.

I have already come across a post with a similar question, but didn't find a proper solution in that.

Any thoughts?

Thanks in advance,
Rajesh

RE: Printing Summary always at bottom of page

In the report property optional bands you can choose whether the summary band prints right under the last detail and its footers or on a separate page, so if you want that, simply check the box at "Summary prints as new page":



Otherwise the pagefooter should be a solution, if you uncheck "constant band height" and only printwhen all elements of the footeer when the page is the last page, the footer band should not reserve blank space, as it will collapse when it's elements don't print.

Bye, Olaf.

RE: Printing Summary always at bottom of page

(OP)
Dear Olaf,

Thank you for your reply.

I don't want the Summary on a new page. I want the Summary to be always at the bottom of the page (like a page footer).
I had tried the settings you mentioned for page footer. But it didn't work. Even if the contents are not printed (when it is not the last page), it leaves the footer height spacing as it is. I believe, I checked and ensured for each and every element in the footer that they have '_pageno == _pagetotal' in their 'Print when' and the 'Remove if blank' is selected. Am I missing something else?

Thanks,
Rajesh

RE: Printing Summary always at bottom of page

Quote:

I checked and ensured for each and every element in the footer that they have '_pageno == _pagetotal' in their 'Print when' and the 'Remove if blank' is selected. Am I missing something else?

Yes. If you read Olaf's reply, you will see that he has given you that last step: remove the tick against "Constant band height".

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Printing Summary always at bottom of page

I tried a bit. It seems the foter only collapses "stretch with overflow" elements and still their unstretched size remains.

The only solution giving ou a chance to keep all space on every but the last page is to add enough empty lines, so the summary band will display at the page bottom.

Bye, Olaf.

RE: Printing Summary always at bottom of page

(OP)
Dear Olaf,

As you suggested, I managed to add blank lines and now I am getting what I wanted when tested over a few invoices with different number of items on it ranging from 2 items to 150 items per invoice.

After generating the final cursor for the invoice report, I determine the number of blank lines to be inserted, if required, as below.

lBlankLines = 23 - MOD(RECCOUNT(), 38)

where 38 is max number of lines on any page and 23 is max lines that can be accommodated in the last page in order to give room for my summary. Then I insert <lBlankLines> number of blank records in my cursor.

As far as I have seen, it produced desired output.
The only bad thing is that I have hard-coded the numbers in the report's Init method where I generate the cursor.

Thanks to Olaf and all others too,
Rajesh

RE: Printing Summary always at bottom of page

Quote:

The only bad thing is that I have hard-coded the numbers in the report's Init method where I generate the cursor.

I don't think there's anything terribly wrong with that. Although it's generally undesirable to hard-code this sort of value, in this case the number is very much tied in with the design of the invoice. If I faced the same problem, I would probably do the same as you.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Printing Summary always at bottom of page

(OP)
Dear Mike,

Yes, it's closely tied up with the design.
If I want to make it dynamic, at least for now, I just don't know how to do that and it would be a nightmare if I try.

Rajesh

RE: Printing Summary always at bottom of page

Well, I suppose one way of doing it dynamically would be something like this:

1. In the summary band of your invoice, create a Run Expression. Have the expression call a function that sets a public variable to the page number (_PAGENO).

2. Before you generate the cursor, do a dummy print of one invoice, that is, print it other than to a physical printer (e.g. to a file, which you can later delete; or to NULL [if that option is still supported]).

3. You now know the number of pages; it's in the variable from step 1. You also know how many records you have just printed. That should allow you to calculate the number of records per page.

4. Use that value when calculating how many blank records to generate in the cursor.

5. Print the invoices for real.

But I'm not seriously suggesting you do any of this. Hard-coding the relevant numbers is much easier, and perfectly acceptable, in my opinion.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close