]> err.no Git - peojumk/commitdiff
Show both paid and unpaid invoices
authorTollef Fog Heen <tfheen@err.no>
Wed, 1 Aug 2012 18:45:45 +0000 (20:45 +0200)
committerTollef Fog Heen <tfheen@err.no>
Wed, 1 Aug 2012 18:45:45 +0000 (20:45 +0200)
invoice/views.py
templates/invoice/index.html

index 84e628ecbf547a7cc6d0206dfb9ec918b234349e..3dd098fbdca25997d45a104eb8ba3218f3b56c67 100644 (file)
@@ -17,8 +17,8 @@ from invoice.forms import ClientForm, InvoiceForm, InvoiceUpdateForm
 @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 ---------------
index 432ec2fce1dbd293d1c69e965138984c4f198f8e..c0399ba984ace99be9a4a37981cc0972db5bdc95 100644 (file)
@@ -2,7 +2,7 @@
 {% block content %}
 
 <div class="page-header">
-  <h2>New invoices</h2>
+  <h2>Unpaid invoices</h2>
 </div>
 
 <table>
@@ -13,7 +13,7 @@
   <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 %}