From 40130e7b43aebd6277592ee5a2f119fabfb8386d Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Thu, 16 May 2013 20:26:43 +0000 Subject: 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 --- mktreasurer | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mktreasurer') 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}; } } } -- cgit v1.2.1