Skip to content

Instantly share code, notes, and snippets.

@bencleary
Created January 11, 2018 12:53
Show Gist options
  • Select an option

  • Save bencleary/e44ed7959d47b70e06cd786a1908fe57 to your computer and use it in GitHub Desktop.

Select an option

Save bencleary/e44ed7959d47b70e06cd786a1908fe57 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Sales Report</title>
<style type="text/css">
@page {
size: A4;
margin: 1cm;
}
.table {
width: 100%;
max-width: 100%;
margin-bottom: 5px;
background-color: #fff;
}
.table th,
.table td {
padding: 5px;
vertical-align: top;
border-top: 1px solid #000;
text-align: center;
}
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #000;
}
.table tbody + tbody {
border-top: 2px solid #000;
}
.table .table {
background-color: #fff;
}
.list-group {
display: block;
width: 100%;
list-style: none;
margin-top: 15px;
margin-bottom: 15px;
}
.list-group p {
width: 100%;
height: 20px;
line-height: 20px;
list-style: none;
font-size: 1.1em;
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<div class="card-header">
<h3>Sales Report - {{ today | date:"d/m/Y" }}</h3>
</div>
<div class="list-group">
<p>Name: {{ request.user.first_name }} {{ request.user.last_name }}</p>
</div>
<table class="table">
<thead>
<tr>
<th>Raised</th>
<th>Product</th>
<th>Quantity</th>
<th>Price</th>
<th>Customer</th>
</tr>
</thead>
<tbody>
{% for sale in sales %}
<tr>
<td>{{ sale.created_at | date:"d/m/Y" }}</td>
<td>{{ sale.product.title }}</td>
<td>{{ sale.quantity }}</td>
<td>&pound;{{ sale.price }}</td>
<td>{{ sale.customer.first_name }} {{ sale.customer.last_name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment