|
Lines 275-291
sub calculate {
Link Here
|
| 275 |
@sqlparams=(@sqlparams,@sqlorparams); |
275 |
@sqlparams=(@sqlparams,@sqlorparams); |
| 276 |
$dbcalc->execute(@sqlparams,@sqlparams); |
276 |
$dbcalc->execute(@sqlparams,@sqlparams); |
| 277 |
my ($emptycol,$emptyrow); |
277 |
my ($emptycol,$emptyrow); |
| 278 |
my $data = $dbcalc->fetchall_hashref([qw(line col)]); |
|
|
| 279 |
my %cols_hash; |
| 280 |
foreach my $row (keys %$data){ |
| 281 |
push @loopline, $row; |
| 282 |
foreach my $col (keys %{$$data{$row}}){ |
| 283 |
$$data{$row}{totalrow}+=$$data{$row}{$col}{calculation}; |
| 284 |
$grantotal+=$$data{$row}{$col}{calculation}; |
| 285 |
$cols_hash{$col}=1 ; |
| 286 |
} |
| 287 |
} |
| 288 |
my $urlbase="do_it=1&".join("&",map{"filter_$_=$$filters_hashref{$_}"} keys %$filters_hashref); |
278 |
my $urlbase="do_it=1&".join("&",map{"filter_$_=$$filters_hashref{$_}"} keys %$filters_hashref); |
|
|
279 |
|
| 280 |
my $results = $dbcalc->fetchall_arrayref({}); |
| 281 |
my %cols_hash; |
| 282 |
my $data; |
| 283 |
foreach my $r (@$results){ |
| 284 |
my $row = $r->{line}; |
| 285 |
$data->{$row}{$r->{col}}{calculation} += $r->{calculation}; |
| 286 |
$data->{$row}{totalrow} += $r->{calculation}; |
| 287 |
$grantotal += $r->{calculation}; |
| 288 |
$cols_hash{$r->{col}}=1 ; |
| 289 |
} |
| 290 |
@loopline = keys $data; |
| 291 |
|
| 289 |
foreach my $row (sort @loopline) { |
292 |
foreach my $row (sort @loopline) { |
| 290 |
my @loopcell; |
293 |
my @loopcell; |
| 291 |
#@loopcol ensures the order for columns is common with column titles |
294 |
#@loopcol ensures the order for columns is common with column titles |
| 292 |
- |
|
|