from django.conf.urls import patterns, include, url
import django.contrib.auth.views
from invoice.views import UpdateClient, DeleteClient, CreateClient, DetailClient, \
- CreateInvoice, DetailInvoice, invoice_text
+ CreateInvoice, DetailInvoice, DetailInvoicePrint
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'),
+ url(r'^invoice/(?P<pk>\d+)/print$', DetailInvoicePrint.as_view(), name='invoice_print_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):
def dispatch(self, *args, **kwargs):
return super(DetailInvoice, self).dispatch(*args, **kwargs)
+class DetailInvoicePrint(DetailInvoice):
+ template_name = 'invoice/invoice_detail_print.html'
+
class CreateInvoice(CreateWithInlinesView):
model = Invoice
inlines = [InvoiceLineInline]
--- /dev/null
+<!DOCTYPE html>
+<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
+ <head>
+ <meta charset="utf-8">
+ <title>{% block title %}{% endblock %}</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="{% block description %}{% endblock %}">
+ <meta name="author" content="{% block author %}{% endblock %}">
+
+<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.css" />
+
+ <style type="text/css">
+ body {
+ padding-top: 60px;
+ padding-bottom: 40px;
+ }
+ .sidebar-nav {
+ padding: 9px 0;
+ }
+ .ta-right {
+ text-align: right;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <div class="page-header">
+ <h1>Invoice #{{invoice.id}}</h1>
+ </div>
+ <div class="row">
+ <div class="span4">
+ <ul class="unstyled">
+ <li><strong>{{invoice.customer.name}}</strong></li>
+ <li><p style="white-space: pre">{{invoice.customer.address}}</p></li>
+ </ul>
+
+ </div>
+
+ <div class="span4 offset4" class="border: 5px solid red">
+ <!-- Some metadata -->
+ <ul class="unstyled">
+ <li><big>err.no AS</big></li>
+ <li>Disengrenda 5b</li>
+ <li>0587 Oslo</li>
+ <li>Norway</li>
+ <li>Foretaksregisteret NO 998 270 189</li>
+ <li>info@err.no</li>
+ </ul>
+ <hr>
+ <ul class="unstyled">
+ <li>Invoice no: {{ invoice.id }}</li>
+ <li>Date: {{ invoice.date|date:"Y-m-d" }}</li>
+ <li>Due date: {{ invoice.due_date|date:"Y-m-d" }}</li>
+ </ul>
+
+ </div>
+ </div>
+ <hr>
+
+ <div class="row">
+ <div class="span4">
+ <strong>Description</strong>
+ </div>
+ <div class="span2 ta-right">
+ <strong>Hours</strong>
+ </div>
+ <div class="span2 ta-right">
+ <strong>Rate ({{ invoice.currency }})</strong>
+ </div>
+ <div class="span2 ta-right">
+ <strong>Total</strong>
+ </div>
+ </div>
+ {% for line in invoice.invoiceline_set.all %}
+ <div class="row">
+ <div class="span4">
+ {{ line.description }}
+ </div>
+ <div class="span2 ta-right">
+ {{ line.time }}
+ </div>
+ <div class="span2 ta-right">
+ {{ line.hourly_rate }}
+ </div>
+ <div class="span2 ta-right">
+ {{ line.amount }}
+ </div>
+ </div>
+ {% endfor %}
+ <div>{{ invoice.comment }}</div>
+
+ <hr>
+ <div>Total: {{ invoice.currency }} {{ invoice.total_sum }}</div>
+
+
+ </div>
+ </div>
+ <!-- Le javascript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="/static/js/jquery.js"></script>
+ <script src="/static/js/bootstrap-transition.js"></script>
+ <script src="/static/js/bootstrap-alert.js"></script>
+ <script src="/static/js/bootstrap-modal.js"></script>
+ <script src="/static/js/bootstrap-dropdown.js"></script>
+ <script src="/static/js/bootstrap-scrollspy.js"></script>
+ <script src="/static/js/bootstrap-tab.js"></script>
+ <script src="/static/js/bootstrap-tooltip.js"></script>
+ <script src="/static/js/bootstrap-popover.js"></script>
+ <script src="/static/js/bootstrap-button.js"></script>
+ <script src="/static/js/bootstrap-collapse.js"></script>
+ <script src="/static/js/bootstrap-carousel.js"></script>
+ <script src="/static/js/bootstrap-typeahead.js"></script>
+
+ </body>
+</html>