#!/usr/local/bin/perl5_8 use strict; use HTML::Template; use DBI; use CGI ':standard'; my $CGI = CGI->new; # Clear buffers and set up web page (required) $|=1; print $CGI->header; # Get the main menu, and pass $CGI variables to the template as needed my $template = HTML::Template->new(filename => 'xethel.tmpl', associate => $CGI, loop_context_vars => 1, global_vars => 1, die_on_bad_params => 0 ); ############################ Begin Section ################################ # Fetch CGI params. my $continue = $CGI->param('bmscont'); print "bmscont $continue
"; my $selected_dpta = $CGI->param('dpta2'); print "dpta $selected_dpta
"; my $selected_fund = $CGI->param('fund2'); print "fund $selected_fund
"; my $selected_prog = $CGI->param('prog2'); print "prog $selected_prog
"; my $dbh=DBI->connect("dbi:Oracle:".$databs,$userid,$passwd) || die "conn die"; # Funding Group Selection my $fund_sql = " SELECT A.FIELDVALUE, A.XLATLONGNAME FROM XLATTABLE_VW A WHERE A.FIELDNAME = 'NC_FUND_GROUPS' AND A.EFFDT = (SELECT MAX(EFFDT) FROM XLATTABLE_VW A2 WHERE A.FIELDNAME = A2.FIELDNAME) AND A.EFF_STATUS = 'A' ORDER BY A.XLATLONGNAME "; my $sth= $dbh->prepare($fund_sql) || die "prep fund die"; $sth->execute || die "exec fund die"; my @fund_loop = (); my ($fund, $fund_descr, %fund_hash); # Fetch the remaining items for the list from the database while ( my $dat = $sth->fetch ) { my %fund_hash; $fund = $dat->[0]; $fund_descr = $dat->[1]; $fund_hash{fund} = $fund; $fund_hash{fund_descr} = $fund_descr; push(@fund_loop, \%fund_hash); }; # Find variables entered on original main menu and use in subsequent database # calls to populate the remaining boxes. if ( $selected_dpta eq "" || $selected_dpta == "" ) { $selected_dpta = 2 } if ( $continue eq "Continue" ) { # hard-coded for now until we figure out how to fetch selected fund $selected_fund = "AA"; } else { # hmmmmmmmm print "BUZZZZZZZZZ wrong answer... try again"; } # Program list based on the Funding Group selection above my $where_prog = "WHERE A.NC_FUND_GROUPS = ('$selected_fund')"; my $prog_sql = " SELECT DISTINCT PROGRAM_CODE, DESCR FROM PS_NC_BMS_PROGCODE A $where_prog ORDER BY DESCR "; $sth= $dbh->prepare($prog_sql) || die "prep prog die"; $sth->execute || die "exec prog die"; my @prog_loop = (); my ($prog, $prog_descr, %prog_hash); # Fetch the remaining items for the list from the database while ( my $dat = $sth->fetch ) { my %prog_hash; $prog = $dat->[0]; $prog_descr = $dat->[1]; $prog_hash{prog} = $prog; $prog_hash{prog_descr} = $prog . ' - ' . $prog_descr; push(@prog_loop, \%prog_hash); }; $sth->finish(); $dbh->disconnect; #++++++++++++++++++++++++++++ End Section +++++++++++++++++++++++++++++++++ ############################ Begin Section ################################ # Pass params and print page $template->param( fund_loop => \@fund_loop, prog_loop => \@prog_loop, selected_dpta => $selected_dpta, selected_fund => $selected_fund, selected_prog => $selected_prog, ); print $template->output(); # The Main Menu request method is normally "get". When a customer times # out due to inactivity, a message will appear telling them they timed out # and will send them back to the Main Menu. If the Request Method isn't # set to POST right before the Main Menu is displayed, the customers will # be put into an endless loop for timing out. See the subroutine "timeout". $ENV{"REQUEST_METHOD"} = "post";