- $req = $dbh->prepare( "select categorycode, description from categories order by description");
- $req->execute;
- my %select_catcode;
- my @select_catcode;
- push @select_catcode,"";
- $select_catcode{""} ="";
- while (my ($catcode, $description) =$req->fetchrow) {
- push @select_catcode, $catcode;
- $select_catcode{$catcode} = $description;
- }
- my $CGICatCode=CGI::scrolling_list( -name => 'Filter',
- -id => 'Filter',
- -values => \@select_catcode,
- -labels => \%select_catcode,
- -size => 1,
- -multiple => 0 );
-
-
-my $branches = GetBranches;
-my @branchloop;
-my @select_branch;
-#my %select_branches;
-push @select_branch,"";
-#$select_branches{""}="";
-foreach my $thisbranch (keys %$branches) {
- push @select_branch,$thisbranch;
- # my $selected = 1 if $thisbranch eq $branch;
- my %row =(value => $thisbranch,
-# selected => $selected,
- branchname => $branches->{$thisbranch}->{'branchname'},
- );
- push @branchloop, \%row;
-}
- my $CGIBranch=CGI::scrolling_list( -name => 'Filter',
- -id => 'Filter',
- -values => \@select_branch,
-# -labels => \%select_branches,
- -size => 1,
- -multiple => 0 );
-
-
- $req = $dbh->prepare( "select distinctrow zipcode from borrowers order by zipcode");
+ $template->param( CAT_LOOP => &catcode_aref);
+ my @branchloop;
+ foreach (sort {$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}} keys %$branches) {
+ my $line = {branchcode => $_, branchname => $branches->{$_}->{branchname} || 'UNKNOWN'};
+ $line->{selected} = 'selected' if ($selected_branch and $selected_branch eq $_);
+ push @branchloop, $line;
+ }
+ $template->param(BRANCH_LOOP => \@branchloop);
+ $req = $dbh->prepare("SELECT DISTINCTROW zipcode FROM borrowers WHERE zipcode IS NOT NULL AND zipcode <> '' ORDER BY zipcode");