<?php ob_start();
error_reporting(0);
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");
session_start();
if (!isset($_SESSION['id_user'])) {
    die('Anda tidak diijinkan mengakses langsung');
}

?>

<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8'>

    <title>Lembar No Induk</title>
<link rel="stylesheet" href="../../plugins/bootstrap/dist/css/bootstrap.min.css">

</head>
<style>
@page { margin: 30px; }
body { margin: 20px; }
</style>
<body style="font-size: 12px;">
 <div class="col-md-12">
	
	<h5 class="text-center">II. NOMOR INDUK SISWA DALAM BUKU INDUK</h5>
	
	<br>
	 <table style="margin-left: 30px;margin-right:5px"  width="100%" border="1">
      <thead>
       <tr>
		<th width="5%" class="text-center" height="30px" style="background-color:#DCDCDC">NO</th>
		<th width="15%"class="text-center" style="background-color:#DCDCDC">NIS</th>
		<th width="15%" class="text-center" style="background-color:#DCDCDC">NISN</th>
		<th class="text-center" style="background-color:#DCDCDC">NAMA LENGKAP</th>
		<th width="10%" class="text-center" style="background-color:#DCDCDC">JENIS KELAMIN</th>
        <th  width="10%" class="text-center" style="background-color:#DCDCDC">KELAS</th>		
      </tr>	
	  
	</thead>
	 <tbody>
                            <?php
                            $query = mysqli_query($koneksi, "select * from siswa");
                            $no = 0;
                            while ($siswa = mysqli_fetch_array($query)) {
							
                                $no++;
                              
                            ?>
                                <tr>
                                    <td class="text-center"><?= $no; ?></td>
                                    <td class="text-center"><?= $siswa['nis'] ?></td>									
                                    <td class="text-center"><?= $siswa['nisn'] ?></td>
                                    <td>&nbsp;<?= $siswa['nama'] ?></td>
									<td class="text-center"><?= $siswa['jenis_kelamin'] ?></td>
									<td class="text-center"><?= $siswa['id_kelas'] ?></td>
									
									 </tr>
									<?php } ?>
                        </tbody>
    </table>
	</div>
	
</body>
</html>
<?php

$html = ob_get_clean();
require_once '../../vendors/autoload.php';

use Dompdf\Dompdf;

$dompdf = new Dompdf();
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'potrait');
$dompdf->render();
$dompdf->stream("Lembar No Induk.pdf", array("Attachment" => false));

exit(0);
?>