Browse Source

Beautifying Selection

3.0.x
hdl 19 years ago
parent
commit
c81e2b2fd6
  1. 72
      reports/catalogue_stats.pl

72
reports/catalogue_stats.pl

@ -102,14 +102,16 @@ if ($do_it) {
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;
my @values; my @values;
my %labels; my %labels;
my $count=0;
my $req; my $req;
$req = $dbh->prepare("select distinctrow left(dewey,3) from biblioitems order by dewey"); $req = $dbh->prepare("select distinctrow left(dewey,3) from biblioitems order by dewey");
$req->execute; $req->execute;
my $hasdewey=1; my $hasdewey;
my @select; my @select;
push @select,""; push @select,"";
while (my ($value) =$req->fetchrow) { while (my ($value) =$req->fetchrow) {
$hasdewey =1 if (($value) and (! $hasdewey)); $hasdewey =1 if (($value) and (! $hasdewey));
$count++ if (($value) and (! $hasdewey));
push @select, $value; push @select, $value;
} }
my $CGIdewey=CGI::scrolling_list( -name => 'Filter', my $CGIdewey=CGI::scrolling_list( -name => 'Filter',
@ -122,11 +124,12 @@ if ($do_it) {
$req->execute; $req->execute;
undef @select; undef @select;
push @select,""; push @select,"";
my $haslccn=1; my $haslccn;
my $hlghtlccn; my $hlghtlccn;
while (my ($value) =$req->fetchrow) { while (my ($value) =$req->fetchrow) {
$hlghtlccn = !($hasdewey); $hlghtlccn = !($hasdewey);
$haslccn =1 if (($value) and (! $haslccn)); $haslccn =1 if (($value) and (! $haslccn));
$count++ if (($value) and (! $haslccn));
push @select, $value; push @select, $value;
} }
my $CGIlccn=CGI::scrolling_list( -name => 'Filter', my $CGIlccn=CGI::scrolling_list( -name => 'Filter',
@ -139,10 +142,11 @@ if ($do_it) {
$req->execute; $req->execute;
undef @select; undef @select;
push @select,""; push @select,"";
my $hascote=1; my $hascote;
my $hlghtcote; my $hlghtcote;
while (my ($value) =$req->fetchrow) { while (my ($value) =$req->fetchrow) {
$hascote =1 if (($value) and (! $hascote)); $hascote =1 if (($value) and (! $hascote));
$count++ if (($value) and (! $hascote));
$hlghtcote = (($hasdewey) and ($haslccn)) or (!($hasdewey) and !($haslccn)); $hlghtcote = (($hasdewey) and ($haslccn)) or (!($hasdewey) and !($haslccn));
push @select, $value; push @select, $value;
} }
@ -151,17 +155,32 @@ if ($do_it) {
-values => \@select, -values => \@select,
-size => 1, -size => 1,
-multiple => 0 ); -multiple => 0 );
$count++;
my $hglghtDT =$count % 2;
# warn "highlightDT ".$hglghtDT;
$count++;
my $hglghtPub =$count % 2;
# warn "highlightPub ".$hglghtPub;
$count++;
my $hglghtPY =$count % 2;
# warn "highlightPY ".$hglghtPY;
$count++;
my $hglghtHB =$count % 2;
# warn "highlightHB ".$hglghtHB;
$count++;
my $hglghtLOC =$count % 2;
# warn "highlightLOC ".$hglghtLOC;
undef @select; # undef @select;
push @select,""; # push @select,"";
for (my $i=1950;$i<=2050;$i++) { # for (my $i=1950;$i<=2050;$i++) {
push @select, $i; # push @select, $i;
} # }
my $CGIpublicationyear=CGI::scrolling_list( -name => 'Filter', # my $CGIpublicationyear=CGI::scrolling_list( -name => 'Filter',
-id => 'Filter', # -id => 'Filter',
-values => \@select, # -values => \@select,
-size => 1, # -size => 1,
-multiple => 0 ); # -multiple => 0 );
$req = $dbh->prepare("select distinctrow itemtype from biblioitems order by itemtype"); $req = $dbh->prepare("select distinctrow itemtype from biblioitems order by itemtype");
$req->execute; $req->execute;
@ -217,7 +236,7 @@ if ($do_it) {
my @mime = ( C4::Context->preference("MIME") ); my @mime = ( C4::Context->preference("MIME") );
foreach my $mime (@mime){ foreach my $mime (@mime){
warn "".$mime; # warn "".$mime;
} }
my $CGIextChoice=CGI::scrolling_list( my $CGIextChoice=CGI::scrolling_list(
@ -244,11 +263,16 @@ if ($do_it) {
CGIToLoCClass => $CGIlccn, CGIToLoCClass => $CGIlccn,
hascote=> $hascote, hascote=> $hascote,
hlghtcote => $hlghtcote, hlghtcote => $hlghtcote,
hglghtDT => $hglghtDT,
hglghtPub => $hglghtPub,
hglghtPY => $hglghtPY,
hglghtHB => $hglghtHB,
hglghtLOC => $hglghtLOC,
CGIFromCoteClass => $CGIcote, CGIFromCoteClass => $CGIcote,
CGIToCoteClass => $CGIcote, CGIToCoteClass => $CGIcote,
CGIItemType => $CGIitemtype, CGIItemType => $CGIitemtype,
CGIFromPublicationYear => $CGIpublicationyear, # CGIFromPublicationYear => $CGIpublicationyear,
CGIToPublicationYear => $CGIpublicationyear, # CGIToPublicationYear => $CGIpublicationyear,
CGIPublisher => $CGIpublisher, CGIPublisher => $CGIpublisher,
CGIBranch => $CGIbranch, CGIBranch => $CGIbranch,
CGILocation => $CGIlocation, CGILocation => $CGIlocation,
@ -358,7 +382,7 @@ sub calculate {
} }
} }
$strsth .=" order by $linefield"; $strsth .=" order by $linefield";
warn "". $strsth; # warn "". $strsth;
my $sth = $dbh->prepare( $strsth ); my $sth = $dbh->prepare( $strsth );
if (( @linefilter ) and ($linefilter[1])){ if (( @linefilter ) and ($linefilter[1])){
@ -400,7 +424,7 @@ sub calculate {
$strsth2 .= " and $column LIKE ? "; $strsth2 .= " and $column LIKE ? ";
} }
$strsth2 .= " order by $colfield"; $strsth2 .= " order by $colfield";
warn "". $strsth2; # warn "". $strsth2;
my $sth2 = $dbh->prepare( $strsth2 ); my $sth2 = $dbh->prepare( $strsth2 );
if ((@colfilter) and ($colfilter[1])) { if ((@colfilter) and ($colfilter[1])) {
$sth2->execute($colfilter[0],$colfilter[1]); $sth2->execute($colfilter[0],$colfilter[1]);
@ -460,12 +484,12 @@ sub calculate {
@$filters[11]=~ s/\*/%/g if (@$filters[11]); @$filters[11]=~ s/\*/%/g if (@$filters[11]);
$strcalc .= " AND items.location like '" . @$filters[11] ."'" if ( @$filters[11] ); $strcalc .= " AND items.location like '" . @$filters[11] ."'" if ( @$filters[11] );
$strcalc .= " group by $linefield, $colfield order by $linefield,$colfield"; $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
warn "". $strcalc; # warn "". $strcalc;
my $dbcalc = $dbh->prepare($strcalc); my $dbcalc = $dbh->prepare($strcalc);
$dbcalc->execute; $dbcalc->execute;
warn "filling table"; # warn "filling table";
while (my ($row, $col, $value) = $dbcalc->fetchrow) { while (my ($row, $col, $value) = $dbcalc->fetchrow) {
warn "filling table $row / $col / $value "; # warn "filling table $row / $col / $value ";
$table{$row}->{$col}=$value; $table{$row}->{$col}=$value;
$table{$row}->{totalrow}+=$value; $table{$row}->{totalrow}+=$value;
$grantotal += $value; $grantotal += $value;
@ -485,14 +509,14 @@ sub calculate {
$hilighted = -$hilighted; $hilighted = -$hilighted;
} }
warn "footer processing"; # warn "footer processing";
foreach my $col ( @loopcol ) { foreach my $col ( @loopcol ) {
my $total=0; my $total=0;
foreach my $row ( @looprow ) { foreach my $row ( @looprow ) {
$total += $table{$row->{rowtitle}}->{$col->{coltitle}}; $total += $table{$row->{rowtitle}}->{$col->{coltitle}};
warn "value added ".$table{$row->{rowtitle}}->{$col->{coltitle}}. "for line ".$row->{rowtitle}; # warn "value added ".$table{$row->{rowtitle}}->{$col->{coltitle}}. "for line ".$row->{rowtitle};
} }
warn "summ for column ".$col->{coltitle}." = ".$total; # warn "summ for column ".$col->{coltitle}." = ".$total;
push @loopfooter, {'totalcol' => $total}; push @loopfooter, {'totalcol' => $total};
} }

Loading…
Cancel
Save