Expand tag report #1106

This commit is contained in:
James Cole
2018-01-12 21:02:27 +01:00
parent 04de4c9b36
commit cbeaf8e16a
2 changed files with 60 additions and 8 deletions

View File

@@ -45,7 +45,7 @@ class TagList implements BinderInterface
$list = []; $list = [];
$incoming = explode(',', $value); $incoming = explode(',', $value);
foreach ($incoming as $entry) { foreach ($incoming as $entry) {
$list[] = trim($entry); $list[] = strtolower(trim($entry));
} }
$list = array_unique($list); $list = array_unique($list);
if (count($list) === 0) { if (count($list) === 0) {
@@ -57,7 +57,7 @@ class TagList implements BinderInterface
$collection = $allTags->filter( $collection = $allTags->filter(
function (Tag $tag) use ($list) { function (Tag $tag) use ($list) {
return in_array($tag->tag, $list); return in_array(strtolower($tag->tag), $list);
} }
); );

View File

@@ -42,6 +42,13 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<tr>
<td>{{ 'sum'|_ }}</td>
<td style="text-align: right;">{{ accountSummary.sum.earned|formatAmount }}</td>
<td style="text-align: right;">{{ accountSummary.sum.spent|formatAmount }}</td>
</tr>
</tfoot>
</table> </table>
</div> </div>
</div> </div>
@@ -120,6 +127,13 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<tr>
<td>{{ 'sum'|_ }}</td>
<td style="text-align: right;">{{ tagSummary.sum.earned|formatAmount }}</td>
<td style="text-align: right;">{{ tagSummary.sum.spent|formatAmount }}</td>
</tr>
</tfoot>
</table> </table>
</div> </div>
</div> </div>
@@ -196,7 +210,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 %}
@@ -225,6 +243,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>
@@ -249,7 +274,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 %}
@@ -286,6 +313,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>
@@ -305,21 +338,25 @@
<thead> <thead>
<tr> <tr>
<th data-defaultsign="az">{{ 'account'|_ }}</th> <th data-defaultsign="az">{{ 'account'|_ }}</th>
<th data-defaultsign="_19">{{ 'income_average'|_ }}</th> <th data-defaultsign="_19" style="text-align:right;">{{ 'income_average'|_ }}</th>
<th data-defaultsign="_19">{{ 'total'|_ }}</th> <th data-defaultsign="_19" style="text-align:right;">{{ 'total'|_ }}</th>
<th data-defaultsign="_19">{{ 'transaction_count'|_ }}</th> <th data-defaultsign="_19">{{ 'transaction_count'|_ }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% set totalCount = 0 %}
{% set totalSum = 0 %}
{% for row in averageIncome %} {% for row in averageIncome %}
{% set totalCount = totalCount+ row.count %}
{% set totalSum = totalSum + row.sum %}
<tr> <tr>
<td data-value="{{ row.name }}"> <td data-value="{{ row.name }}">
<a href="{{ route('accounts.show', row.id) }}">{{ row.name }}</a> <a href="{{ route('accounts.show', row.id) }}">{{ row.name }}</a>
</td> </td>
<td data-value="{{ row.average }}"> <td data-value="{{ row.average }}" style="text-align:right;">
{{ row.average|formatAmount }} {{ row.average|formatAmount }}
</td> </td>
<td data-value="{{ row.sum }}"> <td data-value="{{ row.sum }}" style="text-align:right;">
{{ row.sum|formatAmount }} {{ row.sum|formatAmount }}
</td> </td>
<td data-value="{{ row.count }}"> <td data-value="{{ row.count }}">
@@ -327,6 +364,13 @@
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
<tr>
<td colspan="2">
{{ 'sum'|_ }}
</td>
<td style="text-align:right">{{ totalSum|formatAmount }}</td>
<td>{{ totalCount }}</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -346,11 +390,13 @@
<th data-defaultsort="disabled">{{ 'description'|_ }}</th> <th data-defaultsort="disabled">{{ 'description'|_ }}</th>
<th data-defaultsign="month">{{ 'date'|_ }}</th> <th data-defaultsign="month">{{ 'date'|_ }}</th>
<th data-defaultsign="az">{{ 'account'|_ }}</th> <th data-defaultsign="az">{{ 'account'|_ }}</th>
<th data-defaultsign="_19">{{ 'amount'|_ }}</th> <th data-defaultsign="_19" style="text-align:right;">{{ 'amount'|_ }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% set totalSum = 0 %}
{% for row in topIncome %} {% for row in topIncome %}
{% set totalSum = totalSum + row.transaction_amount %}
{% if loop.index > listLength %} {% if loop.index > listLength %}
<tr class="overListLength"> <tr class="overListLength">
{% else %} {% else %}
@@ -373,7 +419,7 @@
{{ row.opposing_account_name }} {{ row.opposing_account_name }}
</a> </a>
</td> </td>
<td data-value="{{ row.transaction_amount }}"> <td data-value="{{ row.transaction_amount }}" style="text-align:right;">
{{ row.transaction_amount|formatAmount }} {{ row.transaction_amount|formatAmount }}
</td> </td>
</tr> </tr>
@@ -387,6 +433,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>