[Flask] Simple ERP for a farm.
1
{# -*- mode: web; -*- #}
2
3
{% extends "base.html" %}
4
{% block title %}
5
Invoices
6
{% endblock %}
7
8
{% block actions %}
9
<li><ahref="{{ url_for('common.add_item', module='invoices', table='Invoice') }}"class="button">Add invoice</a></li>
10
<li></li>
11
{% endblock %}
12
13
{% block content %}
14
<i>Track your invoices and create new ones here.</i><br/>
15
16
{# Pagination Links #}
17
{# gotten from https://betterprogramming.pub/simple-flask-pagination-example-4190b12c2e2e #}
18
<center>
19
{# Loop through the number of pages to display a link for each #}
20
{% for page_num in invoices.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
21
{% if page_num %}
22
{# Check for the active page and set the link to "Active" #}
23
{% if invoices.page == page_num %}
24
<ahref="{{ url_for('invoices.view', page=page_num) }}"
25
class="button">
26
{{ page_num }}
27
</a>
28
{% else %}
29
<ahref="{{ url_for('invoices.view', page=page_num) }}"
30
class="button button-light">
31
{{ page_num }}
32
</a>
33
{% endif %}
34
{% else %}
35
...
36
{% endif %}
37
{% endfor %}
38
</center>
39
<table>
40
<thead>
41
<tr>
42
<th></th>
43
<th>ID</th>
44
<th>Created</th>
45
<th>Alternative Invoice ID</th>
46
<th>Customer Name</th>
47
<th>Customer Reference</th>
48
<th>Date Billed</th>
49
<th>Date Due</th>
50
<th>Amount (Net €)</th>
51
<th>Amount (Gross €)</th>
52
<th>Tax Amount (€)</th>
53
</tr>
54
</thead>
55
<tbody>
56
{% for invoice in invoices.items %}
57
<tr{%ifinvoice.archive==True%}style="color: dimgray"{%endif%}
58
td
59
!--formmethod"post"action"{{ url_for('common.edit_item', module='invoices', pk=invoice.primary_key, table='Invoice') }}"
60
buttonarchive/button
61
/form--
62
formmethod"get"action"{{ url_for('invoices.preview', pk=invoice.primary_key) }}"
63
buttonpreview/button
64
/form
65
/td
66
td{{invoice.primary_key}}/td
67
td{{invoice.date_time_created}}/td
68
td{{invoice.invoice_id_alt}}/td
69
td{{invoice.customer.name}}/td
70
td{{invoice.customer_reference}}/td
71
td{{invoice.date_billed}}/td
72
td{{invoice.date_due}}/td
73
td{{invoice.amount_net}}/td
74
td{{invoice.amount_gross}}/td
75
td{{invoice.amount_tax}}/td
76
/tr
77
{%endfor%}
78
/tbody
79
/table
80
{%endblock%}
81