Skip to content

Instantly share code, notes, and snippets.

@opalczynski
Created September 16, 2021 16:47
Show Gist options
  • Select an option

  • Save opalczynski/d5a933104532b7eedff0e537668cd94f to your computer and use it in GitHub Desktop.

Select an option

Save opalczynski/d5a933104532b7eedff0e537668cd94f to your computer and use it in GitHub Desktop.
Invoice template with jinja2 expressions
<html>
<head>
<meta charset="utf-8">
<link href="invoice.css" media="print" rel="stylesheet">
<title>Invoice</title>
<meta name="description" content="Invoice demo sample">
</head>
<body>
<h1>Invoice</h1>
<aside>
<address id="from">
{{ issuer.name }}
{{ issuer.address }}
{{ issuer.tax_number }}
{{ issuer.country }}
</address>
<address id="to">
{{ customer.name }}
{{ customer.address }}
{{ customer.tax_number }}
{{ customer.country }}
</address>
</aside>
<dl id="informations">
<dt>Invoice number</dt>
<dd>{{ number }}</dd>
<dt>Date</dt>
<dd>{{ date }}</dd>
</dl>
<table>
<thead>
<tr>
<th>Description</th>
<th>Price</th>
<th>Quantity</th>
<th>Subtotal</th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<td>{{ item.name }}</td>
<td>{{ "{amount:,.2f}".format(amount=item.price) }}</td>
<td>{{ item.quantity }}</td>
<td>{{ "{amount:,.2f}".format(amount=item.price * item.quantity) }} {{ currency }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<table id="total">
<thead>
<tr>
<th>Due by</th>
<th>Account number</th>
<th>Total due</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ due_date }}</td>
<td>{{ account_number }}</td>
<td>{{ total }} {{ currency }}</td>
</tr>
</tbody>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment