From 489fec70ce688815eb854523e3a51d06ce920f7e Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Thu, 16 May 2013 20:26:41 +0000 Subject: mktreasurer: add expenses and revenues git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8279 5b7c3c08-40e5-403b-9995-ace06908e4af --- mktreasurer | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mktreasurer') 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}; + } } } } -- cgit v1.2.1