logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Can HTML::Template do subtotals?: msg#00068

lang.perl.modules.html-template

Subject: Can HTML::Template do subtotals?

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/ 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.  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-Encumbran ces</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;"
                     
                      >
                      <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"
                     
                       >
                      <TMPL_VAR NAME=col_cfte></td>
    <td align="right" style="cursor:pointer;cursor:hand;"
                      title="Click to drill down"
                     
                      >
         &nbs p;            <TMPL_VAR NAME=col_cbud></td>
    <td align="right" style="cursor:pointer;cursor:hand;"
                      title="Click to drill down"
                     
                      >
                      <TMPL_VAR NAME=col_cmo></td>
    <td align="right" style="cursor:pointer;cursor:hand;"
                      title="Click to drill down"
                     
                      >
                      <TMPL_VAR NAME=col_fytd></td>
    <td align="right" style="cursor:pointer;cursor:hand;"
                       title="Click to drill down"
                     
                      >
                      <TMPL_VAR NAME=col_pre></td>
    <td align="right" style="cursor:pointer;cursor:hand;"
                      title="Click to drill down"
                  &n bsp;  
                      >
                      <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"
                     
    &nbs p;                 >
                      <TMPL_VAR NAME=col_ffte></td>
    <td align="right" style="cursor:pointer;cursor:hand;"
                      title="Click to drill down"
                     
                      >
         ;              <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 - Get your photo on the big screen in Times Square
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
krysalis.sandbo...    web.zope.zwiki/...    gnome.apps.gnum...    xfree86.newbie/...    editors.vim/200...    mozilla.enigmai...    boot-loaders.gr...    network.vnc.ult...    redhat.release....    java.geronimo.u...    os.netbsd.devel...    horde.wicked/20...    linux.lsb.discu...    ietf.ips/2005-0...    alsa.devel/2002...    user-groups.lin...    package-managem...    debian.devel.da...    security.cyrus....    video.gstreamer...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation