<!
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laporan Pembelian</title>
<style>
body{
font-family:Tahoma;
}
table,th,td{
border-collapse:collapse;
border:2px solid black;
}
table, th, td{
padding:5px;
}
th{
font-size:14px;
background-color:#2972ba;
color:white;
}
</style>
</head>
<body>
<h4>
LAPORAN PEMBELIAN <br>
<?php if(empty($unit)){
echo "SEMUA UNIT";
} else{
echo "UNIT ".$unit;
}?>
<br>
PERIODE <?php echo $dari; ?> s/d <?php echo $sampai; ?>
</h4>
<table border="1">
<tr>
<th>NO</th>
<th>NO FAKTUR</th>
<th>TGL TRANSAKSI</th>
<th>KODE PELANGGAN</th>
<th>NAMA PELANGGAN</th>
<th>JENIS TRANSAKSI</th>
<th>JATUH TEMPO</th>
<th>TOTAL PENJUALAN</th>
<th>TOTAL BAYAR</th>
<th>SISA BAYAR</th>
<th>KETERANGAN</th>
<th>KASIR</th>
</tr>
<?php
$totalpembelian=0;
$totalbayar=0;
$totalsisabayar=0;
$no=1;
foreach($laporanpemb as $d){
$totalpembelian+=$d->totalpembelian;
$totalbayar+=$d->totalbayar;
$sisabayar=$d->totalpembelian-$d->totalbayar;
$totalsisabayar+=$sisabayar;
if($sisabayar!=0){
$keterangan="Belum Lunas";
$colorbg="#ba2b4f";
$colortext="white";
}else{
$keterangan="Lunas";
$colorbg="";
$colortext="";
}
?>
<tr style="background-color:<?php echo $colorbg; ?>; color:<?php echo
$colortext; ?>; ">
<td><?php echo $no; ?></td>
<td><?php echo $d->no_faktur; ?></td>
<td><?php echo $d->tglbeli; ?></td>
<td><?php echo $d->kode_supplier; ?></td>
<td><?php echo $d->nama_supplier; ?></td>
<td><?php echo $d->jenisbeli; ?></td>
<td><?php echo $d->jatuhtempo; ?></td>
<td align="right"><?php echo number_format($d-
>totalpembelian,'0','','.'); ?></td>
<td align="right"><?php echo number_format($d-
>totalbayar,'0','','.'); ?></td>
<td align="right"><?php echo number_format($sisabayar,'0','','.'); ?
></td>
<td><?php echo $keterangan; ?></td>
<td><?php echo $d->nama_lengkap; ?></td>
</tr>
<?php $no++; } ?>
<tr>
<th colspan="7" align="center">TOTAL</th>
<th align="right"><?php echo number_format($totalpembelian,'0','','.');
?></th>
<th align="right"><?php echo number_format($totalbayar,'0','','.'); ?
></th>
<th align="right"><?php echo number_format($totalsisabayar,'0','','.');
?></th>
<th colspan="2"></th>
</tr>
</table>
</body>
</html>