Project:
Koha Library Automation Package
Code Location:
git://git.koha-community.org/kumara.gitmaster
/
stats2.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/perl #written 14/1/2000 #script to display reports use C4::Stats; use strict; use Date::Manip; use CGI; use C4::Output; use DBI; use C4::Database; my $input=new CGI; my $time=$input->param('time'); print $input->header; print startpage; print startmenu('report'); print center; my $date; my $date2; if ($time eq 'yesterday'){ $date=ParseDate('yesterday'); $date2=ParseDate('today'); } if ($time eq 'today'){ $date=ParseDate('today'); $date2=ParseDate('tomorrow'); } if ($time eq 'daybefore'){ $date=ParseDate('2 days ago'); $date2=ParseDate('yesterday'); } if ($time=~ /\//){ $date=ParseDate($time); $date2=ParseDateDelta('+ 1 day'); $date2=DateCalc($date,$date2); } $date=UnixDate($date,'%Y-%m-%d'); $date2=UnixDate($date2,'%Y-%m-%d'); my $dbh=C4Connect; my $query="select * from accountlines,accountoffsets,borrowers where accountlines.borrowernumber=accountoffsets.borrowernumber and (accountlines.accountno=accountoffsets.accountno or accountlines.accountno =accountoffsets.offsetaccount) and accountlines.timestamp >=20000621000000 and borrowers.borrowernumber=accountlines.borrowernumber group by accountlines.borrowernumber,accountlines.accountno"; my $sth=$dbh->prepare($query); $sth->execute; print mktablehdr; while (my $data=$sth->fetchrow_hashref){ print "<TR><Td>$data->{'surname'}</td><td>$data->{'description'}</td><td>$data->{'amount'} </td>"; if ($data->{'accountype'}='Pay'){ my $branch=Getpaidbranch($data->{'timestamp'}); print "<td>$branch</td>"; } print "</tr>"; } print mktableft; print endcenter; #print "<p><b>$total</b>"; print endmenu('report'); print endpage; $sth->finish; $dbh->disconnect;
