127 lines
5.7 KiB
Plaintext
127 lines
5.7 KiB
Plaintext
{{ define "title" -}}
|
|
{{ .Number | printf ( pgettext "Invoice %s" "title" )}}
|
|
{{- end }}
|
|
|
|
{{ define "breadcrumbs" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.invoice*/ -}}
|
|
<nav>
|
|
<p data-hx-target="main" data-hx-boost="true">
|
|
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
|
|
<a href="{{ companyURI "/invoices"}}">{{( pgettext "Invoices" "title" )}}</a> /
|
|
<a>{{ .Number }}</a>
|
|
</p>
|
|
<p>
|
|
<a class="button primary"
|
|
data-hx-push-url="false" data-hx-swap="beforeend" data-hx-boost="true"
|
|
href="{{ companyURI "/invoices/new"}}?duplicate={{ .Slug }}&location=view">{{( pgettext "Duplicate" "action" )}}</a>
|
|
<a class="button primary"
|
|
data-hx-push-url="false" data-hx-swap="beforeend" data-hx-boost="true"
|
|
href="{{ companyURI "/invoices/"}}{{ .Slug }}/edit?location=view">{{( pgettext "Edit" "action" )}}</a>
|
|
<a class="primary button"
|
|
href="{{ companyURI "/invoices/" }}{{ .Slug }}.pdf"
|
|
download="{{ .Number}}.pdf">{{( pgettext "Download invoice" "action" )}}</a>
|
|
</p>
|
|
</nav>
|
|
{{- end }}
|
|
|
|
{{ define "content" }}
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.invoice*/ -}}
|
|
<link rel="stylesheet" type="text/css" href="/static/invoice.css">
|
|
<article class="invoice">
|
|
<header>
|
|
<div>
|
|
<h1>{{ .Number | printf ( pgettext "Invoice %s" "title" )}}</h1>
|
|
<p class="date">{{( pgettext "Date" "title" )}} {{ .Date | formatDate }}</p>
|
|
</div>
|
|
|
|
<address class="invoicer">
|
|
{{ .Invoicer.Name }}<br>
|
|
{{ .Invoicer.VATIN }}<br>
|
|
{{ .Invoicer.Address }}<br>
|
|
{{ .Invoicer.City }} ({{ .Invoicer.PostalCode}}), {{ .Invoicer.Province }}<br>
|
|
{{ .Invoicer.Email }}<br>
|
|
{{ .Invoicer.Phone }}<br>
|
|
</address>
|
|
|
|
<p class="legal">{{ .LegalDisclaimer }}</p>
|
|
</header>
|
|
|
|
<div>
|
|
<address class="invoicee">
|
|
{{ .Invoicee.Name }}<br>
|
|
{{ .Invoicee.VATIN }}<br>
|
|
{{ .Invoicee.Address }}<br>
|
|
{{ .Invoicee.City }} ({{ .Invoicee.PostalCode}}), {{ .Invoicee.Province }}<br>
|
|
</address>
|
|
|
|
{{- $columns := 5 | add (len .TaxClasses) | add (boolToInt .HasDiscounts) -}}
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>{{( pgettext "Concept" "title" )}}</th>
|
|
<th class="numeric">{{( pgettext "Price" "title" )}}</th>
|
|
{{ if .HasDiscounts -}}
|
|
<th class="numeric">{{( pgettext "Discount" "title" )}}</th>
|
|
{{ end -}}
|
|
<th class="numeric">{{( pgettext "Units" "title" )}}</th>
|
|
<th class="numeric">{{( pgettext "Subtotal" "title" )}}</th>
|
|
{{ range $class := .TaxClasses -}}
|
|
<th class="numeric">{{ . }}</th>
|
|
{{ end -}}
|
|
<th class="numeric">{{( pgettext "Total" "title" )}}</th>
|
|
</tr>
|
|
</thead>
|
|
{{ $lastIndex := len .Products | sub 1 }}
|
|
{{ range $index, $product := .Products -}}
|
|
<tbody>
|
|
{{- if .Description }}
|
|
<tr class="name">
|
|
<td colspan="{{ $columns }}">{{ .Name }}</td>
|
|
</tr>
|
|
{{ end -}}
|
|
<tr>
|
|
{{- if .Description }}
|
|
<td>{{ .Description }}</td>
|
|
{{- else }}
|
|
<td>{{ .Name }}</td>
|
|
{{- end -}}
|
|
<td class="numeric">{{ .Price | formatPrice }}</td>
|
|
{{ if $.HasDiscounts -}}
|
|
<td class="numeric">{{ $product.Discount | formatPercent }}</td>
|
|
{{ end -}}
|
|
<td class="numeric">{{ .Quantity }}</td>
|
|
<td class="numeric">{{ .Subtotal | formatPrice }}</td>
|
|
{{ range $class := $.TaxClasses -}}
|
|
<td class="numeric">{{ index $product.Taxes $class | formatPercent }}</td>
|
|
{{ end -}}
|
|
<td class="numeric">{{ .Total | formatPrice }}</td>
|
|
</tr>
|
|
{{ if (eq $index $lastIndex) }}
|
|
<tr class="tfoot separator">
|
|
<th scope="row" colspan="{{ $columns | sub 1 }}">{{( pgettext "Tax Base" "title" )}}</th>
|
|
<td class="numeric">{{ $.Subtotal | formatPrice }}</td>
|
|
</tr>
|
|
{{ range $tax := $.Taxes -}}
|
|
<tr class="tfoot">
|
|
<th scope="row" colspan="{{ $columns | sub 1 }}">{{ index . 0 }}</th>
|
|
<td class="numeric">{{ index . 1 | formatPrice }}</td>
|
|
</tr>
|
|
{{- end }}
|
|
<tr class="tfoot">
|
|
<th scope="row" colspan="{{ $columns | sub 1 }}">{{( pgettext "Total" "title" )}}</th>
|
|
<td class="numeric">{{ $.Total | formatPrice }}</td>
|
|
</tr>
|
|
{{ end }}
|
|
</tbody>
|
|
{{- end }}
|
|
</table>
|
|
|
|
{{ if .Notes -}}
|
|
<p class="notes">{{ .Notes }}</p>
|
|
{{- end }}
|
|
<p class="payment-instructions">{{ .PaymentInstructions }}</p>
|
|
|
|
</div>
|
|
</article>
|
|
{{- end}}
|