#!/usr/local/bin/perl5_8 use strict; use nc_rpt_library; use HTML::Template; use DBI; use CGI ':standard'; my $CGI = CGI->new; $|=1; #Determine if this is download to Excel or web report. my $excel = $CGI->param('excel'); my ($template_name, $summ_row_nobr, $ouc_code_fix, $new_per_fytd ); if ( $excel eq "Download to Excel" ) { print $CGI->header(-type => 'application/vnd.ms-excel'); &call_vars; #calls in hidden fields $template_name = "nc_period_xl.tmpl"; } elsif ( $excel == "" ) { &call_vars; print $CGI->header; $template_name = "nc_period.tmpl"; $summ_descr = $CGI->param('cell_descr'); #these are coming from $summ_col = $CGI->param('cell_col'); #the previous page and $summ_row = $CGI->param('cell_row'); #need to be captured } my $template = HTML::Template->new( filename => $template_name, associate => $CGI, loop_context_vars => 1, global_vars => 1, ); #Period drilldown SQL (hard-coded for now) --- snipped out (that part works) #Fetch Period cell data from database --- snipped out (that part works) #Create @loop_data array for HTML::Template --- snipped out (that part works) ############################################################################### #NOTE: LOTS OF VARIABLES SNIPPED OUT HERE but they match the &call_vars list. #For the masochists among you, the entire code is posted on my notepad. ############################################################################### $template->param( title_bar => "Report $rpt_no - $rpt_lbl - Period", rpt_no => $rpt_no, rpt_lbl => $rpt_lbl, rpt_asofdt => $rpt_asofdt, rpt_name => $rpt_name, project => $project, proj_ref => $proj_ref, attr_dept => $attr_dept, attr_descr => $attr_descr, attr_award => $attr_award, attr_prog => $attr_prog, attr_projpd => $attr_projpd, attr_fyr => $attr_fyr, attr_budgpd => $attr_budgpd, attr_fund => $attr_fund, attr_rate => $attr_rate, attr_sub => $attr_sub, attr_status => $attr_status, attr_spec => $attr_spec, attr_equip => $attr_equip, attr_resp => $attr_resp, attr_pi => $attr_pi, passdata => \@loop_data, ); print $template->output();