|
Lines 320-327
sub calculate {
Link Here
|
| 320 |
( $linesource eq 'items' ) |
320 |
( $linesource eq 'items' ) |
| 321 |
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
321 |
? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
| 322 |
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
322 |
: " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
|
|
323 |
$strsth .= " WHERE $line is not null "; |
| 323 |
} |
324 |
} |
| 324 |
$strsth .= " WHERE $line is not null "; |
|
|
| 325 |
|
325 |
|
| 326 |
if ( $line =~ /datetime/ ) { |
326 |
if ( $line =~ /datetime/ ) { |
| 327 |
if ( $linefilter[1] and ( $linefilter[0] ) ) { |
327 |
if ( $linefilter[1] and ( $linefilter[0] ) ) { |
|
Lines 408-415
sub calculate {
Link Here
|
| 408 |
( $colsource eq 'items' ) |
408 |
( $colsource eq 'items' ) |
| 409 |
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
409 |
? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " |
| 410 |
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
410 |
: "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; |
|
|
411 |
$strsth2 .= " WHERE $column IS NOT NULL "; |
| 411 |
} |
412 |
} |
| 412 |
$strsth2 .= " WHERE $column IS NOT NULL "; |
|
|
| 413 |
|
413 |
|
| 414 |
if ( $column =~ /datetime/ ) { |
414 |
if ( $column =~ /datetime/ ) { |
| 415 |
if ( ( $colfilter[1] ) and ( $colfilter[0] ) ) { |
415 |
if ( ( $colfilter[1] ) and ( $colfilter[0] ) ) { |
|
Lines 608-614
sub calculate {
Link Here
|
| 608 |
for my $col (@loopcol) { |
608 |
for my $col (@loopcol) { |
| 609 |
my $total = 0; |
609 |
my $total = 0; |
| 610 |
foreach my $row (@looprow) { |
610 |
foreach my $row (@looprow) { |
| 611 |
$total += table_get(\%table, $row->{rowtitle}, $col->{coltitle}); |
611 |
$total += table_get(\%table, $row->{rowtitle}, $col->{coltitle}) || 0; |
| 612 |
$debug and warn "value added " . table_get(\%table, $row->{rowtitle}, $col->{coltitle}) . "for line " . $row->{rowtitle}; |
612 |
$debug and warn "value added " . table_get(\%table, $row->{rowtitle}, $col->{coltitle}) . "for line " . $row->{rowtitle}; |
| 613 |
} |
613 |
} |
| 614 |
push @loopfooter, { 'totalcol' => $total }; |
614 |
push @loopfooter, { 'totalcol' => $total }; |
|
Lines 654-660
sub table_get {
Link Here
|
| 654 |
sub table_inc { |
654 |
sub table_inc { |
| 655 |
my ($table, $row, $col, $inc) = @_; |
655 |
my ($table, $row, $col, $inc) = @_; |
| 656 |
|
656 |
|
| 657 |
$table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } += $inc; |
657 |
$table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc; |
| 658 |
} |
658 |
} |
| 659 |
|
659 |
|
| 660 |
1; |
660 |
1; |
| 661 |
- |
|
|