my $entries = $e->search_acq_invoice_entry({"invoice" => $inv_id}) or
return 0;
+ my $items = $e->search_acq_invoice_item({"invoice" => $inv_id}) or
+ return 0;
+
my %totals_by_fund;
foreach my $entry (@$entries) {
my $debits = find_entry_debits($e, $entry, "f") or return 0;
}
}
+ foreach my $item (@$items) {
+ next unless $item->fund and $item->amount_paid;
+ $totals_by_fund{$item->fund} ||= 0.0;
+ $totals_by_fund{$item->fund} += $item->amount_paid;
+ }
+
my @totals;
foreach my $fund_id (keys %totals_by_fund) {
my $fund = $e->retrieve_acq_fund($fund_id) or return 0;