+
+ next unless ( $ord->{biblionumber} or $ord->{quantity}> 0 );
+ eval {
+ require C4::Biblio;
+ import C4::Biblio;
+ };
+ if ($@){
+ croak $@;
+ }
+ eval {
+ require C4::Koha;
+ import C4::Koha;
+ };
+ if ($@){
+ croak $@;
+ }
+
+ $ord->{rrp} = ConvertCurrency( $ord->{'currency'}, $ord->{rrp} );
+ if ( $bookseller->{'listincgst'} ) {
+ $ord->{rrpgsti} = sprintf( "%.2f", $ord->{rrp} );
+ $ord->{gstgsti} = sprintf( "%.2f", $ord->{gstrate} * 100 );
+ $ord->{rrpgste} = sprintf( "%.2f", $ord->{rrp} / ( 1 + ( $ord->{gstgsti} / 100 ) ) );
+ $ord->{gstgste} = sprintf( "%.2f", $ord->{gstgsti} / ( 1 + ( $ord->{gstgsti} / 100 ) ) );
+ $ord->{ecostgsti} = sprintf( "%.2f", $ord->{ecost} );
+ $ord->{ecostgste} = sprintf( "%.2f", $ord->{ecost} / ( 1 + ( $ord->{gstgsti} / 100 ) ) );
+ $ord->{gstvalue} = sprintf( "%.2f", ( $ord->{ecostgsti} - $ord->{ecostgste} ) * $ord->{quantity});
+ $ord->{totalgste} = sprintf( "%.2f", $ord->{quantity} * $ord->{ecostgste} );
+ $ord->{totalgsti} = sprintf( "%.2f", $ord->{quantity} * $ord->{ecostgsti} );
+ } else {
+ $ord->{rrpgsti} = sprintf( "%.2f", $ord->{rrp} * ( 1 + ( $ord->{gstrate} ) ) );
+ $ord->{rrpgste} = sprintf( "%.2f", $ord->{rrp} );
+ $ord->{gstgsti} = sprintf( "%.2f", $ord->{gstrate} * 100 );
+ $ord->{gstgste} = sprintf( "%.2f", $ord->{gstrate} * 100 );
+ $ord->{ecostgsti} = sprintf( "%.2f", $ord->{ecost} * ( 1 + ( $ord->{gstrate} ) ) );
+ $ord->{ecostgste} = sprintf( "%.2f", $ord->{ecost} );
+ $ord->{gstvalue} = sprintf( "%.2f", ( $ord->{ecostgsti} - $ord->{ecostgste} ) * $ord->{quantity});
+ $ord->{totalgste} = sprintf( "%.2f", $ord->{quantity} * $ord->{ecostgste} );
+ $ord->{totalgsti} = sprintf( "%.2f", $ord->{quantity} * $ord->{ecostgsti} );
+ }
+ my $bib = GetBiblioData($ord->{biblionumber});
+ my $itemtypes = GetItemTypes();
+
+ #FIXME DELETE ME