<!-- // created by : KuduSinau_Hendrik_081275532220 (TERIMAKASIH UNTUK MENDAPATKAN KEBERKAHAN, DENGAN TIDAK MERUBAH NAMA HAK CIPTA, PLAGIAT, DAN TIDAK MEMPERJUALBELIKAN APLIKASI INI, SEMOGA KITA SEMUA MENDAPAT MANFAAT DAN KEBERKAHAN DARI APLIKASI INI)
// created by : KuduSinau_Hendrik_081275532220 (UNTUK MASUKAN DAN SARAN SERTA PENGEMBANGAN BISA MENGHUBUNGI NOMOR) -->

<script>
    window.onload = window.print();
</script>
<style>
    table {
        background-color: white;
        border-collapse: collapse;
        border-color: black;
    }

    head>tr {
        background-color: white;
        color: black;
        border-color: black;
    }

    head>tr>th {
        background-color: black;
        color: black;
        padding: 10px;
        border-color: black;
    }

    th,
    td {
        background-color: white;
        padding: 2px;
        border-color: black;

    }

    th {
        background-color: white;
        color: black;
        text-align: center;
        border-color: black;
    }

    body {
        background-color: white;
        font-family: 'arial';
        font-size: 10pt;
        border-color: black;
    }
</style>
<style type="text/css" media="print">
    @page {
        size: 210mm 297mm;
        margin: 8mm 10mm 10mm 10mm;
    }
</style>

<body onload="hide_loading();">
    <div class="loading overlay">
        <div class="lds-spinner">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
    <hr style="border: 1px black solid;">
    <table width="95%" border="0" align="center" style="border-collapse:collapse; margin-left: 0.2in;">
        <tbody>
            <tr>
                <td width="12%">Nama Siswa</td>
                <td width="1%">:</td>
                <td width="40%" class="tbl"><?php if (!is_null($students)) {
                                                echo $students['nama_siswa'];
                                            } ?></td>
                <td width="16%">Nama Madrasah</td>
                <td width="1%">:</td>
                <td width="30%" class="tbl"><?= $nmJenjang['sgkt_jenjang'] . $nmStatus['sgkt_status'] . ' ' . strtoupper($nmLembaga['nm_lembaga']); ?></td>
            </tr>
            <tr>
                <td>NIS</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    echo $students['nism_siswa'];
                                } ?></td>
                <td>Kelas / Semester</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students) and !is_null($waktu)) {
                                    echo $students['kelas'] . ' / Semester ' . $waktu['semester'];
                                } ?></td>
            </tr>
            <tr>
                <td>NISN</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    echo $students['nisn_siswa'];
                                } ?></td>
                <td>Tahun Pelajaran</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    if ($waktu['semester'] == 'Ganjil') {
                                        echo $waktu['tahun'] . ' / ' . ($waktu['tahun'] + 1);
                                    } elseif ($waktu['semester'] == 'Genap') {
                                        echo ($waktu['tahun'] - 1) . ' / ' . $waktu['tahun'];
                                    }
                                } ?></td>
            </tr>
        </tbody>
    </table>
    <hr style="border: 1px black solid;">
    <p>
    <h4 style="text-align: center; font-weight: bold">CAPAIAN HASIL BELAJAR</h4>
    </p>
    <p style="text-align: justify; text-indent: 0.25in; font-weight: bold;">A. SIKAP</p>
    <p style="text-align: justify; text-indent: 0.5in; font-weight: bold;">1. Sikap Spiritual</p>
    <table border="1" style="border-collapse:collapse; margin-left: 0.5in;" width="87%">
        <tbody>
            <tr height="50px">
                <td width="15%" align="center" style="font-weight: bold;">Predikat</td>
                <td width="85%" align="center" style="font-weight: bold;">Deskripsi</td>
            </tr>
            <tr height="100px">
                <td align="center" style="font-weight: bold;"><?php if (!is_null($sikap)) {
                                                                    echo $sikap['predikat_spiritual'];
                                                                } ?></td>
                <td align="justify" style="word-wrap: break-word; max-width:150px; padding: 5px 5px;"><?php if (!is_null($sikap)) {
                                                                                                            echo  $sikap['deskripsi_spiritual'];
                                                                                                        } ?></td>
            </tr>
        </tbody>
    </table>
    <br><br>
    <p style="text-align: justify; text-indent: 0.5in; font-weight: bold;">2. Sikap Sosial</p>
    <table border="1" style="border-collapse:collapse; margin-left: 0.5in;" width="87%">
        <tbody>
            <tr height="50px">
                <td width="15%" align="center" style="font-weight: bold;">Predikat</td>
                <td width="85%" align="center" style="font-weight: bold;">Deskripsi</td>
            </tr>
            <tr height="100px">
                <td align="center" style="font-weight: bold;"><?php if (!is_null($sikap)) {
                                                                    echo  $sikap['predikat_sosial'];
                                                                } ?></td>
                <td align="justify" style="word-wrap: break-word; max-width:150px; padding: 5px 5px;"><?php if (!is_null($sikap)) {
                                                                                                            echo  $sikap['deskripsi_sosial'];
                                                                                                        } ?></td>
            </tr>
        </tbody>
    </table>
    <div style="page-break-after:always;"></div>
    <hr style="border: 1px black solid;">
    <table width="95%" border="0" align="center" style="border-collapse:collapse; margin-left: 0.2in;">
        <tbody>
            <tr>
                <td width="12%">Nama Siswa</td>
                <td width="1%">:</td>
                <td width="40%" class="tbl"><?php if (!is_null($students)) {
                                                echo $students['nama_siswa'];
                                            } ?></td>
                <td width="16%">Nama Madrasah</td>
                <td width="1%">:</td>
                <td width="30%" class="tbl"><?= $nmJenjang['sgkt_jenjang'] . $nmStatus['sgkt_status'] . ' ' . strtoupper($nmLembaga['nm_lembaga']); ?></td>
            </tr>
            <tr>
                <td>NIS</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    echo $students['nism_siswa'];
                                } ?></td>
                <td>Kelas / Semester</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students) and !is_null($waktu)) {
                                    echo $students['kelas'] . ' / Semester ' . $waktu['semester'];
                                } ?></td>
            </tr>
            <tr>
                <td>NISN</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    echo $students['nisn_siswa'];
                                } ?></td>
                <td>Tahun Pelajaran</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    if ($waktu['semester'] == 'Ganjil') {
                                        echo $waktu['tahun'] . ' / ' . ($waktu['tahun'] + 1);
                                    } elseif ($waktu['semester'] == 'Genap') {
                                        echo ($waktu['tahun'] - 1) . ' / ' . $waktu['tahun'];
                                    }
                                } ?></td>
            </tr>
        </tbody>
    </table>
    <hr style="border: 1px black solid;">
    <?php if ($nmLembaga['kd_jenjang'] == 2) { ?>
        <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">B. PENGETAHUAN DAN KETERAMPILAN</p>
        <p style="text-align: justify; text-indent: 0.45in; font-weight: bold">Kriteria Ketuntasan Minimal : <?= $kkm; ?></p>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <thead>
                <tr height="25px">
                    <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                    <td width="45%" rowspan="2" style="text-align: center; font-weight: bold">Mata Pelajaran</td>
                    <td width="25%" colspan="2" style="text-align: center; font-weight: bold">Pengetahuan</td>
                    <td width="25%" colspan="2" style="text-align: center; font-weight: bold">Keterampilan</td>
                </tr>
                <tr height="25px">
                    <td width="12.5%" style="text-align: center; font-weight: bold">Nilai</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Predikat</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Nilai</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Predikat</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK A</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Agama Islam :</td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                </tr>
                <tr>
                    <?php if (($students['tingkat'] == 'IV') || ($students['tingkat'] == 'V') || ($students['tingkat'] == 'VI')) { ?>
                        <td rowspan="4" style="text-align: center; "></td>
                    <?php } else { ?>
                        <td rowspan="3" style="text-align: center; "></td>
                    <?php } ?>
                    <td style="text-align: left; padding: 0px 5px;">a. AL-Qur'an Hadis</td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">b. Akidah Akhlak</td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">c. Fikih</td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <?php if (($students['tingkat'] == 'III') || ($students['tingkat'] == 'IV') || ($students['tingkat'] == 'V') || ($students['tingkat'] == 'VI')) { ?>
                    <tr>
                        <td style="text-align: left; padding: 0px 5px;">d. Sejarah Kebudayaan Islam</td>
                        <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                                echo $ski['nilaip_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                                echo $ski['predikatp_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                                echo $ski['nilaik_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                                echo $ski['predikatk_mapel'];
                                                            } ?></td>
                    </tr>
                <?php } ?>
                <tr>
                    <td style="text-align: center; ">2. </td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Pancasila dan Kewarganegaraan</td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Indonesia</td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Arab</td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">5. </td>
                    <td style="text-align: left; padding: 0px 5px;">Matematika</td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <?php if (($students['tingkat'] == 'IV') || ($students['tingkat'] == 'V') || ($students['tingkat'] == 'VI')) { ?>
                    <tr>
                        <td style="text-align: center; ">6. </td>
                        <td style="text-align: left; padding: 0px 5px;">Ilmu Pengetahuan Alam</td>
                        <td style="text-align: center; "><?php if (!is_null($ipa)) {
                                                                echo $ipa['nilaip_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ipa)) {
                                                                echo $ipa['predikatp_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ipa)) {
                                                                echo $ipa['nilaik_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ipa)) {
                                                                echo $ipa['predikatk_mapel'];
                                                            } ?></td>
                    </tr>
                    <tr>
                        <td style="text-align: center; ">7. </td>
                        <td style="text-align: left; padding: 0px 5px;">Ilmu Pengetahuan Sosial</td>
                        <td style="text-align: center; "><?php if (!is_null($ips)) {
                                                                echo $ips['nilaip_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ips)) {
                                                                echo $ips['predikatp_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ips)) {
                                                                echo $ips['nilaik_mapel'];
                                                            } ?></td>
                        <td style="text-align: center; "><?php if (!is_null($ips)) {
                                                                echo $ips['predikatk_mapel'];
                                                            } ?></td>
                    </tr>
                <?php } ?>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK B</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Seni Budaya dan Prakarya</td>
                    <td style="text-align: center; "><?php if (!is_null($sbp)) {
                                                            echo $sbp['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sbp)) {
                                                            echo $sbp['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sbp)) {
                                                            echo $sbp['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sbp)) {
                                                            echo $sbp['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Jasmani, Olah Raga dan Kesehatan</td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;">Muatan Lokal<sup>*)</sup></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                </tr>
                <?php $i = 'a';
                foreach ($mulok as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "></td>
                        <td style="text-align: left; padding: 0px 5px;"><?php echo $i . '. ' . ucwords(strtolower($ml['nama_mapel']));
                                                                        $i++; ?>
                        </td>
                        <td style="text-align: center; "><?= $ml['nilaip_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['predikatp_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['nilaik_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['predikatk_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr height="30px">
                    <td colspan="2" style="text-align: left; text-indent: 0.25in; font-weight: bold">JUMLAH</td>
                    <td style="text-align: center; font-weight: bold"><?php if (!is_null($jumlahnilaip)) {
                                                                            echo $jumlahnilaip;
                                                                        } ?></td>
                    <td style="text-align: center; font-weight: bold"></td>
                    <td style="text-align: center; font-weight: bold"><?php if (!is_null($jumlahnilaik)) {
                                                                            echo $jumlahnilaik;
                                                                        } ?></td>
                    <td style="text-align: center; font-weight: bold"></td>
                </tr>
            </tbody>
        </table>
    <?php } elseif ($nmLembaga['kd_jenjang'] == 3) { ?>
        <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">B. PENGETAHUAN DAN KETERAMPILAN</p>
        <p style="text-align: justify; text-indent: 0.45in; font-weight: bold">Kriteria Ketuntasan Minimal : <?= $kkm; ?></p>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <thead>
                <tr height="25px">
                    <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                    <td width="45%" rowspan="2" style="text-align: center; font-weight: bold">Mata Pelajaran</td>
                    <td width="25%" colspan="2" style="text-align: center; font-weight: bold">Pengetahuan</td>
                    <td width="25%" colspan="2" style="text-align: center; font-weight: bold">Keterampilan</td>
                </tr>
                <tr height="25px">
                    <td width="12.5%" style="text-align: center; font-weight: bold">Nilai</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Predikat</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Nilai</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Predikat</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK A</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Agama Islam :</td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                </tr>
                <tr>
                    <td rowspan="4" style="text-align: center; "></td>
                    <td style="text-align: left; padding: 0px 5px;">a. AL-Qur'an Hadis</td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">b. Akidah Akhlak</td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">c. Fikih</td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">d. Sejarah Kebudayaan Islam</td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2. </td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Pancasila dan Kewarganegaraan</td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Indonesia</td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Arab</td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">5. </td>
                    <td style="text-align: left; padding: 0px 5px;">Matematika</td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">6. </td>
                    <td style="text-align: left; padding: 0px 5px;">Ilmu Pengetahuan Alam</td>
                    <td style="text-align: center; "><?php if (!is_null($ipa)) {
                                                            echo $ipa['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ipa)) {
                                                            echo $ipa['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ipa)) {
                                                            echo $ipa['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ipa)) {
                                                            echo $ipa['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">7. </td>
                    <td style="text-align: left; padding: 0px 5px;">Ilmu Pengetahuan Sosial</td>
                    <td style="text-align: center; "><?php if (!is_null($ips)) {
                                                            echo $ips['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ips)) {
                                                            echo $ips['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ips)) {
                                                            echo $ips['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ips)) {
                                                            echo $ips['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">8. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Inggris</td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK B</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Seni Budaya</td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Jasmani, Olah Raga dan Kesehatan</td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;"><?php if (!is_null($informatika)) {
                                                                        echo $informatika['nama_mapel'];
                                                                    } else if (!is_null($pra)) {
                                                                        echo $pra['nama_mapel'];
                                                                    } else if (!is_null($informatika) and !is_null($pra)) {
                                                                    } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($informatika)) {
                                                            echo $informatika['nilaip_mapel'];
                                                        } else if (!is_null($pra)) {
                                                            echo $pra['nilaip_mapel'];
                                                        } else if (!is_null($informatika) and !is_null($pra)) {
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($informatika)) {
                                                            echo $informatika['predikatp_mapel'];
                                                        } else if (!is_null($pra)) {
                                                            echo $pra['predikatp_mapel'];
                                                        } else if (!is_null($informatika) and !is_null($pra)) {
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($informatika)) {
                                                            echo $informatika['nilaik_mapel'];
                                                        } else if (!is_null($pra)) {
                                                            echo $pra['nilaik_mapel'];
                                                        } else if (!is_null($informatika) and !is_null($pra)) {
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($informatika)) {
                                                            echo $informatika['predikatk_mapel'];
                                                        } else if (!is_null($pra)) {
                                                            echo $pra['predikatk_mapel'];
                                                        } else if (!is_null($informatika) and !is_null($pra)) {
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4.</td>
                    <td style="text-align: left; padding: 0px 5px;">Muatan Lokal<sup>*)</sup></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                </tr>
                <?php $i = 'a';
                foreach ($mulok as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "></td>
                        <td style="text-align: left; padding: 0px 5px;"><?php echo $i . '. ' . ucwords(strtolower($ml['nama_mapel']));
                                                                        $i++; ?>
                        </td>
                        <td style="text-align: center; "><?= $ml['nilaip_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['predikatp_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['nilaik_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['predikatk_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr height="30px">
                    <td colspan="2" style="text-align: left; text-indent: 0.25in; font-weight: bold">JUMLAH</td>
                    <td style="text-align: center; font-weight: bold"><?php if (!is_null($jumlahnilaip)) {
                                                                            echo $jumlahnilaip;
                                                                        } ?></td>
                    <td style="text-align: center; font-weight: bold"></td>
                    <td style="text-align: center; font-weight: bold"><?php if (!is_null($jumlahnilaik)) {
                                                                            echo $jumlahnilaik;
                                                                        } ?></td>
                    <td style="text-align: center; font-weight: bold"></td>
                </tr>
            </tbody>
        </table>
    <?php } elseif ($nmLembaga['kd_jenjang'] == 4) { ?>
        <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">B. PENGETAHUAN DAN KETERAMPILAN</p>
        <p style="text-align: justify; text-indent: 0.45in; font-weight: bold">Kriteria Ketuntasan Minimal : <?= $kkm; ?></p>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <thead>
                <tr height="25px">
                    <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                    <td width="45%" rowspan="2" style="text-align: center; font-weight: bold">Mata Pelajaran</td>
                    <td width="25%" colspan="2" style="text-align: center; font-weight: bold">Pengetahuan</td>
                    <td width="25%" colspan="2" style="text-align: center; font-weight: bold">Keterampilan</td>
                </tr>
                <tr height="25px">
                    <td width="12.5%" style="text-align: center; font-weight: bold">Nilai</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Predikat</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Nilai</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Predikat</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK A (UMUM)</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Agama Islam :</td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                </tr>
                <tr>
                    <td rowspan="4" style="text-align: center; "></td>
                    <td style="text-align: left; padding: 0px 5px;">a. AL-Qur'an Hadis</td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">b. Akidah Akhlak</td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">c. Fikih</td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">d. Sejarah Kebudayaan Islam</td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2. </td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Pancasila dan Kewarganegaraan</td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Indonesia</td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Arab</td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">5. </td>
                    <td style="text-align: left; padding: 0px 5px;">Matematika</td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">6. </td>
                    <td style="text-align: left; padding: 0px 5px;">Sejarah Indonesia</td>
                    <td style="text-align: center; "><?php if (!is_null($sejindo)) {
                                                            echo $sejindo['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sejindo)) {
                                                            echo $sejindo['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sejindo)) {
                                                            echo $sejindo['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sejindo)) {
                                                            echo $sejindo['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">7. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Inggris</td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK B (UMUM)</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Seni Budaya</td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Jasmani, Olah Raga dan Kesehatan</td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;">Prakarya dan Kewirausahaan</td>
                    <td style="text-align: center; "><?php if (!is_null($pradkwr)) {
                                                            echo $pradkwr['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pradkwr)) {
                                                            echo $pradkwr['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pradkwr)) {
                                                            echo $pradkwr['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pradkwr)) {
                                                            echo $pradkwr['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4.</td>
                    <td style="text-align: left; padding: 0px 5px;">Muatan Lokal<sup>*)</sup></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                </tr>
                <?php $i = 'a';
                foreach ($mulok as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "></td>
                        <td style="text-align: left; padding: 0px 5px;"><?php echo $i . '. ' . ucwords(strtolower($ml['nama_mapel']));
                                                                        $i++; ?>
                        </td>
                        <td style="text-align: center; "><?= $ml['nilaip_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['predikatp_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['nilaik_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['predikatk_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK C (PEMINATAN)</td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">Peminatan Akademik :</td>
                </tr>
                <?php $i = 1;
                foreach ($cpeminatan as $cpm) :
                ?>
                    <tr>
                        <td style="text-align: center; "><?= $i . '.';
                                                            $i++; ?></td>
                        <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($cpm['nama_mapel'])); ?></td>
                        <td style="text-align: center; "><?= $cpm['nilaip_mapel']; ?></td>
                        <td style="text-align: center; "><?= $cpm['predikatp_mapel']; ?></td>
                        <td style="text-align: center; "><?= $cpm['nilaik_mapel']; ?></td>
                        <td style="text-align: center; "><?= $cpm['predikatk_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">Mata Pelajaran Pilihan :</td>
                </tr>
                <?php $i = 1;
                foreach ($clintasminat as $clm) :
                ?>
                    <tr>
                        <td style="text-align: center; "><?= $i . '.';
                                                            $i++; ?></td>
                        <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($clm['nama_mapel'])); ?></td>
                        <td style="text-align: center; "><?= $clm['nilaip_mapel']; ?></td>
                        <td style="text-align: center; "><?= $clm['predikatp_mapel']; ?></td>
                        <td style="text-align: center; "><?= $clm['nilaik_mapel']; ?></td>
                        <td style="text-align: center; "><?= $clm['predikatk_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr height="30px">
                    <td colspan="2" style="text-align: left; text-indent: 0.25in; font-weight: bold">JUMLAH</td>
                    <td style="text-align: center; font-weight: bold"><?php if (!is_null($jumlahnilaip)) {
                                                                            echo $jumlahnilaip;
                                                                        } ?></td>
                    <td style="text-align: center; font-weight: bold"></td>
                    <td style="text-align: center; font-weight: bold"><?php if (!is_null($jumlahnilaik)) {
                                                                            echo $jumlahnilaik;
                                                                        } ?></td>
                    <td style="text-align: center; font-weight: bold"></td>
                </tr>
            </tbody>
        </table>
    <?php } elseif ($nmLembaga['kd_jenjang'] == 5) { ?>
        <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">B. PENGETAHUAN DAN KETERAMPILAN</p>
        <p style="text-align: justify; text-indent: 0.45in; font-weight: bold">Kriteria Ketuntasan Minimal : <?= $kkm; ?></p>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <thead>
                <tr height="25px">
                    <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                    <td width="45%" rowspan="2" style="text-align: center; font-weight: bold">Mata Pelajaran</td>
                    <td width="25%" colspan="2" style="text-align: center; font-weight: bold">Pengetahuan</td>
                    <td width="25%" colspan="2" style="text-align: center; font-weight: bold">Keterampilan</td>
                </tr>
                <tr height="25px">
                    <td width="12.5%" style="text-align: center; font-weight: bold">Nilai</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Predikat</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Nilai</td>
                    <td width="12.5%" style="text-align: center; font-weight: bold">Predikat</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK A (UMUM)</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Agama Islam :</td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                </tr>
                <tr>
                    <td rowspan="4" style="text-align: center; "></td>
                    <td style="text-align: left; padding: 0px 5px;">a. AL-Qur'an Hadis</td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($quran)) {
                                                            echo $quran['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">b. Akidah Akhlak</td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($akidah)) {
                                                            echo $akidah['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">c. Fikih</td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($fikih)) {
                                                            echo $fikih['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">d. Sejarah Kebudayaan Islam</td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($ski)) {
                                                            echo $ski['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2. </td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Pancasila dan Kewarganegaraan</td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pkn)) {
                                                            echo $pkn['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Indonesia</td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_indonesia)) {
                                                            echo $b_indonesia['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Arab</td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_arab)) {
                                                            echo $b_arab['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">5. </td>
                    <td style="text-align: left; padding: 0px 5px;">Matematika</td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($mtk)) {
                                                            echo $mtk['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">6. </td>
                    <td style="text-align: left; padding: 0px 5px;">Sejarah Indonesia</td>
                    <td style="text-align: center; "><?php if (!is_null($sejindo)) {
                                                            echo $sejindo['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sejindo)) {
                                                            echo $sejindo['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sejindo)) {
                                                            echo $sejindo['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($sejindo)) {
                                                            echo $sejindo['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">7. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Inggris</td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($b_inggris)) {
                                                            echo $b_inggris['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK B (UMUM)</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Seni Budaya</td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($senbud)) {
                                                            echo $senbud['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Jasmani, Olah Raga dan Kesehatan</td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pjok)) {
                                                            echo $pjok['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;">Prakarya dan Kewirausahaan</td>
                    <td style="text-align: center; "><?php if (!is_null($pradkwr)) {
                                                            echo $pradkwr['nilaip_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pradkwr)) {
                                                            echo $pradkwr['predikatp_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pradkwr)) {
                                                            echo $pradkwr['nilaik_mapel'];
                                                        } ?></td>
                    <td style="text-align: center; "><?php if (!is_null($pradkwr)) {
                                                            echo $pradkwr['predikatk_mapel'];
                                                        } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4.</td>
                    <td style="text-align: left; padding: 0px 5px;">Muatan Lokal<sup>*)</sup></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                    <td style="text-align: center; "></td>
                </tr>
                <?php $i = 'a';
                foreach ($mulok as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "></td>
                        <td style="text-align: left; padding: 0px 5px;"><?php echo $i . '. ' . ucwords(strtolower($ml['nama_mapel']));
                                                                        $i++; ?>
                        </td>
                        <td style="text-align: center; "><?= $ml['nilaip_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['predikatp_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['nilaik_mapel']; ?></td>
                        <td style="text-align: center; "><?= $ml['predikatk_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr>
                    <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK C (PEMINATAN)</td>
                </tr>

                <?php if (($students['tingkat'] == 'X') || ($students['tingkat'] == 'XI')) { ?>
                    <tr>
                        <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">C1 Dasar Bidang Keahlian :</td>
                    </tr>
                    <?php $i = 1;
                    foreach ($cdbk as $cb) :
                    ?>
                        <tr>
                            <td style="text-align: center; "><?= $i . '.';
                                                                $i++; ?></td>
                            <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($cb['nama_mapel'])); ?></td>
                            <td style="text-align: center; "><?= $cb['nilaip_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cb['predikatp_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cb['nilaik_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cb['predikatk_mapel']; ?></td>
                        </tr>
                    <?php
                    endforeach;
                    ?>
                <?php } ?>
                <?php if ($students['tingkat'] == 'X') { ?>
                    <tr>
                        <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">C2 Dasar Program Keahlian :</td>
                    </tr>
                    <?php $i = 1;
                    foreach ($cdpk as $cd) :
                    ?>
                        <tr>
                            <td style="text-align: center; "><?= $i . '.';
                                                                $i++; ?></td>
                            <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($cd['nama_mapel'])); ?></td>
                            <td style="text-align: center; "><?= $cd['nilaip_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cd['predikatp_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cd['nilaik_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cd['predikatk_mapel']; ?></td>
                        </tr>
                    <?php
                    endforeach;
                    ?>
                <?php } ?>
                <?php if (($students['tingkat'] == 'XI') || ($students['tingkat'] == 'XII')) { ?>
                    <tr>
                        <td width="100%" align="center" colspan="6" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">C3 Paket Keahlian :</td>
                    </tr>
                    <?php $i = 1;
                    foreach ($cpk as $cp) :
                    ?>
                        <tr>
                            <td style="text-align: center; "><?= $i . '.';
                                                                $i++; ?></td>
                            <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($cp['nama_mapel'])); ?></td>
                            <td style="text-align: center; "><?= $cp['nilaip_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cp['predikatp_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cp['nilaik_mapel']; ?></td>
                            <td style="text-align: center; "><?= $cp['predikatk_mapel']; ?></td>
                        </tr>
                    <?php
                    endforeach;
                    ?>
                <?php } ?>
                <tr height="30px">
                    <td colspan="2" style="text-align: left; text-indent: 0.25in; font-weight: bold">JUMLAH</td>
                    <td style="text-align: center; font-weight: bold"><?php if (!is_null($jumlahnilaip)) {
                                                                            echo $jumlahnilaip;
                                                                        } ?></td>
                    <td style="text-align: center; font-weight: bold"></td>
                    <td style="text-align: center; font-weight: bold"><?php if (!is_null($jumlahnilaik)) {
                                                                            echo $jumlahnilaik;
                                                                        } ?></td>
                    <td style="text-align: center; font-weight: bold"></td>
                </tr>
            </tbody>
        </table>
    <?php } ?>
    <small style="margin-left: 0.4in;">*)Jika ada</small><br><br>
    <small style="text-align: justify; margin-left: 0.4in; font-weight: bold">Tabel Predikat :</small>
    <table border="1" align="center" style="border-collapse:collapse; margin-left: 0.4in;" width="50%">
        <thead>
            <tr>
                <td width="20%" rowspan="2" style="text-align: center; font-weight: bold">KKM</td>
                <td width="80%" colspan="4" style="text-align: center; font-weight: bold">Predikat</td>
            </tr>
            <tr>
                <td width="20%" style="text-align: center; font-weight: bold">D</td>
                <td width="20%" style="text-align: center; font-weight: bold">C</td>
                <td width="20%" style="text-align: center; font-weight: bold">B</td>
                <td width="20%" style="text-align: center; font-weight: bold">A</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td width="20%" style="text-align: center;"><?= $kkm; ?></td>
                <td width="20%" style="text-align: center;"><?= $d; ?></td>
                <td width="20%" style="text-align: center;"><?= $c; ?></td>
                <td width="20%" style="text-align: center;"><?= $b; ?></td>
                <td width="20%" style="text-align: center;"><?= $a; ?></td>
            </tr>
        </tbody>
    </table>
    <div style="page-break-after:always;"></div>
    <hr style="border: 1px black solid;">
    <table width="95%" border="0" align="center" style="border-collapse:collapse; margin-left: 0.2in;">
        <tbody>
            <tr>
                <td width="12%">Nama Siswa</td>
                <td width="1%">:</td>
                <td width="40%" class="tbl"><?php if (!is_null($students)) {
                                                echo $students['nama_siswa'];
                                            } ?></td>
                <td width="16%">Nama Madrasah</td>
                <td width="1%">:</td>
                <td width="30%" class="tbl"><?= $nmJenjang['sgkt_jenjang'] . $nmStatus['sgkt_status'] . ' ' . strtoupper($nmLembaga['nm_lembaga']); ?></td>
            </tr>
            <tr>
                <td>NIS</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    echo $students['nism_siswa'];
                                } ?></td>
                <td>Kelas / Semester</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students) and !is_null($waktu)) {
                                    echo $students['kelas'] . ' / Semester ' . $waktu['semester'];
                                } ?></td>
            </tr>
            <tr>
                <td>NISN</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    echo $students['nisn_siswa'];
                                } ?></td>
                <td>Tahun Pelajaran</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    if ($waktu['semester'] == 'Ganjil') {
                                        echo $waktu['tahun'] . ' / ' . ($waktu['tahun'] + 1);
                                    } elseif ($waktu['semester'] == 'Genap') {
                                        echo ($waktu['tahun'] - 1) . ' / ' . $waktu['tahun'];
                                    }
                                } ?></td>
            </tr>
        </tbody>
    </table>
    <hr style="border: 1px black solid;">
    <?php if ($nmLembaga['kd_jenjang'] == 2) { ?>
        <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">C. DESKRIPSI PENGETAHUAN DAN KETERAMPILAN</p>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <thead>
                <tr height="50px">
                    <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                    <td width="30%" rowspan="2" style="text-align: center; font-weight: bold">Mata Pelajaran</td>
                    <td width="32.5%" style="text-align: center; font-weight: bold">Pengetahuan</td>
                    <td width="32.5%" style="text-align: center; font-weight: bold">Keterampilan</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK A</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Agama Islam :</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <tr>
                    <?php if (($students['tingkat'] == 'III') || ($students['tingkat'] == 'IV') || ($students['tingkat'] == 'V') || ($students['tingkat'] == 'VI')) { ?>
                        <td rowspan="4" style="text-align: center; "></td>
                    <?php } else { ?>
                        <td rowspan="3" style="text-align: center; "></td>
                    <?php } ?>
                    <td style="text-align: left; padding: 0px 5px;">a. AL-Qur'an Hadis</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($quran)) {
                                                                                                                                    echo $quran['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($quran)) {
                                                                                                                                    echo $quran['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">b. Akidah Akhlak</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($akidah)) {
                                                                                                                                    echo $akidah['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($akidah)) {
                                                                                                                                    echo $akidah['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">c. Fikih</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($fikih)) {
                                                                                                                                    echo $fikih['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($fikih)) {
                                                                                                                                    echo $fikih['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <?php if (($students['tingkat'] == 'III') || ($students['tingkat'] == 'IV') || ($students['tingkat'] == 'V') || ($students['tingkat'] == 'VI')) { ?>
                    <tr>
                        <td style="text-align: left; padding: 0px 5px;">d. Sejarah Kebudayaan Islam</td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ski)) {
                                                                                                                                        echo $ski['deskripsip_mapel'];
                                                                                                                                    } ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ski)) {
                                                                                                                                        echo $ski['deskripsik_mapel'];
                                                                                                                                    } ?></td>
                    </tr>
                <?php } ?>
                <tr>
                    <td style="text-align: center; ">2. </td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Pancasila dan Kewarganegaraan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pkn)) {
                                                                                                                                    echo $pkn['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pkn)) {
                                                                                                                                    echo $pkn['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Indonesia</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_indonesia)) {
                                                                                                                                    echo $b_indonesia['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_indonesia)) {
                                                                                                                                    echo $b_indonesia['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Arab</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_arab)) {
                                                                                                                                    echo $b_arab['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_arab)) {
                                                                                                                                    echo $b_arab['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">5. </td>
                    <td style="text-align: left; padding: 0px 5px;">Matematika</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($mtk)) {
                                                                                                                                    echo $mtk['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($mtk)) {
                                                                                                                                    echo $mtk['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">6. </td>
                    <td style="text-align: left; padding: 0px 5px;">Ilmu Pengetahuan Alam</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ipa)) {
                                                                                                                                    echo $ipa['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ipa)) {
                                                                                                                                    echo $ipa['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">7. </td>
                    <td style="text-align: left; padding: 0px 5px;">Ilmu Pengetahuan Sosial</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ips)) {
                                                                                                                                    echo $ips['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ips)) {
                                                                                                                                    echo $ips['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK B</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Seni Budaya dan Prakarya</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($sbp)) {
                                                                                                                                    echo $sbp['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($sbp)) {
                                                                                                                                    echo $sbp['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Jasmani, Olah Raga dan Kesehatan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pjok)) {
                                                                                                                                    echo $pjok['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pjok)) {
                                                                                                                                    echo $pjok['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;">Muatan Lokal<sup>*)</sup></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <?php $i = 'a';
                foreach ($mulok as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "></td>
                        <td style="text-align: left; padding: 0px 5px;"><?php echo $i . '. ' . ucwords(strtolower($ml['nama_mapel']));
                                                                        $i++; ?>
                        </td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
            </tbody>
        </table>
    <?php } elseif ($nmLembaga['kd_jenjang'] == 3) { ?>
        <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">C. DESKRIPSI PENGETAHUAN DAN KETERAMPILAN</p>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <thead>
                <tr height="50px">
                    <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                    <td width="30%" rowspan="2" style="text-align: center; font-weight: bold">Mata Pelajaran</td>
                    <td width="32.5%" style="text-align: center; font-weight: bold">Pengetahuan</td>
                    <td width="32.5%" style="text-align: center; font-weight: bold">Keterampilan</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK A</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Agama Islam :</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <tr>
                    <td rowspan="4" style="text-align: center; "></td>
                    <td style="text-align: left; padding: 0px 5px;">a. AL-Qur'an Hadis</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($quran)) {
                                                                                                                                    echo $quran['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($quran)) {
                                                                                                                                    echo $quran['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">b. Akidah Akhlak</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($akidah)) {
                                                                                                                                    echo $akidah['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($akidah)) {
                                                                                                                                    echo $akidah['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">c. Fikih</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($fikih)) {
                                                                                                                                    echo $fikih['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($fikih)) {
                                                                                                                                    echo $fikih['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">d. Sejarah Kebudayaan Islam</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ski)) {
                                                                                                                                    echo $ski['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ski)) {
                                                                                                                                    echo $ski['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2. </td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Pancasila dan Kewarganegaraan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pkn)) {
                                                                                                                                    echo $pkn['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pkn)) {
                                                                                                                                    echo $pkn['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Indonesia</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_indonesia)) {
                                                                                                                                    echo $b_indonesia['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_indonesia)) {
                                                                                                                                    echo $b_indonesia['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Arab</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_arab)) {
                                                                                                                                    echo $b_arab['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_arab)) {
                                                                                                                                    echo $b_arab['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">5. </td>
                    <td style="text-align: left; padding: 0px 5px;">Matematika</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($mtk)) {
                                                                                                                                    echo $mtk['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($mtk)) {
                                                                                                                                    echo $mtk['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">6. </td>
                    <td style="text-align: left; padding: 0px 5px;">Ilmu Pengetahuan Alam</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ipa)) {
                                                                                                                                    echo $ipa['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ipa)) {
                                                                                                                                    echo $ipa['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">7. </td>
                    <td style="text-align: left; padding: 0px 5px;">Ilmu Pengetahuan Sosial</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ips)) {
                                                                                                                                    echo $ips['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ips)) {
                                                                                                                                    echo $ips['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">8. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Inggris</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_inggris)) {
                                                                                                                                    echo $b_inggris['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_inggris)) {
                                                                                                                                    echo $b_inggris['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK B</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Seni Budaya</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($senbud)) {
                                                                                                                                    echo $senbud['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($senbud)) {
                                                                                                                                    echo $senbud['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Jasmani, Olah Raga dan Kesehatan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pjok)) {
                                                                                                                                    echo $pjok['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pjok)) {
                                                                                                                                    echo $pjok['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;"><?php if (!is_null($informatika)) {
                                                                        echo $informatika['nama_mapel'];
                                                                    } else if (!is_null($pra)) {
                                                                        echo $pra['nama_mapel'];
                                                                    } else if (!is_null($informatika) and !is_null($pra)) {
                                                                    } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($informatika)) {
                                                                                                                                    echo $informatika['deskripsip_mapel'];
                                                                                                                                } else if (!is_null($pra)) {
                                                                                                                                    echo $pra['deskripsip_mapel'];
                                                                                                                                } else if (!is_null($informatika) and !is_null($pra)) {
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($informatika)) {
                                                                                                                                    echo $informatika['deskripsik_mapel'];
                                                                                                                                } else if (!is_null($pra)) {
                                                                                                                                    echo $pra['deskripsik_mapel'];
                                                                                                                                } else if (!is_null($informatika) and !is_null($pra)) {
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4.</td>
                    <td style="text-align: left; padding: 0px 5px;">Muatan Lokal<sup>*)</sup></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <?php $i = 'a';
                foreach ($mulok as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "></td>
                        <td style="text-align: left; padding: 0px 5px;"><?php echo $i . '. ' . ucwords(strtolower($ml['nama_mapel']));
                                                                        $i++; ?>
                        </td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
            </tbody>
        </table>
    <?php } elseif ($nmLembaga['kd_jenjang'] == 4) { ?>
        <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">C. DESKRIPSI PENGETAHUAN DAN KETERAMPILAN</p>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <thead>
                <tr height="50px">
                    <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                    <td width="30%" rowspan="2" style="text-align: center; font-weight: bold">Mata Pelajaran</td>
                    <td width="32.5%" style="text-align: center; font-weight: bold">Pengetahuan</td>
                    <td width="32.5%" style="text-align: center; font-weight: bold">Keterampilan</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK A (UMUM)</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Agama Islam :</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <tr>
                    <td rowspan="4" style="text-align: center; "></td>
                    <td style="text-align: left; padding: 0px 5px;">a. AL-Qur'an Hadis</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($quran)) {
                                                                                                                                    echo $quran['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($quran)) {
                                                                                                                                    echo $quran['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">b. Akidah Akhlak</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($akidah)) {
                                                                                                                                    echo $akidah['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($akidah)) {
                                                                                                                                    echo $akidah['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">c. Fikih</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($fikih)) {
                                                                                                                                    echo $fikih['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($fikih)) {
                                                                                                                                    echo $fikih['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">d. Sejarah Kebudayaan Islam</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ski)) {
                                                                                                                                    echo $ski['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ski)) {
                                                                                                                                    echo $ski['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2. </td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Pancasila dan Kewarganegaraan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pkn)) {
                                                                                                                                    echo $pkn['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pkn)) {
                                                                                                                                    echo $pkn['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Indonesia</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_indonesia)) {
                                                                                                                                    echo $b_indonesia['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_indonesia)) {
                                                                                                                                    echo $b_indonesia['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Arab</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_arab)) {
                                                                                                                                    echo $b_arab['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_arab)) {
                                                                                                                                    echo $b_arab['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">5. </td>
                    <td style="text-align: left; padding: 0px 5px;">Matematika</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($mtk)) {
                                                                                                                                    echo $mtk['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($mtk)) {
                                                                                                                                    echo $mtk['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">6. </td>
                    <td style="text-align: left; padding: 0px 5px;">Sejarah Indonesia</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($sejindo)) {
                                                                                                                                    echo $sejindo['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($sejindo)) {
                                                                                                                                    echo $sejindo['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">7. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Inggris</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_inggris)) {
                                                                                                                                    echo $b_inggris['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_inggris)) {
                                                                                                                                    echo $b_inggris['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK B (UMUM)</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Seni Budaya</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($senbud)) {
                                                                                                                                    echo $senbud['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($senbud)) {
                                                                                                                                    echo $senbud['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Jasmani, Olah Raga dan Kesehatan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pjok)) {
                                                                                                                                    echo $pjok['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pjok)) {
                                                                                                                                    echo $pjok['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;">Prakarya dan Kewirausahaan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pradkwr)) {
                                                                                                                                    echo $pradkwr['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pradkwr)) {
                                                                                                                                    echo $pradkwr['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4.</td>
                    <td style="text-align: left; padding: 0px 5px;">Muatan Lokal<sup>*)</sup></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <?php $i = 'a';
                foreach ($mulok as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "></td>
                        <td style="text-align: left; padding: 0px 5px;"><?php echo $i . '. ' . ucwords(strtolower($ml['nama_mapel']));
                                                                        $i++; ?>
                        </td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK C (PEMINATAN)</td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">Peminatan Akademik :</td>
                </tr>
                <?php $i = 1;
                foreach ($cpeminatan as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "><?php echo $i . '. ';
                                                            $i++; ?></td>
                        <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($ml['nama_mapel'])); ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">Mata Pelajaran Pilihan :</td>
                </tr>
                <?php $i = 1;
                foreach ($clintasminat as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "><?php echo $i . '. ';
                                                            $i++; ?></td>
                        <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($ml['nama_mapel'])); ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
            </tbody>
        </table>
    <?php } elseif ($nmLembaga['kd_jenjang'] == 5) { ?>
        <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">C. DESKRIPSI PENGETAHUAN DAN KETERAMPILAN</p>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <thead>
                <tr height="50px">
                    <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                    <td width="30%" rowspan="2" style="text-align: center; font-weight: bold">Mata Pelajaran</td>
                    <td width="32.5%" style="text-align: center; font-weight: bold">Pengetahuan</td>
                    <td width="32.5%" style="text-align: center; font-weight: bold">Keterampilan</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK A (UMUM)</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Agama Islam :</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <tr>
                    <td rowspan="4" style="text-align: center; "></td>
                    <td style="text-align: left; padding: 0px 5px;">a. AL-Qur'an Hadis</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($quran)) {
                                                                                                                                    echo $quran['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($quran)) {
                                                                                                                                    echo $quran['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">b. Akidah Akhlak</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($akidah)) {
                                                                                                                                    echo $akidah['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($akidah)) {
                                                                                                                                    echo $akidah['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">c. Fikih</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($fikih)) {
                                                                                                                                    echo $fikih['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($fikih)) {
                                                                                                                                    echo $fikih['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: left; padding: 0px 5px;">d. Sejarah Kebudayaan Islam</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ski)) {
                                                                                                                                    echo $ski['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($ski)) {
                                                                                                                                    echo $ski['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2. </td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Pancasila & Kewarganegaraan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pkn)) {
                                                                                                                                    echo $pkn['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pkn)) {
                                                                                                                                    echo $pkn['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Indonesia</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_indonesia)) {
                                                                                                                                    echo $b_indonesia['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_indonesia)) {
                                                                                                                                    echo $b_indonesia['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Arab</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_arab)) {
                                                                                                                                    echo $b_arab['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_arab)) {
                                                                                                                                    echo $b_arab['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">5. </td>
                    <td style="text-align: left; padding: 0px 5px;">Matematika</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($mtk)) {
                                                                                                                                    echo $mtk['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($mtk)) {
                                                                                                                                    echo $mtk['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">6. </td>
                    <td style="text-align: left; padding: 0px 5px;">Sejarah Indonesia</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($sejindo)) {
                                                                                                                                    echo $sejindo['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($sejindo)) {
                                                                                                                                    echo $sejindo['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">7. </td>
                    <td style="text-align: left; padding: 0px 5px;">Bahasa Inggris</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_inggris)) {
                                                                                                                                    echo $b_inggris['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($b_inggris)) {
                                                                                                                                    echo $b_inggris['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK B (UMUM)</td>
                </tr>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;">Seni Budaya</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($senbud)) {
                                                                                                                                    echo $senbud['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($senbud)) {
                                                                                                                                    echo $senbud['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;">Pendidikan Jasmani, Olah Raga dan Kesehatan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pjok)) {
                                                                                                                                    echo $pjok['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pjok)) {
                                                                                                                                    echo $pjok['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;">Prakarya dan Kewirausahaan</td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pradkwr)) {
                                                                                                                                    echo $pradkwr['deskripsip_mapel'];
                                                                                                                                } ?></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?php if (!is_null($pradkwr)) {
                                                                                                                                    echo $pradkwr['deskripsik_mapel'];
                                                                                                                                } ?></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">4.</td>
                    <td style="text-align: left; padding: 0px 5px;">Muatan Lokal<sup>*)</sup></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <?php $i = 'a';
                foreach ($mulok as $ml) :
                ?>
                    <tr>
                        <td style="text-align: center; "></td>
                        <td style="text-align: left; padding: 0px 5px;"><?php echo $i . '. ' . ucwords(strtolower($ml['nama_mapel']));
                                                                        $i++; ?>
                        </td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                    </tr>
                <?php
                endforeach;
                ?>
                <tr>
                    <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">KELOMPOK C (PEMINATAN)</td>
                </tr>
                <?php if (($students['tingkat'] == 'X') || ($students['tingkat'] == 'XI')) { ?>
                    <tr>
                        <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">C1 Dasar Bidang Keahlian :</td>
                    </tr>
                    <?php $i = 1;
                    foreach ($cdbk as $ml) :
                    ?>
                        <tr>
                            <td style="text-align: center; "><?php echo $i . '. ';
                                                                $i++; ?></td>
                            <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($ml['nama_mapel'])); ?></td>
                            <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                            <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                        </tr>
                    <?php
                    endforeach;
                    ?>
                <?php } ?>
                <?php if ($students['tingkat'] == 'X') { ?>
                    <tr>
                        <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">C2 Dasar Program Keahlian :</td>
                    </tr>
                    <?php $i = 1;
                    foreach ($cdpk as $ml) :
                    ?>
                        <tr>
                            <td style="text-align: center; "><?php echo $i . '. ';
                                                                $i++; ?></td>
                            <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($ml['nama_mapel'])); ?></td>
                            <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                            <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                        </tr>
                    <?php
                    endforeach;
                    ?>
                <?php } ?>
                <?php if (($students['tingkat'] == 'XI') || ($students['tingkat'] == 'XII')) { ?>
                    <tr>
                        <td width="100%" align="center" colspan="4" style="text-align: left; text-indent: 0.25in; padding: 0px 5px; font-weight: bold">C3 Paket Keahlian :</td>
                    </tr>
                    <?php $i = 1;
                    foreach ($cpk as $ml) :
                    ?>
                        <tr>
                            <td style="text-align: center; "><?php echo $i . '. ';
                                                                $i++; ?></td>
                            <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($ml['nama_mapel'])); ?></td>
                            <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsip_mapel']; ?></td>
                            <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $ml['deskripsik_mapel']; ?></td>
                        </tr>
                    <?php
                    endforeach;
                    ?>
                <?php } ?>
            </tbody>
        </table>
    <?php } ?>
    <div style="page-break-after:always;"></div>
    <hr style="border: 1px black solid;">
    <table width="95%" border="0" align="center" style="border-collapse:collapse; margin-left: 0.2in;">
        <tbody>
            <tr>
                <td width="12%">Nama Siswa</td>
                <td width="1%">:</td>
                <td width="40%" class="tbl"><?php if (!is_null($students)) {
                                                echo $students['nama_siswa'];
                                            } ?></td>
                <td width="16%">Nama Madrasah</td>
                <td width="1%">:</td>
                <td width="30%" class="tbl"><?= $nmJenjang['sgkt_jenjang'] . $nmStatus['sgkt_status'] . ' ' . strtoupper($nmLembaga['nm_lembaga']); ?></td>
            </tr>
            <tr>
                <td>NIS</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    echo $students['nism_siswa'];
                                } ?></td>
                <td>Kelas / Semester</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students) and !is_null($waktu)) {
                                    echo $students['kelas'] . ' / Semester ' . $waktu['semester'];
                                } ?></td>
            </tr>
            <tr>
                <td>NISN</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    echo $students['nisn_siswa'];
                                } ?></td>
                <td>Tahun Pelajaran</td>
                <td>:</td>
                <td class="tbl"><?php if (!is_null($students)) {
                                    if ($waktu['semester'] == 'Ganjil') {
                                        echo $waktu['tahun'] . ' / ' . ($waktu['tahun'] + 1);
                                    } elseif ($waktu['semester'] == 'Genap') {
                                        echo ($waktu['tahun'] - 1) . ' / ' . $waktu['tahun'];
                                    }
                                } ?></td>
            </tr>
        </tbody>
    </table>
    <hr style="border: 1px black solid;">
    <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">D. EKSTRAKURIKULER</p>
    <table border="1" align="center" style="border-collapse:collapse;" width="90%">
        <thead>
            <tr height="30px">
                <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                <td width="30%" rowspan="2" style="text-align: center; font-weight: bold">Kegiatan Ekstrakurikuler</td>
                <td width="20%" style="text-align: center; font-weight: bold">Predikat</td>
                <td width="45%" style="text-align: center; font-weight: bold">Deskripsi</td>
            </tr>
        </thead>
        <tbody>
            <?php if ($cekNilaiEskul > 0) { ?>
                <?php $i = 1;
                foreach ($eskul as $es) : ?>
                    <tr>
                        <td style="text-align: center; "><?= $i;
                                                            $i++;  ?></td>
                        <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($es['eskul'])); ?></td>
                        <td style="text-align: center;"><?= $es['predikat']; ?></td>
                        <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"><?= $es['deskripsi']; ?></td>
                    </tr>
                <?php endforeach; ?>
            <?php } else { ?>
                <tr>
                    <td style="text-align: center; ">1.</td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                    <td style="text-align: center;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                    <td style="text-align: center;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                    <td style="text-align: center;"></td>
                    <td style="word-wrap: break-word; max-width:150px; padding: 0px 5px; font-size: 8pt; text-align: justify;"></td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
    <br>
    <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">E. PRESTASI</p>
    <table border="1" align="center" style="border-collapse:collapse;" width="90%">
        <thead>
            <tr height="30px">
                <td width="5%" rowspan="2" style="text-align: center; font-weight: bold">No.</td>
                <td width="40%" rowspan="2" style="text-align: center; font-weight: bold">Jenis Kegiatan</td>
                <td width="55%" style="text-align: center; font-weight: bold">Keterangan</td>
            </tr>
        </thead>
        <tbody>
            <?php if ($cekPrestasi > 0) { ?>
                <?php $i = 1;
                foreach ($prestasi as $pr) : ?>
                    <tr>
                        <td style="text-align: center;"><?= $i;
                                                        $i++; ?></td>
                        <td style="text-align: left; padding: 0px 5px;"><?= ucwords(strtolower($pr['prestasi'])); ?></td>
                        <td style="text-align: left; padding: 0px 5px;"><?= $pr['keterangan']; ?></td>
                    </tr>
                <?php endforeach; ?>
            <?php } else { ?>
                <tr>
                    <td style="text-align: center;">1.</td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">2.</td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                </tr>
                <tr>
                    <td style="text-align: center; ">3.</td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                    <td style="text-align: left; padding: 0px 5px;"></td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
    <br>
    <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">F. KETIDAKHADIRAN</p>
    <table border="1" style="border-collapse:collapse; margin-left: 0.4in;" width="50%">
        <tbody>
            <tr>
                <td style="text-align: left; padding: 5px 5px;" width="60%">Sakit</td>
                <td style="text-align: left; padding: 5px 5px;" width="40%">: <?php if (!is_null($absen)) {
                                                                                    echo $absen['s'];
                                                                                } else {
                                                                                    echo '-';
                                                                                } ?> hari</td>
            </tr>
            <tr>
                <td style="text-align: left; padding: 5px 5px;" width="60%">Izin</td>
                <td style="text-align: left; padding: 5px 5px;" width="40%">: <?php if (!is_null($absen)) {
                                                                                    echo $absen['i'];
                                                                                } else {
                                                                                    echo '-';
                                                                                } ?> hari</td>
            </tr>
            <tr>
                <td style="text-align: left; padding: 5px 5px;" width="60%">Tanpa Keterangan</td>
                <td style="text-align: left; padding: 5px 5px;" width="40%">: <?php if (!is_null($absen)) {
                                                                                    echo $absen['a'];
                                                                                } else {
                                                                                    echo '-';
                                                                                } ?> hari</td>
            </tr>
        </tbody>
    </table>
    <br>
    <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">F. CATATAN WALI KELAS</p>
    <table border="1" align="center" style="border-collapse:collapse;" width="90%">
        <tbody>
            <tr height="50px">
                <td style="text-align: left; padding: 5px 5px;" width="100%"><?php if (!is_null($catatan)) {
                                                                                    echo $catatan['catat'];
                                                                                } else {
                                                                                    echo 'Belum ada catatan wali kelas';
                                                                                } ?></td>
            </tr>
        </tbody>
    </table>
    <br>
    <p style="text-align: justify; text-indent: 0.25in; font-weight: bold">G. TANGGAPAN ORANG TUA/WALI</p>
    <table border="1" align="center" style="border-collapse:collapse;" width="90%">
        <tbody>
            <tr height="50px">
                <td style="text-align: left; padding: 5px 5px;" width="100%"></td>
            </tr>
        </tbody>
    </table>
    <br>
    <?php
    $smtr = $waktu['semester'];
    if ($smtr == 'Genap') {
    ?>
        <table border="1" align="center" style="border-collapse:collapse;" width="90%">
            <tbody>
                <tr height="50px">
                    <?php
                    if (!is_null($naik)) {
                        if (($naik['naik_lulus'] == 'Lulus') || ($naik['naik_lulus'] == 'Tidak Lulus')) {
                    ?>
                            <td style="text-align: left; padding: 5px 5px;" width="100%">Keterangan Kelulusan : <?php if (!is_null($naik)) {
                                                                                                                    echo '<b>' . $naik['naik_lulus'] . '</b>';
                                                                                                                } else {
                                                                                                                    echo 'Belum ada kelulusan kelas';
                                                                                                                } ?></td>
                        <?php } else { ?>
                            <td style="text-align: left; padding: 5px 5px; " width="100%">Keterangan Kenaikan Kelas : <?php if (!is_null($naik)) {
                                                                                                                            echo '<b>' . $naik['naik_lulus'] . '</b>';
                                                                                                                        } else {
                                                                                                                            echo 'Belum ada kenaikan kelas';
                                                                                                                        } ?> ke kelas <?php if (!is_null($naik)) {
                                                                                                                                            echo '<b>' . $naik['ke_kelas'] . '</b>';
                                                                                                                                        } else {
                                                                                                                                            echo 'Belum ada kelas tujuan';
                                                                                                                                        } ?></td>
                        <?php }
                    } else { ?>
                        <td style="text-align: left; padding: 5px 5px;" width="100%"><?= 'Wali kelas belum menentukan kenaikan/kelulusan' ?></td>
                    <?php } ?>
                </tr>
            </tbody>
        </table>
        <br>
        <table border="0" style="border-collapse:collapse; margin-left: 0.4in;" width="90%">
            <tbody>
                <tr>
                    <td style="text-align: center;" width="30%"></td>
                    <td style="text-align: center;" width="30%"></td>
                    <td style="text-align: left;" width="40%">
                        <?php
                        if (!is_null($naik)) {
                            if (($naik['naik_lulus'] == 'Lulus') || $naik['naik_lulus'] == 'Tidak Lulus') {
                                echo ucwords(strtolower($waktu['tempat'])) . ', ' . $this->m_walas->tgl_indo(date('d-m-Y', strtotime($waktu['tanggal3'])));
                            } else {
                                echo ucwords(strtolower($waktu['tempat'])) . ', ' . $this->m_walas->tgl_indo(date('d-m-Y', strtotime($waktu['tanggal'])));
                            }
                        } ?>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: left;" width="30%"><br>Orang Tua/Wali,<br><br><br><br><u>(...........................)</u></td>
                    <td style="text-align: center;" width="30%"></td>
                    <td style="text-align: left;" width="40%"><br>Wali Kelas,<br><br><br><br><u><?= $teachers['gelardepan'] . ' ' . $teachers['nama_guru']; ?><?php if (!empty($teachers['gelarbelakang'])) {
                                                                                                                                                                    echo ', ' . $teachers['gelarbelakang'];
                                                                                                                                                                } else {
                                                                                                                                                                    echo $teachers['gelarbelakang'];
                                                                                                                                                                } ?></u><br>NIP. <?= $teachers['nip_guru'] ?></td>
                </tr>
            </tbody>
        </table>
        <br><br>
        <table border="0" style="border-collapse:collapse; margin-left: 0.4in;" width="90%">
            <tbody>
                <tr>
                    <td style="text-align: center;" width="30%"></td>
                    <td style="text-align: left;" width="40%" colspan="3">Mengetahui,<br>
                        Kepala Madrasah<br><br><br><br>
                        <u><?= $waktu['gelardepan'] . ' ' . $waktu['kamad']; ?><?php if (!empty($waktu['gelarbelakang'])) {
                                                                                    echo ', ' . $waktu['gelarbelakang'];
                                                                                } else {
                                                                                    echo $waktu['gelarbelakang'];
                                                                                } ?></u><br>
                        NIP. <?= $waktu['nip_kamad']; ?>
                    </td>
                    <td style="text-align: center;" width="30%"></td>
            </tbody>
        </table>
    <?php
    } else { ?>
        <table border="0" style="border-collapse:collapse; margin-left: 0.4in;" width="90%">
            <tbody>
                <tr>
                    <td style="text-align: center;" width="30%"></td>
                    <td style="text-align: center;" width="30%"></td>
                    <td style="text-align: left;" width="40%">
                        <?= ucwords(strtolower($waktu['tempat'])) . ', ' . $this->m_walas->tgl_indo(date('d-m-Y', strtotime($waktu['tanggal']))); ?>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: left;" width="30%"><br>Orang Tua/Wali,<br><br><br><br><u>(...........................)</u></td>
                    <td style="text-align: center;" width="30%"></td>
                    <td style="text-align: left;" width="40%"><br>Wali Kelas,<br><br><br><br><u><?= $teachers['gelardepan'] . ' ' . $teachers['nama_guru']; ?><?php if (!empty($teachers['gelarbelakang'])) {
                                                                                                                                                                    echo ', ' . $teachers['gelarbelakang'];
                                                                                                                                                                } else {
                                                                                                                                                                    echo $teachers['gelarbelakang'];
                                                                                                                                                                } ?></u><br>NIP. <?= $teachers['nip_guru'] ?></td>
                </tr>
            </tbody>
        </table>
        <br><br>
        <table border="0" style="border-collapse:collapse; margin-left: 0.4in;" width="90%">
            <tbody>
                <tr>
                    <td style="text-align: center;" width="30%"></td>
                    <td style="text-align: left;" width="40%" colspan="3">Mengetahui,<br>
                        Kepala Madrasah<br><br><br><br>
                        <u><?= $waktu['gelardepan'] . ' ' . $waktu['kamad']; ?><?php if (!empty($waktu['gelarbelakang'])) {
                                                                                    echo ', ' . $waktu['gelarbelakang'];
                                                                                } else {
                                                                                    echo $waktu['gelarbelakang'];
                                                                                } ?></u><br>
                        NIP. <?= $waktu['nip_kamad']; ?>
                    </td>
                    <td style="text-align: center;" width="30%"></td>
                </tr>
            </tbody>
        </table>
    <?php } ?>
    <div style="page-break-after:always;"></div>
</body>
<script>
    let fadeTarget = document.querySelector(".loading")

    function show_loading() {
        fadeTarget.style.display = "block";
        fadeTarget.style.opacity = 1;
    }

    function hide_loading() {
        let fadeEffect = setInterval(() => {
            if (!fadeTarget.style.opacity) {
                fadeTarget.style.opacity = 1;
            }
            if (fadeTarget.style.opacity > 0) {
                fadeTarget.style.opacity -= 0.1;
            } else {
                clearInterval(fadeEffect)
                fadeTarget.style.display = "none"
            }
        }, 100)
    }
</script>

</html>