diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-16 20:26:41 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-16 20:26:41 +0000 |
commit | 489fec70ce688815eb854523e3a51d06ce920f7e (patch) | |
tree | 304d2b09137c41adf8faeafe73bf1b9ea3026cea | |
parent | 2d2e3f24176d4580e7c17434e7fb03d05e0dcbb8 (diff) | |
download | mgatres-489fec70ce688815eb854523e3a51d06ce920f7e.tar mgatres-489fec70ce688815eb854523e3a51d06ce920f7e.tar.gz mgatres-489fec70ce688815eb854523e3a51d06ce920f7e.tar.bz2 mgatres-489fec70ce688815eb854523e3a51d06ce920f7e.tar.xz mgatres-489fec70ce688815eb854523e3a51d06ce920f7e.zip |
mktreasurer: add expenses and revenues
git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8279 5b7c3c08-40e5-403b-9995-ace06908e4af
-rwxr-xr-x | mktreasurer | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mktreasurer b/mktreasurer index 25b4999..97a3583 100755 --- a/mktreasurer +++ b/mktreasurer @@ -60,6 +60,7 @@ sub transactions_list { who => party_name($r, $tra->{Pa}), ac => $tra->{Ac}, account => account_name($r, $tra->{Ac}), + $tra->{Trt} != 0 ? (trt => $tra->{Trt}) : (), $tra->{Sca} != 0 ? (sc_name => subcat_name($r, $tra->{Sca}, $tra->{Ca})) : (), $tra->{No} ne '(null)' ? (notes => $tra->{No}) : (), ); @@ -130,6 +131,12 @@ sub transactions_infos { $t->{balance} = new Math::BigFloat 0; foreach my $tra (@{$t->{transactions}}) { $t->{balance} += new Math::BigFloat $tra->{amount}; + next if $tra->{trt} && $by ne 'by_account'; + if ($tra->{amount} > 0) { + $t->{revenues} += new Math::BigFloat $tra->{amount}; + } else { + $t->{expenses} -= new Math::BigFloat $tra->{amount}; + } } } } |