feat(template): add ch-cross

This commit is contained in:
2025-08-22 16:34:08 +02:00
parent 7c6916f3a1
commit 0267e6e578
4 changed files with 117 additions and 6 deletions

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 20.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Ebene_2"
x="0px"
y="0px"
viewBox="0 0 128 128"
xml:space="preserve"
sodipodi:docname="ch-cross.svg"
width="128"
height="128"
inkscape:export-filename="/home/irvin/Work/repos/swiss-qr-invoice/assets/raw/ch-cross.png"
inkscape:export-xdpi="232.22856"
inkscape:export-ydpi="232.22856"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
style="shape-rendering:crispEdges"><metadata
id="metadata17"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs15" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1668"
inkscape:window-height="1021"
id="namedview13"
showgrid="false"
inkscape:document-units="px"
units="px"
inkscape:zoom="2.8284271"
inkscape:cx="-38.018193"
inkscape:cy="61.405051"
inkscape:window-x="0"
inkscape:window-y="31"
inkscape:window-maximized="0"
inkscape:current-layer="Ebene_2"><inkscape:grid
type="xygrid"
id="grid916" /></sodipodi:namedview>
<style
type="text/css"
id="style2">
.st0{fill:#FFFFFF;}
.st1{fill:none;stroke:#FFFFFF;stroke-width:1.4357;stroke-miterlimit:10;}
</style>
<g
id="g4736"
transform="matrix(4.8380969,0,0,4.8380389,-1.9834927e-5,9.0008541e-4)"><polygon
transform="matrix(1.3598365,0,0,1.3598365,-0.23403522,-0.23403522)"
style="fill:#000000;fill-opacity:1;stroke-width:0.73538256"
id="polygon4"
points="0.7,0.7 0.7,1.6 0.7,18.3 0.7,19.1 1.6,19.1 18.3,19.1 19.1,19.1 19.1,18.3 19.1,1.6 19.1,0.7 18.3,0.7 1.6,0.7 " /><rect
style="fill:#ffffff;fill-opacity:1;stroke-width:1"
id="rect6"
height="14.958201"
width="4.4874606"
class="st0"
y="5.2231627"
x="11.034758" /><rect
style="fill:#fffff9;fill-opacity:1;stroke-width:1"
id="rect8"
height="4.4874606"
width="14.958201"
class="st0"
y="10.526525"
x="5.7313952" /><polygon
transform="matrix(1.3598207,0,0,1.3598361,-0.2338788,-0.23403126)"
style="fill:none;stroke:#ffffff;stroke-width:1.05601561;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="polygon10"
points="1.6,0.7 0.7,0.7 0.7,1.6 0.7,18.3 0.7,19.1 1.6,19.1 18.3,19.1 19.1,19.1 19.1,18.3 19.1,1.6 19.1,0.7 18.3,0.7 "
class="st1" /></g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

134
report/assets/style.css Normal file
View File

@@ -0,0 +1,134 @@
body {
font-family: sans-serif;
margin: 40px;
color: #333;
}
section {
margin-bottom: 3em;
}
p {
margin-top: 0.25em;
margin-bottom: 0.5em;
}
header {
display: flex;
justify-content: space-between;
margin-bottom: 40px;
h2 {
margin-top: 0;
}
}
h1 {
margin: 0;
font-size: 2em;
}
.company,
.client {
margin-bottom: 20px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
table,
th,
td {
border: 1px solid #ccc;
}
th,
td {
padding: 10px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
tfoot td {
font-weight: bold;
}
h2 {
margin-top: 40px;
}
article {
margin-bottom: 20px;
}
footer {
margin-top: 40px;
font-size: 0.9em;
text-align: center;
color: #666;
}
.totals {
float: right;
width: 300px;
margin-top: -15px;
}
.totals table {
border: none;
margin: 0;
}
.totals td {
border: none;
padding: 5px 10px;
text-align: right;
}
@media print {
.page,
.page-break {
break-after: page;
}
}
.qr-section {
position: absolute;
bottom: 0;
display: grid;
grid-template-columns: 250px 1fr;
grid-template-rows: 1fr;
gap: 1em;
width: 100%;
/* border-top: 2px solid #000; */
/* padding-top: 1rem; */
h4 {
margin-bottom: 0.1em;
}
.qr-code {
display: flex;
flex-direction: column;
justify-content: space-between;
.qr-section-img {
position: relative;
width: 100%;
img {
width: 100%;
}
svg {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1;
width: 40px;
}
}
.qr-section-info {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
justify-items: center;
}
}
.payment-details {
font-size: 0.9rem;
line-height: 1.4;
}
}

129
report/assets/template.html Normal file
View File

@@ -0,0 +1,129 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Rechnung vom {{ .Date | date }}</title>
<!-- <link href="css/style.css" rel="stylesheet" /> -->
<style>
{{ .Style }}
</style>
</head>
<body>
<header>
<div class="company">
<h2>{{ .Company.Name }}</h2>
<p>
{{ .Company.Address.Street}} {{.Company.Address.Number}} <br />
{{ .Company.Address.ZIPCode }} {{ .Company.Address.Place }} <br />
{{ .Company.Contact }}
</p>
<p></p>
</div>
<div class="invoice-info">
<p>
<strong>Rechnung:</strong> {{ .ID }} <br />
<strong>Datum:</strong> {{ .Date | date }} <br />
</p>
</div>
</header>
<section class="client">
<h2>Rechnung an:</h2>
<p>
{{ .Client.Name }} <br />
{{ .Client.Address.Street}} {{.Client.Address.Number}} <br />
{{ .Client.Address.ZIPCode }} {{ .Client.Address.Place }} <br />
{{ .Client.Contact }}
</p>
</section>
<section class="page p1">
<article>
<table>
<thead>
<tr>
<th>FID</th>
<th>Name</th>
<th>Zeitaufwand</th>
<th>Stundensatz</th>
<th>Preis CHF</th>
<th>Fertiggestellt</th>
</tr>
</thead>
<tbody>
{{ range .Issues }}
<tr>
<td>{{ .Index }}</td>
<td>{{ .Title }}</td>
<td>{{ .Duration | duration }}</td>
<td>16 CHF/h</td>
<td>{{ .Duration | price }} CHF</td>
<td>{{ .Closed | time }}</td>
</tr>
{{ end }}
</tbody>
</table>
<div class="totals">
<table>
<tr>
<td>Gesamtbetrag:</td>
<td>{{ .Total }} CHF</td>
</tr>
</table>
</div>
</article>
<article class="qr-section">
<div class="qr-code">
<!-- Replace with your QR code image or generated SVG -->
<div class="qr-section-img">
<image src="{{ .QRInvoice }}"></image>
{{ .ChCross }}
</div>
<div class="qr-section-info">
<h4>Währung</h4>
<h4>Betrag</h4>
<p>CHF</p>
<p>{{ .Total}}</p>
</div>
</div>
<div class="payment-details">
<div>
<h4 style="margin-top: 0">Konto / Zahlbar an</h4>
<p>
{{ .Company.IBAN }} <br />
{{ .Company.Contact }} <br />
{{ .Company.Address.Street}} {{.Company.Address.Number}} <br />
{{ .Company.Address.ZIPCode }} {{ .Company.Address.Place }}
</p>
</div>
<div>
<h4>Referenz</h4>
<p></p>
</div>
<div>
<h4>Zahlbar durch</h4>
<p>
{{ .Client.Contact }} <br />
{{ .Client.Address.Street}} {{.Client.Address.Number}} <br />
{{ .Client.Address.ZIPCode }} {{ .Client.Address.Place }}
</p>
</div>
</div>
</article>
</section>
<section>
<h2>Details zu den Features</h2>
{{ range .Issues }}
<article>
<h3>{{ .Index }}: {{ .Title }}</h3>
{{ .Body | md | oh 3 }}
</article>
{{ end }}
</section>
</body>
</html>