<div class="container my-4">
	<h4 style="font-family: roboto mono;">Laporan</h4>
	<?php if($tgl1 != null && $tgl2 != null):?>
		<h4>Periode <?= $tgl1 ?> - <?= $tgl2 ?></h4> 
	<?php endif;?>
	
	
	<table class="table table-bordered ">
		<thead class="table-dark">
            <tr>
                <!-- <th>ID BARANG</th> -->
                <td style="font-family: roboto mono;"><center>Invoice</center></td>
                <td style="font-family: roboto mono;"><center>Atas Nama</center></td>
                <td style="font-family: roboto mono;"><center>Tanggal</center></td>
                <td style="font-family: roboto mono;"><center>Total Belanja</center></td>
                <td style="font-family: roboto mono;"><center>Total Keuntungan</center></td>
            </tr>
        </thead>
            
		<?php 
		$totalhrg = 0;
		$totallaba = 0;
		foreach ($inv as $psn) :
			// $subtotal = $psn->jumlah * $psn->harga;
			?>

<tr>
			<td style="font-family: roboto mono;"><center><?=$psn['id']?></center></td>
			<td style="font-family: roboto mono;"><center><?=$psn['nama']?></center></td>
			<td style="font-family: roboto mono;"><center><?=$psn['tgl_lunas']?></center></td>
			<td style="font-family: roboto mono;"><center>Rp.<?=number_format(($psn['harga']+$psn['keuntungan']), 0,',','.')?></center></td>
			<td style="font-family: roboto mono;"><center>Rp.<?=number_format(($psn['keuntungan']), 0,',','.')?></center></td>
</tr>

<?php 
$totalhrg = $totalhrg + ($psn['harga']+$psn['keuntungan']);
$totallaba = $totallaba + $psn['keuntungan'];
endforeach; ?>
<tr>
	<td colspan="3">Total
	</td>
	<td>Rp.<?= number_format($totalhrg, 0,',','.') ?></td>
	<td>Rp.<?= number_format($totallaba, 0,',','.') ?></td>
</tr>

	</table>	
</div>
<script>window.print()</script>