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++){
44 my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'});
45 my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
48 $line{bookfundname} = $results[$i]->{'bookfundname'};
49 $line{budgetamount} = $results[$i]->{'budgetamount'};
50 $line{spent} = sprintf ("%.2f", $spent);
51 $line{comtd} = sprintf ("%.2f",$comtd);
52 $line{avail} = sprintf ("%.2f",$avail);
53 $line{'toggle'} = $toggle;
54 push @loop_budget, \%line;
55 $total+=$results[$i]->{'budgetamount'};
62 ($count,$rates)=getcurrencies();
63 my @loop_currency = ();
64 for (my $i=0;$i<$count;$i++){
66 $line{currency} = $rates->[$i]->{'currency'};
67 $line{rate} = $rates->[$i]->{'rate'};
68 push @loop_currency, \%line;
72 my $suggestion = countsuggestion("ASKED");
73 $template->param(classlist => $classlist,
75 loop_budget => \@loop_budget,
76 loop_currency => \@loop_currency,
77 total => sprintf("%.2f",$total),
78 suggestion => $suggestion,
79 totspent => sprintf("%.2f",$totspent),
80 totcomtd => sprintf("%.2f",$totcomtd),
81 totavail => sprintf("%.2f",$totavail),
82 nobudget => $#results==-1?1:0);
84 output_html_with_http_headers $query, $cookie, $template->output;