View | Details | Raw Unified | Return to bug 31631
Collapse All | Expand All

(-)a/C4/Budgets.pm (-8 / +8 lines)
Lines 352-358 sub GetBudgetSpent { Link Here
352
            quantityreceived > 0 AND
352
            quantityreceived > 0 AND
353
            datecancellationprinted IS NULL
353
            datecancellationprinted IS NULL
354
    |);
354
    |);
355
	$sth->execute($budget_id);
355
    $sth->execute($budget_id);
356
    my $sum = ( $sth->fetchrow_array || 0 ) + 0;
356
    my $sum = ( $sth->fetchrow_array || 0 ) + 0;
357
357
358
    $sth = $dbh->prepare(qq|
358
    $sth = $dbh->prepare(qq|
Lines 370-393 sub GetBudgetSpent { Link Here
370
        $sum += $adj->adjustment;
370
        $sum += $adj->adjustment;
371
    }
371
    }
372
372
373
	return $sum;
373
    return $sum;
374
}
374
}
375
375
376
# -------------------------------------------------------------------
376
# -------------------------------------------------------------------
377
sub GetBudgetOrdered {
377
sub GetBudgetOrdered {
378
	my ($budget_id) = @_;
378
    my ($budget_id) = @_;
379
	my $dbh = C4::Context->dbh;
379
    my $dbh = C4::Context->dbh;
380
380
381
    # Get correct unitprice and ecost prices as possible
381
    # Get correct unitprice and ecost prices as possible
382
    my ( $unitprice_field, $ecost_field ) = FieldsForCalculatingFundValues();
382
    my ( $unitprice_field, $ecost_field ) = FieldsForCalculatingFundValues();
383
383
384
	my $sth = $dbh->prepare(qq|
384
    my $sth = $dbh->prepare(qq|
385
        SELECT SUM(| . C4::Acquisition::get_rounding_sql(qq|$ecost_field|) . qq| *  quantity) AS sum FROM aqorders
385
        SELECT SUM(| . C4::Acquisition::get_rounding_sql(qq|$ecost_field|) . qq| *  quantity) AS sum FROM aqorders
386
            WHERE budget_id = ? AND
386
            WHERE budget_id = ? AND
387
            quantityreceived = 0 AND
387
            quantityreceived = 0 AND
388
            datecancellationprinted IS NULL
388
            datecancellationprinted IS NULL
389
    |);
389
    |);
390
	$sth->execute($budget_id);
390
    $sth->execute($budget_id);
391
    my $sum =  ( $sth->fetchrow_array || 0 ) + 0;
391
    my $sum =  ( $sth->fetchrow_array || 0 ) + 0;
392
392
393
    my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $budget_id, encumber_open => 1, closedate => undef},{ join => 'invoiceid' });
393
    my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $budget_id, encumber_open => 1, closedate => undef},{ join => 'invoiceid' });
Lines 395-401 sub GetBudgetOrdered { Link Here
395
        $sum += $adj->adjustment;
395
        $sum += $adj->adjustment;
396
    }
396
    }
397
397
398
	return $sum;
398
    return $sum;
399
}
399
}
400
400
401
=head2 GetBudgetName
401
=head2 GetBudgetName
Lines 1414-1420 sub MoveOrders { Link Here
1414
1414
1415
    my ( $unitprice_field, $ecost_field ) = FieldsForCalculatingFundValues();
1415
    my ( $unitprice_field, $ecost_field ) = FieldsForCalculatingFundValues();
1416
1416
1417
Fetch the tax inclusive or tax exclusive database fields for caclulating fund values based
1417
Fetch the tax inclusive or tax exclusive database fields for calculating fund values based
1418
on the value of the CalculateFundValuesIncludingTax system preference.
1418
on the value of the CalculateFundValuesIncludingTax system preference.
1419
1419
1420
=cut
1420
=cut
(-)a/acqui/spent.pl (-2 / +1 lines)
Lines 21-27 Link Here
21
21
22
=head1 NAME
22
=head1 NAME
23
23
24
 spent.pl
24
 acqui/spent.pl
25
25
26
=head1 DESCRIPTION
26
=head1 DESCRIPTION
27
27
28
- 

Return to bug 31631