Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 98 lines (79 sloc) 2.463 kb
d0374d0 Initial revision
rangi authored
1 #!/usr/bin/perl
2
7197a37 Added magic RCS comment.
arensb authored
3 # $Id$
4
d0374d0 Initial revision
rangi authored
5 #written 14/1/2000
6 #script to display reports
7
1e67687 Added copyright statement to all .pl and .pm files
tonnesen authored
8
9 # Copyright 2000-2002 Katipo Communications
10 #
11 # This file is part of Koha.
12 #
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
16 # version.
17 #
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.
21 #
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
25
d0374d0 Initial revision
rangi authored
26 use strict;
dbca398 Merged with arensb-context branch: use C4::Context->dbh instead of
arensb authored
27 use C4::Context;
28 use C4::Stats;
d0374d0 Initial revision
rangi authored
29 use Date::Manip;
30 use CGI;
31 use C4::Output;
32 use DBI;
33
34 my $input=new CGI;
35 my $time=$input->param('time');
36 print $input->header;
37
38 print startpage;
39 print startmenu('report');
40 print center;
41
42 my $date;
43 my $date2;
44 if ($time eq 'yesterday'){
45 $date=ParseDate('yesterday');
46 $date2=ParseDate('today');
47 }
48 if ($time eq 'today'){
49 $date=ParseDate('today');
50 $date2=ParseDate('tomorrow');
51 }
52 if ($time eq 'daybefore'){
53 $date=ParseDate('2 days ago');
54 $date2=ParseDate('yesterday');
55 }
56 if ($time=~ /\//){
57 $date=ParseDate($time);
58 $date2=ParseDateDelta('+ 1 day');
59 $date2=DateCalc($date,$date2);
60 }
61 $date=UnixDate($date,'%Y-%m-%d');
62 $date2=UnixDate($date2,'%Y-%m-%d');
63
dbca398 Merged with arensb-context branch: use C4::Context->dbh instead of
arensb authored
64 my $dbh = C4::Context->dbh;
2f3d832 sync'ing with rel_2_0 (mostly prepare/execute pb, bug #662)
tipaul authored
65 my $sth=$dbh->prepare("select *
d0374d0 Initial revision
rangi authored
66 from accountlines,accountoffsets,borrowers where
67 accountlines.borrowernumber=accountoffsets.borrowernumber and
68 (accountlines.accountno=accountoffsets.accountno or accountlines.accountno
7197a37 Added magic RCS comment.
arensb authored
69 =accountoffsets.offsetaccount) and accountlines.timestamp >=20000621000000
d0374d0 Initial revision
rangi authored
70 and borrowers.borrowernumber=accountlines.borrowernumber
2f3d832 sync'ing with rel_2_0 (mostly prepare/execute pb, bug #662)
tipaul authored
71 group by accountlines.borrowernumber,accountlines.accountno");
72 $sth->execute();
d0374d0 Initial revision
rangi authored
73
74
75
76 print mktablehdr;
77 while (my $data=$sth->fetchrow_hashref){
78 print "<TR><Td>$data->{'surname'}</td><td>$data->{'description'}</td><td>$data->{'amount'}
79 </td>";
dbca398 Merged with arensb-context branch: use C4::Context->dbh instead of
arensb authored
80 if ($data->{'accountype'}='Pay'){ # FIXME - This should be "==", not "=", right?
d0374d0 Initial revision
rangi authored
81 my $branch=Getpaidbranch($data->{'timestamp'});
82 print "<td>$branch</td>";
83 }
84 print "</tr>";
85
86 }
87
88
89 print mktableft;
90 print endcenter;
91 #print "<p><b>$total</b>";
92
93
94
95 print endmenu('report');
96 print endpage;
97 $sth->finish;
Something went wrong with that request. Please try again.