X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=acqui%2Fordered.pl;h=92f44a0dac73da3a4f9249b0bbc2bb4992d33796;hb=1142b189f29808bae6f7f099f692b902795ab94b;hp=9d319f6af656332e4a0baf9869434bca3b2bc08c;hpb=9638053a25a89040c21a38196dc6c4bb09e6010a;p=koha.git diff --git a/acqui/ordered.pl b/acqui/ordered.pl index 9d319f6af6..92f44a0dac 100755 --- a/acqui/ordered.pl +++ b/acqui/ordered.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # Copyright 2008 - 2009 BibLibre SARL -# Copyright 2010 Catalyst IT Limited +# Copyright 2010,2011 Catalyst IT Limited # This file is part of Koha. # # Koha is free software; you can redistribute it and/or modify it under the @@ -19,7 +19,7 @@ =head1 NAME -committed.pl +ordered.pl =head1 DESCRIPTION @@ -27,19 +27,18 @@ this script is to show orders ordered but not yet received =cut - use C4::Context; use strict; use warnings; use CGI; use C4::Auth; use C4::Output; +use C4::Dates; -my $dbh = C4::Context->dbh; -my $input = new CGI; +my $dbh = C4::Context->dbh; +my $input = new CGI; my $fund_id = $input->param('fund'); -my $start = $input->param('start'); -my $end = $input->param('end'); +my $fund_code = $input->param('fund_code'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -56,7 +55,7 @@ my $query = < quantityreceived OR quantityreceived IS NULL) + GROUP BY aqorders.ordernumber EOQ my $sth = $dbh->prepare($query); -$sth->execute( $fund_id); -if ($sth->err) { - die "Error occurred fetching records: ".$sth->errstr; +$sth->execute($fund_id); +if ( $sth->err ) { + die "Error occurred fetching records: " . $sth->errstr; } my @ordered; @@ -91,18 +91,19 @@ while ( my $data = $sth->fetchrow_hashref ) { } if ( $left && $left > 0 ) { my $subtotal = $left * $data->{'ecost'}; - $data->{subtotal} = sprintf ("%.2f", $subtotal); + $data->{subtotal} = sprintf( "%.2f", $subtotal ); $data->{'left'} = $left; push @ordered, $data; $total += $subtotal; } } -$total = sprintf ("%.2f", $total); -$template->param( - ordered => \@ordered, - total => $total -); +$total = sprintf( "%.2f", $total ); + +$template->{VARS}->{'fund'} = $fund_id; +$template->{VARS}->{'ordered'} = \@ordered; +$template->{VARS}->{'total'} = $total; +$template->{VARS}->{'fund_code'} = $fund_code; + $sth->finish; -$dbh->disconnect; output_html_with_http_headers $input, $cookie, $template->output;