mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-25 06:51:08 +00:00
Expand budget report #1106
This commit is contained in:
@@ -194,7 +194,9 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
|||||||
*/
|
*/
|
||||||
private function summarizeByBudget(Collection $collection): array
|
private function summarizeByBudget(Collection $collection): array
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [
|
||||||
|
'sum' => '0',
|
||||||
|
];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($collection as $transaction) {
|
foreach ($collection as $transaction) {
|
||||||
$jrnlBudId = intval($transaction->transaction_journal_budget_id);
|
$jrnlBudId = intval($transaction->transaction_journal_budget_id);
|
||||||
@@ -202,6 +204,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
|||||||
$budgetId = max($jrnlBudId, $transBudId);
|
$budgetId = max($jrnlBudId, $transBudId);
|
||||||
$result[$budgetId] = $result[$budgetId] ?? '0';
|
$result[$budgetId] = $result[$budgetId] ?? '0';
|
||||||
$result[$budgetId] = bcadd($transaction->transaction_amount, $result[$budgetId]);
|
$result[$budgetId] = bcadd($transaction->transaction_amount, $result[$budgetId]);
|
||||||
|
$result['sum'] = bcadd($result['sum'], $transaction->transaction_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@@ -146,12 +146,15 @@ class Support
|
|||||||
*/
|
*/
|
||||||
protected function summarizeByAccount(Collection $collection): array
|
protected function summarizeByAccount(Collection $collection): array
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [
|
||||||
|
'sum' => '0',
|
||||||
|
];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($collection as $transaction) {
|
foreach ($collection as $transaction) {
|
||||||
$accountId = $transaction->account_id;
|
$accountId = $transaction->account_id;
|
||||||
$result[$accountId] = $result[$accountId] ?? '0';
|
$result[$accountId] = $result[$accountId] ?? '0';
|
||||||
$result[$accountId] = bcadd($transaction->transaction_amount, $result[$accountId]);
|
$result[$accountId] = bcadd($transaction->transaction_amount, $result[$accountId]);
|
||||||
|
$result['sum'] = bcadd($result['sum'], $transaction->transaction_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@@ -35,6 +35,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td>{{ 'sum'|_ }}</td>
|
||||||
|
<td style="text-align: right;">{{ accountSummary.sum|formatAmount }}</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -65,6 +71,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td>{{ 'sum'|_ }}</td>
|
||||||
|
<td style="text-align: right;">{{ budgetSummary.sum|formatAmount }}</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -140,7 +152,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{% set totalCount = 0 %}
|
||||||
|
{% set totalSum = 0 %}
|
||||||
{% for row in averageExpenses %}
|
{% for row in averageExpenses %}
|
||||||
|
{% set totalCount = totalCount+ row.count %}
|
||||||
|
{% set totalSum = totalSum + row.sum %}
|
||||||
{% if loop.index > listLength %}
|
{% if loop.index > listLength %}
|
||||||
<tr class="overListLength">
|
<tr class="overListLength">
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -169,6 +185,13 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
{{ 'sum'|_ }}
|
||||||
|
</td>
|
||||||
|
<td style="text-align:right">{{ totalSum|formatAmount }}</td>
|
||||||
|
<td>{{ totalCount }}</td>
|
||||||
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -193,7 +216,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{% set totalSum = 0 %}
|
||||||
{% for row in topExpenses %}
|
{% for row in topExpenses %}
|
||||||
|
{% set totalSum = totalSum + row.transaction_amount %}
|
||||||
{% if loop.index > listLength %}
|
{% if loop.index > listLength %}
|
||||||
<tr class="overListLength">
|
<tr class="overListLength">
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -230,6 +255,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
{{ 'sum'|_ }}
|
||||||
|
</td>
|
||||||
|
<td style="text-align:right">{{ totalSum|formatAmount }}</td>
|
||||||
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user