<?php

require('../../asset/mod/autoLoad.php');

$classcekPost = new cekissetPost();
$detail_id_transaksi = $classcekPost->cek('detail_id');

$jenis_transaksi = "11";
if ($detail_id_transaksi == "") {
    $detail_id_transaksi = "";
} else {
    $detail_id_transaksi = $detail_id_transaksi;
};
if ($detail_id_transaksi == "" && !isset($_POST['detail_id']) && ($jenis_transaksi == 21 || $jenis_transaksi == 22  || $jenis_transaksi >= 41)) {
    $detail_kode_transaksi = "<i class='text-primary'>" . $jenis_transaksi . ' : </i>';
    $detail_deskripsi_transaksi = "<i class='text-primary'>" . $jenis_deskripsi . "</i>";
    $enable = "";
    $rkas_kategori = "";
    $rkas_kegiatan = "";
    $rkas_komponen = "";
    $rkas_akun = "";
    $rkas_pembiayaan_id = "";
    $rkas_pembiayaan_kegiatan = "";
    $rkas_pembiayaan_komponen = "";
    $rkas_pembiayaan_akun = "";

    if ($jenis_transaksi == 21) {
        $uraian_rekomendasi = "Setor Tunai ke Bank";
    } elseif ($jenis_transaksi == 22) {
        $uraian_rekomendasi = "Tarik Tunai dari Bank";
    } elseif ($jenis_transaksi == 41) {
        $uraian_rekomendasi = "Penerimaan Hutang Pihak Ketiga Tunai";
    } elseif ($jenis_transaksi == 42) {
        $uraian_rekomendasi = "Penerimaan Hutang Pihak Ketiga Bank";
    } elseif ($jenis_transaksi == 43) {
        $uraian_rekomendasi = "Pembayaran Hutang Pada Pihak Ketiga Tunai";
    } elseif ($jenis_transaksi == 44) {
        $uraian_rekomendasi = "Pembayaran Hutang Pada Pihak Ketiga Bank";
    } elseif ($jenis_transaksi == 45) {
        $uraian_rekomendasi = "Pengeluaran Piutang Kepada Pihak Ketiga Tunai";
    } elseif ($jenis_transaksi == 46) {
        $uraian_rekomendasi = "Pengeluaran Piutang Kepada Pihak Ketiga Bank";
    } elseif ($jenis_transaksi == 47) {
        $uraian_rekomendasi = "Pengembalian Piutang Kepada Pihak Ketiga Tunai";
    } else {
        $uraian_rekomendasi = "Pengembalian Piutang Kepada Pihak Ketiga Bank";
    };
} elseif (!isset($_POST['detail_id']) || isset($_POST['saveTransaksi']) && ($jenis_transaksi != 21 || $jenis_transaksi != 22)) {
    $detail_kode_transaksi = "<i class='text-danger'>Akun Belum dipilih</i>";
    $detail_deskripsi_transaksi = "";
    $enable = "disabled";
    $rkas_kategori = "";
    $rkas_kegiatan = "";
    $rkas_komponen = "";
    $rkas_akun = "";
    $rkas_pembiayaan_id = "";
    $rkas_pembiayaan_kegiatan = "";
    $rkas_pembiayaan_komponen = "";
    $rkas_pembiayaan_akun = "";
    $uraian_rekomendasi = "";
} elseif (isset($_POST['detail_id']) && ($jenis_transaksi == 13 || $jenis_transaksi == 14 || $jenis_transaksi == 33 || $jenis_transaksi == 34)) {
    $detail_kode_transaksi = "<i class='text-primary'>" . $pajak_transaksi . ' : </i>';
    $detail_deskripsi_transaksi = "<i class='text-primary'>" . $class->uraianPajak($pajak_transaksi) . "</i>";
    $enable = "";
    $rkas_kategori = "";
    $rkas_kegiatan = "";
    $rkas_komponen = "";
    $rkas_akun = "";
    $rkas_pembiayaan_id = "";
    $rkas_pembiayaan_kegiatan = "";
    $rkas_pembiayaan_komponen = "";
    $rkas_pembiayaan_akun = "";

    $class = new simakom_setor();
    $uraian_rekomendasi = $class->rekomUraianPajak($jenis_transaksi,  $pajak_transaksi);
} else {
    $class = new simakom_setor();
    $detail_kode_transaksi = "<i class='text-primary'>" . $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'detail_id') . ' : </i>';
    $detail_deskripsi_transaksi = "<i class='text-primary'>" . $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'uraian') . "</i>";
    $enable = "";
    $rkas_kategori = $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'kategori');
    $rkas_kegiatan = $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'kegiatan');
    $rkas_komponen = $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'komponen');
    $rkas_akun = $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'akun');
    $rkas_pembiayaan_id = $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'pembiayaan_id');
    $rkas_pembiayaan_kegiatan = $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'pembiayaan_kegiatan');
    $rkas_pembiayaan_komponen = $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'pembiayaan_komponen');
    $rkas_pembiayaan_akun = $class->uraianRKAS($tb_detail, 'detail_id', $detail_id_transaksi, 'pembiayaan_akun');

    $class = new simakom_setor();
    $uraian_rekomendasi = $class->rekomUraianNonPajak($jenis_transaksi, $tb_detail, $detail_id_transaksi);
};

