<!DOCTYPE html>
<html lang="en">

<head>

    <link rel="stylesheet" href="../../../../../../asset/bootstrap/css/adminlte.min.css">
    <style>
        .font {
            font-family: arial;
            font-size: 11px;
        }

        .fontlamp {
            font-family: arial;
            font-size: 8px;
        }

        .fontJudullamp {
            font-size: 12px;
            font-family: arial;

        }

        .fontInput {
            font-size: 11px;
            font-family: arial;
        }

        .fontJudul {
            font-size: 12px;
            font-family: arial;
            color: dodgerblue;
            background: #000;
        }
    </style>
</head>

<body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed layout-footer-fixed small">

    <div class="wrapper">
        <?php
        require('../../../../../../asset/mod/autoLoad.php');

        $clssekolah = new sekolah;
        $cekID = new cekID();
        $time = new time();
        $crud = new crudData();
        $format = new format();
        $classRKAS = new simakom_rkas();

        $tahun = $_GET['tahun'];
        $id = $_GET['id'];


        $tb_transaksi = "simakom_transaksi" . substr($tahun, 2, 2) . substr($tahun, 7, 2);
        $tb_komponen = "simakom_komponen" . substr($tahun, 2, 2) . substr($tahun, 7, 2);
        $tb_kegiatan = "simakom_kegiatan" . substr($tahun, 2, 2) . substr($tahun, 7, 2);
        $tb_akun = "simakom_akun" . substr($tahun, 2, 2) . substr($tahun, 7, 2);
        $tb_detail = "simakom_detail" . substr($tahun, 2, 2) . substr($tahun, 7, 2);
        $tb_revisi = "simakom_revisi" . substr($tahun, 2, 2) . substr($tahun, 7, 2);


        $sql = $crud->editData($tb_detail, 'id', $id);
        $data = $sql->fetch(PDO::FETCH_OBJ);

        $uraian_kategori = $classRKAS->uraianRKAS('simakom_ref_kategori', 'kategori', $data->kategori, 'uraian');
        $uraian_kegiatan = $classRKAS->uraianRKAS($tb_kegiatan, 'kegiatan', $data->kegiatan, 'uraian');
        $uraian_komponen = $classRKAS->uraianRKAS($tb_komponen, 'kode_id', $data->kategori . $data->kegiatan . $data->komponen, 'uraian');
        $uraian_akun = $classRKAS->kodeCustome('simakom_ref_akun', 'akun', $data->akun, 'uraian');
        $uraian_detail = $classRKAS->kodeCustome($tb_detail, 'id', $data->id, 'uraian');
        if ($data->kategori == 'A') {
            $debkredi = 'debet';
        } else {
            $debkredi = 'kredit';
        };
        $jumlah_total = $crud->sum($tb_transaksi, $debkredi, "where rkas_kategori='$data->kategori' && rkas_kegiatan='$data->kegiatan' && rkas_komponen='$data->komponen' && rkas_akun='$data->akun' && rkas_detail_id='$data->detail_id'");



        ?>


        <div class="container col-12 mb-4">
            <div class="row">
                <div class="col-12">
                    <div class="row">
                        <div class="card-body col-12 mx-4">
                            <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="text-danger">RINCIAN PENGGUNAAN ANGGARAN <br> TAHUN PELAJARAN <?php echo $tahun; ?></b></small><br>
                            </h5>
                        </div>
                        <div class="card-body col-12 mx-4">
                            <div class="row invoice-info">
                                <div class="col-sm-2 invoice-col">
                                    <b>KATEGORI</b>
                                </div>
                                <div class="col-sm-8 invoice-col">
                                    <b>: <?php echo $data->kategori . " - " . $uraian_kategori; ?></b>
                                </div>
                            </div>
                            <div class="row invoice-info">
                                <div class="col-sm-2 invoice-col">
                                    <b>KEGIATAN</b>
                                </div>
                                <div class="col-sm-8 invoice-col">
                                    <b>: <?php echo $data->kegiatan . " - " . $uraian_kegiatan; ?></b>
                                </div>
                            </div>
                            <div class="row invoice-info">
                                <div class="col-sm-2 invoice-col">
                                    <b>KOMPONEN</b>
                                </div>
                                <div class="col-sm-8 invoice-col">
                                    <b>: <?php echo $data->komponen . " - " . $uraian_komponen; ?></b>
                                </div>
                            </div>
                            <div class="row invoice-info">
                                <div class="col-sm-2 invoice-col">
                                    <b>AKUN</b>
                                </div>
                                <div class="col-sm-8 invoice-col">
                                    <b>: <?php echo $data->akun . " - " . $uraian_akun; ?></b>
                                </div>
                            </div>
                            <div class="row invoice-info">
                                <div class="col-sm-2 invoice-col">
                                    <b>DETAIL</b>
                                </div>
                                <div class="col-sm-8 invoice-col">
                                    <b>: <?php echo $data->detail . " - " . $uraian_detail; ?></b>
                                </div>
                            </div>
                            <div class="row invoice-info">
                                <div class="col-sm-2 invoice-col">
                                    <b>JUMLAH</b>
                                </div>
                                <div class="col-sm-8 invoice-col">
                                    <b>: <?php echo $format->ribuan($jumlah_total); ?></b>
                                </div>
                            </div>
                        </div>
                        <div class="card-body mx-4">

                            <table id="example51" class="table table-bordered table-striped table-sm mb-4">
                                <thead>
                                    <tr>

                                        <th>No</th>
                                        <th>No. Bukti</th>
                                        <th width="80">Tanggal</th>
                                        <th>Uraian</th>
                                        <th>Jumlah</th>

                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    $simakom_transaksi = new simakom_transaksi;
                                    $db = database::getInstance();
                                    $show = $db->runQuery("SELECT * FROM  $tb_transaksi where rkas_kategori='$data->kategori' && rkas_kegiatan='$data->kegiatan' && rkas_komponen='$data->komponen' && rkas_akun='$data->akun' && rkas_detail_id='$data->detail_id' order by tanggal asc,jenis asc, bukti asc, time asc");
                                    $no = 1;
                                    $row = 1;
                                    while ($data = $show->fetch(PDO::FETCH_OBJ)) {
                                        $format = new format();
                                        $tanggal = $format->dateToIndo($data->tanggal);
                                        $debet = $format->ribuan($data->debet);
                                        $kredit = $format->ribuan($data->kredit);
                                        $detail_id = $data->rkas_detail_id;
                                        $jenis_transaksi = $data->jenis;


                                        $cekRefRKAS = $simakom_transaksi->getRefRKAS($tb_detail, $detail_id);
                                        if ($cekRefRKAS > 0 || $jenis_transaksi == 21 ||  $jenis_transaksi == 22 || $jenis_transaksi == 13 || $jenis_transaksi == 14 || $jenis_transaksi == 33 || $jenis_transaksi == 34 || $jenis_transaksi > 40) {
                                            $warningNoRef = "#FFFFFF";
                                        } else {
                                            $warningNoRef = "#E9967A";
                                        };

                                        $link = new linkpage();


                                        if ($data->rkas_kategori == "A") {
                                            $jumlah = $debet;
                                        } else {
                                            $jumlah = $kredit;
                                        };

                                        echo "
                                        <tr bgcolor=$warningNoRef >
                                            <td width='5px'>$no </td>
                                        
                                            <td align=center>$data->bukti</td>
                                            <td align=center>$tanggal</td>
                                            <td align=left>$data->uraian</td>
                                            <td align=right>$jumlah</td>
                                            
                                        </tr>";
                                        $no++;
                                    }
                                    echo "
                                    <tr bgcolor='' >
                                        <td width='5px' colspan='4' align=center><b>JUMLAH </b></td>
                                        <td align=right><b>" . $format->ribuan($jumlah_total) . "</b></td>
                                    </tr>";
                                    ?>
                                </tbody>
                            </table>

                            <div class="row col-md-12 mt-3">
                                <?php
                                $class = new simakom_laporan();
                                $format = new format();
                                $class = $class->penandaTangan($format->dateToEng($time->getDateInput()), $tahun);
                                ?>
                            </div>
                        </div>

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

        </div>

        <script src="../../../../../../asset/bootstrap/js/adminlte.min.js"></script>




</body>

</html>