Link to home
Start Free TrialLog in
Avatar of RSTOCKEWLL
RSTOCKEWLL

asked on

Crystal Reports carry forward totals from the previous page

Hi Experts,

I am developing a Crystal Report built on finanical data i.e. Date, Month, Debit, Credit, General Ledger Code

The report requires a sub-totals per ledger account, per month and have therefore inserted groups (new page used to start a new page per either Month or GLCode) and summary fields to deal with this.

The report output also requires that I show page totals, a brought forward in the page header and a carry forward in the page footer. The additional complexity comes that the page totals (bfwd and carry forward) should reset in accordance with the grouping.

So far I have:

Entered a formula in the details section of the report, to take the cumulative value of the debits and similarly one for the credits

WhilePrintingRecords;
NumberVar PageDeb_total;
PageDeb_total := PageDeb_total + {Command.DebitLC};

I have then entered a formula in the page footer as below, which shows the page (carry forward) balance correctly:

WhilePrintingRecords;
NumberVar PageDeb_total;

I am however struggling to define the formula to go in the page header which will bring forward the carry forward from the previous page firstly and secondly that will reset to 0 based on the grouping i.e. if either the month or ledger account changes.

Any help or expert tips would be gratefully welcomed.

Thanks experts
SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike McCracken
Mike McCracken

WHat do you need on the page footer and header when the group changes?

mlmcc
Avatar of RSTOCKEWLL

ASKER

Hi All,

I had tried initially using the below formula in the header:

WhilePrintingRecords;
NumberVar PageDeb_total;
//PageDeb_total := 0

If OnfirstRecord Then 0
else {@PageDebTotal}

Whilst this works on the first page of the report in that it starts the count from zero and similarly the totals at the footer of the page, based on the formula previously posted also shows the correct value e.g. CreditTotal = 4334.01 (this is correct). However when I look at the second page the Page Header displays an opening (brought forward) balance of 4590.21 and not 4334.01 as I would have expected. On examining this further I see that the difference between the values equates to the first 'credit' record (details section) in the second page and therefore that the balance displayed in the page header of page 2 is the 4334.01 brought forward + 1st record of the second page (details section) = 4590.21....

I guess I have overlooked something further.

Regards the resetting at the lowest level of groups, I think this will be the answer to the seconday problem and therefore just need to overcome this problem.

Thanks

Rick
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent job, both of my problems resolved with the solutions suggested.

Great job

Thanks
You're welcome.  Glad I could help.

 James