|
Lines 301-351
sub calculate {
Link Here
|
| 301 |
foreach ($line, $column) { |
301 |
foreach ($line, $column) { |
| 302 |
$filter{$_} = []; |
302 |
$filter{$_} = []; |
| 303 |
$field{$_} = $_; |
303 |
$field{$_} = $_; |
| 304 |
given ($_) { |
304 |
if ( $_ =~ /closedate/ ) { |
| 305 |
when (/closedate/) { |
305 |
$filter{$_}->[0] = @$filters[0]; |
| 306 |
$filter{$_}->[0] = @$filters[0]; |
306 |
$filter{$_}->[1] = @$filters[1]; |
| 307 |
$filter{$_}->[1] = @$filters[1]; |
307 |
my $a = $_; |
| 308 |
my $a = $_; |
308 |
if ( $podsp == 1 ) { |
| 309 |
given ($podsp) { |
309 |
$field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))"; |
| 310 |
when (1) { $field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))" } |
310 |
} elsif ( $podsp == 2 ) { |
| 311 |
when (2) { $field{$a} = "concat(hex(month($a)),'-',monthname($a))" } |
311 |
$field{$a} = "concat(hex(month($a)),'-',monthname($a))"; |
| 312 |
when (3) { $field{$a} = "Year($a)" } |
312 |
} elsif ( $podsp == 3 ) { |
| 313 |
default { $field{$a} = $a } |
313 |
$field{$a} = "Year($a)"; |
| 314 |
} |
314 |
} else { |
| 315 |
} |
315 |
$field{$a} = $a; |
| 316 |
when (/received/) { |
|
|
| 317 |
$filter{$_}->[0] = @$filters[2]; |
| 318 |
$filter{$_}->[1] = @$filters[3]; |
| 319 |
my $a = $_; |
| 320 |
given ($rodsp) { |
| 321 |
when (1) { $field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))" } |
| 322 |
when (2) { $field{$a} = "concat(hex(month($a)),'-',monthname($a))" } |
| 323 |
when (3) { $field{$a} = "Year($a)" } |
| 324 |
default { $field{$a} = $a } |
| 325 |
} |
| 326 |
} |
| 327 |
when (/bookseller/) { |
| 328 |
$filter{$_}->[0] = @$filters[4]; |
| 329 |
} |
| 330 |
when (/homebranch/) { |
| 331 |
$filter{$_}->[0] = @$filters[5]; |
| 332 |
} |
| 333 |
when (/ccode/) { |
| 334 |
$filter{$_}->[0] = @$filters[6]; |
| 335 |
} |
| 336 |
when (/itemtype/) { |
| 337 |
$filter{$_}->[0] = @$filters[7]; |
| 338 |
} |
| 339 |
when (/budget/) { |
| 340 |
$filter{$_}->[0] = @$filters[8]; |
| 341 |
} |
| 342 |
when (/sort1/) { |
| 343 |
$filter{$_}->[0] = @$filters[9]; |
| 344 |
} |
316 |
} |
| 345 |
when (/sort2/) { |
317 |
} |
| 346 |
$filter{$_}->[0] = @$filters[10]; |
318 |
elsif ( $_ =~ /received/ ) { |
|
|
319 |
$filter{$_}->[0] = @$filters[2]; |
| 320 |
$filter{$_}->[1] = @$filters[3]; |
| 321 |
my $a = $_; |
| 322 |
if ( $rodsp == 1 ) { |
| 323 |
$field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))"; |
| 324 |
} elsif ( $rodsp == 2 ) { |
| 325 |
$field{$a} = "concat(hex(month($a)),'-',monthname($a))"; |
| 326 |
} elsif ( $rodsp == 3 ) { |
| 327 |
$field{$a} = "Year($a)"; |
| 328 |
} else { |
| 329 |
field{$a} = $a; |
| 347 |
} |
330 |
} |
| 348 |
} |
331 |
} |
|
|
332 |
elsif ( $_ =~ /bookseller/ ) { |
| 333 |
$filter{$_}->[0] = @$filters[4]; |
| 334 |
} |
| 335 |
elsif ( $_ =~ /homebranch/ ) { |
| 336 |
$filter{$_}->[0] = @$filters[5]; |
| 337 |
} |
| 338 |
elsif ( $_ =~ /ccode/ ) { |
| 339 |
$filter{$_}->[0] = @$filters[6]; |
| 340 |
} |
| 341 |
elsif ( $_ =~ /itemtype/ ) { |
| 342 |
$filter{$_}->[0] = @$filters[7]; |
| 343 |
} |
| 344 |
elsif ( $_ =~ /budget/ ) { |
| 345 |
$filter{$_}->[0] = @$filters[8]; |
| 346 |
} |
| 347 |
elsif ( $_ =~ /sort1/ ) { |
| 348 |
$filter{$_}->[0] = @$filters[9]; |
| 349 |
} |
| 350 |
elsif ( $_ =~ /sort2/ ) { |
| 351 |
$filter{$_}->[0] = @$filters[10]; |
| 352 |
} |
| 349 |
} |
353 |
} |
| 350 |
|
354 |
|
| 351 |
my @linefilter = @{ $filter{$line} }; |
355 |
my @linefilter = @{ $filter{$line} }; |
|
Lines 484-494
sub calculate {
Link Here
|
| 484 |
# preparing calculation |
488 |
# preparing calculation |
| 485 |
my $strcalc; |
489 |
my $strcalc; |
| 486 |
$strcalc .= "SELECT $linefield, $colfield, "; |
490 |
$strcalc .= "SELECT $linefield, $colfield, "; |
| 487 |
given ($process) { |
491 |
if ( $process == 1 ) { |
| 488 |
when (1) { $strcalc .= "COUNT(*) " } |
492 |
$strcalc .= "COUNT(*) "; |
| 489 |
when (2) { $strcalc .= "COUNT(DISTINCT(aqorders.biblionumber)) " } |
493 |
} elsif ( $process == 2 ) { |
| 490 |
when ([3,4,5]) { $strcalc .= "SUM(aqorders.listprice) " } |
494 |
$strcalc .= "COUNT(DISTINCT(aqorders.biblionumber)) "; |
| 491 |
default { $strcalc .= "NULL " } |
495 |
} elsif ( $process == 3 || $process == 4 || $process == 5 ) { |
|
|
496 |
$strcalc .= "SUM(aqorders.listprice) "; |
| 497 |
} else { |
| 498 |
$strcalc .= "NULL "; |
| 492 |
} |
499 |
} |
| 493 |
$strcalc .= " |
500 |
$strcalc .= " |
| 494 |
FROM aqorders |
501 |
FROM aqorders |