Print total in the last line.
Some accounting systems use to put the total of an amount column in the last
row of a group, like this :
Account A 500
Account B 300
Account C 200 1,000
-------------
Account D 200
Account E 100
Account F 800 1,100
-------------
and so on ...
How can I know if I am in the last row of a group so I can print the total ?
Or any other technique or approach to do this would be greatly appreciated.
Thanks in advance,
This discussion has been closed.
Comments
sums the total field.
procedure GroupFooterBeforePrint
begin
if Report.FirstPass then
begin
TotalLines.Add(IntToStr(Detail.Count));
TotalSales.Add(FloatToStr(DBCalc1.Value));
end;
end;
procedure DetailBeforePrint
begin
if Report.SecondPass then
DBCalc1.Visible :=
(StrToInt(TotalLines[Group1.BreakNo])=(Detail.Count+1))
else
DBCalc1.Visible := False;
end;
HTH
-Jack
Below is a link to an example of an easy work-around solution to your
problem. The example essentially places a variable in a group footer and
calculates the total of the detail band values and then by accessing the
TppVariable's draw command, moving the variable manually to the last line of
the detail band.
http://www.digital-metaphors.com/tips/DrawInDetail.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks much for the sample.
Isn't there any method to just know whether I'm in the last row of a group
or I'm about the break ?
I guessed it should be, since there are before and after break events, just
I can't put my code there.
Regards,
When printing the detail band, you can only access the current record as you
are traversing the data for the first time. Two alternatives to the method
I gave in my last post are as follows:
1. Create a TwoPass report. On the FirstPass, mark each record where the
group break occurs by storing the break value in a String List and then
compare this in the second pass to the current pipeline value.
2. Loop through your dataset before printing the report and locate where
each group break will occurs.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com