At 05:27 AM 12/31/03 -0800, LDT wrote:
This is my first project using Perl and HTML::Template, and my first posting to this users list (after searching <http://www.bluedot.net/mail/archive/>http://www.bluedot.net/mail/archive/ for things like "totals" and "total row" and "subtotal").
I'm trying to figure out how to insert subtotals periodically and to calculate differences between two rows. For example, this is a mock up similar to what I'm doing (mine is more complex):
accounts curr month year-to-date 10-19 $xxx $xxx 20-29 $xxx $xxx 30-39 $xxx $xxx sub1 10-39 $xxxxx $xxxxx 40-49 $xxx $xxx 50-59 $xxx $xxx sub2 40-59 $xxxx $xxxx grand total $xxxxx $xxxxx diff b/w sub1 & sub 2 $xxx $xxx
Right now, I'm using several case statements in my Sybase SQL and several unions (which I know is pretty ugly)... but if I could get HTML::Template and Perl to play nicely together and let me generate occasional subtotals along the way (or differences as the case may be), that would be great. Does HTML::Template have a way to do this? I have the H:T documentation printed out (because I refer to it so often), and I'm wondering if a TMPL_IF might be the answer. But, I can't wrap my brain around how I could use it for subtotalling and differences.
Oh, and feel free to dumb it down for me since I'm new to Perl, SQL, [insert language here]. ;-)
Thanks!
Lori
P.S. I didn't include my Perl code because I wasn't sure if it would be necessary (and it's 600+ lines), but for the masochists among you, you can see it here along with the .tmpl file: <http://www.perlmonks.org/index.pl?node_id=108949&user=Lori713>http://www.perlmonks.org/index.pl?node_id=108949&user=Lori713. The .tmpl file is also included below:
<!-- Begin Summary Report -->
<TMPL_INCLUDE 'nc_start.tmpl'>
<TMPL_INCLUDE 'nc_style.tmpl'>
<TMPL_INCLUDE 'nc_titlebar.tmpl'>
<TMPL_INCLUDE 'nc_rpt_hdr.tmpl'>
<hr>
<form name=frm_summ_rept method=POST action="<http://www.ncsu.edu>http://www.ncsu.edu">
<table border=1 cellspacing=0 cellpadding=1 width="100%" summary="Column Headings and Data Cells">
<tr valign="bottom">
<th width="9%">Account Summary</th>
<th width="18%">Description</th>
<th width="4%">Current FTE</th>
<th width="9%">Current Budget</th>
<th width="9%">Current Month Activity</th>
<th width="9%">FYTD Activity</th>
<th width="9%">Pre-Encumbrances</th>
<th width="9%">Encumbrances</th>
<th width="11%">Budget Balance Available</th>
<th width="4%">Future FTE</th>
<th width="9%">Future Budget</th>
</tr>
<TMPL_LOOP NAME=passacts>
<tr class=<TMPL_VAR NAME=trclass> bgcolor=<TMPL_VAR NAME=bgcolor>>
<td align="left" style="cursor:pointer;cursor:hand;"
onmouseover="style.background='<TMPL_VAR NAME=bgcolor>';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<font color=#000000><TMPL_VAR NAME=col_acct></td>
<td align="left" style="cursor:pointer;cursor:hand;"
title="Account(s) <TMPL_VAR NAME=col_acct>">
<font color=#000000><TMPL_VAR NAME=col_descr></td>
<td align="right" style="cursor:pointer;cursor:hand;"
title="Click to drill down"
onmouseover="style.background='#CCCCFF';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<TMPL_VAR NAME=col_cfte></td>
<td align="right" style="cursor:pointer;cursor:hand;"
title="Click to drill down"
onmouseover="style.background='#CCCCFF';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<TMPL_VAR NAME=col_cbud></td>
<td align="right" style="cursor:pointer;cursor:hand;"
title="Click to drill down"
onmouseover="style.background='#CCCCFF';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<TMPL_VAR NAME=col_cmo></td>
<td align="right" style="cursor:pointer;cursor:hand;"
title="Click to drill down"
onmouseover="style.background='#CCCCFF';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<TMPL_VAR NAME=col_fytd></td>
<td align="right" style="cursor:pointer;cursor:hand;"
title="Click to drill down"
onmouseover="style.background='#CCCCFF';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<TMPL_VAR NAME=col_pre></td>
<td align="right" style="cursor:pointer;cursor:hand;"
title="Click to drill down"
onmouseover="style.background='#CCCCFF';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<TMPL_VAR NAME=col_enc></td>
<td align="right"><TMPL_VAR NAME=col_bba></td>
<td align="right" style="cursor:pointer;cursor:hand;"
title="Click to drill down"
onmouseover="style.background='#CCCCFF';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<TMPL_VAR NAME=col_ffte></td>
<td align="right" style="cursor:pointer;cursor:hand;"
title="Click to drill down"
onmouseover="style.background='#CCCCFF';"
onmouseout ="style.background='<TMPL_VAR NAME=bgcolor>';">
<TMPL_VAR NAME=col_fbud></td>
</tr>
</TMPL_LOOP>
</table>
</form>
<TMPL_INCLUDE 'nc_buttons.tmpl'>
<TMPL_INCLUDE 'nc_end.tmpl'>
<!-- End Summary Report -->
Do you Yahoo!?
Yahoo! Photos - <http://us.rd.yahoo.com/evt=21486/*http://f1.pg.photos.yahoo.com/ph//spsimplenol?.file=ny_ts_splash.html>Get your photo on the big screen in Times Square
------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users