<?php
date_default_timezone_set('Asia/Jakarta');
$tanggal = mktime(date("m"), date("d"), date("Y"));
$tglsekarang = date("d-m-Y", $tanggal);

$link = new linkpage;
if (isset($_POST['buku'])) {
    $buku = $_POST['buku'];
    $classLap = new simakom_laporan();
    $v_buku = $classLap->jenisBuku($buku);
} else {
    $buku = 1;
    $classLap = new simakom_laporan();
    $v_buku = $classLap->jenisBuku($buku);
};

if (isset($_POST['tanggal'])) {
    $tanggal = $_POST['tanggal'];
} else {
    $classTime = new time();
    $format = new format();
    $tanggal =  $format->dateToIndo($classTime->getDate());
};
$format = new format();
$tanggalBuku = $format->dateToEng($tanggal);

$optVal = new lembaga();
if (isset($_POST['bulan'])) {
    $bulan = $_POST['bulan'];
    $v_bulan = $optVal->ValPeriode($bulan, $tahun1, $tahun2);
} else {
    $bulan = "";
    $v_bulan = $optVal->ValPeriode('1', $tahun1, $tahun2);
};


?>

<div class="content-wrapper">

    <?php require('./layout/headerpage.php'); ?>

    <div class="container col-12 mb-4 pb-5">
        <div class="row  mx-3 pr-3">
            <div class="col-12">
                <div class="col-12 ">
                    <div class="card  mx-3">
                        <div class="timeline-header bg-primary  py-2 pl-2">
                            <b class="text-light judul"><span class="bi bi-journal-text"></span> Laporan Realisasi Penggunaan Pendapatan</b>
                        </div>

                        <div class="row col-md-12">
                            <div class="col-md-6">
                                <div class="card-body mt-4 px-1 mx-2">

                                    <div class="row">
                                        <div class="col-12 col-sm-6 col-md-12">
                                            <div class="info-box mb-3">


                                                <div class="info-box-content">
                                                    <div class="relative mb-0 pb-4">
                                                        <input name="judul" value="TANGGAL LAPORAN" style="background-color: gainsboro;" class="form-control-sm col-sm-3 fontInput small bg-default mt-3 text-center" disabled>
                                                    </div>

                                                    <div class="col-sm-12 invoice-col pt-0">
                                                        <form action="" method="post">
                                                            <div class="row">
                                                                <label class="col-sm-3 col-form-label">Tanggal Laporan</label>
                                                                <div class="col-md-3">
                                                                    <input class="form-control form-control-sm fontInput small d-inline" onchange="this.form.submit()" style="text-align:center" pattern="\d{2,2}-\d{2,2}-\d{4}" id="tanggal1" name="tanggal" value="<?php echo $tanggal;

                                                                                                                                                                                                                                                                        ?>" <?php
                                                                                                                                                                                                                                                                            $oldClass = new old();
                                                                                                                                                                                                                                                                            $bukti = $oldClass->showOld('tanggal'); ?> required />
                                                                </div>

                                                            </div>

                                                            <div class="row mt-3">
                                                                <label class="col-sm-3 col-form-label"></label>
                                                                <div class="col-md-9">

                                                        </form>


                                                        <?php echo $link->exportXlsxRealisasiPendapatan('laporan/realisasi/pendapatan/print_excel', $tahun,  $bulan, $tanggal); ?>

                                                        <form name="cetak" action="<?php echo $link->pageAction('laporan/realisasi/pendapatan/print_preview'); ?>" method="post">
                                                            <input name="tahun" value="<?php echo $tahun; ?>" hidden>
                                                            <input name="bulan" value="<?php echo $bulan; ?>" hidden>
                                                            <input name="tanggal" value="<?php echo $tanggal; ?>" hidden>
                                                            <button type="submit" class="btn btn-primary btn-xs float-left px-2 mx-1 d-inline"><i class="bi bi-printer"></i><b> CETAK</b></button>
                                                        </form>
                                                    </div>
                                                </div>

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



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


        <div class="card-body mx-1">
            <label>
                <h6><b class="text-primary">REALISASI ANGGARAN PENDAPATAN DAN BELANJA _</b></h6>
            </label>
            <?php
            $class = new simakom_search();
            $showList = $class->search_input();
            ?>
            <table class="table table-bordered table-hover table-sm mb-0 mt-2">
                <thead>
                    <tr>
                        <th width="105">Kode/Akun</th>
                        <th>Uraian</th>
                        <th width="130">Pagu</br> Anggaran</th>
                        <th width="130">Realisasi</th>
                        <th width="130">Sisa Anggaran</th>
                        <th width="80">% Realisasi Pendaatan</th>
                        <th width="130">Relisasi Penggunaan Pendapatan</th>
                        <th width="130">Sisa Kas Pendapatan</th>
                        <th width="80">% Realisasi Penggunaan</th>
                    </tr>
                </thead>
            </table>

            <table id="searchtable" class="table table-bordered table-hover table-sm mb-4 mt-0">
                <thead>
                    <tr>
                        <th width="100"></th>
                        <th></th>
                        <th width="130"></th>
                        <th width="130"></th>
                        <th width="130"></th>
                        <th width="80"></th>
                        <th width="130"></th>
                        <th width="130"></th>
                        <th width="80"></th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $class = new simakom_laporan();
                    $showList = $class->list_kategori($tahun, $tb_kegiatan, $tb_komponen, $tb_akun, $tb_detail, $tb_revisi, '12', $tb_transaksi, '4');
                    ?>
                </tbody>
            </table>
        </div>
    </div>
</div>