from django.conf.urls import patterns, include, url
import django.contrib.auth.views
from invoice.views import UpdateClient, DeleteClient, CreateClient, DetailClient, \
- CreateInvoice, DetailInvoice
+ CreateInvoice, DetailInvoice, invoice_text
import invoice.views
url(r'^accounts/login/$', django.contrib.auth.views.login),
url(r'^invoice/new$', CreateInvoice.as_view(), name="invoice_new"),
url(r'^invoice/(?P<pk>\d+)$', DetailInvoice.as_view(), name='invoice_view'),
+ url(r'^invoice/(?P<pk>\d+)/text$', invoice_text, name='invoice_view'),
)
sent_invoices = Invoice.objects.filter(status = 'S')
return render_to_response('invoice/index.html', locals())
+@login_required
+def invoice_text(request, pk):
+ invoice = Invoice.objects.get(pk = pk)
+
+ return render_to_response('invoice/invoice_detail.txt', locals(), mimetype="text/plain")
+
# ------------------- CLIENT ---------------
class DetailClient(DetailView):
--- /dev/null
+INVOICE
+------------------------------------------------------------------------------
+err.no AS
+Disengrenda 5b
+0587 Oslo
+Norway
+
+Transfer to:
+Account number (IBAN) : NO5915032765650
+
+Branch Address:
+DNB ASA
+0021 Oslo
+Norway
+Phone: +47 73 58 21 01
+
+SWIFT Code: DNBANOKK / DNBANOKKXXX
+------------------------------------------------------------------------------
+Charge to:
+
+{{ invoice.customer.name }}
+{{ invoice.customer.address }}
+
+------------------------------------------------------------------------------
+Invoice # {{ invoice.id }}
+Date: {{ invoice.date|date:"Y-m-d"}}
+------------------------------------------------------------------------------
+Description Hours Rate Sum
+------------------------------------------------------------------------------
+{% for line in invoice.invoiceline_set.all %}{{ line.description|ljust:"30" }}{{ line.time|rjust:"5" }} {{ line.hourly_rate|rjust:"5" }}{{ line.amount|rjust:"9" }}{% endfor %}
+
+{{ invoice.comment }}
+------------------------------------------------------------------------------
+Total: {{ invoice.currency }} {{ invoice.total_sum }}