@login_required
def index(request):
clients = Client.objects.all()
- new_invoices = Invoice.objects.filter(status = 'N')
- sent_invoices = Invoice.objects.filter(status = 'S')
+ unpaid_invoices = Invoice.objects.filter(status__in = ['N', 'S'])
+ paid_invoices = Invoice.objects.filter(status = 'P')
return render_to_response('invoice/index.html', locals())
# ------------------- CLIENT ---------------
{% block content %}
<div class="page-header">
- <h2>New invoices</h2>
+ <h2>Unpaid invoices</h2>
</div>
<table>
<th>Customer</td>
<th>Total sum</td>
</tr>
-{% for i in new_invoices %}
+{% for i in unpaid_invoices %}
<tr>
<td>
<a href="{% url invoice:invoice_view i.id %}">
{% endfor %}
</table>
+<div class="page-header">
+ <h2>Paid invoices</h2>
+</div>
+
+<table>
+<tr>
+ <th>Invoice #</td>
+ <th>Date</td>
+ <th>Customer</td>
+ <th>Total sum</td>
+</tr>
+{% for i in paid_invoices %}
+<tr>
+ <td>
+ <a href="{% url invoice:invoice_view i.id %}">
+ {{ i.id }}
+ </a>
+ </td>
+ <td>{{ i.date }}</td>
+ <td>{{ i.customer }}</td>
+ <td>{{ i.currency }} {{ i.total_sum }}</td>
+</tr>
+{% endfor %}
+</table>
+
{% endblock %}