catalogue.pm deals only with acquisitions.
[koha_gimpoz] / 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::Acquisition;
28 use C4::Biblio;
29 my ($count,@results)=bookfunds;
30
31
32 print <<printend
33
34 <TABLE  width="40%"  cellspacing=0 cellpadding=5 border=1 >
35 <FORM ACTION="/cgi-bin/koha/search.pl">
36 <TR VALIGN=TOP>
37 <TD  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><b>BUDGETS AND BOOKFUNDS</b></TD></TR>
38 <TR VALIGN=TOP>
39 <TD colspan=2><table>
40
41
42 <tr><td>
43 <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>
44 printend
45 ;
46 my $total=0;
47 my $totspent=0;
48 my $totcomtd=0;
49 my $totavail=0;
50 for (my $i=0;$i<$count;$i++){
51   my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'});
52   my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
53   print  <<EOP
54 <tr><td>
55 $results[$i]->{'bookfundname'} </TD>
56 <TD>$results[$i]->{'budgetamount'}</TD> <TD>
57 EOP
58 ;
59 printf  ("%.2f", $spent);
60 print  "</TD><TD>";
61 printf  ("%.2f",$comtd);
62 print  "</TD><TD>";
63 printf  ("%.2f",$avail);
64 print  "</TD></TR>";
65   $total+=$results[$i]->{'budgetamount'};
66   $totspent+=$spent;
67   $totcomtd+=$comtd;
68   $totavail+=$avail;
69 }
70
71 print  <<printend
72 <tr><td colspan=5>
73 <hr size=1 noshade></TD></TR>
74
75 <tr><td>
76 Total </TD> <TD>$total</TD> <TD>
77 printend
78 ;
79 printf  ("%.2f",$totspent);
80 print  "</TD><TD>";
81 printf  ("%.2f",$totcomtd);
82 print  "</TD><TD>";
83 printf  ("%.2f",$totavail);
84 print  "</TD></TR>";
85 print  <<printend
86 </table><br>
87 Use your reload button [ctrl + r] to get the most recent figures.
88 Committed figures are approximate only, as exchange rates will affect the amount actually paid.
89
90 </TD></TR>
91 </form>
92 </table>
93
94 printend
95 ;
96
97 #close ;