<table class="listObat" cellpadding="5">
	<thead>
		<tr>
			<th style="width:50px">Pilih</th>
			<th>Tanggal</th>
			<th>Nama</th>
			<th>Harga</th>
			<th>Jumlah</th>
			<th>Total</th>
		</tr>
	</thead>
	<tbody class="body">
		{%if data.length > 0 %}
		{% for d in data %}
		<tr>
			<td><input class="cBox" type='checkbox' name='ids[]' value='{{d.id}}' style="margin-left:10px" {% if d.sumber != NULL %}checked="true"{% endif %}></td>
			<td>{{d.tgl}}</td>
			<td>{{d.nama}}</td>
			<td>{{d.harga_beli}}</td>
			<td>{{d.jumlah}}</td>
			<td class="total">{{d.total}}</td>
		</tr>
		{% endfor %}
		{% else %}
		<tr><td colspan=6 style="text-align:center"><p>Tidak ada data obat</p></td></tr>
		{% endif %}
	</tbody>
</table>
<script>
	$(document).ready(function () {
		$(".cBox").on("click",function() {
			var total = 0;
			$(".cBox").each(function() {
				if($(this).is(':checked')) {
					total += $(this).parent().parent().find('.total').text()*1;
				};
			});
			$('#nominal').val(total);
		});
	});
</script>