From 75debecc210de2bbc7d8d4cbe70f5e95d9ce1b1e Mon Sep 17 00:00:00 2001 From: einhverfr Date: Tue, 5 Dec 2006 23:13:22 +0000 Subject: Fixing NaN issues with cash screens. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@726 4979c152-3d1c-0410-bac9-87ea11338e46 --- bin/cp.pl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/cp.pl b/bin/cp.pl index c0f2c2eb..0e8a4255 100755 --- a/bin/cp.pl +++ b/bin/cp.pl @@ -373,7 +373,11 @@ sub invoices_due { $totalamount += $form->{"amount_$i"}; $totaldue += $form->{"due_$i"}; - $totalpaid += $form->{"paid_$i"}; + if ($form->{"paid_$i"} =~ /NaN/){ + $form->{"paid_$i"} = ''; + } else { + $totalpaid += $form->{"paid_$i"}; + } for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } @@ -387,6 +391,9 @@ sub invoices_due { $column_data{due} = qq|$form->{"due_$i"} {"due_$i"}>|; + if ($form->{"paid_$i"} =~ /NaN/){ + $form->{"paid_$i"} = ''; + } $column_data{paid} = qq|{"paid_$i"}>|; if ($same_id eq $form->{"$form->{vc}_id_$i"}) { @@ -992,10 +999,13 @@ sub list_invoices { for $i (1 .. $form->{rowcount}) { for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } - + + $totalamount += $form->{"amount_$i"}; $totaldue += $form->{"due_$i"}; - $totalpaid += $form->{"paid_$i"}; + if ($form->{"paid_$i"} !~ /NaN/){ + $totalpaid += $form->{"paid_$i"}; + } for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } @@ -1008,6 +1018,9 @@ sub list_invoices { {"amount_$i"}>|; $column_data{due} = qq|$form->{"due_$i"} {"due_$i"}>|; + if ($form->{"paid_$i"} =~ /NaN/){ + $form->{"paid_$i"} = ''; + } $column_data{paid} = qq|{"paid_$i"}>|; -- cgit v1.2.3