diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-16 20:26:43 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-16 20:26:43 +0000 |
commit | 40130e7b43aebd6277592ee5a2f119fabfb8386d (patch) | |
tree | ebdcc120a08969c4868216e98e141c836e036af0 /mktreasurer | |
parent | 489fec70ce688815eb854523e3a51d06ce920f7e (diff) | |
download | mgatres-40130e7b43aebd6277592ee5a2f119fabfb8386d.tar mgatres-40130e7b43aebd6277592ee5a2f119fabfb8386d.tar.gz mgatres-40130e7b43aebd6277592ee5a2f119fabfb8386d.tar.bz2 mgatres-40130e7b43aebd6277592ee5a2f119fabfb8386d.tar.xz mgatres-40130e7b43aebd6277592ee5a2f119fabfb8386d.zip |
mktreasurer: simplify by creating amount as Math::BigFloat
git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8280 5b7c3c08-40e5-403b-9995-ace06908e4af
Diffstat (limited to 'mktreasurer')
-rwxr-xr-x | mktreasurer | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mktreasurer b/mktreasurer index 97a3583..ce3fbd4 100755 --- a/mktreasurer +++ b/mktreasurer @@ -54,7 +54,7 @@ sub transactions_list { foreach my $tra (@transactions) { my %d = ( nb => $tra->{Nb}, - amount => $tra->{Am}, + amount => (new Math::BigFloat $tra->{Am}), date => epoch_date($tra->{Dt}), pa => $tra->{Pa}, who => party_name($r, $tra->{Pa}), @@ -124,18 +124,18 @@ sub transactions_infos { push @{$res{by_year}->{$year}->{months}}, $month; push @{$res{by_pa}->{$tra->{pa}}->{transactions}}, $tra; push @{$res{by_account}->{$tra->{ac}}->{transactions}}, $tra; - $res{balance} += new Math::BigFloat $tra->{amount}; + $res{balance} += $tra->{amount}; } foreach my $by ('by_account', 'by_year', 'by_month') { foreach my $t (values %{$res{$by}}) { $t->{balance} = new Math::BigFloat 0; foreach my $tra (@{$t->{transactions}}) { - $t->{balance} += new Math::BigFloat $tra->{amount}; + $t->{balance} += $tra->{amount}; next if $tra->{trt} && $by ne 'by_account'; if ($tra->{amount} > 0) { - $t->{revenues} += new Math::BigFloat $tra->{amount}; + $t->{revenues} += $tra->{amount}; } else { - $t->{expenses} -= new Math::BigFloat $tra->{amount}; + $t->{expenses} -= $tra->{amount}; } } } |