go/svc/invoice: template changes for EU VAT invoices, restore FV/ numbering

changes/03/3/1
q3k 2019-06-20 16:11:07 +02:00
parent 0de4368f5c
commit bc27e64692
2 changed files with 19 additions and 13 deletions

View File

@ -105,11 +105,7 @@ func (m *model) sealInvoice(ctx context.Context, uid, language string, useProfor
invoice.State = pb.Invoice_STATE_SEALED
// TODO(q3k): this should be configurable.
if language == "pl" {
invoice.FinalUid = fmt.Sprintf("FV/%s", finalUid)
} else {
invoice.FinalUid = fmt.Sprintf("%s", finalUid)
}
invoice.FinalUid = fmt.Sprintf("FV/%s", finalUid)
invoice.Date = sealTime.UnixNano()
calculateInvoiceData(invoice)
@ -230,7 +226,7 @@ func (s *sqlInvoiceSealRow) Proto() (*pb.Invoice, error) {
}
if s.finalUid.Valid {
p.State = pb.Invoice_STATE_SEALED
p.FinalUid = fmt.Sprintf("%s", s.finalUid.String)
p.FinalUid = fmt.Sprintf("FV/%s", s.finalUid.String)
p.Date = s.sealedTime.Int64
} else {
p.State = pb.Invoice_STATE_PROFORMA

View File

@ -147,7 +147,7 @@ div.bgtext div {
{{ end }}
{{ if .ReverseVAT }}
<li><b>(reverse charge applies)</b></li>
<li><b>(reverse charge / obciążenie odwrotne)</b></li>
{{ end }}
</ul>
</div>
@ -155,33 +155,43 @@ div.bgtext div {
<div style="clear: both; height: 1em;"></div>
<table class="items">
<tr>
<th style="width: 60%;">Description</th>
<th>Price<br />(ex. VAT)</th>
<th style="width: 60%;">Name of goods / service</th>
<th>Unit price<br />(net)</th>
<th>Qty</th>
{{ if not .ReverseVAT }}
<th>VAT rate</th>
<th>Total<br />(net)</th>
<th>Total<br />(inc. VAT)</th>
{{ end }}
<th>Goods value<br />(net)</th>
{{ if not .ReverseVAT }}
<th>Goods value<br />(gross)</th>
{{ end }}
</tr>
{{ range .Items }}
<tr>
<td style="text-align: left;">{{ .Title }}</td>
<td>{{ .UnitPrice }}</td>
<td>{{ .Qty }}</td>
{{ if not $.ReverseVAT }}
<td>{{ .VATRate }}</td>
{{ end }}
<td>{{ .TotalNet }}</td>
{{ if not $.ReverseVAT }}
<td>{{ .Total }}</td>
{{ end }}
</tr>
{{ end }}
{{ if not .ReverseVAT }}
<tr>
<td colspan="5" class="lhead">Subtotal without VAT</td>
<td>{{ .TotalNet }}</td>
</tr>
<tr>
<td colspan="5" class="lhead">VAT Total{{ if .ReverseVAT }} (reverse charge applies){{ end }} {{ if .USCustomer }}(VAT zero rate){{ end }}</td>
<td colspan="5" class="lhead">VAT Total {{ if .USCustomer }}(VAT zero rate){{ end }}</td>
<td>{{ .VATTotal }}</td>
</tr>
{{ end }}
<tr>
<td colspan="5" class="lhead"><b>Total</b></td>
<td colspan="{{ if .ReverseVAT }}3{{ else }}5{{ end }}" class="lhead"><b>Total</b></td>
<td><b>{{ .Total }}</b></td>
</tr>
</table>