{% extends 'leprikon/form.html' %}
{% load i18n leprikon_tags sekizai_tags static %}

{% block content %}
<div class="hidden-print">
{{ block.super }}
</div>

{% if form.is_valid %}
<h1>{% blocktrans with date=date %}Received course payments from {{ date_start }} to {{ date_end }}{% endblocktrans %}</h1>

<table class="table table-hover">
    <tr>
        <th>{% trans 'Date' %}</th>
        <th>{% trans 'Registration' %}</th>
        <th class="right">{% trans 'Amount' %}</th>
    </tr>
    {% for payment in received_payments %}
    <tr id="report-{{ payment.id }}">
        <th>{{ payment.accounted }}</th>
        <th>{{ payment.target_registration }}</th>
        <th class="right">{{ payment.amount | currency }}</th>
    </tr>
    {% endfor %}
    <tr id="report-received-payments-sum">
        <th></th>
        <th></th>
        <th class="right">{{ received_payments_sum | currency }}</th>
    </tr>
</table>
{% endif %}

{% if returned_payments %}
<h1>{% blocktrans with date=date %}Returned course payments from {{ date_start }} to {{ date_end }}{% endblocktrans %}</h1>

<table class="table table-hover">
    <tr>
        <th>{% trans 'Date' %}</th>
        <th>{% trans 'Registration' %}</th>
        <th class="right">{% trans 'Returned amount' %}</th>
    </tr>
    {% for payment in returned_payments %}
    <tr id="report-{{ payment.id }}">
        <th>{{ payment.accounted }}</th>
        <th>{{ payment.source_registration }}</th>
        <th class="right">{{ payment.amount | currency }}</th>
    </tr>
    {% endfor %}
    <tr id="report-returned-payments-sum">
        <th></th>
        <th></th>
        <th class="right">{{ returned_payments_sum | currency }}</th>
    </tr>
</table>
{% endif %}

{% if received_payments or returned_payments %}
<h1>{% blocktrans with date=date %}Summary from {{ date_start }} to {{ date_end }}{% endblocktrans %}</h1>

<table class="table table-hover">
    <tr>
        <th>{% trans 'All received payments' %}</th>
        <th>{% trans 'All returned payments' %}</th>
        <th>{% trans 'Received - returned payments' %}</th>
    </tr>
    <tr id="report-sum">
        <th>{{ received_payments_sum | currency }}</th>
        <th>{{ returned_payments_sum | currency }}</th>
        <th>{{ sum | currency }}</th>
    </tr>
</table>
{% endif %}


{% include 'leprikon/static/bootstrap-datetimepicker.html' %}

{% endblock %}
