7 use C4::Interface::CGI::Output;
14 my ($template, $loggedinuser, $cookie)
15 = get_template_and_user({template_name => "acqui/acqui-home.tmpl",
19 flagsrequired => {acquisition => 1},
24 my $dbh = C4::Context->dbh;
25 my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?");
26 $sthtemp->execute($loggedinuser);
27 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'};
53 ($count,$rates)=getcurrencies();
54 my @loop_currency = ();
55 for (my $i=0;$i<$count;$i++){
57 $line{currency} = $rates->[$i]->{'currency'};
58 $line{rate} = $rates->[$i]->{'rate'};
59 push @loop_currency, \%line;
63 my $suggestion = countsuggestion("ASKED");
64 $template->param(classlist => $classlist,
66 loop_budget => \@loop_budget,
67 loop_currency => \@loop_currency,
68 total => sprintf("%.2f",$total),
69 suggestion => $suggestion,
70 totspent => sprintf("%.2f",$totspent),
71 totcomtd => sprintf("%.2f",$totcomtd),
72 totavail => sprintf("%.2f",$totavail),
73 nobudget => $#results==-1?1:0);
75 output_html_with_http_headers $query, $cookie, $template->output;