Merge "bgpwtf/invoice: render SP/GTU codes on invoices"
diff --git a/bgpwtf/invoice/render.go b/bgpwtf/invoice/render.go
index 693aa62..c0eeca1 100644
--- a/bgpwtf/invoice/render.go
+++ b/bgpwtf/invoice/render.go
@@ -4,6 +4,7 @@
 	"bytes"
 	"fmt"
 	"html/template"
+	"strings"
 	"time"
 
 	wkhtml "github.com/sebastiaanklippert/go-wkhtmltopdf"
@@ -41,6 +42,20 @@
 		Total     string
 	}
 
+	symbols := ""
+	var parts []string
+	for _, code := range i.Data.SpCode {
+		parts = append(parts, code.String())
+	}
+	for _, code := range i.GtuCode {
+		parts = append(parts, code.String())
+	}
+	if len(parts) > 0 {
+		symbols = strings.Join(parts, ", ") + "."
+	} else {
+		symbols = "<i>brak</i>."
+	}
+
 	data := struct {
 		InvoiceNumber         string
 		InvoicerBilling       []string
@@ -60,6 +75,7 @@
 		VATTotal              string
 		Total                 string
 		DeliveryCharge        string
+		Symbols               template.HTML
 	}{
 		InvoiceNumber:         i.FinalUid,
 		Date:                  time.Unix(0, i.Date),
@@ -75,6 +91,7 @@
 
 		InvoicerBilling: make([]string, len(i.Data.InvoicerBilling)),
 		InvoiceeBilling: make([]string, len(i.Data.CustomerBilling)),
+		Symbols:         template.HTML(symbols),
 	}
 
 	for d, s := range i.Data.InvoicerBilling {
diff --git a/bgpwtf/invoice/templates/invoice_en.html b/bgpwtf/invoice/templates/invoice_en.html
index 6a92022..976dbdf 100644
--- a/bgpwtf/invoice/templates/invoice_en.html
+++ b/bgpwtf/invoice/templates/invoice_en.html
@@ -92,6 +92,9 @@
     -webkit-transform: rotate(-45deg);
     text-transform: uppercase;
 }
+div.symbols {
+    padding: 0 0 0.5rem 0.1rem;
+}
         </style>
     </head>
     <body>
@@ -153,6 +156,9 @@
             </div>
         </div>
         <div style="clear: both; height: 1em;"></div>
+        <div class="symbols">
+            <b>Oznaczenia</b>: {{ .Symbols }}
+        </div>
         <table class="items">
             <tr>
                 <th style="width: 60%;">Name of goods / service</th>
@@ -195,5 +201,8 @@
                 <td><b>{{ .Total }}</b></td>
             </tr>
         </table>
+        <div class="footer">
+            {{ .Footer }}
+        </div>
     </body>
 </html>
diff --git a/bgpwtf/invoice/templates/invoice_pl.html b/bgpwtf/invoice/templates/invoice_pl.html
index 15f5d08..b09086b 100644
--- a/bgpwtf/invoice/templates/invoice_pl.html
+++ b/bgpwtf/invoice/templates/invoice_pl.html
@@ -92,6 +92,9 @@
     -webkit-transform: rotate(-45deg);
     text-transform: uppercase;
 }
+div.symbols {
+    padding: 0 0 0.5rem 0.1rem;
+}
         </style>
     </head>
     <body>
@@ -154,6 +157,9 @@
             </div>
         </div>
         <div style="clear: both; height: 1em;"></div>
+        <div class="symbols">
+            <b>Oznaczenia</b>: {{ .Symbols }}
+        </div>
         <table class="items">
             <tr>
                 <th style="width: 60%;">Nazwa towaru lub usługi</th>