diff --git a/app/Generator/Report/Support.php b/app/Generator/Report/Support.php index 328d0addd8..f169bc59bc 100644 --- a/app/Generator/Report/Support.php +++ b/app/Generator/Report/Support.php @@ -102,7 +102,12 @@ class Support */ protected function getObjectSummary(array $spent, array $earned): array { - $return = []; + $return = [ + 'sum' => [ + 'spent' => '0', + 'earned' => '0', + ], + ]; /** * @var int @@ -110,10 +115,11 @@ class Support */ foreach ($spent as $objectId => $entry) { if (!isset($return[$objectId])) { - $return[$objectId] = ['spent' => 0, 'earned' => 0]; + $return[$objectId] = ['spent' => '0', 'earned' => '0']; } $return[$objectId]['spent'] = $entry; + $return['sum']['spent'] = bcadd($return['sum']['spent'], $entry); } unset($entry); @@ -123,10 +129,11 @@ class Support */ foreach ($earned as $objectId => $entry) { if (!isset($return[$objectId])) { - $return[$objectId] = ['spent' => 0, 'earned' => 0]; + $return[$objectId] = ['spent' => '0', 'earned' => '0']; } $return[$objectId]['earned'] = $entry; + $return['sum']['earned'] = bcadd($return['sum']['earned'], $entry); } return $return; diff --git a/resources/views/reports/category/month.twig b/resources/views/reports/category/month.twig index 030b7673a9..cab2ee99ec 100644 --- a/resources/views/reports/category/month.twig +++ b/resources/views/reports/category/month.twig @@ -42,6 +42,13 @@ {% endfor %} + + + {{ 'sum'|_ }} + {{ accountSummary.sum.earned|formatAmount }} + {{ accountSummary.sum.spent|formatAmount }} + + @@ -80,6 +87,13 @@ {% endfor %} + + + {{ 'sum'|_ }} + {{ categorySummary.sum.earned|formatAmount }} + {{ categorySummary.sum.spent|formatAmount }} + + @@ -174,7 +188,11 @@ + {% set totalCount = 0 %} + {% set totalSum = 0 %} {% for row in averageExpenses %} + {% set totalCount = totalCount+ row.count %} + {% set totalSum = totalSum + row.sum %} {% if loop.index > listLength %} {% else %} @@ -193,6 +211,8 @@ {{ row.count }} + {% set totalCount = totalCount+ row.count %} + {% set totalSum = totalSum + row.sum %} {% endfor %} @@ -203,6 +223,13 @@ {% endif %} + + + {{ 'sum'|_ }} + + {{ totalSum|formatAmount }} + {{ totalCount }} + @@ -227,7 +254,9 @@ + {% set totalSum = 0 %} {% for row in topExpenses %} + {% set totalSum = totalSum + row.sum %} {% if loop.index > listLength %} {% else %} @@ -264,6 +293,12 @@ {% endif %} + + + {{ 'sum'|_ }} + + {{ totalSum|formatAmount }} + @@ -283,21 +318,25 @@ {{ 'account'|_ }} - {{ 'income_average'|_ }} - {{ 'total'|_ }} + {{ 'income_average'|_ }} + {{ 'total'|_ }} {{ 'transaction_count'|_ }} + {% set totalCount = 0 %} + {% set totalSum = 0 %} {% for row in averageIncome %} + {% set totalCount = totalCount+ row.count %} + {% set totalSum = totalSum + row.sum %} {{ row.name }} - + {{ row.average|formatAmount }} - + {{ row.sum|formatAmount }} @@ -305,6 +344,13 @@ {% endfor %} + + + {{ 'sum'|_ }} + + {{ totalSum|formatAmount }} + {{ totalCount }} + @@ -324,11 +370,13 @@ {{ 'description'|_ }} {{ 'date'|_ }} {{ 'account'|_ }} - {{ 'amount'|_ }} + {{ 'amount'|_ }} + {% set totalSum = 0 %} {% for row in topIncome %} + {% set totalSum = totalSum + row.transaction_amount %} {% if loop.index > listLength %} {% else %} @@ -351,7 +399,7 @@ {{ row.opposing_account_name }} - + {{ row.transaction_amount|formatAmount }} @@ -365,6 +413,12 @@ {% endif %} + + + {{ 'sum'|_ }} + + {{ totalSum|formatAmount }} +