?>
<style>
    .fontInput {
        font-size: 11px;
        font-family: arial;
    }

    .fontJudul {
        font-size: 12px;
        font-family: arial;
        color: dodgerblue;
        background: #000;

    }
</style>
<script>
    function formatNumber(num) {
        return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.')
    }
</script>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">

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

    <div class="container col-12 mb-4 pb-5">
        <div class="row  mx-0 pr-3">
            <div class="col-12">
                <div class="col-12 ">
                    <div class="card  mx-0">

                        <div class="timeline-header bg-primary  py-1 pl-1">
                            <b class="text-light judul"><span class="bi bi-clipboard-plus"></span> Rekam Data Setor</b>
                        </div>

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

                                    <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="PILIH TAHUN PEMBUKUAN" style="background-color: gainsboro;" class="form-control-sm col-sm-2 fontInput small bg-default mt-3 text-center" disabled>
                                                    </div>

                                                    <div class="col-sm-12 invoice-col pt-0">

                                                        <form action="<?php $classLink = new linkpage();
                                                                        echo $classLink->pageAction('setor/setor_create_step2') ?>" method="post" role="form">
                                                            <div class="row mx-0 mt-0">
                                                                <div class="col-md-12">
                                                                    <div class="card-body mt-0 px-0 mx-0">
                                                                        <div class="row">
                                                                            <label for="exampleEmail" class="col-sm-3 col-form-label">Tahun Pembukuan (Bendahara) </label>
                                                                            <div class="col-sm-8">
                                                                                <select name="tahun_setor" class="form-control form-control-sm fontInput small" required>
                                                                                    <option><?php $sekolah = new crudData();
                                                                                            $show = $sekolah->editData('sekolah', 'id', $sekolah_id);
                                                                                            $data = $show->fetch(PDO::FETCH_OBJ);
                                                                                            echo $data->tp; ?></option>
                                                                                    <?php
                                                                                    $opt = new form();
                                                                                    $opval = $opt->optSelect('tb_tp', 'order by tp asc');
                                                                                    while ($dataopt = $opval->fetch(PDO::FETCH_OBJ)) {
                                                                                        echo "<option>$dataopt->tp</option>";
                                                                                    };
                                                                                    ?>
                                                                                </select>
                                                                            </div>


                                                                        </div>
                                                                        <div class="col-md-6">

                                                                        </div>
                                                                    </div>
                                                                    <div class="row mx-3 mt-0">
                                                                        <div class="col-md-12">
                                                                            <div class='row '>
                                                                                <div class="col-12 my-0 pl-0 py-0 my-3">
                                                                                    <div class="row float-left">
                                                                                        <div class="col-auto">
                                                                                            <button type="submit" class="btn btn-primary btn-xs mx-1 px-2 mt-1" name="saveStep1"> LANJUT <i class="bi bi-chevron-double-right"></i> </button>
                                                                                            <a <?php echo $link->page('setor/setor_read_create');
                                                                                                ?> class="btn btn-primary btn-xs float-right mx-1 px-2 mt-1"><i class="bi bi-chevron-double-left"></i> CANCEL</a>
                                                                                        </div>

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

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