Browse Source

script to do reserve reports

master
chris 22 years ago
parent
commit
6e53de9767
  1. 23
      C4/Search.pm
  2. 21
      C4/Stats.pm
  3. 27
      reservereport.pl

23
C4/Search.pm

@ -285,8 +285,8 @@ sub CatSearch {
my $count=@key;
my $i=1;
$query="select count(*) from
biblio
where
biblio,biblioitems
where (biblio.biblionumber=biblioitems.biblionumber) and
((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%')";
while ($i < $count){
$query=$query." and (author like '$key[$i]%' or author like '% $key[$i]%')";
@ -296,17 +296,18 @@ sub CatSearch {
if ($search->{'title'} ne ''){
$query=$query. " and title like '%$search->{'title'}%'";
}
#if ($search->{'class'} ne ''){
# $query.=" and biblioitems.itemtype='$search->{'class'}'";
#}
if ($search->{'class'} ne ''){
$query.=" and biblioitems.itemtype='$search->{'class'}'";
}
} else {
if ($search->{'title'} ne ''){
my @key=split(' ',$search->{'title'});
my $count=@key;
my $i=1;
$query="select count(*) from biblio,bibliosubtitle
$query="select count(*) from biblio,bibliosubtitle,biblioitems
where
(biblio.biblionumber=bibliosubtitle.biblionumber) and
(biblio.biblionumber=bibliosubtitle.biblionumber and
biblioitems.biblionumber=biblio.biblionumber) and
(((title like '$key[0]%' or title like '% $key[0]%')";
while ($i<$count){
$query=$query." and (title like '$key[$i]%' or title like '% $key[$i]%')";
@ -321,9 +322,9 @@ sub CatSearch {
$query.=" and (seriestitle like '$key[$i]%' or seriestitle like '% $key[$i]%')";
}
$query=$query."))";
# if ($search->{'class'} ne ''){
# $query.=" and biblioitems.itemtype='$search->{'class'}'";
# }
if ($search->{'class'} ne ''){
$query.=" and biblioitems.itemtype='$search->{'class'}'";
}
} elsif ($search->{'class'} ne ''){
$query="select count(*) from biblioitems,biblio where itemtype =
'$search->{'class'}' and biblio.biblionumber=biblioitems.biblionumber";
@ -354,7 +355,7 @@ sub CatSearch {
my $search2=uc $search->{'isbn'};
my $query1 = "select * from biblioitems where isbn='$search2'";
my $sth1=$dbh->prepare($query1);
print $query1;
# print $query1;
$sth1->execute;
my $i2=0;
while (my $data=$sth1->fetchrow_hashref) {

21
C4/Stats.pm

@ -14,7 +14,7 @@ $VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&UpdateStats &statsreport &Count &Overdues &TotalOwing
&TotalPaid &getcharges &Getpaidbranch);
&TotalPaid &getcharges &Getpaidbranch &unfilledreserves);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -200,6 +200,25 @@ sub Getpaidbranch{
return($data->{'branch'});
}
sub unfilledreserves {
my $dbh=C4Connect;
my $query="select *,biblio.title from reserves,biblio,borrowers where found <> 'F' and cancellationdate
is NULL and biblio.biblionumber=reserves.biblionumber and
reserves.borrowernumber=borrowers.borrowernumber order by
biblio.title,reservedate";
my $sth=$dbh->prepare($query);
$sth->execute;
my $i=0;
my @results;
while (my $data=$sth->fetchrow_hashref){
$results[$i]=$data;
$i++;
}
$sth->finish;
$dbh->disconnect;
return($i,\@results);
}
END { } # module clean-up code here (global destructor)

27
reservereport.pl

@ -0,0 +1,27 @@
#!/usr/bin/perl
#written 26/4/2000
#script to display reports
use C4::Stats;
use strict;
use Date::Manip;
use CGI;
use C4::Output;
my $input=new CGI;
my $time=$input->param('time');
print $input->header;
print startpage;
print startmenu('report');
print center;
print mktablehdr();
my ($count,$data)=unfilledreserves();
print $count;
for (my $i=0;$i<$count;$i++){
print mktablerow(3,'white',"$data->[$i]->{'surname'}\, $data->[$i]->{'firstname'}",$data->[$i]->{'reservedate'},$data->[$i]->{'title'});
}
print mktableft();
print endmenu('report');
print endpage;
Loading…
Cancel
Save