Lines 212-218
sub GetBudgetsPlanCell {
Link Here
|
212 |
# get the actual amount |
212 |
# get the actual amount |
213 |
$sth = $dbh->prepare( qq| |
213 |
$sth = $dbh->prepare( qq| |
214 |
|
214 |
|
215 |
SELECT SUM(ecost) AS actual FROM aqorders |
215 |
SELECT SUM(ecost_tax_included) AS actual FROM aqorders |
216 |
WHERE budget_id = ? AND |
216 |
WHERE budget_id = ? AND |
217 |
entrydate like "$cell->{'authvalue'}%" | |
217 |
entrydate like "$cell->{'authvalue'}%" | |
218 |
); |
218 |
); |
Lines 221-227
sub GetBudgetsPlanCell {
Link Here
|
221 |
# get the actual amount |
221 |
# get the actual amount |
222 |
$sth = $dbh->prepare( qq| |
222 |
$sth = $dbh->prepare( qq| |
223 |
|
223 |
|
224 |
SELECT SUM(ecost) FROM aqorders |
224 |
SELECT SUM(ecost_tax_included) FROM aqorders |
225 |
LEFT JOIN aqorders_items |
225 |
LEFT JOIN aqorders_items |
226 |
ON (aqorders.ordernumber = aqorders_items.ordernumber) |
226 |
ON (aqorders.ordernumber = aqorders_items.ordernumber) |
227 |
LEFT JOIN items |
227 |
LEFT JOIN items |
Lines 233-239
sub GetBudgetsPlanCell {
Link Here
|
233 |
# get the actual amount |
233 |
# get the actual amount |
234 |
$sth = $dbh->prepare( qq| |
234 |
$sth = $dbh->prepare( qq| |
235 |
|
235 |
|
236 |
SELECT SUM( ecost * quantity) AS actual |
236 |
SELECT SUM( ecost_tax_included * quantity) AS actual |
237 |
FROM aqorders JOIN biblioitems |
237 |
FROM aqorders JOIN biblioitems |
238 |
ON (biblioitems.biblionumber = aqorders.biblionumber ) |
238 |
ON (biblioitems.biblionumber = aqorders.biblionumber ) |
239 |
WHERE aqorders.budget_id = ? and itemtype = ? | |
239 |
WHERE aqorders.budget_id = ? and itemtype = ? | |
Lines 246-252
sub GetBudgetsPlanCell {
Link Here
|
246 |
# get the actual amount |
246 |
# get the actual amount |
247 |
$sth = $dbh->prepare( qq| |
247 |
$sth = $dbh->prepare( qq| |
248 |
|
248 |
|
249 |
SELECT SUM(ecost * quantity) AS actual |
249 |
SELECT SUM(ecost_tax_included * quantity) AS actual |
250 |
FROM aqorders |
250 |
FROM aqorders |
251 |
JOIN aqbudgets ON (aqbudgets.budget_id = aqorders.budget_id ) |
251 |
JOIN aqbudgets ON (aqbudgets.budget_id = aqorders.budget_id ) |
252 |
WHERE aqorders.budget_id = ? AND |
252 |
WHERE aqorders.budget_id = ? AND |
Lines 325-334
sub ModBudgetPlan {
Link Here
|
325 |
|
325 |
|
326 |
# ------------------------------------------------------------------- |
326 |
# ------------------------------------------------------------------- |
327 |
sub GetBudgetSpent { |
327 |
sub GetBudgetSpent { |
328 |
my ($budget_id) = @_; |
328 |
my ($budget_id) = @_; |
329 |
my $dbh = C4::Context->dbh; |
329 |
my $dbh = C4::Context->dbh; |
330 |
my $sth = $dbh->prepare(qq| |
330 |
# unitprice_tax_included should always been set here |
331 |
SELECT SUM( COALESCE(unitprice, ecost) * quantity ) AS sum FROM aqorders |
331 |
# we should not need to retrieve ecost_tax_included |
|
|
332 |
my $sth = $dbh->prepare(qq| |
333 |
SELECT SUM( COALESCE(unitprice_tax_included, ecost_tax_included) * quantity ) AS sum FROM aqorders |
332 |
WHERE budget_id = ? AND |
334 |
WHERE budget_id = ? AND |
333 |
quantityreceived > 0 AND |
335 |
quantityreceived > 0 AND |
334 |
datecancellationprinted IS NULL |
336 |
datecancellationprinted IS NULL |
Lines 354-360
sub GetBudgetOrdered {
Link Here
|
354 |
my ($budget_id) = @_; |
356 |
my ($budget_id) = @_; |
355 |
my $dbh = C4::Context->dbh; |
357 |
my $dbh = C4::Context->dbh; |
356 |
my $sth = $dbh->prepare(qq| |
358 |
my $sth = $dbh->prepare(qq| |
357 |
SELECT SUM(ecost * quantity) AS sum FROM aqorders |
359 |
SELECT SUM(ecost_tax_included * quantity) AS sum FROM aqorders |
358 |
WHERE budget_id = ? AND |
360 |
WHERE budget_id = ? AND |
359 |
quantityreceived = 0 AND |
361 |
quantityreceived = 0 AND |
360 |
datecancellationprinted IS NULL |
362 |
datecancellationprinted IS NULL |
361 |
- |
|
|