From 3336907bcb2f1418677f87c48fdc330cf33c24ff Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Tue, 5 Jun 2012 19:42:35 +0000 Subject: more info on report for expenses and incomes --- en/about/reports/template.php | 69 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 9 deletions(-) (limited to 'en/about/reports') diff --git a/en/about/reports/template.php b/en/about/reports/template.php index dc5e90bb2..deb7d9b18 100644 --- a/en/about/reports/template.php +++ b/en/about/reports/template.php @@ -295,16 +295,34 @@ $flow['revenue_op'] = $count; $v = $parsed['# Expenses details > ## Monthly summary']; echo ''; - array_shift($v); + $s = array_shift($v); + echo vsprintf('', + $s); + $sums = array(); foreach ($v as $line) { if ($line[0] == 'total') continue; - echo sprintf('', - $_months[$line[0]], $line[1], - number_format(str_replace(',', '.', $line[2]), 2, '.', ',')); + echo sprintf('', + $_months[$line[0]], + $line[1], + number_format(str_replace(',', '.', $line[2]), 2, '.', ','), + $line[1] > 0 ? number_format(str_replace(',', '.', $line[2] / $line[1]), 2, '.', ',') : '' + ); + + $sums['count'] += $line[1]; + $sums['total'] += $line[2]; } - echo '
%s%s%saverage/expense
%s%s%s
%s%s%s%s
'; + echo ''; + echo sprintf('Total + %s + %s + %s', + $sums['count'], + number_format(str_replace(',', '.', $sums['total']), 2, '.', ','), + $sums['count'] > 0 ? number_format(str_replace(',', '.', $sums['total'] / $sums['count']), 2, '.', ',') : '' + ); + echo ''; ?>

Details

@@ -340,27 +358,60 @@ $flow['revenue_op'] = $count; $line = array_shift($v); echo sprintf('%s%s %s%s%s%s - %s', + %sAverage per donation', $line[0], $line[1], $line[2], $line[3], $line[4], $line[5], $line[6]); + echo ''; + + $sums = array(); + foreach ($v as $line) { echo sprintf('%s%s %s %s %s %s + %s %s', - $_months[$line[0]], $line[1], + $_months[$line[0]], + $line[1], number_format(str_replace(',', '.', $line[2]), 2, '.', ','), number_format(str_replace(',', '.', $line[3]), 2, '.', ','), number_format(str_replace(',', '.', $line[4]), 2, '.', ','), number_format(str_replace(',', '.', $line[5]), 2, '.', ','), - number_format(str_replace(',', '.', $line[6]), 2, '.', ',')); + number_format(str_replace(',', '.', $line[6]), 2, '.', ','), + $line[1] > 0 ? number_format(str_replace(',', '.', $line[2] / $line[1]), 2, '.', ',') : '' + ); + + $sums['count'] += $line[1]; + $sums['total'] += $line[2]; + $sums['check'] += $line[3]; + $sums['xfer'] += $line[4]; + $sums['paypal'] += $line[5]; + $sums['cash'] += $line[6]; } - echo ''; + echo ''; + echo sprintf('Total + %s + %s + %s + %s + %s + %s + %s', + $sums['count'], + number_format(str_replace(',', '.', $sums['total']), 2, '.', ','), + number_format(str_replace(',', '.', $sums['check']), 2, '.', ','), + number_format(str_replace(',', '.', $sums['xfer']), 2, '.', ','), + number_format(str_replace(',', '.', $sums['paypal']), 2, '.', ','), + number_format(str_replace(',', '.', $sums['cash']), 2, '.', ','), + $sums['count'] > 0 ? number_format(str_replace(',', '.', $sums['total'] / $sums['count']), 2, '.', ',') : '' + ); + echo ''; + ?>
-- cgit v1.2.1