<?php 
session_start();
ob_start();

 ?>
<html>
<head>
  <title>Cetak PDF</title>
    
   <style>
   table {border-collapse:collapse; table-layout:fixed;width:106%; }
  /* table td {word-wrap:break-word;width: 20%;}*/
    table td {margin: 0 20px 20px 0;}
</style>
<style>
   /*https://www.dicoding.com/blog/cara-membuat-table-di-html/*/
        table { margin-top: 2%;
            /*border-collapse: collapse;*/
        }    
        th, td {
            padding: 0px;
            font-size: 11px;
        }
       /* p{ margin-top: 0px;            
        }
        h5{ margin-top: 0px;
        }
        h4{ margin-bottom: 1px;*/
        }
    </style>
   <style type="text/css">
       .borderkotak1{
        width: 90%;
        height: 100px;
        background-color: white;
        /*line-height: 100px;*/
        border: 1px solid black;
        
       }
   </style>
</head>

<body>
   <!--  <page_footer align="right">
    Page[[page_cu]]
  </page_footer> 
  <page_header>
  
  </page_header> -->
  <div class="borderkotak">

 <table border="0" style="width: 100%;margin-top: 79px;margin-left: 68px;" >
<tr>
<!-- <td><img src="./../img/kop.png" style="width:175px;height:65px;" />
</td> -->
<td style="width:35%"></td>
<!-- <td style="padding-top:40px"><b>NOTA PELUNASAN</b></td> -->
</tr>
</table>  
      
<?php     

$akuncw =$_SESSION['warkatp']['akun'];
$sqlcw=  $_SESSION['warkatp']['kode']['sql'];
?>
<p align="center" style="margin:0px;font-family : Arial; "></p>
<p style="font-size:13px;text-align:center;margin:0px; font-family : Arial;"> <!-- KANTOR <?php echo $_SESSION['kantor'];?> --> </p>
<p style="font-size:13px;text-align:center;margin:0px; font-family : Arial;"></p>
<p style="font-size:13px;text-align:center;margin:0px; font-family : Arial;"> </p>
<?php
// Load file koneksi.php
include "./../koneksi.php";
 error_reporting(0); //hide php errors
 $no=0;
$sql = mysqli_query($koneksi, $sqlcw); // Eksekusi/Jalankan query dari variabel 
$row = mysqli_num_rows($sql); // Ambil jumlah data dari hasil eksekusi $sql
if($row > 0){ // Jika jumlah data lebih dari 0 (Berarti jika data ada)
    while($datacw = mysqli_fetch_array($sql)){ // Ambil semua data dari hasil eksekusi $sql
      extract($datacw);
      
      
     }}  
    ?>   

 <!-- <table border="0" style="width: 100%;margin-top: 6px;">
    <tr>
     <td colspan="8" style="font-weight: bold;height: 5px; padding-left: 390px;"><A?php echo"CABANG ".$_SESSION['kantor']; ?></td>    
    </tr>
    </table> -->

<table border="0" style="padding-top: 19px;padding-bottom: 11px;margin-left: 70px;margin-top: 2px;">
<tr> 
<td colspan="3" style="text-align: left; padding-to:6px;"><b>DATA NASABAH</b></td>

<td colspan="3" style="text-align: left;"><b>RINCIAN PELUNASAN</b></td>

</tr>
    
<tr> 
<td style="text-align: left; padding-left:0px; width:11%;">No KTP</td>
<td style="text-align: center; width:1%;">:</td> 
<td style="text-align: left; padding-left: 1px; width:28%;"><?php echo ucwords(strtolower($nik)); ?> </td> 
<td style="text-align: width:16%;">Tanggal Pelunasan</td>
<td style="text-align: center; width:1%;">:</td> 
<td style="text-align: left; padding-left: 1px; width:17%;"><?php echo date('d-M-Y',strtotime($tgl)); ?> </td> 
</tr>

<tr>
<td style="text-align: left; padding-left:0px; width:11%;">Nama Lengkap</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 1px; width:28%;"><?php echo ucwords(strtolower($nama)); ?> </td> 
<td style="text-align: width:16%;">Pokok Pinjaman</td>
<td style="text-align: center; width:1%;">:</td> 
<td style="text-align: left; padding-left: 1px; width:17%;"><?php echo number_format($pokok,0); ?> </td>
</tr>

<tr>
<td style="text-align: left; padding-left:0px; width:11%;">No Telepon</td>
<td style="text-align: center; width:1%;">:</td> 
<td style="text-align: left; padding-left: 1px; width:28%;"><?php echo ucwords(strtolower($nohp)); ?> </td> 
<td style="text-align: width:16%;">Biaya Titip</td>
<td style="text-align: center; width:1%;">:</td> 
<td style="text-align: left; padding-left: 1px; width:17%;"><?php echo number_format($margin,0); ?> </td> 
</tr>

<tr>
<td style="text-align: left; padding-left:0px; width:11%;">Alamat</td>
<td style="text-align: center; width:1%;">:</td> 
<td style="text-align: left; padding-left: 1px; width:28%;"><?php echo ucwords(strtolower($alamat)); ?> </td> 
<td style="text-align: width:16%;">Jumlah</td>
<td style="text-align: center; width:1%;">:</td> 
<td style="text-align: left; padding-left: 1px; width:17%;"><?php echo number_format($pokok+$margin,0); ?></td>
</tr>

</table>

<table border="1" style="margin-left: 70px;margin-top: 1px;width: 90%;">
<tr>

<td style="text-align: center; padding-left: 6px; width:20%;padding: 4px;">Nama Barang</td> <!-- color: white; -->
<td style="text-align: center; padding-left: 6px; width:10%;padding: 4px;">Kondisi</td>
<td style="text-align: center; padding-left: 6px; width:22%;padding: 4px;">No Seri</td> 
<td style="text-align: center; padding-left: 6px; width:25%;padding: 4px;">Kelengkapan</td>

</tr>


    <tr>
    <td style="text-align: center; padding-left: 6px;padding: 4px;"><?php echo $barang; ?></td>
    <td style="text-align: center; padding-left: 6px;padding: 4px;"><?php echo $kondisi; ?></td>
    <td style="text-align: center; padding-left: 6px;padding: 4px;"><?php echo $noseri; ?></td>
    <td style="text-align: center; padding-left: 6px;padding: 4px;"><?php echo ucwords(strtolower($kelengkapan)); ?></td>
    </tr>

</table>

<table border="0" style="padding-top: 19px;padding-bottom: 16px;margin-left: 70px;margin-top: 2px;">

<tr >
<td  rowspan="2" style="text-align: left; padding-left: 6px; width:30%;">
<!-- <a?php echo "<b>KETERANGAN :</b>"."<br>";
echo "<b>1</b>.";
echo wordwrap("Cek kembali barang dan uang anda sebelum "."&nbsp;"."meninggal kan outlet"."<br>\n");
echo "<b>2</b>.";
echo wordwrap("Segala bentuk kerusakan dan kekurangan pada barang atau uang  menjadi tanggung jawab nasabah setelah meninggalkan outlet". "<br>\n");
echo "<b>3</b>.";
echo wordwrap("Barang gadai yg telah melewati batas maksimal masa gadai" ."(45 hari)"." tidak dapat mengklaim garansi"."<br>\n"); ?> -->
</td>

<td style="text-align: center; padding-left: 6px; width:20%;">Dibayar Oleh</td>
<td style="text-align: center; padding-left: 6px; width:20%;">Diterima Oleh</td>    
</tr>

<tr>

<td style="text-align: center; padding-left: 6px;padding-top: 60px; width:20%;"><?php echo ucwords(strtolower($nama)); ?></td>
<td style="text-align: center; padding-left: 6px;padding-top: 60px; width:20%;"><?php echo ucwords(strtolower($usersystem)); ?></td>

</tr>

<!--    <tr>
    <td></td>
    <td></td>
     <td >Samarinda,<A?php echo date('d-m-Y');?></td>    
    </tr> -->               
 
</table>
</div>
</body>

</html>
<?php
$html = ob_get_contents();
ob_end_clean();
        
require '../html2pdf/autoload.php';
$pdf = new Spipu\Html2Pdf\Html2Pdf('P','A4','en');
$pdf->WriteHTML($html);
$pdf->Output('Laporan Tunggakan.pdf', 'D');
?>


<!-- https://www.mynotescode.com/cara-mudah-membuat-laporan-pdf-dengan-php-dan-mysql/ -->