my$strcalc.="SELECT $linefield, $colfield, count( * ) FROM biblioitems, items WHERE (items.biblioitemnumber = biblioitems.biblioitemnumber) AND $line is not null AND $column is not null";
my$strcalc.="SELECT $linefield, $colfield, count( * ) FROM biblioitems, items WHERE (items.biblioitemnumber = biblioitems.biblioitemnumber) ";
@$filters[0]=~s/\*/%/gif(@$filters[0]);
$strcalc.=" AND dewey >".@$filters[0].""if(@$filters[0]);
@$filters[1]=~s/\*/%/gif(@$filters[1]);
@ -486,17 +486,24 @@ sub calculate {
@$filters[11]=~s/\*/%/gif(@$filters[11]);
$strcalc.=" AND items.location like '".@$filters[11]."'"if(@$filters[11]);
$strcalc.=" group by $linefield, $colfield order by $linefield,$colfield";
# warn "". $strcalc;
warn"".$strcalc;
my$dbcalc=$dbh->prepare($strcalc);
$dbcalc->execute;
# warn "filling table";
while(my($row,$col,$value)=$dbcalc->fetchrow){
# warn "filling table $row / $col / $value ";
$row="ZZEMPTY"unless$row;
$col="ZZEMPTY"unless$col;
$table{$row}->{$col}=$value;
$table{$row}->{totalrow}+=$value;
$grantotal+=$value;
}
my%cell={rowtitle=>'ZZEMPTY'};
push@loopline,\%cell;
my%cell={coltitle=>'ZZEMPTY'};
push@loopcol,\%cell;
foreachmy$row(sortkeys%table){
my@loopcell;
#@loopcol ensures the order for columns is common with column titles