-- formatting currency amounts to two decimals

-- formatting dates according to system preference
-- adding variables to indicate positive or negative currency amounts (for use in styling output)
This commit is contained in:
oleonard 2005-07-15 18:16:14 +00:00
parent 90125d5761
commit 4b748b4766
1 changed files with 10 additions and 3 deletions

View File

@ -36,8 +36,15 @@ $template->param( BORROWER_INFO => \@bordat );
my ($numaccts,$accts,$total) = getboracctrecord(undef,$borr);
for (my $i=0;$i<$numaccts;$i++){
$accts->[$i]{'amount'}+=0.00;
$accts->[$i]{'amountoutstanding'}+=0.00;
$accts->[$i]{'date'} = format_date($accts->[$i]{'date'});
$accts->[$i]{'amount'} = sprintf("%.2f", $accts->[$i]{'amount'});
if($accts->[$i]{'amount'} >= 0){
$accts->[$i]{'amountcredit'} = 1;
}
$accts->[$i]{'amountoutstanding'} =sprintf("%.2f", $accts->[$i]{'amountoutstanding'});
if($accts->[$i]{'amountoutstanding'} >= 0){
$accts->[$i]{'amountoutstandingcredit'} = 1;
}
if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
$accts->[$i]{'print_title'};
}
@ -56,7 +63,7 @@ $template->param( ACCOUNT_LINES => $accts,
LibraryName => C4::Context->preference("LibraryName"),
);
$template->param( total => $total );
$template->param( total => sprintf("%.2f",$total) );
#$template->param(loggeninuser => $loggedinuser);
output_html_with_http_headers $query, $cookie, $template->output;