<?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: 4px;
            font-size: 13px;
        }
       /* p{ margin-top: 0px;            
        }
        h5{ margin-top: 0px;
        }
        h4{ margin-bottom: 1px;*/
        }
    </style>
   
</head>

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

 <!-- <table border="0">
  <tr>
   
<th ><img src="./../gambar/logommu.png" style="width:745px;height:100px"align="center" /></th>

</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";
 /*include ('../koneksi.php');*/
 error_reporting(0); //hide php errors
/*error_reporting(E_ALL^(E_NOTICE|E_WARNING));
ini_set('display_errors',1);
error_reporting(0);*/
 $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: 68px;">
    <tr>
    <td colspan="8" style="font-weight: bold;height: 5px; padding-left: 590px;"><?php echo" ".$_SESSION['kantor']; ?></td> 
    <!-- <td colspan="8" style="font-weight: bold;height: 5px; padding-left: 390px;"><?php echo"CABANG ".$_SESSION['kantor']; ?></td>  -->   
    </tr>
    </table>

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


    <tr>
    <td colspan="3" style="font-weight: bold;height: 20px;">DATA PEMOHON GADAI</td>
    <!-- <td></td>
    <td></td> -->
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
<tr> 
<td style="text-align: left; padding-left:6px; width:16%;">Rekening</td>
<td style="text-align: center; width:1%;">:</td>                     
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $rekening; ?> </td> 
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;">Nilai Taksiran</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"><?php echo number_format($taksasi,0); ?></td>
</tr>
<tr>
<td style="text-align: left; padding-left:6px; width:16%;">No. KTP</td>
<td style="text-align: center; width:1%;">:</td>                     
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $nik; ?> </td> 
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;">Plafond</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"><?php echo number_format($plafond,0); ?></td>
</tr>  
<tr>
<td style="text-align: left; padding-left:6px; width:16%;">Nama</td>
<td style="text-align: center; width:1%;">:</td>                     
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $nama; ?> </td> 
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;">Bakidebet</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"><?php echo number_format($bakidebet,0); ?></td>
</tr>
<tr>
<td style="text-align: left; padding-left: 6px; width:16%;">No. Tlp</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $nohp; ?></td>
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;">Biaya Penitipan</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"><?php echo number_format($margin,0); ?></td>
</tr>

<tr>
<td style="text-align: left; padding-left: 6px; width:16%;">Alamat</td> 
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $alamat; ?></td>
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;">Tgl Realisasi</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"><?php echo date('d-F-Y',strtotime($tgl)); ?></td>
</tr>



    <tr>
    <td colspan="3" style="font-weight: bold;height: 20px;">DATA BARANG GADAI</td>
    <!-- <td></td>
    <td></td> -->
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>



<tr>
<td style="text-align: left; padding-left: 6px; width:16%;">Nama Barang</td>    
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $barang; ?></td>
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;">Perpanjangan ke-1</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"><?php echo date('d-F-Y', strtotime('+15 days', strtotime($tgl))) ; ?></td>
</tr>

<tr>
<td style="text-align: left; padding-left: 6px; width:16%;">Jenis Barang</td>    
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $jenisbarang; ?></td>
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;">Perpanjangan ke-2</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"><?php echo date('d-F-Y', strtotime('+30 days', strtotime($tgl))); ?></td>
</tr>

<tr>
<td style="text-align: left; padding-left: 6px; width:16%;">Kelengkapan</td>    
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $kelengkapan; ?></td>
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;"> Pelunasan</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"> <?php ?></td>
</tr>
<tr>
<td style="text-align: left; padding-left: 6px; width:16%;">Kondisi</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $kondisi; ?></td>
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;">Tgl Pelunasan</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px;width:12%;"><?php echo date('d-F-Y', strtotime('+45 days', strtotime($tgl))); ?></td>
</tr>
<tr>
<td style="text-align: left; padding-left: 6px; width:16%;">No. Seri</td>
<td style="text-align: center; width:1%;">:</td>
<td style="text-align: left; padding-left: 6px; width:23%;"><?php echo $noseri; ?></td>
<td style="text-align: center; padding-left: 6px; width:3%;"></td>
<td style="text-align: left; padding-left: 6px;width:19%;"></td>
<td style="text-align: center; width:1%;"></td>
<td style="text-align: left; padding-left: 6px;width:12%;"></td>
</tr>


<tr>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <!-- <td></td> -->
    <td colspan="2">Samarinda,<?php echo date('d-m-Y');?></td>
    <td></td>
    
    </tr>                
 
</table>

</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('Warkat Pencairan.pdf', 'D');
?>


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