<!-- https://www.malasngoding.com/membuat-cetak-print-laporan-dengan-php/ -->
<!DOCTYPE html>
<html>

	<head>
		<!-- https://stackoverflow-com.translate.goog/questions/1960939/disabling-browser-print-options-headers-footers-margins-from-page?_x_tr_sl=en&_x_tr_tl=id&_x_tr_hl=id&_x_tr_pto=tc 
		
		https://stackoverflow-com.translate.goog/questions/585254/how-to-remove-the-url-from-the-printing-page?_x_tr_sl=en&_x_tr_tl=id&_x_tr_hl=id&_x_tr_pto=tc
		-->
    <title>Print Test</title>
    <style type="text/css" media="print">
    @page 
    {
        size:  auto;   /* auto is the initial value */
        margin: 0mm;  /* this affects the margin in the printer settings */
    }

    html
    {
        background-color: #FFFFFF; 
        margin: 0px;  /* this affects the margin on the html before sending to printer */
    }

    body
    {
        /*border: solid 1px blue ;*/
        margin: 10mm 15mm 10mm 15mm; /* margin you want for the content */
    }
    </style>
   
<style>
   /*https://www.dicoding.com/blog/cara-membuat-table-di-html/*/
        table { margin-top: 2px;
            /*border-collapse: collapse;*/
        }    
        th, td {
         
            font-size: 14px;
            font-family: Arial;
        }
       
    </style>
</head>
<body>
 
	<?php 
    session_start();
    $rekening=  $_SESSION['warkatp']['akun'];
  include '../koneksi.php';                       
$querycw = "SELECT b.tgl as tgl, b.rekening as rekening,a.id as id,a.nik as nik,a.nama as nama,a.alamat as alamat,b.taksasi as taksasi ,a.rtrw as rtrw, a.nohp as nohp,b.plafond as plafond,SUM(c.plafond-c.pokok) AS bakidebet,b.barang as barang,b.jenisbarang as jenisbarang,b.kelengkapan as kelengkapan,b.kondisi as kondisi,b.noseri as noseri,sum(c.plafond-c.pokok)*b.margin/100 as margin,DATE_ADD(b.tgl, INTERVAL b.jangkawaktu MONTH)as jatuh_tempo  from registrasi a left join pinjaman b ON a.id=b.register LEFT JOIN angsuran c ON b.rekening=c.rekening where b.rekening ='".$rekening."'  ";
$queryc       =mysqli_query($koneksi,$querycw);
if(mysqli_num_rows($queryc)){
while ($data = mysqli_fetch_assoc($queryc)) {
  extract($data);
   }}
    ?>   
    <table border="0" style="width: 100%;margin-top: 100px;">
    <tr>
    <td colspan="8" style="font-weight: bold;height: 5px; padding-left: 390px;"><?php echo $_SESSION['kantor']; ?></td>    
    </tr>
    </table>
      
      <div id="printableArea"> 
        <table border="0" style="padding-top: 19px;padding-bottom: 16px;margin-left: 70px;margin-top: 7px; width: 100%;">
            <!-- <table border="0" style="padding-top: 19px;padding-bottom: 16px;margin-left: 70px;margin-top: 120px; width: 100%;"> tanpa nama cabang -->


    <tr>
    <td colspan="3" style="font-weight: bold;height: 30px;">DATA PEMOHON GADAI</td>
    <!-- <td></td>
    <td></td> -->
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td ></td>
    </tr>
<tr> 
<td style="text-align: left; width:197px;">No. Rekening</td>
<td style="width:2px;">:</td>                     
<td style="text-align: left;  width:165px;"><?php echo $rekening; ?> </td> 
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;">Nilai Taksiran</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php echo number_format($taksasi,0); ?></td>
<td ></td>
</tr> 

