Start reworking invoice things

This commit is contained in:
2020-03-18 18:09:45 +00:00
parent 0144bd37fc
commit 50ca782569
15 changed files with 350 additions and 434 deletions

View File

@@ -1,5 +1,6 @@
{% extends 'base_rigs.html' %}
{% load paginator from filters %}
{% load static %}
{% block title %}Invoices{% endblock %}
@@ -7,67 +8,51 @@
<div class="col-sm-12">
<h2>{% block heading %}Invoices{% endblock %}</h2>
{% block description %}{% endblock %}
{% if is_paginated %}
<div class="col-md-6 col-md-offset-6 col-sm-12 text-right">
{% paginator %}
</div>
{% endif %}
{% block search %}{% endblock %}
<div class="table-responsive col-sm-12">
<table class="table table-hover">
<thead>
<tr>
<th>Invoice #</th>
<th>Event</th>
<th>Client</th>
<th>Event Date</th>
<th>Invoice Date</th>
<th>Balance</th>
<th></th>
</tr>
<thead class="thead-dark">
<tr>
<th scope="col">Invoice #</th>
<th scope="col">Event</th>
<th scope="col">Client</th>
<th scope="col">Event Date</th>
<th scope="col">Invoice Date</th>
<th scope="col">Balance</th>
<th></th>
</tr>
</thead>
<tbody>
{% for object in object_list %}
<tr>
<td class="{% if object.is_closed %}success{% else %}warning{% endif %}">{{ object.pk }}<br>
<span class="text-muted">{% if object.void %}(VOID){% elif object.is_closed %}(PAID){% else %}(O/S){% endif %}</span></td>
<td class="
{% if object.event.cancelled %}
active text-muted
{% elif not object.event.is_rig %}
info
{% elif object.event.confirmed and object.event.mic %}
{# interpreated as (booked and mic) #}
success
{% elif object.event.mic %}
warning
{% else %}
danger
{% endif %}
"><a href="{% url 'event_detail' object.event.pk %}">N{{ object.event.pk|stringformat:"05d" }}</a>: {{ object.event.name }} <br>
<span class="text-muted">{{ object.event.get_status_display }}{% if not object.event.mic %}, No MIC{% endif %}
{% for invoice in invoice_list %}
<tr class="table-{% if invoice.is_closed %}success{% else %}warning{% endif %}">
<th scope="row">{{ invoice.pk }}<br>
<span class="text-muted">{% if invoice.void %}(VOID){% elif invoice.is_closed %}(PAID){% else %}(O/S){% endif %}</span></th>
<td><a href="{% url 'event_detail' invoice.event.pk %}">N{{ invoice.event.pk|stringformat:"05d" }}</a>: {{ invoice.event.name }} <br>
<span class="text-muted">{{ invoice.event.get_status_display }}{% if not invoice.event.mic %}, No MIC{% endif %}
</span></td>
</td>
<td>{% if object.event.organisation %}
{{ object.event.organisation.name }}
<td>{% if invoice.event.organisation %}
{{ invoice.event.organisation.name }}
<br>
<span class="text-muted">{{ object.event.internal|yesno:'Internal,External' }}</span>
{% else %}
{{ object.event.person.name }}
<span class="text-muted">{{ invoice.event.internal|yesno:'Internal,External' }}</span>
{% elif invoice.event.person %}
{{ invoice.event.person.name }}
<br>
<span class="text-muted">External</span>
<span class="text-muted">Individual</span>
{% endif %}
</td>
<td>{{ object.event.start_date }}</td>
<td>{{ object.invoice_date }}</td>
<td>{{ invoice.event.start_date }}</td>
<td>{{ invoice.invoice_date }}</td>
<td>
{{ object.balance|floatformat:2 }}
{{ invoice.balance|floatformat:2 }}
{% if not invoice.event.internal %}
<br />
<span class="text-muted">{{ object.event.purchase_order }}</span>
<span class="text-muted">{{ invoice.event.purchase_order }}</span>
{% endif %}
</td>
<td class="text-right">
<a href="{% url 'invoice_detail' object.pk %}" class="btn btn-default">
<span class="fas fa-pencil"></span>
<a href="{% url 'invoice_detail' invoice.pk %}" class="btn btn-primary">
<i class="fas fa-edit"></i>
</a>
</td>
</tr>
@@ -76,9 +61,9 @@
</table>
</div>
{% if is_paginated %}
<div class="col-md-6 col-md-offset-6 col-sm-12 text-right">
{% paginator %}
</div>
<div class="row justify-content-center">
{% paginator %}
</div>
{% endif %}
</div>
{% endblock %}