{% extends 'template.html' %}
{% block subcontent %}
<h1>Laporan - Jumlah kunjungan {{tgl}}</h1>
<form method="get">
	<span class="monthly">
		{% date monthly year[2018-2030] nodate %}
	</span>
	Poli :
	<select name="poli">
		<option value="0">-- semua --</option>
		{% for p in polis %}
		<option {% if p.id == poli.id %}selected="selected"{% endif %} value="{{p.id}}">{{p.nama}}</option>
		{% endfor %}
	</select>
	<input type="submit" value="Go"/>
	<button type="submit" name="xls" value="y" style="margin-left:30px" class="btn-success btn"><i class="far fa-file"></i></button>
</form>
<br/><br/><br/>
{% if data.totala > 0 %}
<table class="data">
	<tr>
		<th>Tgl</th>
		<th>Total</th>
		<th>Shift</th>
		<th>Px</th>
		<th style="min-width:20px">L</th>
		<th style="min-width:20px">P</th>
		<th style="min-width:20px">Baru</th>
		<th style="min-width:20px">Lama</th>
		<th style="min-width:20px">Dhuafa</th>
		<th style="min-width:20px">Khusus</th>
		<th style="min-width:20px">Umum</th>
	</tr>
	{% for d in data.tabel %}
	<tr>
		<td rowspan="2" style="text-align:center;border-top:1px solid #ccc"><b>{{d.tgl}}</b></td>
		<td rowspan="2" style="text-align:center;border-top:1px solid #ccc">{{d.total}}</td>
		<td style="border-top:1px solid #ccc">Pagi</td>
		<td style="border-top:1px solid #ccc">{% if d.ptotal == 0 %}-{% else %}{{d.ptotal}}{% endif %}</td>
		<td style="border-top:1px solid #ccc">{% if d.plaki == 0 %}-{% else %}{{d.plaki}}{% endif %}</td>
		<td style="border-top:1px solid #ccc">{% if d.pperempuan == 0 %}-{% else %}{{d.pperempuan}}{% endif %}</td>
		<td style="border-top:1px solid #ccc">{% if d.pbaru == 0 %}-{% else %}{{d.pbaru}}{% endif %}</td>
		<td style="border-top:1px solid #ccc">{% if d.plama == 0 %}-{% else %}{{d.plama}}{% endif %}</td>
		<td style="border-top:1px solid #ccc">{% if d.pd == 0 %}-{% else %}{{d.pd}}{% endif %}</td>
		<td style="border-top:1px solid #ccc">{% if d.pk == 0 %}-{% else %}{{d.pk}}{% endif %}</td>
		<td style="border-top:1px solid #ccc">{% if d.pu == 0 %}-{% else %}{{d.pu}}{% endif %}</td>
	</tr>
	<tr>
		<td>Sore</td>
		<td>{% if d.stotal == 0 %}-{% else %}{{d.stotal}}{% endif %}</td>
		<td>{% if d.slaki == 0 %}-{% else %}{{d.slaki}}{% endif %}</td>
		<td>{% if d.sperempuan == 0 %}-{% else %}{{d.sperempuan}}{% endif %}</td>
		<td>{% if d.sbaru == 0 %}-{% else %}{{d.sbaru}}{% endif %}</td>
		<td>{% if d.slama == 0 %}-{% else %}{{d.slama}}{% endif %}</td>
		<td>{% if d.sd == 0 %}-{% else %}{{d.sd}}{% endif %}</td>
		<td>{% if d.sk == 0 %}-{% else %}{{d.sk}}{% endif %}</td>
		<td>{% if d.su == 0 %}-{% else %}{{d.su}}{% endif %}</td>
	</tr>
	{% endfor %}
</table>
{% else %}
	- Kunjungan Masih Kosong -<br/><br/>
{% endif %}
{% endblock %}
{% block script %}
<script type="text/javascript">
	$(document).ready(function() {
		$("select[name=monthly_month]").val("{{bln}}").change();
		$("select[name=monthly_year]").val("{{thn}}").change();
	});
</script>
{% endblock %}