summaryrefslogtreecommitdiff
path: root/app/templates/modules/invoices.html
blob: 9e8f7655d5a73085d9501dd15a9caa6888bb68bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{# -*- mode: web; -*- #}

{% extends "base.html" %}
{% block title %}
Invoices
{% endblock %}

{% block actions %}
<li><a href="{{ url_for('common.add_item', module='invoices', table='Invoice') }}" class="button">Add invoice</a></li>
<li></li>
{% endblock %}

{% block content %}
<i>Track your invoices and create new ones here.</i><br/>

{# Pagination Links #}
{# gotten from https://betterprogramming.pub/simple-flask-pagination-example-4190b12c2e2e #}
<center>
    {# Loop through the number of pages to display a link for each #}
    {% for page_num in invoices.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
    {% if page_num %}
    {# Check for the active page and set the link to "Active" #}
    {% if invoices.page == page_num %}
    <a href="{{ url_for('invoices.view', page=page_num) }}"
       class="button">
	{{ page_num }}
    </a>
    {% else %}
    <a href="{{ url_for('invoices.view', page=page_num) }}"
       class="button button-light">
	{{ page_num }}
    </a>
    {% endif %}
    {% else %}
    ...
    {% endif %}
    {% endfor %}
</center>
<table>
    <thead>
	<tr>
	    <th></th>
	    <th>ID</th>
	    <th>Created</th>
	    <th>Alternative Invoice ID</th>
	    <th>Customer Name</th>
	    <th>Customer Reference</th>
	    <th>Date Billed</th>
	    <th>Date Due</th>
	    <th>Amount (Net €)</th>
	    <th>Amount (Gross €)</th>
	    <th>Tax Amount (€)</th>
	</tr>
    </thead>
    <tbody>
	{% for invoice in invoices.items %}
	<tr {% if invoice.archive == True %} style="color: dimgray" {% endif %}>
	    <td>
		<form method="post" action="{{ url_for('common.edit_item', module='invoices', pk=invoice.primary_key, table='Invoice') }}">
		    <button>archive</button>
		</form>
		<form method="get" action="{{ url_for('invoices.preview', pk=invoice.primary_key) }}">
		    <button>preview</button>
		</form>
	    </td>
	    <td>{{ invoice.primary_key }}</td>
	    <td>{{ invoice.date_time_created }}</td>
	    <td>{{ invoice.invoice_id_alt }}</td>
	    <td>{{ invoice.customer.name }}</td>
	    <td>{{ invoice.customer_reference }}</td>
	    <td>{{ invoice.date_billed }}</td>
	    <td>{{ invoice.date_due }}</td>
	    <td>{{ invoice.amount_net }}</td>
	    <td>{{ invoice.amount_gross }}</td>
	    <td>{{ invoice.amount_tax }}</td>
	</tr>
	{% endfor %}
    </tbody>
</table>
{% endblock %}
Copyright 2019--2024 Marius PETER