7 use C4::Interface::CGI::Output;
14 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
16 template_name => "acqui/acqui-home.tmpl",
20 flagsrequired => { acquisition => 1 },
26 my $dbh = C4::Context->dbh;
29 "Select flags, branchcode from borrowers where borrowernumber = ?");
30 $sthtemp->execute($loggedinuser);
31 my ( $flags, $homebranch ) = $sthtemp->fetchrow;
33 my ( $count, @results ) = bookfunds($homebranch);
40 for (my $i=0;$i<$count;$i++){
41 my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'});
42 my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
44 $line{bookfundname} = $results[$i]->{'bookfundname'};
45 $line{budgetamount} = $results[$i]->{'budgetamount'};
46 $line{spent} = sprintf ("%.2f", $spent);
47 $line{comtd} = sprintf ("%.2f",$comtd);
48 $line{avail} = sprintf ("%.2f",$avail);
49 push @loop_budget, \%line;
50 $total+=$results[$i]->{'budgetamount'};
58 ( $count, $rates ) = getcurrencies();
59 my @loop_currency = ();
60 for ( my $i = 0 ; $i < $count ; $i++ ) {
62 $line{currency} = $rates->[$i]->{'currency'};
63 $line{rate} = $rates->[$i]->{'rate'};
64 push @loop_currency, \%line;
68 my $status = $query->param('status') || "ASKED";
69 my $suggestion = CountSuggestion($status);
70 my $suggestions_loop = &SearchSuggestion( '', '', '', '', $status, '' );
73 classlist => $classlist,
75 loop_budget => \@loop_budget,
76 loop_currency => \@loop_currency,
77 total => sprintf( "%.2f", $total ),
78 suggestion => $suggestion,
79 suggestions_loop => $suggestions_loop,
80 totspent => sprintf( "%.2f", $totspent ),
81 totcomtd => sprintf( "%.2f", $totcomtd ),
82 totavail => sprintf( "%.2f", $totavail ),
83 nobudget => $#results == -1 ? 1 : 0
86 output_html_with_http_headers $query, $cookie, $template->output;