<div class="content-wrapper">

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

    <div class="container col-12 mb-4 pb-5">
        <div class="row">
            <div class="col-12">

                <div class="card-body mx-4">

                    <div class="card">
                        <div class="timeline-header bg-primary py-2 pl-2">
                            <b class="text-light judul"><span class="bi bi-journal-text"></span> ANGGARAN PENDAPATAN DAN BELANJA SEKOLAH/MADRASAH [APBS/M] TP. <?php echo $tahun; ?></b>
                        </div>
                        <div class="card-body mb-0">
                            <div class="row mx-0 mt-0">
                                <div class="col-md-12">
                                    <div class="card-body mt-1 px-1 mx-0">

                                        <?php
                                        $class_cekRevisi = new cekID();
                                        $count_revisi = $class_cekRevisi->cekRevisi($tb_revisi);
                                        $link = new linkpage();
                                        if ($count_revisi == 0) {
                                            $info_history = "<p class='col-12'>BELUM ADA HISTORY RKAS/M. PROSES BUAT HISTORY [REVISI] RKAS/M UNTUK DAPAT MULAI MEREKAM RKAS/M AWAL, MELALUI MENU UTILITY->HISTORY [REVISI] RKAS/M ATAU DENGAN IMPORT RKAS/TAHUN LALU</p>";
                                            $createRevisi = "<a " . $link->page('rkas/revisi_read') . " class='btn btn-primary btn-xs d-inline px-2 ml-2'> <i class='bi bi-cloud-fog2 text-light '></i> BUAT HISTORY RKAS/M</a>";
                                            $print = "";
                                            $excel = "";
                                            $excel2 = "";
                                            $excel_rekap = "";
                                            $importTL = "<a " . $link->page('rkas/importtl') . " class='btn btn-primary btn-xs d-inline px-2 ml-2'> <i class='bi bi-front text-light '></i> IMPORT RKAS/M TAHUN LALU</a>";
                                        } elseif ($count_revisi == 1) {
                                            $info_history = "<p class='col-12'><strong class='text-danger'>HISTORY RKAS/M : RKAS/M AWAL</strong></p>";;
                                            $createRevisi = "<a " . $link->page('rkas/revisi_read') . " class='btn btn-primary btn-xs d-inline px-2 ml-2' > <i class='bi bi-front text-light '></i><b> BUAT/HAPUS REVISI</b></a>";
                                            $print = "<a " . $link->page('rkas/rkas_preview') . " class='btn btn-primary btn-xs d-inline px-2 ml-2' > <i class='bi bi-printer text-light '></i><b> CETAK</b></a>";
                                            $excel = $link->exportXlsxRKAS('rkas/rkas_excel', $tb_detail);
                                            $excel2 = $link->exportXlsxRKAS('rkas/rkas_print_xls', $tahun);
                                            $excel_rekap = $link->exportXlsxRKASRekap('rkas/rkas_print_xls_rekap', $tahun);
                                            $importTL = "";
                                        } else {
                                            $info_history = "<p class='col-12'><strong class='text-danger'>HISTORY RKAS/M : REVISI " . (($count_revisi) - 1) . "</strong></p> ";
                                            $createRevisi = "<a " . $link->page('rkas/revisi_read') . " class='btn btn-primary btn-xs d-inline px-2 ml-2' > <i class='bi bi-front text-light '></i><b> BUAT/HAPUS REVISI</b></a>";
                                            $print = "<a " . $link->page('rkas/rkas_preview') . " class='btn btn-primary btn-xs d-inline px-2 ml-2' > <i class='bi bi-printer text-light '></i><b> CETAK</b></a>";
                                            $excel = $link->exportXlsxRKAS('rkas/rkas_excel', $tb_detail);
                                            $excel2 = $link->exportXlsxRKAS('rkas/rkas_print_xls', $tahun);
                                            $excel_rekap = $link->exportXlsxRKASRekap('rkas/rkas_print_xls_rekap', $tahun);
                                            $importTL = "";
                                        };

                                        echo $info_history;
                                        echo $importTL;
                                        echo $createRevisi;
                                        echo $print;
                                        echo $excel2;
                                        echo $excel_rekap;
                                        echo $link->exportXlsxAnalisaRKAS('rkas/excel_analisa', $tahun);
                                        ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php
                    if ($count_revisi == 0) {
                        echo "";
                    } else {
                        include "rkas.php";
                    };
                    ?>

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