6 #script to display reports
9 # Copyright 2000-2002 Katipo Communications
11 # This file is part of Koha.
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA 02111-1307 USA
35 my $time=$input->param('time');
39 print startmenu('report');
44 if ($time eq 'yesterday'){
45 $date=ParseDate('yesterday');
46 $date2=ParseDate('today');
48 if ($time eq 'today'){
49 $date=ParseDate('today');
50 $date2=ParseDate('tomorrow');
52 if ($time eq 'daybefore'){
53 $date=ParseDate('2 days ago');
54 $date2=ParseDate('yesterday');
57 $date=ParseDate($time);
58 $date2=ParseDateDelta('+ 1 day');
59 $date2=DateCalc($date,$date2);
61 $date=UnixDate($date,'%Y-%m-%d');
62 $date2=UnixDate($date2,'%Y-%m-%d');
64 my $dbh = C4::Context->dbh;
66 from accountlines,accountoffsets,borrowers where
67 accountlines.borrowernumber=accountoffsets.borrowernumber and
68 (accountlines.accountno=accountoffsets.accountno or accountlines.accountno
69 =accountoffsets.offsetaccount) and accountlines.timestamp >=20000621000000
70 and borrowers.borrowernumber=accountlines.borrowernumber
71 group by accountlines.borrowernumber,accountlines.accountno";
72 my $sth=$dbh->prepare($query);
78 while (my $data=$sth->fetchrow_hashref){
79 print "<TR><Td>$data->{'surname'}</td><td>$data->{'description'}</td><td>$data->{'amount'}
81 if ($data->{'accountype'}='Pay'){ # FIXME - This should be "==", not "=", right?
82 my $branch=Getpaidbranch($data->{'timestamp'});
83 print "<td>$branch</td>";
92 #print "<p><b>$total</b>";
96 print endmenu('report');