diff --git a/C4/Stats.pm b/C4/Stats.pm index 8c03061358..d16b13fd17 100644 --- a/C4/Stats.pm +++ b/C4/Stats.pm @@ -91,7 +91,7 @@ sub TotalPaid { my ($time,$time2)=@_; $time2=$time unless $time2; my $dbh = C4::Context->dbh; - my $query="Select * from accountlines,borrowers where (accounttype = 'Pay' or accounttype ='W') + my $query="Select * from accountlines,borrowers where (accounttype = 'Pay' or accounttype ='W' or accounttype='C') and accountlines.borrowernumber = borrowers.borrowernumber"; my @bind = (); if ($time eq 'today'){ @@ -109,14 +109,12 @@ sub TotalPaid { # $query.=" and datetime > '$time'"; # } $query.=" order by timestamp"; - # print $query; + warn $query; my $sth=$dbh->prepare($query); $sth->execute(@bind); my @results; - my $i=0; while (my $data=$sth->fetchrow_hashref){ - $results[$i]=$data; - $i++; + push @results,$data; } $sth->finish; # print $query; diff --git a/koha-tmpl/intranet-tmpl/default/en/stats.tmpl b/koha-tmpl/intranet-tmpl/default/en/stats.tmpl index 4659f328c4..28f74c2d0f 100644 --- a/koha-tmpl/intranet-tmpl/default/en/stats.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/stats.tmpl @@ -1,16 +1,20 @@ +
- - - - - + + + + + + + + @@ -26,6 +30,5 @@ Total written off:

- - - + + \ No newline at end of file diff --git a/stats.pl b/stats.pl index 7c4ebb0d48..b092f4636e 100755 --- a/stats.pl +++ b/stats.pl @@ -78,10 +78,10 @@ my $total=0; my $oldtime; my $totalw=0; my @loop; -my %row; my $i=0; +# parse all lines for today while ($i<$count){ - warn " pay : ".$payments[$i]{'timestamp'}; +# warn " pay : ".$payments[$i]{'timestamp'}; my $time=$payments[$i]{'datetime'}; my $payments=$payments[$i]{'value'}; my $charge=0; @@ -95,13 +95,14 @@ while ($i<$count){ my $temptotalren=0; my $temptotalw=0; for (my $i2=0;$i2<$count;$i2++){ +# warn "I2 : $i2 i=$i"; $charge+=$charges[$i2]->{'amount'}; - %row = ( name => $charges[$i2]->{'description'}, - type => $charges[$i2]->{'accounttype'}, - time => $charges[$i2]->{'timestamp'}, - amount => $charges[$i2]->{'amount'}, - branch => $charges[$i2]->{'amountoutstanding'} ); - push(@loop, \%row); +# %row = ( name => $charges[$i2]->{'description'}, +# type => $charges[$i2]->{'accounttype'}, +# time => $charges[$i2]->{'timestamp'}, +# amount => $charges[$i2]->{'amount'}, +# branch => $charges[$i2]->{'amountoutstanding'} ); +# push(@loop, \%row); if ($payments[$i]{'accountytpe'} ne 'W'){ if ($charges[$i2]->{'accounttype'} eq 'Rent'){ $temptotalr+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'}; @@ -139,10 +140,10 @@ while ($i<$count){ $payments[$i]{'amount'}=$payments[$i]{'amount'}*-1; $total+=$payments[$i]{'amount'}; } - - %row = ( name => "".$payments[$i]{'firstname'}.$payments[$i]{'surname'} . "", + my %row = ( name => "".$payments[$i]{'firstname'}.' '.$payments[$i]{'surname'} . "", type => $payments[$i]{'accounttype'}, time => $payments[$i]{'date'}, - amount => $payments[$i]{'amount'}, branch => $branch ); + amount => $payments[$i]{'amount'}, branch => $branch, + description => $payments[$i]{'description'}); push(@loop, \%row); $oldtype=$payments[$i]{'accounttype'}; $oldtime=$payments[$i]{'timestamp'};
NameTypeDate/timeAmountBranchNameDescriptionTypeDate/timeAmountBranch