Lines 334-340
if ( $op eq 'delete_confirm' ) {
Link Here
|
334 |
my $cur = GetCurrency(); |
334 |
my $cur = GetCurrency(); |
335 |
|
335 |
|
336 |
|
336 |
|
337 |
my @results = GetOrders( $basketno ); |
337 |
my @orders = GetOrders( $basketno ); |
338 |
my @books_loop; |
338 |
my @books_loop; |
339 |
|
339 |
|
340 |
my @book_foot_loop; |
340 |
my @book_foot_loop; |
Lines 343-349
if ( $op eq 'delete_confirm' ) {
Link Here
|
343 |
my $total_gste = 0; |
343 |
my $total_gste = 0; |
344 |
my $total_gsti = 0; |
344 |
my $total_gsti = 0; |
345 |
my $total_gstvalue = 0; |
345 |
my $total_gstvalue = 0; |
346 |
for my $order (@results) { |
346 |
for my $order (@orders) { |
|
|
347 |
$order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 }); |
347 |
my $line = get_order_infos( $order, $bookseller); |
348 |
my $line = get_order_infos( $order, $bookseller); |
348 |
if ( $line->{uncertainprice} ) { |
349 |
if ( $line->{uncertainprice} ) { |
349 |
$template->param( uncertainprices => 1 ); |
350 |
$template->param( uncertainprices => 1 ); |
Lines 351-357
if ( $op eq 'delete_confirm' ) {
Link Here
|
351 |
|
352 |
|
352 |
push @books_loop, $line; |
353 |
push @books_loop, $line; |
353 |
|
354 |
|
354 |
$foot{$$line{gstgsti}}{gstgsti} = $$line{gstgsti}; |
355 |
$foot{$$line{gstgsti}}{gstrate} = $$line{gstrate}; |
355 |
$foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue}; |
356 |
$foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue}; |
356 |
$total_gstvalue += $$line{gstvalue}; |
357 |
$total_gstvalue += $$line{gstvalue}; |
357 |
$foot{$$line{gstgsti}}{quantity} += $$line{quantity}; |
358 |
$foot{$$line{gstgsti}}{quantity} += $$line{quantity}; |
Lines 365-373
if ( $op eq 'delete_confirm' ) {
Link Here
|
365 |
push @book_foot_loop, map {$_} values %foot; |
366 |
push @book_foot_loop, map {$_} values %foot; |
366 |
|
367 |
|
367 |
# Get cancelled orders |
368 |
# Get cancelled orders |
368 |
@results = GetCancelledOrders($basketno); |
369 |
my @cancelledorders = GetCancelledOrders($basketno); |
369 |
my @cancelledorders_loop; |
370 |
my @cancelledorders_loop; |
370 |
for my $order (@results) { |
371 |
for my $order (@cancelledorders) { |
371 |
my $line = get_order_infos( $order, $bookseller); |
372 |
my $line = get_order_infos( $order, $bookseller); |
372 |
push @cancelledorders_loop, $line; |
373 |
push @cancelledorders_loop, $line; |
373 |
} |
374 |
} |
Lines 375-381
if ( $op eq 'delete_confirm' ) {
Link Here
|
375 |
my $contract = GetContract({ |
376 |
my $contract = GetContract({ |
376 |
contractnumber => $basket->{contractnumber} |
377 |
contractnumber => $basket->{contractnumber} |
377 |
}); |
378 |
}); |
378 |
my @orders = GetOrders($basketno); |
|
|
379 |
|
379 |
|
380 |
if ($basket->{basketgroupid}){ |
380 |
if ($basket->{basketgroupid}){ |
381 |
$basketgroup = GetBasketgroup($basket->{basketgroupid}); |
381 |
$basketgroup = GetBasketgroup($basket->{basketgroupid}); |
Lines 446-473
sub get_order_infos {
Link Here
|
446 |
$line{order_received} = ( $qty == $order->{'quantityreceived'} ); |
446 |
$line{order_received} = ( $qty == $order->{'quantityreceived'} ); |
447 |
$line{basketno} = $basketno; |
447 |
$line{basketno} = $basketno; |
448 |
$line{budget_name} = $budget->{budget_name}; |
448 |
$line{budget_name} = $budget->{budget_name}; |
449 |
$line{rrp} = ConvertCurrency( $order->{'currency'}, $line{rrp} ); # FIXME from comm |
|
|
450 |
if ( $bookseller->{'listincgst'} ) { |
451 |
$line{rrpgsti} = sprintf( "%.2f", $line{rrp} ); |
452 |
$line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 ); |
453 |
$line{rrpgste} = sprintf( "%.2f", $line{rrp} / ( 1 + ( $line{gstgsti} / 100 ) ) ); |
454 |
$line{gstgste} = sprintf( "%.2f", $line{gstgsti} / ( 1 + ( $line{gstgsti} / 100 ) ) ); |
455 |
$line{ecostgsti} = sprintf( "%.2f", $line{ecost} ); |
456 |
$line{ecostgste} = sprintf( "%.2f", $line{ecost} / ( 1 + ( $line{gstgsti} / 100 ) ) ); |
457 |
$line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity}); |
458 |
$line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} ); |
459 |
$line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} ); |
460 |
} else { |
461 |
$line{rrpgsti} = sprintf( "%.2f", $line{rrp} * ( 1 + ( $line{gstrate} ) ) ); |
462 |
$line{rrpgste} = sprintf( "%.2f", $line{rrp} ); |
463 |
$line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 ); |
464 |
$line{gstgste} = sprintf( "%.2f", $line{gstrate} * 100 ); |
465 |
$line{ecostgsti} = sprintf( "%.2f", $line{ecost} * ( 1 + ( $line{gstrate} ) ) ); |
466 |
$line{ecostgste} = sprintf( "%.2f", $line{ecost} ); |
467 |
$line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity}); |
468 |
$line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} ); |
469 |
$line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} ); |
470 |
} |
471 |
|
449 |
|
472 |
if ( $line{uncertainprice} ) { |
450 |
if ( $line{uncertainprice} ) { |
473 |
$line{rrpgste} .= ' (Uncertain)'; |
451 |
$line{rrpgste} .= ' (Uncertain)'; |