<div class="content-wrapper">

    <!-- Main content -->
    <section class="content">
        <div class="container">
            <!-- Info boxes -->

            <!-- /.row -->
            <div class="row mt-5">
                <div class="col-md-12  mt-5">
                    <div class="timeline-header bg-secondary  py-1 pl-1">
                        <b class="text-light judul pl-1" style="font-family:consolas;font-size:12px"><span class="bi bi-card-checklist"></span> Daftar Rincian Transaksi</b>

                    </div>
                    <!-- /.card-header -->
                    <div class="card-body my-2 mx-0">
                        <div class="row col-12 mb-4">
                            <div class="div d-inline float-right">
                                <a <?php echo $link->page('transaksi/kuitansi_read'); ?> class="btn btn-secondary btn-xs mb-2 btn-rounded small px-2"> <i class="bi bi-printer"></i><b> CETAK KUITANSI</b></a>

                            </div>
                        </div>

                        <div class="col-md-12 mt-2">

                            <?php
                            $class = new crudData();
                            $format = new format();

                            $showList = $class->showTable($tb_transaksi . " where nis='$nis'");
                            $no = 0;
                            while ($data = $showList->fetch(PDO::FETCH_OBJ)) {

                                if ($data->setor == "Ya") {
                                    $setor = "Disetor";
                                } else {
                                    $setor = "--";
                                };
                                $nis = $data->nis;
                                $tahap = $data->tahap;
                                //nama Bayar
                                $classNB = new namaBayar();
                                $ceknamaBayar = $classNB->ceknamaBayar($tahun, $data->jenis, $data->jenjang);

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

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

                                $showJenis = $classNB->shownamaBayar($tahun, $data->jenis, $data->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;
                                };

                                //Proses Setor
                                $clsSetor = new setor;
                                $statusSetor = $clsSetor->statusSetor($data->setor);

                                $link = new linkpage;
                                $modal = new modal();
                                $no++;

                                $conten = "
                                <div class='row bg-light small'>
                                <div class='info-box  bg-transparent'>
                                    <div class='info-box-content'><b class='text-primary'>" . $format->dateTimeToIndo($data->time) . "</b> <span><i class='text-danger small'> " . $data->jenis . " : " . $ceknamaBayar . "</i></span>
                                        <span class='info-box-text text-dark'><b class='col-6 float-left'>Jumlah </b><b class='float-right'>Rp. " . $format->ribuan($data->jumlah) . "</b></span>
                                        <span class='info-box-text text-dark small'><i class='col-6 float-left'>Catatan</i>$data->catatan </span>
                                    </div>
                                </div>
                                </div>
                            ";

                                echo $modal->linkModaltiny('view/transaksi/transaksi_view', 'detailTr',  $data->id . $tahun, $conten);
                            };

                            ?>
                        </div>


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


    </section>
    <!-- /.content -->
</div>

<!-- /.content-wrapper -->
<script type="text/javascript">
    $(function() {
        $('.check_all').click(function() {
            $('.chk_boxes1').prop('checked', this.checked);
        });
    });
</script>

<?php
if (isset($_POST['submit'])) {
    foreach ($_POST['id_trans'] as $id) {
        $class = new crudData();
        $delete = $class->deleteData($tb_transaksi, 'no', $id);
    };

    $direct = new toast();
    echo  $direct->redirect('toast', 'delete', 'transaksi/transaksi_read');
} else {
    echo '';
}



?>