{% extends '../template.html' %}
{% block subcontent %}
<h2>Keuangan - Laba-Rugi {{tahun}}</h2>
<br/>
<h3>
	<table>
		<tr>
			<td>Pilih Tahun Buku :</td>
			<td>
				<select id="tahun" tabindex="-1">
					{% for t in listTahun %}
					<option value="{{t.tahun}}">{{t.tahun}}</option>
					{% endfor %}
				</select>
			</td>
		</tr>
		<tr>
			<td>Pilih Bulan :</td>
			<td>
				<select id="bulan" tabindex="-1">
					<option value="0" >- Semua -</option>
					<option value="1" >Januari</option>
					<option value="2" >Februari</option>
					<option value="3" >Maret</option>
					<option value="4" >April</option>
					<option value="5" >Mei</option>
					<option value="6" >Juni</option>
					<option value="7" >Juli</option>
					<option value="8" >Agustus</option>
					<option value="9" >September</option>
					<option value="10" >Oktober</option>
					<option value="11" >Nopember</option>
					<option value="12" >Desember</option>
				</select>
			</td>
		</tr>
	</table>
</h3>
<br/><br/>

{% if data.length > 0 %}
<table class="data">
	{% for row in data %}
	<tr class="orders" valign="top">
		<td style="width:300px"><b>{{row.nama}}</b></td>
		<td style="width:100px"></td>
	</tr>
	{% for a in row.akun %}
	<tr>
		<td style="padding-left:30px">{{a.nama}}</td>
		<td style="text-align:right">{{a.nominal | currency}}</td>
	</tr>
	{% endfor %}
	<tr>
		<td><b>Total</b></td>
		{% if row.normal == 'kredit' %}
		<td style="text-align:right;border-top:1px solid gray"><b>{{row.total | currency}}</b></td>
		{% else %}
		<td style="text-align:right;border-top:1px solid gray"><b>({{row.total | currency}})</b></td>
		{% endif %}
	</tr>
	{% endfor %}
	<tr>
		<td><b>GRANDTOTAL</b></td>
		<td style="text-align:right;font-size:18px;border-top:1px solid gray;color:{%if grandtotal < 0%}red{%else%}green{%endif%}"><b>{{grandtotal | currency}}</b></td>
	</tr>
</table>
{% else %}
	- Data Masih Kosong -<br/><br/>
{% endif %}
<br/><br/><br/>
{% endblock %}
{% block script %}
<script type="text/javascript">
	$(document).ready(function() {
		menuSelected("mLaporan","smLabaRugi");
		$('#tahun').val('{{tahun}}');
		$('#bulan').val('{{bulan}}');
		$('#tahun').on('change',function() {
			window.location = ("{% nav bendahara_keuangan_labarugi %}?tahun="+$('#tahun').val()+"&bulan="+$('#bulan').val());
		});
		$('#bulan').on('change',function() {
			window.location = ("{% nav bendahara_keuangan_labarugi %}?tahun="+$('#tahun').val()+"&bulan="+$('#bulan').val());
		});
	});
</script>
{% endblock %}