Fixed a little bug so that flags get recalculated after an item is issued.
[koha.git] / boraccount.pl
1 #!/usr/bin/perl
2
3 #wrriten 11/1/2000 by chris@katipo.oc.nz
4 #script to display borrowers account details
5
6
7 # Copyright 2000-2002 Katipo Communications
8 #
9 # This file is part of Koha.
10 #
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 #
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA  02111-1307 USA
23
24 use strict;
25 use C4::Output;
26 use CGI;
27 use C4::Search;
28 my $input=new CGI;
29
30
31 my $bornum=$input->param('bornum');
32 #get borrower details
33 my $data=borrdata('',$bornum);
34
35
36 #get account details
37 my %bor;
38 $bor{'borrowernumber'}=$bornum;                            
39 my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);   
40
41
42   
43 print $input->header;
44 print startpage();
45 print startmenu('member');
46 print <<printend
47 <FONT SIZE=6><em>Account for $data->{'firstname'} $data->{'surname'}</em></FONT><P>
48 <a href=/cgi-bin/koha/maninvoice.pl?bornum=$bornum><image src=/images/create-man-invoice.gif border=0></a>
49  &nbsp; <a href=/cgi-bin/koha/mancredit.pl?bornum=$bornum><image src=/images/create-man-credit.gif border=0></a>
50 <center>
51 <p>
52 <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 >
53 <TR VALIGN=TOP>
54 <td  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><B>FINES & CHARGES</TD>
55 <td  bgcolor="99cc33" background="/images/background-mem.gif" colspan=1><B>AMOUNT</TD>
56 <td  bgcolor="99cc33" background="/images/background-mem.gif" colspan=1><B>STILL OWING</TD>
57 </TR>
58
59 printend
60 ;
61 for (my $i=0;$i<$numaccts;$i++){
62   $accts->[$i]{'amount'}+=0.00;
63   $accts->[$i]{'amountoutstanding'}+=0.00;
64   print <<printend
65   <tr VALIGN=TOP  >
66   <td>$accts->[$i]{'date'}</td>
67   <TD>$accts->[$i]{'description'}
68 printend
69 ;
70   if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
71      print "$accts->[$i]{'title'}";
72   }
73   print <<printend
74   </td>
75
76   <td>$accts->[$i]{'amount'}</td>
77   <TD>$accts->[$i]{'amountoutstanding'}</td>
78 </tr>
79 printend
80 ;
81 }
82 print <<printend
83 <tr VALIGN=TOP  >
84 <TD></td>
85 <TD colspan=2><b>Total Due</b></td>
86
87 <TD><b>$total</b></td>
88
89 </tr>
90 </table>
91 <br clear=all>
92 <p> &nbsp; </p>
93
94 printend
95 ;
96 print endmenu('member');
97 print endpage();
98