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

		<style>
		    @page {
		        size: a4 portrait;
		        @frame header_frame {          
		            -pdf-frame-content: header_content;
		            left: 50pt; width: 512pt; top: 50pt; height: 70pt;
		        }
		        @frame content_frame {
		            left: 50pt; width: 512pt; top: 120pt; height: 632pt;
		        }
		        @frame footer_frame { 
		            -pdf-frame-content: footer_content;
		            left: 50pt; width: 512pt; top: 772pt; height: 30pt;
		        }
		    }
		    body {
		    	font-size: 9pt;
		    }
		    #coordonnees_illyse {
		    	font-size:9pt;
		    }
		    #coordonnees_client {
		    	vertical-align: top;
		    }

		    table#details {
		    	width:100%;
		    }
		    th.cell {border:0px;}
		    .cell.result {border:0px; font-weight: bold}
		    .cell { padding:2pt; border:1px solid #DDD; }
		    .cell.label { width:400pt;}
		    .cell.quantity {width:50pt;}
		    .cell.amount {width:50pt;}
		    .cell.total {width:50pt;}

		    .period {color:#888;}

		    #paiements {
		    	background-color:#EEE;
		    	padding:5pt;
		    	font-size:80%;
		    }
		    #page_number {
		    	float:right;
		    }
		</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">
		<hr />
		<table widht="100%">
			<tr>
				<td width="50"><img id="logo" src="{% static "billing/invoice_logo.jpg" %}" height="20" /></td>
				<td>ILLYSE, association loi de 1901 à but non lucratif - SIRET : 539 453 191 00014</td>
				<td width="20"><pdf:pagenumber>
					/<pdf:pagecount>
				</td>
			</tr>
		</table>
	</div>
	<table>
		<tr>
			<td id="coordonnees_illyse">
				<p>
				Association ILLYSE<br />
				c/o Jean-François MOURGUES<br />
				225 route de Genas<br />
				69100 Villeurbanne</p>
				<p>conctact@illyse.org<br/>
				<a href="http://www.illyse.net">http://www.illyse.net</a></p>
			</td>
			<td id="coordonnees_client">
				<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" repeat="1">
		<thead>
			<tr>
				<th class="cell label"></th>
				<th class="cell quantity">Quantité</th>
				<th class="cell amount">PU</th>
				<th class="cell total">Total</th>
			</tr>
		</thead>
		<tbody>
			{% for detail in invoice.details.all %}
			<tr>
				<td class="cell label">{{ detail.label }}
					{% if detail.period_from and detail.period_to %}<br/><span class="period">Pour la période du {{ detail.period_from }} au {{ detail.period_to }}{% endif %}</span></td>
				<td class="cell quantity">{{ detail.quantity }}</td>
				<td class="cell amount">{{ detail.amount }}€</td>
				<td class="cell total">{{ detail.total }}€</td>
			</tr>
			{% endfor %}
			<tr>
				<td class="cell result"></td>
				<td class="cell result total_ttc" colspan="2">Total TTC</td>
				<td class="cell result invoice_amount">{{ invoice.amount }}€</td>
			</tr>
		</tbody>
	</table>
	<div id="paiements">
		<p><strong>Merci de préférer si possible le paiement par virement</strong></p>

		<strong>Virement</strong><br />
		Titulaire du compte : ILLYSE<br/>
		RIB : 42559 00012 41020023285 19<br/>
		IBAN : FR76 4255 9000 1241 0200 2328 519<br />

		<strong>Chèque</strong><br />
		Paiement par chèque à l'ordre de "Association ILLYSE" envoyé à l'adresse : Association ILLYSE, c/o Jean-François MOURGUES, 225 route de Genas, 69100 Villeurbanne
	</div>

</body>
</html>
