Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to display total on last set of records

Status
Not open for further replies.

jcook32

Programmer
Jun 11, 2003
20
US
I have code that works ok. It keeps a running total and displays it on the screen. the way i have the code set up though is it does not give me a running total for the last set of data.
My screen looks like this:
Health Care Group
|30 | 31-60 |61-90 |91-120 |120 | Net |
Total $1,428,512 $694,560 $326,272 $154,673 $451,112 3,055


Intellectual Property Group
30 |31-60 |61-90 |91-120| 120 |Net |
Total 1,655,587 1,737,393 533,269 363,6551, 976 146,266


Government Services Group
30 | 31-60 |61-90 |91-120 |120 |Net |

Under Government Services Group there should be a total like the first two.
My code:
do while not rs.eof
strDispName=rs("tsectdes")
locDesc= rs("ldesc")
dept=rs("tsectdes")


if not strFullName=strDispName then
if intTotPts1 > 0 or intTotPts2 >0 or intTotPts3 >0 or intTotPts4 >0 or intTotPts5 >0 or intTotPtsttl > 0 then
response.write &quot;<tr bgcolor=&quot; & rspaleyellow & &quot;><td class=home2textB>Total</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts1,0)& &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts2,0) & &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts3,0) & &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts4,0) & &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts5,0) & &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPtsttl,0) & &quot;</td>&quot;
response.write &quot;</tr>&quot;
end if
intTotPts1=0
intTotPts2=0
intTotPts3=0
intTotPts4=0
intTotPts5=0
intTotPtsttl=0
end if

if Not strFullName=strDispName then
response.write &quot;<table style=&quot;&quot;border:solid &quot; & tableborder & &quot; 1px&quot;&quot; align=&quot;&quot;center&quot;&quot; width=&quot;&quot;95%&quot;&quot;>&quot;
response.write &quot;<tr class=tablehead2><td class=home2textb colspan=7>&quot; & dept & &quot;</td>&quot;
response.write &quot;</tr>&quot;
response.write &quot;<tr class=tablehead>&quot;
response.write &quot;<th width=&quot;&quot;25%&quot;&quot;>Matter Resp Attorney/Matter</th>&quot;
response.write &quot;<th>30 Days of Less</th>&quot;
response.write &quot;<th>31-60 Days</th>&quot;
response.write &quot;<th>61-90 Days</th>&quot;
response.write &quot;<th>91-120 Days</th>&quot;
response.write &quot;<th>120 Days of More</th>&quot;
response.write &quot;<th>Net Outstanding</th>&quot;
response.write &quot;</tr>&quot;
end if
if v=1 then
bgcolor=rsgreyll
v=0
else
bgcolor=&quot;#ffffff&quot;
v=1
end if

'if Not strFullName=strDispName then
' response.write &quot;<tr bgcolor=&quot; & bgcolor & &quot; class=home2text valign=top>&quot;
' response.write &quot;<td>&quot; & rs(&quot;tsectdes&quot;) & &quot;</td>&quot;
' response.write &quot;<td>&quot; & formatcurrency(rs(&quot;one&quot;),0) & &quot;</td>&quot;
' response.write &quot;<td>&quot; & formatcurrency(rs(&quot;two&quot;),0) & &quot;</td>&quot;
' response.write &quot;<td>&quot; & formatcurrency(rs(&quot;three&quot;),0) & &quot;</td>&quot;
' response.write &quot;<td>&quot; & formatcurrency(rs(&quot;four&quot;),0) & &quot;</td>&quot;
' response.write &quot;<td>&quot; & formatcurrency(rs(&quot;five&quot;),0) & &quot;</td>&quot;
' response.write &quot;<td>&quot; & formatcurrency(rs(&quot;ttl&quot;),0) & &quot;</td>&quot;
' response.write &quot;</tr>&quot;
'end if
'running totals
intTotPts1=intTotPts1 + rs(&quot;one&quot;)
intTotPts2=intTotPts2 + rs(&quot;two&quot;)
intTotPts3=intTotPts3 + rs(&quot;three&quot;)
intTotPts4=intTotPts4 + rs(&quot;four&quot;)
intTotPts5=intTotPts5 + rs(&quot;five&quot;)
intTotPtsttl=intTotPtsttl + rs(&quot;ttl&quot;)


intSpace=1
intFirst=1
strTLoc=rs(&quot;tkloc&quot;)
strFullName=strDispName

rs.movenext
loop

Please help

thanks
joe cook
 
YOu need to repeat


if intTotPts1 > 0 or intTotPts2 >0 or intTotPts3 >0 or intTotPts4 >0 or intTotPts5 >0 or intTotPtsttl > 0 then
response.write &quot;<tr bgcolor=&quot; & rspaleyellow & &quot;><td class=home2textB>Total</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts1,0)& &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts2,0) & &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts3,0) & &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts4,0) & &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPts5,0) & &quot;</td>&quot;
response.write &quot;<td class=home2text>&quot; & formatcurrency(intTotPtsttl,0) & &quot;</td>&quot;
response.write &quot;</tr>&quot;
end if

AFTER your last loop is executed....

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
You are the man!!! Thanks

Another question. I want to take those three totals and add them together to get a Total for the whole column which would be the department total.

Thanks

Hey we have the same last name Cook
Any relative in Pittsburgh, PA area??

Joe Cook
 
Rick Cook is an author - I found the quote....

each time you print, add...

dptTotal1 =dptTotal1 + intTotPts1
dptTotal2 =dptTotal2 + intTotPts2
...
...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top