<tr> 
<td style="text-align: left; width:100px;">No. KTP</td>
<td style="width:2px;">:</td>                     
<td style="text-align: left;  width:165px;"><?php echo $nik; ?> </td> 
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;">Plafond</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php echo number_format($plafond,0); ?></td>
<td ></td>
</tr> 
<tr>
<td style="text-align: left; width:100px;">Nama</td>           
<td style="width:2px;">:</td>
<td style="text-align: left;  width:165px;"><?php echo $nama; ?></td>
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;">Bakidebet</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php echo number_format($bakidebet,0); ?></td>
<td ></td>
</tr>

<tr>
<td style="text-align: left; width:100px;">No. Tlp</td>

<td style="width:2px;">:</td>
<td style="text-align: left;  width:165px;"><?php echo $nohp; ?></td>
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;">Biaya Penitipan</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php echo number_format($margin,0); ?></td>
<td ></td>
</tr>

<tr>
<td style="text-align: left; width:100px;">Alamat</td> 
<td style="width:2px;">:</td>
<td style="text-align: left;  width:165px;"><?php echo $alamat; ?></td>
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;">Tgl Realisasi</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php echo date('d-F-Y',strtotime($tgl)); ?></td>
<td ></td>
</tr>

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

<tr>
<td style="text-align: left; width:100px;">Nama Barang</td>    
<td style="width:2px;">:</td>
<td style="text-align: left;  width:165px;"><?php echo $barang; ?></td>
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;">Perpanjangan ke-1</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php echo date('d-F-Y', strtotime('+15 days', strtotime($tgl))) ; ?></td>
<td ></td>
</tr>

<tr>
<td style="text-align: left; width:100px;">Jenis Barang</td>   
<td style="width:2px;">:</td>
<td style="text-align: left;  width:165px;"><?php echo $jenisbarang; ?></td>
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;">Perpanjangan ke-2</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php echo date('d-F-Y', strtotime('+30 days', strtotime($tgl))); ?></td>
<td ></td>
</tr>

<tr>
<td style="text-align: left; width:100px;">Kelengkapan</td>    
<td style="width:2px;">:</td>
<td style="text-align: left;  width:165px;"><?php echo $kelengkapan; ?></td>
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;"> Pelunasan</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php  ?></td>
<td ></td>
</tr>

<tr>
<td style="text-align: left; width:100px;">Kondisi</td>    
<td style="width:2px;">:</td>
<td style="text-align: left;  width:165px;"><?php echo $kondisi; ?></td>
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;">Tgl Pelunasan</td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php echo date('d-F-Y', strtotime('+45 days', strtotime($tgl))); ?></td>
<td ></td>
</tr>

<tr>
<td style="text-align: left; width:100px;">No Seri</td>    
<td style="width:2px;">:</td>
<td style="text-align: left;  width:165px;"><?php echo $noseri; ?></td>
<td style="width:18px;"></td>
<td style="text-align: left; width:137px;"></td>
<td style="width:2px;">:</td>
<td style="text-align: left; width:135px;"><?php  ?></td>
<td ></td>
</tr>                   

<tr>
    <td style="text-align: left; width:100px;"></td>
    <td style="text-align: left; padding-left:6px; width:5px;"></td>
    <td style="text-align: left; padding-left:6px; width:135px;"></td>
    <td style="text-align: left; padding-left:6px; width:5px;"></td>
    
    
    <td colspan="4" style="text-align: left; padding-left:6px; width:5px;" >Samarinda,<?php echo date('d-F-Y');?></td>
    
    </tr>
</table>
       </div>


<style type="text/css" media="print">
    /* ISO Paper Size 
https://stackoverflow.com/questions/138422/landscape-printing-from-html
    */
@page {
  size: A4 landscape;
}

/* Size in mm */    
@page {
  size: 100mm 200mm landscape;
}

/* Size in inches */    
@page {
  size: 4in 6in landscape;
}
</style>


     
 
	<script>
		window.print();
	</script>
  <div id="Success" class="Content" onload="winClose()">
  <script language="JavaScript" type="text/javascript">
 
  /*window.setTimeout("window.close();",1500)*/
</script>

	
</body>
</html>