4 #script to display reports
15 my $time=$input->param('time');
19 print startmenu
('report');
24 if ($time eq 'yesterday'){
25 $date=ParseDate
('yesterday');
26 $date2=ParseDate
('today');
28 if ($time eq 'today'){
29 $date=ParseDate
('today');
30 $date2=ParseDate
('tomorrow');
32 if ($time eq 'daybefore'){
33 $date=ParseDate
('2 days ago');
34 $date2=ParseDate
('yesterday');
37 $date=ParseDate
($time);
38 $date2=ParseDateDelta
('+ 1 day');
39 $date2=DateCalc
($date,$date2);
41 $date=UnixDate
($date,'%Y-%m-%d');
42 $date2=UnixDate
($date2,'%Y-%m-%d');
46 from accountlines,accountoffsets,borrowers where
47 accountlines.borrowernumber=accountoffsets.borrowernumber and
48 (accountlines.accountno=accountoffsets.accountno or accountlines.accountno
49 =accountoffsets.offsetaccount) and accountlines.timestamp >=20000621000000
50 and borrowers.borrowernumber=accountlines.borrowernumber
51 group by accountlines.borrowernumber,accountlines.accountno";
52 my $sth=$dbh->prepare($query);
58 while (my $data=$sth->fetchrow_hashref){
59 print "<TR><Td>$data->{'surname'}</td><td>$data->{'description'}</td><td>$data->{'amount'}
61 if ($data->{'accountype'}='Pay'){
62 my $branch=Getpaidbranch
($data->{'timestamp'});
63 print "<td>$branch</td>";
72 #print "<p><b>$total</b>";
76 print endmenu
('report');