<div class="container my-4">
	<h4 style="font-family: roboto mono;">Nota Pesanan</h4>
	
	
	<table class="table table-bordered ">
		<thead class="table-dark">
            <tr>
                <!-- <th>ID BARANG</th> -->
                <td style="font-family: roboto mono;"><center>NAMA PRODUK</center></td>
                <td style="font-family: roboto mono;"><center>JUMLAH PESANAN</center></td>
                <td style="font-family: roboto mono;"><center>HARGA SATUAN</center></td>
                <td style="font-family: roboto mono;"><center>SUB-TOTAL</center></td>
            </tr>
        </thead>
            
		<?php 
		$total = 0;
		foreach ($pesanan as $psn) :
			$subtotal = $psn->harga * $psn->jumlah + $psn->keuntungan;
			$total = $subtotal;
			?>

<tr>
	<!-- <td> <?php echo $psn->id_brg ?></td> -->
	<td style="font-family: roboto mono;"><center> <?php echo $psn->nama_brg  ?></center></td>
	<td style="font-family: roboto mono;"><center> <?php echo $psn->jumlah  ?></center></td>
	<td align="right" style="font-family: roboto mono;">Rp. <?php echo number_format($psn->harga + ($psn->keuntungan /$psn->jumlah),0,',','.') ?></td>
	<td align="right" style="font-family: roboto mono;">Rp. <?php echo number_format($subtotal,0,',','.') ?></td>
</tr>

<?php endforeach; ?>

<tr>
	<?php if($invoice->ket == 1):?>
		<td colspan="2" class="text-right table-dark " style="font-family: roboto mono;">LUNAS</td>
		<?php else:?>
			<td colspan="2" style="font-family: roboto mono;" class="text-right text-light bg-secondary">BELUM LUNAS</td>
			<?php endif;?>
			<td align="right" style="font-family: roboto mono;">Grand Total</td>
			<td align="right" style="font-family: roboto mono;">Rp. <?php echo number_format($total,0,',','.') ?></td>
		</tr>
	</table>	
</div>
<script>window.print()</script>