Subtotal on page break

Dan??bioDan??bio Brazil
edited 12:21AM in FreeReport
Hi all!

Firstly, sorry for my bad english. I hope I can make myself understandable.

I'm trying to make a report that has a subtotal when page breaks, and the records of DetailBand are partially in one page, partially on the other.

My report has the following structure:

ReportTitle
Groupheader -> Group Data, Subtotal of the Values in the previous page
MasterData -> Customer Data, First Value
DetailData -> Other Values for this Customer
Footer -> MasterData Value + DetailDataValue
ReportSummary -> Sum of All Values in the Report
PageFooter -> Actual MasterData Value + Sum of the Actual DetailData Values = i.e. Subtotal, Page Count: n/m

PageFooter and GroupHeader has Memos that show the subtotal if ( (MasterData or DetailData) and ( not (Footer) ) ) was printed. This is controled with Boolean Vars setted in the OnAfterPrint events of the Bands. The values are summed through a var too, in the OnAfterData of the Memos that show the values. Curiously, I had a situation that prevented me of summing the last record. It seens that if there's no space to print the last record + the footer, the OnAfterPrint event for the DetailBand and Memo is fired in this page anyway, regardless the data itself is printed on the next page.

My intent is to show the value of sum for the (MasterData+DetailData) that was in the previous page, but only if the MasterData or DetailData is to be continued on the next page.
The report works perfectly if I have only one group, but when I have several groups, there is a situation in wich the page has no left space to print the data, but again, the OnAfterPrint is fired too early.

I'll show a little example in order make myself more clear:

Page 1
Group 1
Customer 1.......100,00
........................200,00
........................300,00
......Subtotal:.....600,00
Page 2
Group 1
......Subtotal:.....600,00
........................400,00
........................500,00
Cust.Subtotal: 1.500,00
Customer 2........100,00
.........................200,00
.........................300,00
Cust.Subtotal:....600,00
Page 3
Group 1
Customer 3........100,00
.........................200,00
.........................300,00
Cust.Subtotal:....600,00

And so on...

I also observed that GroupHeader doesn't print in some pages, but couldn't figure out what is the condition for this (it's property ReprintOnNewPage is true, then it should Reprint On EVERY New Page).

Sorry for my verbosity.
I've attached the FR3 file if needed.

Can someone help me please?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.