Bug 5549 : Only use DateTime for issues table
[koha.git] / C4 / Budgets.pm
index 888b4fd..7c867e0 100644 (file)
@@ -304,7 +304,7 @@ sub GetBudgetSpent {
        my ($budget_id) = @_;
        my $dbh = C4::Context->dbh;
        my $sth = $dbh->prepare(qq|
-        SELECT SUM(ecost *  quantity) AS sum FROM aqorders
+        SELECT SUM( COALESCE(unitprice, ecost) * quantity ) AS sum FROM aqorders
             WHERE budget_id = ? AND
             quantityreceived > 0 AND
             datecancellationprinted IS NULL