No harm in adding these to the main branch either
[koha.git] / showbudget.pl
1 #!/usr/bin/perl
2
3 #script to show list of budgets and bookfunds
4 #written 4/2/00 by chris@katipo.co.nz
5 #called as an include by the acquisitions index page
6
7 use C4::Acquisitions;
8 #use CGI;
9 #my $inp=new CGI;
10 #print $inp->header;
11 my ($count,@results)=bookfunds;
12
13
14 print <<printend
15
16 <TABLE  width="40%"  cellspacing=0 cellpadding=5 border=1 >
17 <FORM ACTION="/cgi-bin/koha/search.pl">
18 <TR VALIGN=TOP>
19 <TD  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><b>BUDGETS AND BOOKFUNDS</b></TD></TR>
20 <TR VALIGN=TOP>
21 <TD colspan=2><table>
22
23
24 <tr><td>
25 <b>Budgets</B></TD> <TD><b>Total</B></TD> <TD><b>Spent</B></TD><TD><b>Comtd</B></TD><TD><b>Avail</B></TD></TR>
26 printend
27 ;
28 my $total=0;
29 my $totspent=0;
30 my $totcomtd=0;
31 my $totavail=0;
32 for (my $i=0;$i<$count;$i++){
33   my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'});
34   my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
35   print  <<EOP
36 <tr><td>
37 $results[$i]->{'bookfundname'} </TD> 
38 <TD>$results[$i]->{'budgetamount'}</TD> <TD>
39 EOP
40 ;
41 printf  ("%.2f", $spent);
42 print  "</TD><TD>";
43 printf  ("%.2f",$comtd);
44 print  "</TD><TD>";
45 printf  ("%.2f",$avail);
46 print  "</TD></TR>";
47   $total+=$results[$i]->{'budgetamount'};
48   $totspent+=$spent;
49   $totcomtd+=$comtd;
50   $totavail+=$avail;
51 }
52
53 print  <<printend
54 <tr><td colspan=5>
55 <hr size=1 noshade></TD></TR>
56
57 <tr><td>
58 Total </TD> <TD>$total</TD> <TD>
59 printend
60 ;
61 printf  ("%.2f",$totspent);
62 print  "</TD><TD>";
63 printf  ("%.2f",$totcomtd);
64 print  "</TD><TD>";
65 printf  ("%.2f",$totavail);
66 print  "</TD></TR>";
67 print  <<printend
68 </table><br>
69 Use your reload button [ctrl + r] to get the most recent figures.
70 Committed figures are approximate only, as exchange rates will affect the amount actually paid.
71
72 </TD></TR>
73 </form>
74 </table>
75
76 printend
77 ;
78
79 #close ;