{% for period in periods %}
    <div class="box box-default">
        <div class="box-header with-border">
            <h3 class="box-title"><a href="{{ period.route }}">{{ period.title }}</a>
            </h3>
        </div>
        <div class="box-body no-padding">
            <table class="table table-hover">
                {% if period.total_transactions > 0 %}
                    <tr>
                        <td style="width:33%;">{{ 'transactions'|_ }}</td>
                        <td style="text-align: right;">{{ period.total_transactions }}</td>
                    </tr>
                {% endif %}
                {% for entry in period.spent %}
                    {% if entry.amount != 0 %}
                        <tr>
                            <td style="width:33%;">{{ 'spent'|_ }}</td>
                            <td style="text-align: right;">
                                <span title="{{ entry.count }}">
                                    {{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }}
                                </span>
                            </td>
                        </tr>
                    {% endif %}
                {% endfor %}

                {% for entry in period.earned %}
                    {% if entry.amount != 0 %}
                        <tr>
                            <td style="width:33%;">{{ 'earned'|_ }}</td>
                            <td style="text-align: right;">
                                <span title="{{ entry.count }}">
                                    {% if entry.amount < 0 %}
                                        {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }}
                                    {% else %}
                                        {{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }}
                                    {% endif %}
                                </span>
                            </td>
                        </tr>
                    {% endif %}
                {% endfor %}

                {% for entry in period.transferred %}
                    {% if entry.amount != 0 %}
                        <tr>
                            <td style="width:33%;">{{ 'transferred'|_ }}</td>
                            <td style="text-align: right;">
                                <span title="{{ entry.count }}">
                                    {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }}
                                </span>
                            </td>
                        </tr>
                    {% endif %}
                {% endfor %}

                {% for entry in period.transferred_away %}
                    {% if entry.amount != 0 %}
                        <tr>
                            <td style="width:33%;">{{ 'transferred_away'|_ }}</td>
                            <td style="text-align: right;">
                                <span title="{{ entry.count }}">
                                    {% if entry.amount < 0 %}
                                        {{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }}
                                    {% else %}
                                        {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }}
                                    {% endif %}
                                </span>
                            </td>
                        </tr>
                    {% endif %}
                {% endfor %}

                {% for entry in period.transferred_in %}
                    {% if entry.amount != 0 %}
                        <tr>
                            <td style="width:33%;">{{ 'transferred_in'|_ }}</td>
                            <td style="text-align: right;">
                                <span title="{{ entry.count }}">
                                    {% if entry.amount < 0 %}
                                        {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }}
                                    {% else %}
                                        {{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }}
                                    {% endif %}
                                </span>
                            </td>
                        </tr>
                    {% endif %}
                {% endfor %}
            </table>
        </div>
    </div>

{% endfor %}
