Skip to content

Commit db85670

Browse files
Added 'All incomes' tab
1 parent 1fd5be5 commit db85670

File tree

3 files changed

+28
-44
lines changed

3 files changed

+28
-44
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<table>
2+
{% for row in data %}
3+
<thead>
4+
<tr>
5+
<th colspan="2">{{row.receiver}}</h3>
6+
</tr>
7+
</thead>
8+
<tbody>
9+
<tr>
10+
<th>{{'Amount'|trans}}:</th><td>{{row.amount}}</td>
11+
</tr>
12+
<tr>
13+
<th>{{'Date'|trans}}:</th><td>{{row.entryDate|date('d.m.Y')}}</td>
14+
</tr>
15+
<tr>
16+
<th>{{'Event'|trans}}:</th><td>{{row.event}}</td>
17+
</tr>
18+
</tbody>
19+
20+
{% endfor %}
21+
</table>

src/Stats/BankBundle/Resources/views/stats/monthly.html.twig

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -55,54 +55,16 @@
5555
<ul>
5656
<li><a href="#tabs-1">{{ 'Biggest expenses this month'|trans }}</a></li>
5757
<li><a href="#tabs-2">{{ 'All expenses this month'|trans }}</a></li>
58+
<li><a href="#tabs-3">{{ 'All incomes this month'|trans }}</a></li>
5859
</ul>
5960
<div id="tabs-1">
60-
61-
<table>
62-
{% for expense in stats.top_expenses %}
63-
<thead>
64-
<tr>
65-
<th colspan="2">{{expense.receiver}}</h3>
66-
</tr>
67-
</thead>
68-
<tbody>
69-
<tr>
70-
<th>{{'Amount'|trans}}:</th><td>{{expense.amount}}</td>
71-
</tr>
72-
<tr>
73-
<th>{{'Date'|trans}}:</th><td>{{expense.entryDate|date('d.m.Y')}}</td>
74-
</tr>
75-
<tr>
76-
<th>{{'Event'|trans}}:</th><td>{{expense.event}}</td>
77-
</tr>
78-
</tbody>
79-
80-
{% endfor %}
81-
</table>
82-
61+
{% include 'StatsBankBundle:Partial:stats-table.html.twig' with {"data": stats.top_expenses} %}
8362
</div>
8463
<div id="tabs-2">
85-
<table>
86-
{% for expense in stats.all_expenses %}
87-
<thead>
88-
<tr>
89-
<th colspan="2">{{expense.receiver}}&nbsp;</h3>
90-
</tr>
91-
</thead>
92-
<tbody>
93-
<tr>
94-
<th>{{'Amount'|trans}}:</th><td>{{expense.amount}}</td>
95-
</tr>
96-
<tr>
97-
<th>{{'Date'|trans}}:</th><td>{{expense.entryDate|date('d.m.Y')}}</td>
98-
</tr>
99-
<tr>
100-
<th>{{'Event'|trans}}:</th><td>{{expense.event}}</td>
101-
</tr>
102-
</tbody>
103-
104-
{% endfor %}
105-
</table>
64+
{% include 'StatsBankBundle:Partial:stats-table.html.twig' with {"data": stats.all_expenses} %}
65+
</div>
66+
<div id="tabs-3">
67+
{% include 'StatsBankBundle:Partial:stats-table.html.twig' with {"data": stats.all_incomes} %}
10668
</div>
10769
</div>
10870

src/Stats/BankBundle/Service/AccountService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public function getStatisticsForPeriod(\DateTime $start, \DateTime $end)
205205
$results['difference'] = $statistics->calculateDifference();
206206
$results['top_expenses'] = $this->repository->getHighestWithdrawals(5, $start, $end);
207207
$results['all_expenses'] = $this->repository->getWithdrawalsFor($start, $end);
208+
$results['all_incomes'] = $this->repository->getDepositsFor($start, $end);
208209

209210
return $results;
210211
}

0 commit comments

Comments
 (0)