4 #script to display reports
7 # Copyright 2000-2002 Katipo Communications
9 # This file is part of Koha.
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
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.
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
33 my $time=$input->param('time');
37 print startmenu('report');
42 if ($time eq 'yesterday'){
43 $date=ParseDate('yesterday');
44 $date2=ParseDate('today');
46 if ($time eq 'today'){
47 $date=ParseDate('today');
48 $date2=ParseDate('tomorrow');
50 if ($time eq 'daybefore'){
51 $date=ParseDate('2 days ago');
52 $date2=ParseDate('yesterday');
55 $date=ParseDate($time);
56 $date2=ParseDateDelta('+ 1 day');
57 $date2=DateCalc($date,$date2);
59 $date=UnixDate($date,'%Y-%m-%d');
60 $date2=UnixDate($date2,'%Y-%m-%d');
62 my $dbh = C4::Context->dbh;
64 from accountlines,accountoffsets,borrowers where
65 accountlines.borrowernumber=accountoffsets.borrowernumber and
66 (accountlines.accountno=accountoffsets.accountno or accountlines.accountno
67 =accountoffsets.offsetaccount) and accountlines.timestamp >=20000621000000
68 and borrowers.borrowernumber=accountlines.borrowernumber
69 group by accountlines.borrowernumber,accountlines.accountno";
70 my $sth=$dbh->prepare($query);
76 while (my $data=$sth->fetchrow_hashref){
77 print "<TR><Td>$data->{'surname'}</td><td>$data->{'description'}</td><td>$data->{'amount'}
79 if ($data->{'accountype'}='Pay'){ # FIXME - This should be "==", not "=", right?
80 my $branch=Getpaidbranch($data->{'timestamp'});
81 print "<td>$branch</td>";
90 #print "<p><b>$total</b>";
94 print endmenu('report');