Bug 17182: (QA follow-up) Fix call to GetMarcBiblio
[koha.git] / acqui / invoice.pl
index 0672866..3ab2d9f 100755 (executable)
@@ -35,7 +35,7 @@ use C4::Output;
 use C4::Acquisition;
 use C4::Budgets;
 
-use Koha::Acquisition::Bookseller;
+use Koha::Acquisition::Booksellers;
 use Koha::Acquisition::Currencies;
 use Koha::DateUtils;
 use Koha::Misc::Files;
@@ -112,7 +112,7 @@ elsif ( $op && $op eq 'delete' ) {
 
 
 my $details = GetInvoiceDetails($invoiceid);
-my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $details->{booksellerid} });
+my $bookseller = Koha::Acquisition::Booksellers->find( $details->{booksellerid} );
 my @orders_loop = ();
 my $orders = $details->{'orders'};
 my @foot_loop;
@@ -124,8 +124,11 @@ my $total_tax_value = 0;
 foreach my $order (@$orders) {
     my $line = get_infos( $order, $bookseller);
 
-    $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{unitprice_tax_excluded} * $line->{quantity} )->format;
-    $line->{total_tax_included} = Koha::Number::Price->new( $line->{unitprice_tax_included} * $line->{quantity} )->format;
+    $line->{total_tax_excluded} = $line->{unitprice_tax_excluded} * $line->{quantity};
+    $line->{total_tax_included} = $line->{unitprice_tax_included} * $line->{quantity};
+
+    $line->{tax_value} = $line->{tax_value_on_receiving};
+    $line->{tax_rate} = $line->{tax_rate_on_receiving};
 
     $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
     $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
@@ -143,7 +146,6 @@ foreach my $order (@$orders) {
 
 push @foot_loop, map {$_} values %foot;
 
-my $format = "%.2f";
 my $budgets = GetBudgets();
 my @budgets_loop;
 my $shipmentcost_budgetid = $details->{shipmentcost_budgetid};
@@ -170,12 +172,12 @@ $template->param(
     orders_loop      => \@orders_loop,
     foot_loop        => \@foot_loop,
     total_quantity   => $total_quantity,
-    total_tax_excluded       => sprintf( $format, $total_tax_excluded ),
-    total_tax_included       => sprintf( $format, $total_tax_included ),
-    total_tax_value   => sprintf( $format, $total_tax_value ),
-    total_tax_excluded_shipment => sprintf( $format, $total_tax_excluded + $details->{shipmentcost}),
-    total_tax_included_shipment => sprintf( $format, $total_tax_included + $details->{shipmentcost}),
-    invoiceincgst    => $bookseller->{invoiceincgst},
+    total_tax_excluded => $total_tax_excluded,
+    total_tax_included => $total_tax_included,
+    total_tax_value  => $total_tax_value,
+    total_tax_excluded_shipment => $total_tax_excluded + $details->{shipmentcost},
+    total_tax_included_shipment => $total_tax_included + $details->{shipmentcost},
+    invoiceincgst    => $bookseller->invoiceincgst,
     currency         => Koha::Acquisition::Currencies->get_active,
     budgets_loop     => \@budgets_loop,
 );