perltidy before next commit.

This commit is contained in:
sushi 2006-06-07 02:36:24 +00:00
parent e07e589879
commit 9d1c8fa9d2
1 changed files with 55 additions and 48 deletions

View File

@ -11,29 +11,33 @@ use HTML::Template;
use C4::Acquisition;
my $query = new CGI;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "acqui/acqui-home.tmpl",
query => $query,
type => "intranet",
authnotrequired => 0,
flagsrequired => {acquisition => 1},
debug => 1,
});
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "acqui/acqui-home.tmpl",
query => $query,
type => "intranet",
authnotrequired => 0,
flagsrequired => { acquisition => 1 },
debug => 1,
}
);
# budget
my $dbh = C4::Context->dbh;
my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?");
my $dbh = C4::Context->dbh;
my $sthtemp =
$dbh->prepare(
"Select flags, branchcode from borrowers where borrowernumber = ?");
$sthtemp->execute($loggedinuser);
my ($flags, $homebranch)=$sthtemp->fetchrow;
my ( $flags, $homebranch ) = $sthtemp->fetchrow;
my ($count,@results)=bookfunds($homebranch);
my $classlist='';
my $total=0;
my $totspent=0;
my $totcomtd=0;
my $totavail=0;
my ( $count, @results ) = bookfunds($homebranch);
my $classlist = '';
my $total = 0;
my $totspent = 0;
my $totcomtd = 0;
my $totavail = 0;
my @loop_budget = ();
for (my $i=0;$i<$count;$i++){
for ( my $i = 0 ; $i < $count ; $i++ ) {
if ( $toggle eq 0 ) {
$toggle = 1;
@ -41,44 +45,47 @@ for (my $i=0;$i<$count;$i++){
else {
$toggle = 0;
}
my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'});
my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
my %line;
my ( $spent, $comtd ) = bookfundbreakdown( $results[$i]->{'bookfundid'} );
my $avail = $results[$i]->{'budgetamount'} - ( $spent + $comtd );
my %line;
$line{bookfundname} = $results[$i]->{'bookfundname'};
$line{budgetamount} = $results[$i]->{'budgetamount'};
$line{spent} = sprintf ("%.2f", $spent);
$line{comtd} = sprintf ("%.2f",$comtd);
$line{avail} = sprintf ("%.2f",$avail);
$line{'toggle'} = $toggle;
push @loop_budget, \%line;
$total+=$results[$i]->{'budgetamount'};
$totspent+=$spent;
$totcomtd+=$comtd;
$totavail+=$avail;
$line{bookfundname} = $results[$i]->{'bookfundname'};
$line{budgetamount} = $results[$i]->{'budgetamount'};
$line{spent} = sprintf( "%.2f", $spent );
$line{comtd} = sprintf( "%.2f", $comtd );
$line{avail} = sprintf( "%.2f", $avail );
$line{'toggle'} = $toggle;
push @loop_budget, \%line;
$total += $results[$i]->{'budgetamount'};
$totspent += $spent;
$totcomtd += $comtd;
$totavail += $avail;
}
#currencies
my $rates;
($count,$rates)=getcurrencies();
( $count, $rates ) = getcurrencies();
my @loop_currency = ();
for (my $i=0;$i<$count;$i++){
my %line;
$line{currency} = $rates->[$i]->{'currency'};
$line{rate} = $rates->[$i]->{'rate'};
push @loop_currency, \%line;
for ( my $i = 0 ; $i < $count ; $i++ ) {
my %line;
$line{currency} = $rates->[$i]->{'currency'};
$line{rate} = $rates->[$i]->{'rate'};
push @loop_currency, \%line;
}
# suggestions ?
my $suggestion = countsuggestion("ASKED");
$template->param(classlist => $classlist,
type => 'intranet',
loop_budget => \@loop_budget,
loop_currency => \@loop_currency,
total => sprintf("%.2f",$total),
suggestion => $suggestion,
totspent => sprintf("%.2f",$totspent),
totcomtd => sprintf("%.2f",$totcomtd),
totavail => sprintf("%.2f",$totavail),
nobudget => $#results==-1?1:0);
$template->param(
classlist => $classlist,
type => 'intranet',
loop_budget => \@loop_budget,
loop_currency => \@loop_currency,
total => sprintf( "%.2f", $total ),
suggestion => $suggestion,
totspent => sprintf( "%.2f", $totspent ),
totcomtd => sprintf( "%.2f", $totcomtd ),
totavail => sprintf( "%.2f", $totavail ),
nobudget => $#results == -1 ? 1 : 0
);
output_html_with_http_headers $query, $cookie, $template->output;