From 01595fe1790a724331e96a502743e7f30810d800 Mon Sep 17 00:00:00 2001 From: hdl Date: Fri, 16 Dec 2005 15:58:25 +0000 Subject: [PATCH] Bug Fixing on acquisition stats. Adding selection to bor_issues_top report. Doing soon the same for any other top or out reports.... --- .../default/en/reports/bor_issues_top.tmpl | 61 +++++++++++++++++-- reports/acquisitions_stats.pl | 18 +++--- reports/bor_issues_top.pl | 42 ++++++++++++- 3 files changed, 106 insertions(+), 15 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/default/en/reports/bor_issues_top.tmpl b/koha-tmpl/intranet-tmpl/default/en/reports/bor_issues_top.tmpl index fc5a382dba..85d27ebd7a 100644 --- a/koha-tmpl/intranet-tmpl/default/en/reports/bor_issues_top.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/reports/bor_issues_top.tmpl @@ -220,31 +220,82 @@ function Dopop(link) {     Branch - + + +     Document Type - + + +     Borrower Category - + + +     Day - + + +     Month - + + +   diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl index 53828d5eb5..04281a5a26 100755 --- a/reports/acquisitions_stats.pl +++ b/reports/acquisitions_stats.pl @@ -321,7 +321,7 @@ sub calculate { } $strsth .=" group by $linefield"; $strsth .=" order by $lineorder"; - warn "". $strsth; + warn "rows: ". $strsth; my $sth = $dbh->prepare( $strsth ); if (( @linefilter ) and ($linefilter[1])){ @@ -339,7 +339,7 @@ sub calculate { # } else { # $cell{rowtitle} = ""; } - $cell{totalrow} = 0; + $cell{totalrow} = 0; push @loopline, \%cell; } @@ -394,7 +394,7 @@ sub calculate { } $strsth2 .=" group by $colfield"; $strsth2 .=" order by $colorder"; - warn "". $strsth2; + warn "columns : ". $strsth2; my $sth2 = $dbh->prepare( $strsth2 ); if (( @colfilter ) and ($colfilter[1])){ @@ -449,7 +449,7 @@ sub calculate { @$filters[4]=~ s/\*/%/g if (@$filters[4]); $strcalc .= " AND aqbooksellers.name like '" . @$filters[4] ."'" if ( @$filters[4] ); @$filters[5]=~ s/\*/%/g if (@$filters[5]); - $strcalc .= " AND aqbookfund.bookfundid like '" . @$filters[5] ."'" if ( @$filters[5] ); + $strcalc .= " AND aqorderbreakdown.bookfundid like '" . @$filters[5] ."'" if ( @$filters[5] ); @$filters[6]=~ s/\*/%/g if (@$filters[6]); $strcalc .= " AND aqorders.sort1 like '" . @$filters[6] ."'" if ( @$filters[6] ); @$filters[7]=~ s/\*/%/g if (@$filters[7]); @@ -472,20 +472,20 @@ sub calculate { $grantotal += $value; } - push @loopcol,{coltitle => "NULL"} if ($emptycol); + push @loopcol,{coltitle => "NULL"} if ($emptycol); - foreach my $row ( sort keys %table ) { + foreach my $row (@loopline) { my @loopcell; #@loopcol ensures the order for columns is common with column titles # and the number matches the number of columns foreach my $col ( @loopcol ) { - my $value =$table{$row}->{($col->{coltitle} eq "NULL")?"zzEMPTY":$col->{coltitle}}; + my $value =$table{($row->{'rowtitle'} eq "NULL")?"zzEMPTY":$row->{'rowtitle'}}->{($col->{coltitle} eq "NULL")?"zzEMPTY":$col->{coltitle}}; push @loopcell, {value => $value } ; } - push @looprow,{ 'rowtitle' => ($row eq "zzEMPTY")?"NULL":$row, + push @looprow,{ 'rowtitle' => $row->{'rowtitle'}, 'loopcell' => \@loopcell, 'hilighted' => ($hilighted >0), - 'totalrow' => $table{$row}->{totalrow} + 'totalrow' => $table{($row->{'rowtitle'} eq "NULL")?"zzEMPTY":$row->{'rowtitle'}}->{totalrow} }; $hilighted = -$hilighted; } diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl index 11d4602a35..4b80824b11 100755 --- a/reports/bor_issues_top.pl +++ b/reports/bor_issues_top.pl @@ -132,10 +132,50 @@ if ($do_it) { -values => \@dels, -size => 1, -multiple => 0 ); + #branch + my $branches = getallbranches; + my @branchloop; + foreach my $thisbranch (keys %$branches) { +# my $selected = 1 if $thisbranch eq $branch; + my %row =(value => $thisbranch, +# selected => $selected, + branchname => $branches->{$thisbranch}->{'branchname'}, + ); + push @branchloop, \%row; + } + + #doctype + my $itemtypes = getitemtypes; + my @itemtypeloop; + foreach my $thisitemtype (keys %$itemtypes) { +# my $selected = 1 if $thisbranch eq $branch; + my %row =(value => $thisitemtype, +# selected => $selected, + description => $itemtypes->{$thisitemtype}->{'description'}, + ); + push @itemtypeloop, \%row; + } + + #borcat + my ($codes,$labels) = borrowercategories; + my @borcatloop; + foreach my $thisborcat (sort keys %$labels) { + # my $selected = 1 if $thisbranch eq $branch; + my %row =(value => $thisborcat, + # selected => $selected, + description => $labels->{$thisborcat}, + ); + push @borcatloop, \%row; + } + #Day + #Month $template->param( CGIextChoice => $CGIextChoice, - CGIsepChoice => $CGIsepChoice + CGIsepChoice => $CGIsepChoice, + branchloop =>\@branchloop, + itemtypeloop =>\@itemtypeloop, + borcatloop =>\@borcatloop, ); output_html_with_http_headers $input, $cookie, $template->output; } -- 2.39.5