<style type="text/css">
table {
	border-collapse: collapse;
}

th {
	border: 1px solid #000;
}
</style>

<table>
<tr>
	<td colspan="4">{{ $judul }}</td>
</tr>
<tr>
	<td colspan="2">Priode</td>
	<td colspan="2">: {{ $periode }}</td>
</tr>
</table>
<br>
<table>
	<thead>
	<tr>
		<th>No</th>
		<th>Tanggal</th>
		<th>No. Order</th>
		<th>Penyedia</th>
		<th>Nama Barang</th>
		<th>Satuan</th>
		<th>Qty</th>
		<th>Harga Satuan</th>
		<th>PPN</th>
		<th>Jumlah</th>
		<th>Status</th>
	</tr>
	</thead>
	<tbody>
		<?php
		$total = 0;
        if(count($pembelian) > 0){
            $no = 1;
            foreach ($pembelian AS $key => $d) {
                # code...
                $set_nama_barang = $d->kategori." ".$d->sub_kategori.' '.$d->nama_barang;
                if($d->id_kelompok==4){
                    $set_nama_barang = $d->nama_barang;
                }

                $total = $d->jml_barang*($d->harga_satuan+$d->nilai_ppn);

                echo "<tr>";
                    echo "<td>".$no."</td>";
                    echo "<td>".tgl_full($d->tanggal, '')."</td>";
                    echo "<td>".nomor_orderbeli($d)."</td>";
                    echo "<td>".$d->nama."</td>";
                    echo "<td>".$set_nama_barang."</td>";
                    echo "<td>".$d->satuan."</td>";
                    echo "<td>".$d->jml_barang."</td>";
                    echo "<td>".($d->harga_satuan)."</td>";
                    echo "<td>".($d->nilai_ppn)."</td>";
                    echo "<td>".($total)."</td>";
                    echo "<td>".$d->status_bayar."</td>";
                echo "</tr>";

                $no++;
                $total += ($total);
            }
        }
		?>
	</tbody>
</table>