-for (my $i=0;$i<$count;$i++){
- my ($spent,$comtd)=GetBookFundBreakdown($results[$i]->{'bookfundid'});
- my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
- my %line;
- $line{bookfundname} = $results[$i]->{'bookfundname'};
- $line{budgetamount} = $results[$i]->{'budgetamount'};
- $line{spent} = sprintf ("%.2f", $spent);
- $line{comtd} = sprintf ("%.2f",$comtd);
- $line{avail} = sprintf ("%.2f",$avail);
- push @loop_budget, \%line;
- $total+=$results[$i]->{'budgetamount'};
- $totspent+=$spent;
- $totcomtd+=$comtd;
- $totavail+=$avail;
+for my $r (@results) {
+ my ( $spent, $comtd ) =
+ GetBookFundBreakdown( $r->{'bookfundid'} );
+ my $avail = $r->{'budgetamount'} - ( $spent + $comtd );
+ my %line;
+ $line{bookfundname} = $r->{'bookfundname'};
+ $line{budgetamount} = $r->{'budgetamount'};
+ $line{spent} = sprintf( "%.2f", $spent );
+ $line{comtd} = sprintf( "%.2f", $comtd );
+ $line{avail} = sprintf( "%.2f", $avail );
+ push @loop_budget, \%line;
+ $total += $r->{'budgetamount'};
+ $totspent += $spent;
+ $totcomtd += $comtd;
+ $totavail += $avail;