<!-- Hak Cipta dilindungi Undang-undang. Hak Cipta : Khamdi Rahmani, Reg. Kemenkum HAM No : 000121327. Dilarang merubah isi File tanpa ijin tertulis dari pemegang Hak Cipta.-->
<style>
    .fontKw {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 14px;
    }
</style>
<table width="1150" class="fontKw">
    <tr>
        <td width="600" valign="top">
            <div class="card-body pt-0 mt-0">
                <section class="">
                    <!-- title row -->
                    <div class="row">
                        <div class="col-12">
                            <h5 class="page-header">
                                <?php
                                $view = new lembaga;
                                echo $view->viewImage('../../../../asset/dokumen/foto/', 'logo', 'mr-2 position-absolute', '60', '60');
                                echo "<b class='d-block ml-5 pl-3 pt-1'>" . $clssekolah->dataSekolah('sekolah') . "</b>";
                                echo "<i class='footer font ml-5 pl-3 mb-2 pb-3'>" . $clssekolah->dataSekolah('alamat')  . "</i>"; ?>

                                <small class="float-right position-relative"><b class="font"></b> </small><br>
                            </h5>
                        </div>
                        <h5><small class="float-left position-relative ml-2 mt-2"><b><u>BUKTI PEMBAYARAN</u></b> </small></h5><br>
                    </div>
                    <div class="row invoice-info">
                        <div class="col-sm-4 invoice-col">
                            Penerima
                            <address>
                                <?php echo $penerima; ?><br>
                                <?php echo $format->dateToIndo($tanggal); ?><br>
                            </address>
                        </div>
                        <div class="col-sm-6 invoice-col">
                            <address>
                                <strong><?php echo strtoupper($format->entityEncode($pembayar1)); ?></strong><br>
                                <?php echo $pembayar2 . ' <br>' . $pembayar3 . ' <br>' . $pembayar4; ?>

                            </address>
                        </div>

                        <div class="col-sm-2 invoice-col">
                            <p class="float-right position-relative"> <?php
                                                                        QRCode::png($qrcode, '../../../../qrcode/qrcode_' . $id_tr . '.png', 'M', 2, 2);

                                                                        echo "<img src='../../../../qrcode/qrcode_" . $id_tr . ".png' class='position-relative'/>";
                                                                        ?></p>
                        </div>
                        <div class="col-sm-12 invoice-col">
                            <i>ID-TRAN #<?php echo $id_tr; ?></i><br>
                            <i>METODE #<?php echo $metode; ?></i>

                            <b class="float-right">JUMLAH : <?php echo number_format($jmlKuitansi, 0, ",", "."); ?></b>
                        </div>
                    </div>
                    <div class="row font">
                        <div class="col-12 table-responsive">
                            <table class="table table-striped table-sm fontKw">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>Kode : Jenis Pembayaran</th>
                                        <th>Periode</th>
                                        <th>Jumlah</th>
                                        <th>Catatan</th>

                                    </tr>
                                </thead>
                                <tbody>

                                    <?php
                                    error_reporting(0);
                                    clearstatcache();
                                    $class = new transaksi();
                                    $showList = $class->showTransaksiID($tb_transaksi, $id_tr);
                                    while ($dataTr = $showList->fetch(PDO::FETCH_OBJ)) {
                                        if ($dataTr->jumlah == "" || $dataTr->jumlah == 0) {
                                            $jumlah = number_format(0, 0, ",", ".");
                                        } else {
                                            $jumlah = number_format($dataTr->jumlah, 0, ",", ".");
                                        };

                                        $tahap = $dataTr->tahap;

                                        //startAt
                                        $startAt = $class->startAt($tb_siswa, $nis);
                                        $cekbulan = $class->cekPeriode($startAt, $tahap, $tahun1, $tahun2);

                                        //nama Bayar
                                        $classNB = new namaBayar();
                                        $ceknamaBayar = $classNB->ceknamaBayar($tahun, $dataTr->jenis, $dataTr->jenjang);

                                        $showJenis = $classNB->shownamaBayar($tahun, $dataTr->jenis, $dataTr->jenjang);
                                        $datajenis = $showJenis->fetch(PDO::FETCH_OBJ);
                                        $field_tang = 'tang_' . $datajenis->kode;
                                        $setbulanan = $datajenis->bulanan; //Cek Apakah Bulanan

                                        if ($setbulanan == "Tidak") {
                                            $periode = "Tahap " . $tahap;
                                        } else {
                                            $periode = $cekbulan;
                                        };

                                        echo "
                                            <tr>
                                                <td width='5px'>#</td>
                                                <td align=left>$dataTr->jenis : $ceknamaBayar</td>
                                                <td align=left>$periode</td>
                                                <td align=left>" . $jumlah . "</td>
                                                <td align=left><i style='font-size:8px'>$dataTr->catatan</i></td>
                                            </tr>";
                                    }
                                    ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="row col-12 font">
                        <div class="col-12">
                            <div class="callout callout-default pt-1 pl-1">
                                <b>Informasi</b>
                                <p><?php echo  $clssekolah->dataSekolah('notice');; ?></p>
                            </div>
                        </div>

                    </div>
                    <div class="row col-12 font">
                        <div class="col-7">
                            <div class="fontKw">
                                <b class="fontKw">Penerima</b></br></br></br></br>
                                <p class="fontKw">[ <?php echo $penerima; ?> ]</p>
                            </div>
                        </div>
                        <div class="col-5 fontKw ml-0">
                            <div class="fontKw">
                                <b class="fontKw">Penyetor</b></br></br></br></br>
                                <p class="fontKw">[ <?php echo strtoupper($format->entityEncode($pembayar1)); ?> ]</p>
                            </div>
                        </div>
                    </div>

                </section>
            </div>
        </td>
        <td width="50" align="left" valign="top"> </td>
        <td width="600" valign="top">
            <div class="card-body pt-0 mt-0">
                <section class="">
                    <!-- title row -->

                    <div class="row font">
                        <div class="col-12 table-responsive">
                            <div class="card-body mx-0">
                                <label>
                                    <h6><b class="text-secondary">REKAPITULASI PEMBAYARAN</b></h6>
                                </label>
                                <table class="table table-striped table-sm fontKw">
                                    <thead>
                                        <tr>
                                            <th>No</th>
                                            <th>Kode : Jenis Pembayaran</th>
                                            <th>Bulanan</th>
                                            <th>Tanggungan</th>
                                            <th>Terbayar</th>
                                            <th>Kurang</th>

                                        </tr>
                                    </thead>
                                    <tbody>

                                        <?php
                                        $namaBayar = new namaBayar();
                                        $showJenis = $namaBayar->NamaTransaksi('tb_nama_bayar', 'tp', $tahun, $data->jenjang, 'kode');
                                        $count = $showJenis->rowCount();
                                        $no = 0;
                                        while ($datajenis = $showJenis->fetch(PDO::FETCH_OBJ)) {
                                            $field_tang = 'tang_' . $datajenis->kode;

                                            if ($data->{$field_tang} == "" || !is_numeric($data->{$field_tang})) {
                                                $val_tang = 0;
                                            } else {
                                                $val_tang = $data->{$field_tang};
                                            }; //Cek jika jumlah tanggungan kosong / bukan angka

                                            $setbulanan = $datajenis->bulanan; //Cek Apakah Bulanan

                                            $rupiah_tang = @(number_format($val_tang, 0, ".", "."));
                                            $jenis = $datajenis->kode;

                                            //Terbayar & Kurang
                                            $classTrans = new transaksi();
                                            $infoTerbayar = $classTrans->infoterbayar($tb_transaksi, $data->nis, $jenis);
                                            $terbayar = @(number_format($infoTerbayar, 0, ".", "."));
                                            $kurang = @(number_format(($val_tang - $infoTerbayar), 0, ".", "."));

                                            if ($setbulanan == "Ya" || $setbulanan == "ya") {
                                                $bulanan = @(number_format(($val_tang / (12 - ($startAt - 1))), 0, ".", "."));
                                            } else {
                                                $bulanan = "--";
                                            };
                                            $no++;
                                            echo "<tr>
                                            <td width='5px'>$no</td>
                                            <td align=left>$datajenis->kode : $datajenis->nama</td>
                                            <td align=right>$bulanan</td>
                                            <td align=right>$rupiah_tang</td>
                                            <td align=right>$terbayar</td>
                                            <td align=right>$kurang</td>
                                           
                                        </tr>";
                                        };
                                        //Jumlah
                                        $dt_jenis = new listTanggungan();
                                        $jumlah = $dt_jenis->tanggunganSiswa($tb_siswa, 'id', $siswa_id);
                                        $total_tang = number_format($jumlah, 0, ".", ".");

                                        //Terbayar & Kurang Total
                                        $infoTerbayartotal = $classTrans->infoterbayartotal($tb_transaksi, $data->nis);
                                        $terbayarTotal = @(number_format($infoTerbayartotal, 0, ".", "."));
                                        $kurangTotal = @(number_format(($jumlah - $infoTerbayartotal), 0, ".", "."));
                                        echo "<tr>
                                            <td width='5px'></td>
                                            <td align=left colspan='2'><b>TOTAL</b></td>
                                            <td align=right><b> $total_tang</b></td>
                                            <td align=right><b> $terbayarTotal</b></td>
                                            <td align=right><b> $kurangTotal</b></td>
                                           
                                        </tr>";

                                        ?>

                                    </tbody>
                                </table>



                            </div>
                        </div>
                    </div>

                </section>
            </div>
        </td>
    </tr>
</table>