write complete invoice

This commit is contained in:
Torsten Ueberschar
2024-02-18 11:11:04 +01:00
parent 1720f1b89e
commit 7c2703f2fe
25 changed files with 316 additions and 83 deletions

View File

@@ -1,11 +1,44 @@
<html>
<head>
<style>
@font-face {
font-family: "Barlow Semi Condensed";
src: url("test_data/templates/fonts/BarlowSemiCondensed-Regular.ttf");
}
@font-face {
font-family: "Barlow Semi Condensed";
src: url("test_data/templates/fonts/BarlowSemiCondensed-Light.ttf");
font-style: normal;
font-weight: normal;
}
@font-face {
font-family: "Barlow Semi Condensed";
src: url("test_data/templates/fonts/BarlowSemiCondensed-LightItalic.ttf");
font-style: italic;
font-weight: normal;
}
@font-face {
font-family: "Barlow Semi Condensed";
src: url("test_data/templates/fonts/BarlowSemiCondensed-Bold.ttf");
font-style: normal;
font-weight: bold;
}
@font-face {
font-family: "Barlow Semi Condensed";
src: url("test_data/templates/fonts/BarlowSemiCondensed-BoldItalic.ttf");
font-style: italic;
font-weight: bold;
}
@page {
size: a4 portrait;
margin: 1cm 1cm 1cm 2cm;
font-size: 12pt;
font-family: "Barlow Semi Condensed";
@frame address_frame {
/* Static Frame */
-pdf-frame-content: address_frame_content;
@@ -13,7 +46,6 @@
width: 8.5cm;
top: 5.5cm;
height: 4cm;
-pdf-frame-border: 1;
}
@frame letter_head_frame {
@@ -30,45 +62,90 @@
width: 13cm;
top: 11cm;
bottom: 1cm;
-pdf-frame-border: 1;
}
}
body {
font-family: 'Barlow Semi Condensed';
font-size: 10pt;
}
table {
font-family: 'Barlow Semi Condensed', sans-serif !important;
}
#address_frame_content {
background-color: lightcoral;
}
#letter_head_content {
background-color: lightblue;
}
.head {
}
.positionen {
padding-top: 1mm;
padding-bottom: 1mm;
}
.links {
text-align: left;
}
.rechts {
text-align: right;
}
.summe {
padding-top: 1mm;
border-top: .1pt solid black;
}
.bold {
font-weight: bold;
}
.underline {
border-bottom: .1pt solid black;
}
.overline {
border-top: .1pt solid black;
}
.head_data {
width: 100%;
border-collapse: collapse;
}
.head_data td {
text-align: center;
}
.small {
font-size: 8pt;
}
</style>
</head>
<body>
<!-- Content for Static Frame 'header_frame' -->
<div id="address_frame_content">
<p>Absender</p>
<address>Anschrift
in
mehreren
Zeilen
<p class="underline">{{ envelope.AddressContent.AddressBoxSender }}</p>
<address>
{{ invoice.AddressField | markdown_to_html }}
</address>
</div>
<div id="letter_head_content">
<div id="letter_head_content" class="small">
{% for address in envelope.AddressContent.Contents %}
{% if address.Head %}
<p><strong>{{ address.Head }}</strong></p>
{% endif %}
<p>{{ address.Text | replace('\n', '<br>') }}</p>
<p>{{ address.Text | markdown_to_html }}</p>
{% endfor %}
</div>
<!-- HTML Content -->
<table>
<tr>
<table class="head_data">
<tr class="small">
<td>Rechnungsnummer:</td>
<td>Kundennummer:</td>
<td>Rechnungsdatum:</td>
@@ -76,48 +153,58 @@
<tr>
<td>{{ invoice.Id }}</td>
<td>{{ invoice.CustomerId }}</td>
<td>{{ invoice.InvoiceDate }}</td>
<td>{{ invoice.InvoiceDate.strftime('%d. %B %Y') }}</td>
</tr>
</tr>
</table>
To PDF or not to PDF
<section>
<h2>About Us</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.</p>
<p>{{ invoice.Introduction | markdown_to_html }}</p>
</section>
<section>
<h2>Our Services</h2>
<ul>
<li>Service 1</li>
<li>Service 2</li>
<li>Service 3</li>
</ul>
<table>
<tr class="head underline">
<th class="links" style="width: 55%">Aktivität</th>
<th class="rechts"style="width: 15%">Anzahl</th>
<th class="rechts"style="width: 15%">Einheit</th>
<th class="rechts"style="width: 15%">Betrag</th>
</tr>
{% for position in invoice.Positions %}
<tr class="positionen">
<td class="links">{{ position.Title }}<br><span class="small">{{ position.SubTitle }}</span></td>
<td class="rechts">{{ format_float(position.Quantity | float) }}</td>
<td class="rechts">{{ format_float((position.PricePerUnit or invoice.PricePerUnit) | float) }}
</td>
<td class="rechts">{{ format_float(position.Quantity * ( position.PricePerUnit or
invoice.PricePerUnit ))}}
</td>
</tr>
{% endfor %}
<tr class="summe">
<td></td>
<td></td>
<td class="rechts">Nettosumme:</td>
<td class="rechts">{{ format_float(calculate_total(invoice)) }}</td>
</tr>
<tr>
<td></td>
<td></td>
<td class="rechts">USt. ({{ format_float(invoice.Vat) }}%):</td>
<td class="rechts">{{ format_float(calculate_total(invoice) * ((invoice.Vat / 100))) }}</td>
</tr>
<tr>
<td></td>
<td></td>
<td class="rechts bold overline">Gesamt Summe:</td>
<td class="rechts bold overline">{{ format_float(calculate_total(invoice) * ((invoice.Vat / 100)+1)) }}</td>
</tr>
</table>
</section>
<section>
<h2>About Us</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.</p>
</section>
<section>
<h2>Our Services</h2>
<ul>
<li>Service 1</li>
<li>Service 2</li>
<li>Service 3</li>
</ul>
<p>{{ invoice.Footer | markdown_to_html | named_replace(ZahlungsZiel=(invoice.InvoiceDate |
add_days(invoice.DueDate)).strftime('%d. %B %Y')) }}</p>
</section>
</body>
</html>