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_tax_included) AS actual FROM aqorders |
215 |
SELECT SUM(ROUND(ecost_tax_included, 2)) 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_tax_included) FROM aqorders |
224 |
SELECT SUM(ROUD(ecost_tax_included, 2)) 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_tax_included * quantity) AS actual |
236 |
SELECT SUM( ROUND(ecost_tax_included, 2) * 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_tax_included * quantity) AS actual |
249 |
SELECT SUM(ROUND(ecost_tax_included, 2) * 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 330-336
sub GetBudgetSpent {
Link Here
|
330 |
# unitprice_tax_included should always been set here |
330 |
# unitprice_tax_included should always been set here |
331 |
# we should not need to retrieve ecost_tax_included |
331 |
# we should not need to retrieve ecost_tax_included |
332 |
my $sth = $dbh->prepare(qq| |
332 |
my $sth = $dbh->prepare(qq| |
333 |
SELECT SUM( COALESCE(unitprice_tax_included, ecost_tax_included) * quantity ) AS sum FROM aqorders |
333 |
SELECT SUM( ROUND(COALESCE(unitprice_tax_included, ecost_tax_included), 2) * quantity ) AS sum FROM aqorders |
334 |
WHERE budget_id = ? AND |
334 |
WHERE budget_id = ? AND |
335 |
quantityreceived > 0 AND |
335 |
quantityreceived > 0 AND |
336 |
datecancellationprinted IS NULL |
336 |
datecancellationprinted IS NULL |
Lines 339-345
sub GetBudgetSpent {
Link Here
|
339 |
my $sum = $sth->fetchrow_array; |
339 |
my $sum = $sth->fetchrow_array; |
340 |
|
340 |
|
341 |
$sth = $dbh->prepare(qq| |
341 |
$sth = $dbh->prepare(qq| |
342 |
SELECT SUM(shipmentcost) AS sum |
342 |
SELECT SUM(ROUND(shipmentcost, 2)) AS sum |
343 |
FROM aqinvoices |
343 |
FROM aqinvoices |
344 |
WHERE shipmentcost_budgetid = ? |
344 |
WHERE shipmentcost_budgetid = ? |
345 |
AND closedate IS NOT NULL |
345 |
AND closedate IS NOT NULL |
Lines 356-362
sub GetBudgetOrdered {
Link Here
|
356 |
my ($budget_id) = @_; |
356 |
my ($budget_id) = @_; |
357 |
my $dbh = C4::Context->dbh; |
357 |
my $dbh = C4::Context->dbh; |
358 |
my $sth = $dbh->prepare(qq| |
358 |
my $sth = $dbh->prepare(qq| |
359 |
SELECT SUM(ecost_tax_included * quantity) AS sum FROM aqorders |
359 |
SELECT SUM(ROUND(ecost_tax_included, 2) * quantity) AS sum FROM aqorders |
360 |
WHERE budget_id = ? AND |
360 |
WHERE budget_id = ? AND |
361 |
quantityreceived = 0 AND |
361 |
quantityreceived = 0 AND |
362 |
datecancellationprinted IS NULL |
362 |
datecancellationprinted IS NULL |
Lines 365-371
sub GetBudgetOrdered {
Link Here
|
365 |
my $sum = $sth->fetchrow_array; |
365 |
my $sum = $sth->fetchrow_array; |
366 |
|
366 |
|
367 |
$sth = $dbh->prepare(qq| |
367 |
$sth = $dbh->prepare(qq| |
368 |
SELECT SUM(shipmentcost) AS sum |
368 |
SELECT SUM(ROUND(shipmentcost, 2)) AS sum |
369 |
FROM aqinvoices |
369 |
FROM aqinvoices |
370 |
WHERE shipmentcost_budgetid = ? |
370 |
WHERE shipmentcost_budgetid = ? |
371 |
AND closedate IS NULL |
371 |
AND closedate IS NULL |