X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FBudgets.pm;h=8d0a2f03bd6f708443ec0c9656d9f09faff19269;hb=599887a1855349de6bafe9c1b6ce155ed9be5fb5;hp=8ef85edbf9beeea1d667eb268f2fbcb68934d86c;hpb=d339abf0bfc334a819818bbb9b4c31f23326cbd1;p=srvgit diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 8ef85edbf9..8d0a2f03bd 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -39,6 +39,7 @@ BEGIN { &ModBudget &DelBudget &GetBudgetSpent + &GetBudgetOrdered &GetPeriodsCount &GetBudgetPeriod @@ -300,9 +301,26 @@ 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(ecost * quantity) AS sum FROM aqorders WHERE budget_id = ? AND - datecancellationprinted IS NULL + quantityreceived > 0 AND + datecancellationprinted IS NULL + |); + + $sth->execute($budget_id); + my $sum = $sth->fetchrow_array; + return $sum; +} + +# ------------------------------------------------------------------- +sub GetBudgetOrdered { + my ($budget_id) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare(qq| + SELECT SUM(ecost * quantity) AS sum FROM aqorders + WHERE budget_id = ? AND + quantityreceived = 0 AND + datecancellationprinted IS NULL |); $sth->execute($budget_id); @@ -612,14 +630,14 @@ sub DelBudget { return $rc; } -=back - =head2 FUNCTIONS ABOUT BUDGETS =over 2 =cut +=back + =head3 GetBudget =over 4 @@ -755,9 +773,12 @@ sub ConvertCurrency { return ( $price / $cur ); } -=item +=head3 _columns + returns an array containing fieldname followed by PRI as value if PRIMARY Key + =cut + sub _columns(;$) { my $tablename=shift||"aqbudgets"; return @{C4::Context->dbh->selectcol_arrayref("SHOW columns from $tablename",{Columns=>[1,4]})}; @@ -788,8 +809,6 @@ END { } # module clean-up code here (global destructor) 1; __END__ -=back - =head1 AUTHOR Koha Developement team