{% load static %}
<html>
	<head>
		<title>Facture N°{{ invoice.number }}</title>

		<style>
		    @page {
		        size: a4 portrait;
		        @frame header_frame {          
		            -pdf-frame-content: header_content;
		            -pdf-frame-border: 1;
		            left: 50pt; width: 512pt; top: 50pt; height: 50pt;
		        }
		        @frame content_frame {
		        	-pdf-frame-border: 1;
		            left: 50pt; width: 512pt; top: 120pt; height: 632pt;
		        }
		        @frame footer_frame { 
		            -pdf-frame-content: footer_content;
		            -pdf-frame-border: 1;
		            left: 50pt; width: 512pt; top: 772pt; height: 20pt;
		        }
		    }
		    table#details {
		    	border:1px solid black;
		    }
		    table td {
		    	padding-top:5pt;
		    	border:1px solid red;
		    }
		</style>

	</head>
<body>
	<div id="header_content">
		<table widht="100%">
			<tr>
				<td><img id="logo" src="{% static "billing/invoice_logo.jpg" %}" height="70" /></td>
				<td><h1>Facture N°{{ invoice.number }}</h1>
					Le {{ invoice.date }}</td>
			</tr>
		</table>		
	</div>
	<div id="footer_content">ILLYSE - <pdf:pagenumber>
		/<pdf:pagecount>
	</div>
	<table>
		<tr>
			<td>
				<p>
				Association ILLYSE<br />
				c/o Jean-François MOURGUES<br />
				225 route de Genas<br />
				69100 Villeurbanne</p>
				<p>SIRET : 539 453 191 00014</p>
			</td>
			<td style="vertical-align:top">
				<strong>Facturé à :</strong><br/>
				{{ member.last_name }} {{ member.first_name }}<br />
				{% if member.organization_name != "" %}{{ member.organization_name }}<br />{% endif %}
				{{ member.address }}<br />
				{{ member.postal_code }} {{ member.city}}
			</td>
		</tr>
	</table>

	<hr />
	Facture N°{{ invoice.number }}

	<table id="details">
		<thead>
			<tr>
				<th></th>
				<th>Quantité</th>
				<th>Prix unitaire</th>
				<th>Total</th>
			</tr>
		</thead>
		{% for detail in invoice.details.all %}
		<tr>
			<td>{{ detail.label }}</td>
			<td>{{ detail.quantity }}</td>
			<td>{{ detail.amount }}€</td>
			<td>{{ detail.total }}€</td>
		</tr>
		{% endfor %}
		<tr>
			<td></td>
			<td></td>
			<td>Total TTC</td>
			<td>{{ invoice.amount }}€</td>
		</tr>
	</table>


</body>
</html>
