VFP Printing B/Fwd and C/Fwd Page Totals

VFP Printing B/Fwd and C/Fwd Page Totals

These days it is not often that users want to print great swathes of paper of - say - all the journals posted to a ledger or even to a single ledger account.
On-line realtime systems have greatly reduced the need for such printouts.
However, I received a request to put Carry Forward (C/Fwd) and Brought Forward (B/Fwd) totals into a report when the number of journals to an individual account went over N+ pages.
Easy I thought. Just sum the detail amounts and put a B/Fwd in the page header and a C/Fwd in the page footer to print the interim totals. Only print the C/Fwd and B/Fwds when the interim total is not Zero by setting the 'Print When' condition to MYCBFWDTOT <> 0

Worked fine until:
a) an account ended near the bottom of the page
b) at a page throw the account just happened to total zero

For a) an account total was given. This should have cleared the the C/Fwd and B/Fwd's to zero. Unfortunately this clearing back to zero does not occur until the new account group is encountered on the next page - so the C/Fwd and B/Fwd showed the prior accounts total.

For b) no C/Fwd or B/Fwd totals were given because MYCBFWDTOT happened to be zero at the point of a page throw.
Thus a little research and a lot of testing to resolve these issues arose.

It was resolved using the VFP9 facility to run an expression when a print band (page header/footer, group header/footer, detail) is entered or exited.

First I declared a report variable MYCBFWDPRINT and set it to .F. (False)
Then the Detail band Entry Expression was set to
      _VFP.SetVar('MYCBFWDPRINT', .T.)
Which sets the report variable to true when first printing a detail line.
(A function call is required here as a direct Assignment Expression is not permitted.)

Then the Account Group Footer band Entry Expression was set to
      _VFP.SetVar('MYCBFWDPRINT', .F.)
Which sets the report variable to false when entering the account totals print band.

Then finally in the print controls for the C/Fwd and B/Fwd amounts the Print When condition was set to just -
      MYCBFWDPRINT

This solved all the problems prevously encountered by controlling printing on the value of MYCBFWDPRINT and not the MYCBFWDTOT variable.

Such Entry and Exit expressions can be used by a programmer to achieve more user friendly and flexible report layouts.
Leave a Comment
  • Please add 4 and 3 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 1. Comment: Modified title casing

Page 1 of 1 (1 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Richard Mueller edited Revision 1. Comment: Modified title casing

Page 1 of 1 (1 items)