-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoice.templ
166 lines (162 loc) · 4.05 KB
/
invoice.templ
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Invoice</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
line-height: 1.5;
}
h1,
h2 {
margin: 0 0 8px 0;
}
hr {
margin: 20px 0;
border: none;
border-top: 0.1px solid #000;
}
/* Header */
.invoice-header {
display: flex;
justify-content: space-between;
<br />
align-items: baseline;
}
.addresses {
width: 50%;
display: flex;
justify-content: space-between;
margin-bottom: 40px;
}
.address {
width: 45%;
box-sizing: border-box;
}
/* Table styling */
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
thead th {
text-align: left;
}
thead tr:first-child th {
padding-bottom: 8px;
}
tbody td {
vertical-align: top;
padding: 6px 0;
}
.top-separator td,
.bottom-separator td {
padding: 0;
}
.top-separator td {
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
.bottom-separator td {
border-top: 0.1px solid #000;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.bold {
font-weight: bold;
}
.line-row td {
padding: 0;
}
</style>
</head>
<body>
<div class="invoice-header">
<h1>INVOICE {{ .Invoice.Name }} from {{ .Config.CompanyName }}</h1>
</div>
<div>
<div>Invoice number: {{ .Invoice.Name }}</div>
<div>Issue date: {{ .Invoice.IssueDate }}</div>
</div>
<hr />
<div class="addresses">
<div class="address">
<strong>Billed to</strong><br />
{{ .Invoice.CustomerName }}
</div>
<div class="address">
<!-- TODO: fix address linebreaks -->
<strong>Issued by</strong><br />
{{ .Config.CompanyName }}<br />
{{ range .Config.CompanyAddress }}
{{ . }}<br />
{{ end }}
</div>
</div>
<h2>{{ .Invoice.TotalAmount }} EUR due by {{ .Invoice.DueDate }}</h2>
<table>
<thead>
<tr>
<th style="width: 25%">Product or service</th>
<th style="width: 25%">Description</th>
<th style="width: 10%" class="text-center">Quantity</th>
<th style="width: 20%" class="text-right">Unit price</th>
<th style="width: 20%" class="text-right">Total</th>
</tr>
<tr class="top-separator">
<td colspan="5"></td>
</tr>
</thead>
<tbody>
{{ range .Invoice.Services }}
<tr>
<td>{{ .Name }}</td>
<td>{{ .Description }}</td>
<td>{{ .Quantity }}</td>
<td class="text-right">{{ .Price }} EUR</td>
<td class="text-right">{{ .PriceTotal }} EUR</td>
</tr>
{{ end }}
<tr class="bottom-separator">
<td colspan="5"></td>
</tr>
<tr>
<td colspan="3"></td>
<td class="text-left bold">Total</td>
<td class="text-right bold">{{ .Invoice.TotalAmount }} EUR</td>
</tr>
<tr class="line-row">
<td colspan="3"></td>
<td colspan="2">
<hr style="margin: 0.1px" />
</td>
</tr>
<tr>
<td colspan="3"></td>
<td class="text-left bold"><h3>Amount due</h3></td>
<td class="text-right bold"><h3>{{ .Invoice.TotalAmount }} EUR</h3></td>
</tr>
</tbody>
</table>
<p><strong>Bank details</strong></p>
<p>
Account holder: {{ .Config.AccountName }}<br />
IBAN: {{ .Config.IBAN }}<br />
BIC: {{ .Config.BIC }}<br />
Bank name and address:<br />
{{ .Config.BankName }}<br />
{{ range .Config.BankAddress }}
{{ . }}<br />
{{ end }}
</p>
</body>
</html>