#!/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(); #### package nc_rpt_library; #contains various subroutines used by the Campus Financial Reporting system use strict; use Exporter (); our @ISA = 'Exporter'; our @EXPORT; use vars @EXPORT=qw/ &call_vars &commify &dberror $CGI $spec_vars $titlebar $rpt_no $rpt_lbl $rpt_asofdt $rpt_name $project $proj_ref $attr_dept $attr_descr $attr_award $attr_prog $attr_projpd $attr_fyr $attr_budgpd $attr_fund $attr_rate $attr_sub $attr_status $attr_spec $attr_equip $attr_resp $attr_pi $rpt_type $from_act_tbl $from_bud_tbl $per_crmo $per_fytd $per_fytdadj $per_fytdbal $per_fytdbaladj $attr_pfyr $ledger $timespan $bud_led_amt $act_led_amt $pre_led_amt $enc_led_amt $cell_col $cell_row $acct_sql $src_or_scen $curr_or_stat $src_lbl $summ_col $summ_row $per_col $per_row $jrnl_col $jrnl_row $ouc_code $proj_display $cell_descr $summ_descr $mycheck $rpt_id $rpt_dates $sql_asofyr $sql_asofmo $sql_asofdy $amt_type $led_tbl /; sub call_vars #pulls in passed variables { use CGI ':standard'; my $CGI = CGI->new; my $spec_vars = param('spec_vars'); #strip out descr labels in front of actual value $spec_vars =~ s/(xxx\w*zzz)(.*|\n~)(.{1})/$2/gm; ( $titlebar, $rpt_no, $rpt_lbl, $rpt_asofdt, $rpt_name, $project, $proj_ref, $attr_dept, $attr_descr, $attr_award, $attr_prog, $attr_projpd, $attr_fyr, $attr_budgpd, $attr_fund, $attr_rate, $attr_sub, $attr_status, $attr_spec, $attr_equip, $attr_resp, $attr_pi, $rpt_type, $from_act_tbl, $from_bud_tbl, $per_crmo, $per_fytd, $per_fytdadj, $per_fytdbal, $per_fytdbaladj, $attr_pfyr, $ledger, $timespan, $bud_led_amt, $act_led_amt, $pre_led_amt, $enc_led_amt, $cell_col, $cell_row, $acct_sql, $src_or_scen, $curr_or_stat, $src_lbl, $summ_col, $summ_row, $per_col, $per_row, $jrnl_col, $jrnl_row, $ouc_code, $proj_display, $cell_descr, $summ_descr, $mycheck, $rpt_id, $rpt_dates, $sql_asofyr, $sql_asofmo, $sql_asofdy, $amt_type, $led_tbl, ) = split /~\s?/, $spec_vars; return; }