Browse Source

bugfixes

master
chris 22 years ago
parent
commit
9fca395542
  1. 18
      C4/Stats.pm
  2. 24
      fines.pl
  3. 2
      moremember.pl
  4. 6
      stats.pl

18
C4/Stats.pm

@ -14,7 +14,7 @@ $VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&UpdateStats &statsreport &Count &Overdues &TotalOwing
&TotalPaid &getcharges);
&TotalPaid &getcharges &Getpaidbranch);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -171,7 +171,7 @@ sub getcharges{
my $dbh=C4Connect;
my $timestamp2=$timestamp-1;
my $query="Select * from accountlines where borrowernumber=$borrowerno
and timestamp < '$timestamp' and accounttype <> 'Pay'";
and timestamp <= '$timestamp' and accounttype <> 'Pay'";
my $sth=$dbh->prepare($query);
# print $query,"<br>";
$sth->execute;
@ -186,6 +186,20 @@ sub getcharges{
$dbh->disconnect;
return(@results);
}
sub Getpaidbranch{
my($date)=@_;
my $dbh=C4Connect;
my $query="select * from statistics where type='payment' and datetime='$date'";
my $sth=$dbh->prepare($query);
$sth->execute;
# print $query;
my $data=$sth->fetchrow_hashref;
$sth->finish;
$dbh->disconnect;
return($data->{'branch'});
}
END { } # module clean-up code here (global destructor)

24
fines.pl

@ -6,6 +6,7 @@
use C4::Circulation::Fines;
use Date::Manip;
open (FILE,'>/tmp/fines') || die;
my ($count,$data)=Getoverdues();
#print $count;
my $count2=0;
@ -14,10 +15,12 @@ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
$mon++;
$year=$year+1900;
#my $date=Date_DaysSince999($mon,$mday,$year);
my $date=Date_DaysSince999(2,3,2000);
my $date=Date_DaysSince999(2,20,2000);
my $bornum;
my $borrower;
my $total=0;
my $max=5;
my $bornum2;
for (my $i=0;$i<$count;$i++){
my @dates=split('-',$data->[$i]->{'date_due'});
my $date2=Date_DaysSince999($dates[1],$dates[2],$dates[0]);
@ -26,6 +29,7 @@ for (my $i=0;$i<$count;$i++){
$count2++;
my $difference=$date-$date2;
if ($bornum != $data->[$i]->{'borrowernumber'}){
$bornum=$data->[$i]->{'borrowernumber'};
$borrower=BorType($bornum);
}
@ -37,15 +41,21 @@ for (my $i=0;$i<$count;$i++){
}
if ($amount > 0){
UpdateFine($data->[$i]->{'itemnumber'},$bornum,$amount,$type,$due);
if ($amount ==5){
# marklost();
}
print "$printout\t$bornum\t$borrower->{'firstname'}\t$borrower->{'surname'}\t$data->[$i]->{'date_due'}\t$type\t$difference\t$borrower->{'emailaddress'}\t$borrower->{'phone'}\t$borrower->{'streetaddress'}\t$borrower->{'city'}\n";
if ($bornum2 == $data->[$i]->{'borrowernumber'}){
$total=$total+$amount;
} else {
print FILE "\"$borrower->{'cardnumber'}\"\,\"$borrower->{'phone'}\"\,\"Overdue or Extd Rental$total\"\,\"$borrower->{'homebranch'}\"\n";
$total=$amount;
}
if ($amount ==5){
# marklost();
}
print "$printout\t$borrower->{'cardnumber'}\t$borrower->{'firstname'}\t$borrower->{'surname'}\t$data->[$i]->{'date_due'}\t$type\t$difference\t$borrower->{'emailaddress'}\t$borrower->{'phone'}\t$borrower->{'streetaddress'}\t$borrower->{'city'}\n";
} else {
# print "0 fine\n";
}
}
$bornum2=$data->[$i]->{'borrowernumber'};
}
print "\n $count2\n";
close FILE;

2
moremember.pl

@ -167,7 +167,7 @@ for (my $i=0;$i<$count;$i++){
if ($datedue < $today){
print "<font color=red>";
}
print "$issue->[$i]{'title'}</td>
print "$issue->[$i]{'title'} $issue->[$i]{'barcode'}</td>
<TD>$issue->[$i]{'date_due'}</td>";
#find the charge for an item
my $charge=calc_charges(\%env,$issue->[$i]{'itemnumber'},$bornum);

6
stats.pl

@ -52,10 +52,12 @@ for (my $i=0;$i<$count;$i++){
'',
$charges[$i2]->{'amount'},$charges[$i2]->{'amountoutstanding'});
}
my $time2="$payments[$i]{'date'} $time";
my $branch=Getpaidbranch($time2);
print mktablerow(6,'white',"$payments[$i]{'firstname'} <b>$payments[$i]{'surname'}</b>"
,$payments[$i]{'accounttype'},"$payments[$i]{'date'} $time",$payments[$i]{'amount'}
,$payments[$i]{'branchcode'});
,$branch);
}
print mktableft;

Loading…
Cancel
Save