my $total_gste = 0;
my $total_gsti = 0;
+my $subtotal_for_funds;
for my $order ( @orders ) {
$order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $bookseller->{id}, receiving => 1, ordering => 1 });
$order->{'unitprice'} += 0;
}
}
- my $budget = GetBudget( $line{budget_id} );
- $line{budget_name} = $budget->{'budget_name'};
+ my $budget_name = GetBudgetName( $line{budget_id} );
+ $line{budget_name} = $budget_name;
+
+ $subtotal_for_funds->{ $line{budget_name} }{ecost} += $order->{ecost} * $order->{quantity};
+ $subtotal_for_funds->{ $line{budget_name} }{unitprice} += $order->{total};
push @loop_received, \%line;
}
$line{holds} = $holds;
$line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
- my $budget = GetBudget( $line{budget_id} );
- $line{budget_name} = $budget->{'budget_name'};
+ my $budget_name = GetBudgetName( $line{budget_id} );
+ $line{budget_name} = $budget_name;
push @loop_orders, \%line;
}
(uc(C4::Context->preference("marcflavour"))) => 1,
total_gste => $total_gste,
total_gsti => $total_gsti,
+ subtotal_for_funds => $subtotal_for_funds,
sticky_filters => $sticky_filters,
);
output_html_with_http_headers $input, $cookie, $template->output;
<div id="acqui_receive_receivelist">
<h3>Already received</h3>
-
[% IF ( loop_received ) %]
- [% SET funds = {} %]
- [% SET estimated_total = 0 %]
-
- [% FOREACH loop_receive IN loop_received %]
- [% SET index = loop.count %]
- [% SET funds.${ index }.budget_name = loop_receive.budget.budget_name %]
- [% IF (funds.${ index }.estimated == '') %]
- [% SET funds.${ index }.estimated = 0 %]
- [% END %]
- [% IF (funds.${ index }.actual == '') %]
- [% SET funds.${ index }.actual = 0 %]
- [% END %]
- [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
- [% SET funds.${ index }.estimated = funds.${ index }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%]
-
- [% SET funds.${ index }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
- [% END %]
-
<form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
<table id="receivedt">
<thead>
</tr>
</thead>
<tfoot>
- [% FOREACH key IN funds.keys.sort %]
+ [% FOREACH key IN subtotal_for_funds.keys.sort %]
<tr>
<td colspan="6" class="total">(Tax exc.)</td>
<td colspan="2"><i>Subtotal for</i> [% funds.$key.budget_name %]</td>
- <td>[% funds.$key.estimated | $Price %]</td>
- <td>[% funds.$key.actual | $Price %]</td>
+ <td>[% subtotal_for_funds.$key.ecost | $Price %]</td>
+ <td>[% subtotal_for_funds.$key.unitprice | $Price %]</td>
<td> </td>
<td> </td>
</tr>