From 4fb88deaa7a0ada50480751cbfadcf1dde75d8eb Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Wed, 7 Sep 2011 16:02:21 +1200 Subject: [PATCH] bug_4831: Use unitprice (actual cost) when totalling spent amounts for "All available funds", as in "Already received" Signed-off-by: Katrin Fischer To test: - add new fund for an active budget - order item, price 8.00 - check funds page and acq home: committed amount should be 8.00 - receive item, enter actual price 10.00 - check funds page and acq home: spent amount should be 10.00 Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- C4/Budgets.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 888b4fde54..7c867e0aab 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -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 -- 2.39.2