my $cur = GetCurrency();
- my @results = GetOrders( $basketno );
+ my @orders = GetOrders( $basketno );
my @books_loop;
my @book_foot_loop;
my $total_gste = 0;
my $total_gsti = 0;
my $total_gstvalue = 0;
- for my $order (@results) {
+ for my $order (@orders) {
+ $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
my $line = get_order_infos( $order, $bookseller);
if ( $line->{uncertainprice} ) {
$template->param( uncertainprices => 1 );
push @books_loop, $line;
- $foot{$$line{gstgsti}}{gstgsti} = $$line{gstgsti};
+ $foot{$$line{gstgsti}}{gstrate} = $$line{gstrate};
$foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue};
$total_gstvalue += $$line{gstvalue};
$foot{$$line{gstgsti}}{quantity} += $$line{quantity};
push @book_foot_loop, map {$_} values %foot;
# Get cancelled orders
- @results = GetCancelledOrders($basketno);
+ my @cancelledorders = GetCancelledOrders($basketno);
my @cancelledorders_loop;
- for my $order (@results) {
+ for my $order (@cancelledorders) {
my $line = get_order_infos( $order, $bookseller);
push @cancelledorders_loop, $line;
}
my $contract = GetContract({
contractnumber => $basket->{contractnumber}
});
- my @orders = GetOrders($basketno);
if ($basket->{basketgroupid}){
$basketgroup = GetBasketgroup($basket->{basketgroupid});
$line{order_received} = ( $qty == $order->{'quantityreceived'} );
$line{basketno} = $basketno;
$line{budget_name} = $budget->{budget_name};
- $line{rrp} = ConvertCurrency( $order->{'currency'}, $line{rrp} ); # FIXME from comm
- if ( $bookseller->{'listincgst'} ) {
- $line{rrpgsti} = sprintf( "%.2f", $line{rrp} );
- $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
- $line{rrpgste} = sprintf( "%.2f", $line{rrp} / ( 1 + ( $line{gstgsti} / 100 ) ) );
- $line{gstgste} = sprintf( "%.2f", $line{gstgsti} / ( 1 + ( $line{gstgsti} / 100 ) ) );
- $line{ecostgsti} = sprintf( "%.2f", $line{ecost} );
- $line{ecostgste} = sprintf( "%.2f", $line{ecost} / ( 1 + ( $line{gstgsti} / 100 ) ) );
- $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
- $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
- $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
- } else {
- $line{rrpgsti} = sprintf( "%.2f", $line{rrp} * ( 1 + ( $line{gstrate} ) ) );
- $line{rrpgste} = sprintf( "%.2f", $line{rrp} );
- $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
- $line{gstgste} = sprintf( "%.2f", $line{gstrate} * 100 );
- $line{ecostgsti} = sprintf( "%.2f", $line{ecost} * ( 1 + ( $line{gstrate} ) ) );
- $line{ecostgste} = sprintf( "%.2f", $line{ecost} );
- $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
- $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
- $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
- }
if ( $line{uncertainprice} ) {
$line{rrpgste} .= ' (Uncertain)';
[% USE KohaDates %]
+[% USE Price %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions › [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
[% FOREACH foot_loo IN book_foot_loop %]
<tr>
<th></th>
- <th>Total (GST [% foot_loo.gstgsti %])</th>
+ <th>Total (GST [% foot_loo.gstrate * 100 | $Price %])</th>
<th class="gste"> </th>
<th class="gste"> </th>
<th class="gsti"> </th>
</td>
[% SET zero_regex = "^0{1,}\.?0{1,}[^1-9]" %] [%# 0 or 0.0 or 0.00 or 00 or 00.0 or 00.00 or 0.000 ... %]
[%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
- <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste %]</td>
- <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste %]</td>
- <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti %]</td>
- <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti %]</td>
+ <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste | $Price %]</td>
+ <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste | $Price%]</td>
+ <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti | $Price %]</td>
+ <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti | $Price %]</td>
<td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
- <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste %]</td>
- <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti %]</td>
- <td class="number [% IF books_loo.gstgsti.search(zero_regex) %]error[% END %]">[% books_loo.gstgsti %]</td>
- <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue %]</td>
+ <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste | $Price %]</td>
+ <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti | $Price %]</td>
+ <td class="number">[% books_loo.gstrate * 100 | $Price %]</td>
+ <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue | $Price %]</td>
<td>[% books_loo.budget_name %]</td>
[% IF ( active ) %]
[% UNLESS ( closedate ) %]
<td class="number">[% order.quantity %]</td>
<td class="number gste">[% order.totalgste %]</td>
<td class="number gsti">[% order.totalgsti %]</td>
- <td class="number">[% order.gstgsti %]</td>
+ <td class="number">[% order.gstrate * 100 %]</td>
<td class="number">[% order.gstvalue %]</td>
<td>[% order.budget_name %]
</tr>