<?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');
}
$tahun=date('Y');
$ids=$_GET['nis'];

$siswa = fetch($koneksi, 'siswa', ['nis' => $ids]);
$kelas = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM kelas  WHERE id_kelas='$siswa[id_kelas]'"));


?>
<!DOCTYPE html>
<html>

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

    <title>Raport_<?= $siswa['nama'] ?></title>
<link rel="stylesheet" href="../../plugins/bootstrap/dist/css/bootstrap.min.css">
</head>
<style>
@page { margin: 20px; }
body { margin: 20px; }
</style>
<body style="font-size: 13px;">
    
   
    <center>
        <h5><?= strtoupper($setting['sekolah']); ?><br>TRANSKRIP NILAI<br>STANDAR KOMPETENSI UTAMA</h5>
		<p>No Ijazah : <?= $siswa['noijazah'] ?> </p>
    </center>
    <br>
    
    <div class="col-md-14">
	
        <table style="margin-left: 40px;margin-right:10px;font-size:12px"  width="100%">
            <tr>
                <td width="20%">Nama Siswa</td>
                <td width="5%">:</td>
				<td><?= $siswa['nama'] ?></td>
				</tr>
			<tr>
                <td>Tempat, Tanggal Lahir</td>
                <td>:</td>
				<td><?= $siswa['tempat_lahir'] ?>, <?= $siswa['tgl_lahir'] ?></td>
			</tr>
			<tr>
				<td>NIS / NISN</td>
                <td>:</td>
				<td><?= $siswa['nis'] ?> / <?= $siswa['nisn'] ?></td>
            </tr>
			<tr>
				<td>Kompetensi Keahlian</td>
                <td>:</td>
				<td><?= $kelas['nama_pk'] ?></td>
            </tr>
			<tr>
				<td>Lama Belajar</td>
                <td>:</td>
				<td>3 Tahun</td>
            </tr>
        </table>
       
        <br>
 
            <table style="margin-left: 10px;margin-right:10px;font-size:12px" border ="1" width="100%">
                <thead>
                    <tr>
                        <th width="5%" style="text-align:center;height:30px" >No</th>
                        <th style="text-align:center;">Standar Kompetensi Utama</th>
                       <th style="text-align:center;width:10%" >Jumlah<br>Jam</th>
					     <th style="text-align:center;width:10%">Nilai</th>
						  
							   
                    </tr>
                </thead>
                <tbody>
			    
                    
                        <?php
                        $q1 = mysqli_query($koneksi, "SELECT * FROM nilai_sku WHERE nis='$ids'");
                        $no = 0;
                        while ($k = mysqli_fetch_array($q1)) {
                      $sku = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM m_produktif WHERE kode='$k[kode]'"));
						$no++;			
							 
                        ?>
                           
						  
						 <tr>
						  <td style="text-align:center;height:20px" ><?= $no ?> </td>
                           <td style="text-align:justify;" >&nbsp;<?= $sku['sku'] ?> </td>
						   <td style="text-align:center;" ><?= $sku['jjm'] ?> </td>
						   <td style="text-align:center;" ><?= $k['nilai'] ?> </td>
						   
				              </tr>
						<?php } ?>	
                        
                   
                </tbody>
            </table>
           <br><br>
			 <table style="margin-left: 80px;" width="90%">
		<tr>
               <td style="text-align: center" width="33.3%"></td>
                 <td style="text-align: center" width="33.3%"></td>
                <td width="33.3%"><?= $setting['kecamatan'] ?>, <?= $setting['tgl_lulus'] ?></td>
            </tr>
			</table>
			<table style="margin-left: 80px;" width="90%">
            <tr>
                <td></td>
			<td></td>
				 <td>Kepala Sekolah,
				 
				<br><br><br><br><br>
				 <b><u><?= $setting['kepsek'] ?></u> </b>
				 <p>NIP. <?= $setting['nip'] ?></p>
				 </td>
            </tr>
			
		<tr>
               <td width="33.3%"></td>
                 <td  width="33.3%"> </td>
                <td  width="33.3%"></td>
            </tr>
			</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', 'portrait');
$dompdf->render();
$dompdf->stream("Raport_" . $siswa['nama'] . ".pdf", array("Attachment" => false));
exit(0);
?>