OPAC now show a systempref variable in main/home screen => easier to change for a...
[koha.git] / showbudget.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 #script to show list of budgets and bookfunds
6 #written 4/2/00 by chris@katipo.co.nz
7 #called as an include by the acquisitions index page
8
9
10 # Copyright 2000-2002 Katipo Communications
11 #
12 # This file is part of Koha.
13 #
14 # Koha is free software; you can redistribute it and/or modify it under the
15 # terms of the GNU General Public License as published by the Free Software
16 # Foundation; either version 2 of the License, or (at your option) any later
17 # version.
18 #
19 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License along with
24 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
25 # Suite 330, Boston, MA  02111-1307 USA
26
27 use C4::Catalogue;
28 use C4::Biblio;
29 #use CGI;
30 #my $inp=new CGI;
31 #print $inp->header;
32 my ($count,@results)=bookfunds;
33
34
35 print <<printend
36
37 <TABLE  width="40%"  cellspacing=0 cellpadding=5 border=1 >
38 <FORM ACTION="/cgi-bin/koha/search.pl">
39 <TR VALIGN=TOP>
40 <TD  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><b>BUDGETS AND BOOKFUNDS</b></TD></TR>
41 <TR VALIGN=TOP>
42 <TD colspan=2><table>
43
44
45 <tr><td>
46 <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>
47 printend
48 ;
49 my $total=0;
50 my $totspent=0;
51 my $totcomtd=0;
52 my $totavail=0;
53 for (my $i=0;$i<$count;$i++){
54   my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'});
55   my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
56   print  <<EOP
57 <tr><td>
58 $results[$i]->{'bookfundname'} </TD>
59 <TD>$results[$i]->{'budgetamount'}</TD> <TD>
60 EOP
61 ;
62 printf  ("%.2f", $spent);
63 print  "</TD><TD>";
64 printf  ("%.2f",$comtd);
65 print  "</TD><TD>";
66 printf  ("%.2f",$avail);
67 print  "</TD></TR>";
68   $total+=$results[$i]->{'budgetamount'};
69   $totspent+=$spent;
70   $totcomtd+=$comtd;
71   $totavail+=$avail;
72 }
73
74 print  <<printend
75 <tr><td colspan=5>
76 <hr size=1 noshade></TD></TR>
77
78 <tr><td>
79 Total </TD> <TD>$total</TD> <TD>
80 printend
81 ;
82 printf  ("%.2f",$totspent);
83 print  "</TD><TD>";
84 printf  ("%.2f",$totcomtd);
85 print  "</TD><TD>";
86 printf  ("%.2f",$totavail);
87 print  "</TD></TR>";
88 print  <<printend
89 </table><br>
90 Use your reload button [ctrl + r] to get the most recent figures.
91 Committed figures are approximate only, as exchange rates will affect the amount actually paid.
92
93 </TD></TR>
94 </form>
95 </table>
96
97 printend
98 ;
99
100 #close ;