summaryrefslogtreecommitdiffstats
path: root/templates/invoice.gohtml
blob: fe7fece0b90da7bffabb5a33bc459a4d87763145 (plain) (blame)
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
<header>
	<article class="company">
		<h2>{{ index .translations.invoice_from .ctx.lang }}</h2>
		{{ tpl (file.Read "templates/company.gohtml")
			(dict
				"ctx" .ctx
				"data" .data
				"translations" .translations) }}
	</article>

	<article class="metadata">
		<table>
			<tr>

				{{ if (eq .data.type "invoice") }}
				<td><h2>{{ index .translations.invoice .ctx.lang }}</h2></td>
				{{ else }}
				<td><h2>{{ index .translations.quote .ctx.lang }}</h2></td>
				{{ end }}
				<td><h2>#{{ .data.number }}</h2></td>
			</tr>
			<tr>

				{{ if (eq .data.type "invoice") }}
				<td>{{ index .translations.invoice_issued_at .ctx.lang }}</td>
				{{ else }}
				<td>{{ index .translations.quote_issued_at .ctx.lang }}</td>
				{{ end }}

				<td>{{ .data.date.Format "2006-01-02" }}</td>
			</tr>

			{{ if (eq .data.type "invoice") }}
			<tr>
				<td>{{ index .translations.invoice_due_at .ctx.lang }}</td>
				<td>{{ .data.due_date.Format "2006-01-02" }}</td>
			</tr>
			{{ end }}
		</table>
	</article>
</header>

<section>
	<article class="client">
		<h2>{{ index .translations.invoice_to .ctx.lang }}</h2>
		<ul>
			<li>{{ .data.client.name }}</li>
			<li>{{ .data.client.address }}</li>
			<li>{{ .data.client.email }}</li>
		</ul>
	</article>
</section>

<section>
	<article class="items">
		<table>
			<thead>
				<tr>
					<th>{{ index .translations.item .ctx.lang }}</th>
					<th>{{ index .translations.rate .ctx.lang }}</th>
					<th>{{ index .translations.quantity .ctx.lang }}</th>
					<th>{{ index .translations.amount .ctx.lang }}</th>
				</tr>
			</thead>
			<tbody>
			{{ $ctx := .ctx }}
			{{ range .data.items }}
				<tr>
					<td>
						{{ index .name $ctx.lang }}
						{{ if (has .comment $ctx.lang) }}
						<p class="comment">{{ index .comment $ctx.lang }}</p>
						{{ end }}
					</td>
					<td>{{ .rate }}</td>
					<td>{{ .qty }}</td>
					<td>{{ .sum }}</td>
				</tr>
			{{ end }}
			</tbody>
			<tfoot>
				<tr>
					<td colspan="3">{{ index .translations.total_in .ctx.lang }} {{ .data.currency }}</td>
					<td>{{ .data.total }}</td>
				</tr>
			</tfoot>
		</table>
	</article>
</section>

<section>
	{{ if .data.notes }}
	<article class="notes">
		<p>{{ index .data.notes .ctx.lang }}</p>
	</article>
	{{ end }}
</section>

<footer>
	{{ if (eq .data.type "invoice") }}
	<article class="bank">
		<h2>{{ index .translations.bank_details .ctx.lang }}</h2>
		<table>
			<tr><td>{{ index .translations.bank_name .ctx.lang }}</td><td>{{ .data.bank.name }}</td></tr>
			<tr><td>SWIFT</td><td>{{ .data.bank.swift }}</td></tr>
			<tr><td>IBAN</td><td>{{ .data.bank.iban }}</td></tr>
		</table>
	</article>
	{{ end }}

	<article class="tax">
		<h2>{{ index .translations.tax_details .ctx.lang }}</h2>
		<table>
			<tr><td>SIRET</td><td>{{ .data.tax.siret }}</td></tr>
			<tr><td>{{ index .translations.tax_vat .ctx.lang }}</td><td>{{ index .data.tax.vat .ctx.lang }}</td></tr>
		</table>
	</article>
</footer>
remember that computers suck.