The key would be to use the different Qreport bands to trigger the
events you want.  For example: 

Create a global variable called "Total" to hold the page's totals which
are printed at the end of the page.

You could use the PageHeaderBand's BeforePrint event to zero out your
"Total" variable.

Create a second global variable called "SubTotal" to hold the group's
subtotal amount.  Use the BeforePrint event of the Detail band to add
the report line's amount to this "Subtotal" variable.

Use the Group footer's AfterPrint Event to add the "Subtotal" amount
into your "Total" variable.  That way, the variable increases only when
the group has finished printing.  After this is done you will need to
zero out the "Subtotal" variable.

When the Page Footer band prints, it can then print the "Total"
variable's amount.


By using Global variables and triggering the adding of the amounts to
them based on the bands that are activated, you should be able to do
what you want to do.

Tom Nesler

PS.  Your English is way better than my Portuguese...:-)

-----Original Message-----
From: advanced_delphi@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of lucianatol
Sent: Wednesday, September 24, 2008 7:45 AM
To: advanced_delphi@yahoogroups.com
Subject: [advanced_delphi] Re: PLEASEEEE help with quick report


thanksss Tom, i will try to do what you said =)
i would like to do this thing because i wanna sum the total in the
END OF EACH page, and not in the end of relatory
so, i put this code in the GroupheaderBeforePrint:

"if quickrep1.currentY > 2000 then
begin
quickrep1.newpage
sum_data:=0;
end;
sum_data:=sum_data+dm.Query1.fieldbyname('data').AsFloat
tot_data.Caption:=FormatCurr('###,##0.00',floatToCurr(sum_data));"

this works well when the data not breaks...when it breaks, this sum
the value witch goes to other page, u know? and the total stay wrong.
example:
data1 ---
  detail1 ---20,00
  detail2 ---10,00
  detail3 ---30,00
  total:     50,00         

data2
  detail1 --10,00
  detail2 --30,00
  total:    40,00
   
data3
  detail1 --30,00

totalofthepage:150,00(50+40+"60"). I want to appears only 90(50+40) 
in this page.

the data3 breaks and in the other page continue
  detail2 --20,00
  detail3 --10,00
  total:60

If you have some idea of how can i do that, even breaks the data,
please..tell me =D

Thank you very much, i looked for the answer in some forum here in 
Brazil and nobody knows hehehe and sorry for my bad english lol
God bless you

Reply via email to