Bug 21454: Do not require html filter on Price
[koha.git] / acqui / ordered.pl
index 5c2cc6d..e393490 100755 (executable)
@@ -28,11 +28,11 @@ this script is to show orders ordered but not yet received
 =cut
 
 use C4::Context;
-use strict;
-use warnings;
+use Modern::Perl;
 use CGI qw ( -utf8 );
 use C4::Auth;
 use C4::Output;
+use Koha::Acquisition::Invoice::Adjustments;
 
 my $dbh     = C4::Context->dbh;
 my $input   = new CGI;
@@ -96,12 +96,19 @@ while ( my $data = $sth->fetchrow_hashref ) {
         $total += $subtotal;
     }
 }
+
+my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $fund_id, closedate => undef, encumber_open => 1 }, { join => 'invoiceid' } );
+while ( my $adj = $adjustments->next ){
+    $total += $adj->adjustment;
+}
+
 $total = sprintf( "%.2f", $total );
 
 $template->{VARS}->{'fund'}    = $fund_id;
 $template->{VARS}->{'ordered'} = \@ordered;
 $template->{VARS}->{'total'}   = $total;
 $template->{VARS}->{'fund_code'} = $fund_code;
+$template->{VARS}->{'adjustments'} = $adjustments;
 
 $sth->finish;