[followup] (bug #4051) fix default values
[koha.git] / acqui / bookfund.pl
index 76e14fe..bac0bf9 100755 (executable)
@@ -71,9 +71,10 @@ SELECT quantity,
     AND budgetdate < ?
     AND (datecancellationprinted IS NULL
          OR datecancellationprinted = \'0000-00-00\')
+    AND (closedate >= ? and closedate < ?)
 ';
 my $sth = $dbh->prepare($query);
-$sth->execute( $bookfund, $start, $end );
+$sth->execute( $bookfund, $start, $end, $start, $end);
 my @commited_loop;
 
 my $total = 0;
@@ -84,7 +85,7 @@ while ( my $data = $sth->fetchrow_hashref ) {
     }
     if ( $left && $left > 0 ) {
         my $subtotal = $left * $data->{'ecost'};
-        $data->{subtotal} = $subtotal;
+        $data->{subtotal} = sprintf("%.2f",$subtotal);
         $data->{'left'} = $left;
         push @commited_loop, $data;
         $total += $subtotal;
@@ -92,8 +93,8 @@ while ( my $data = $sth->fetchrow_hashref ) {
 }
 
 $template->param(
-    COMMITEDLOOP => \@commited_loop,
-    total        => $total
+    COMMITTEDLOOP => \@commited_loop,
+    total        =>  sprintf("%.2f",$total),
 );
 $sth->finish;
 $dbh->disconnect;