{% extends "base.html" %}

{% block title %}
	&raquo; DC Contracts &raquo; {{bill.batch.contract.name}} &raquo;
 	Batches &raquo; {{bill.batch.reference}} &raquo; {{bill.reference}}
{% endblock %}

{% block nav %}
	&raquo; <a href="/dc_contracts">DC Contracts</a> &raquo; 
	<a
			href="/dc_contracts/{{bill.batch.contract.id}}"
			>{{bill.batch.contract.name}}</a> &raquo; 
	<a href="/dc_batches?dc_contract_id={{bill.batch.contract.id}}">Batches</a>
 	&raquo; 
	<a href="/dc_batches/{{bill.batch.id}}">{{bill.batch.reference}}</a> &raquo;
	Bill {{bill.id}} [<a href="/dc_bills/{{bill.id}}/edit">edit</a>]
{% endblock %}

{% block content %}
<div class="layer-section">
	<div class="section-header">
		<h2>Bill</h2>	
	</div>
	<div class="section-content">
		<div class="section-data">
			<div class="noWrap">
				<table class="DataTable widthAuto noMarginBottom">
					<thead>
						<tr>
							<th>Supply</th>
							<th>Reference</th>
							<th>Account</th>
							<th>Issue Date</th>
							<th>From</th>
							<th>To</th>
							<th>kWh</th>
							<th>Net</th>
							<th>VAT</th>
							<th>Gross</th>
							<th>Type</th>
							<th>Check</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>
								<a href="/supplies/{{bill.supply.id}}">Supply</a>
							</td>
							<td>{{bill.reference}}</td>
							<td>{{bill.account}}</td>
							<td>{{bill.issue_date.strftime('%Y-%m-%d %H:%M')}}</td>
							<td>{{bill.start_date|hh_format }}</td>
							<td>{{bill.finish_date|hh_format }}</td>
							<td>{{bill.kwh}}</td>
							<td>{{bill.net}}</td>
							<td>{{bill.vat}}</td>
							<td>{{bill.gross}}</td>
							<td>
								<a
										href="/bill_types/{{bill.bill_type.id}}"
										title="{{bill.bill_type.description}}"
										>{{bill.bill_type.code}}</a>
							</td>
							<td>
								<a href="/reports/111?bill_id={{bill.id}}">Check</a>
							</td>
						</tr>
					</tbody>
				</table>
			</div>			
		</div>
	</div>
</div>

<div class="layer-section">
	<div class="section-header">
		<h2>Breakdown</h2>	
	</div>
	<div class="section-content">
		<div class="section-data">
			<pre>{%- for line in raw_lines -%}
			{{line}}<br>
		{%- endfor -%}</pre>
		</div>
		<div class="section-data">
			<table class="DataTable widthAuto noMarginBottom">
				<thead>
					<tr>
						<th>element</th>
						{% for col in column_list %}
							<th>{{col}}</th>
						{% endfor %}
					</tr>  
				</thead>
				<tbody>
					{% for row in row_list %}
						<tr>
							<td>{{row}}</td>
							{% for col in column_list %}
								<td>{{grid[row][col]}}</td>
							{% endfor %}
						</tr>
					{% endfor %}
				</tbody>
			</table>
		</div>
	</div>
</div>

{% endblock %}
