7 use C4::Interface::CGI::Output;
12 my ($template, $loggedinuser, $cookie)
13 = get_template_and_user({template_name => "bull/search-supply.tmpl",
17 flagsrequired => {acquisition => 1},
21 #FIXME : Is this page still used ????
25 my $dbh = C4::Context->dbh;
26 my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?");
27 $sthtemp->execute($loggedinuser);
28 my ($flags, $homebranch)=$sthtemp->fetchrow;
29 my ($count,@results)=bookfunds($homebranch);
36 for (my $i=0;$i<$count;$i++){
37 my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'});
38 my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
40 $line{bookfundname} = $results[$i]->{'bookfundname'};
41 $line{budgetamount} = $results[$i]->{'budgetamount'};
42 $line{spent} = sprintf ("%.2f", $spent);
43 $line{comtd} = sprintf ("%.2f",$comtd);
44 $line{avail} = sprintf ("%.2f",$avail);
45 push @loop_budget, \%line;
46 $total+=$results[$i]->{'budgetamount'};
52 my ($count,$rates)=getcurrencies();
53 my @loop_currency = ();
54 for (my $i=0;$i<$count;$i++){
56 $line{currency} = $rates->[$i]->{'currency'};
57 $line{rate} = $rates->[$i]->{'rate'};
58 push @loop_currency, \%line;
60 $template->param(classlist => $classlist,
62 loop_budget => \@loop_budget,
63 loop_currency => \@loop_currency,
64 total => sprintf("%.2f",$total),
65 totspent => sprintf("%.2f",$totspent),
66 totcomtd => sprintf("%.2f",$totcomtd),
67 totavail => sprintf("%.2f",$totavail));
69 output_html_with_http_headers $query, $cookie, $template->output;