<?php

//Cek User
$format = new format;
$time = new time;
$clslistTanggungan = new listTanggungan();
$hariini = $time->tanggalIni();

if ((int)substr($time->getDate(), 5, 2) > 6) {
    $blnNow = (int)substr($time->getDate(), 5, 2) - 6;
} else {
    $blnNow = (int)substr($time->getDate(), 5, 2) + 6;
}

if (isset($_POST['bulan'])) {
    $bulan = $_POST['bulan'];
    $periode = $lembaga->valPeriodeEng($bulan, $tahun1, $tahun2);
    $v_bulan = $lembaga->ValPeriode($bulan, $tahun1, $tahun2);
} else {
    $bulan = $lembaga->nowPeriode();
    $periode = $lembaga->valPeriodeEng($blnNow, $tahun1, $tahun2);
    $v_bulan = $lembaga->ValPeriode($blnNow, $tahun1, $tahun2);
};

//TOTAL KEKURANGAN
//Jumlah
$dt_jenis = new listTanggungan();
$classTrans = new transaksi();
$jumlah = $dt_jenis->tanggunganSiswa($tb_siswa, 'id', $id_siswa);
$total_tang = number_format($jumlah, 0, ".", ".");

//Terbayar & Kurang Total
$infoTerbayartotal = $classTrans->infoterbayartotal($tb_transaksi, $nis);
$terbayarTotal = @(number_format($infoTerbayartotal, 0, ".", "."));
$kurangTotal = @(number_format(($jumlah - $infoTerbayartotal), 0, ".", "."));

$persenTotal = $format->persen($infoTerbayartotal, $jumlah);

if ($persenTotal < 50) {
    $fgcolor = "red";
} elseif ($persenTotal >= 50 && $persenTotal < 100) {
    $fgcolor = "orange";
} else {
    $fgcolor = "green";
};
?>
<!-- Content Wrapper. Contains page content -->
<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 pt-0 pb-1 mb-5">
                        <b class="text-light judul my-2 ml-2" style="font-family:consolas;font-size:14px"><span class="bi bi-house-fill"></span> Beranda</b>
                        <a class="btn bg-transparent btn-xs  mx-1 text-light float-right" <?php echo $link->page('logout'); ?> style="font-family: consolas;" title="KELUAR"><img src="../../asset/dokumen/foto/switch.png" width="20" height="20">

                        </a>
                    </div>

                    <div class='row mt-3'>
                        <div class='col-12 col-sm-12 col-md-12'>
                            <div class='info-box  bg-transparent mt-2'>

                                <div class='info-box-content small'>
                                    <span class='info-box-text text-danger'><b class='col-4 float-left'>Nama</b><b>: <?php echo strtoupper($nama); ?> </b></span>
                                    <span class='info-box-text text-dark'><b class='col-4 float-left'>NIS</b><b>: <?php echo $nis; ?> </b></span>
                                    <span class='info-box-text text-dark'><b class='col-4 float-left'>Kelas</b><b>: <?php echo $kelas; ?> </b></span>

                                    <span class='info-box-text float-right'>
                                        <a <?php echo $link->pageID($user_id, 'seting/userAdmin/user_profil'); ?> class="badge badge-secondary small px-2"> <i class="bi bi-person-plus"></i> SETING PROFIL & PASSWORD</a>

                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row col-md-12 mt-2 text-center">
                    <div class="col-sm-12">
                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->page('beranda'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/home.png" width="30" height="30"><br> Home</a>
                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->pageID($user_id, 'seting/userAdmin/user_profil'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/siswa2.png" width="25" height="30"> <br>Profil</a>
                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->pageID($id_siswa, 'report'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/diagram.png" width="40" height="30"> <br>Tanggungan</a>
                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->pageID($id_siswa, 'billing/index'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/bill.png" width="40" height="30"> <br>Bayar</a>
                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->page('transaksi/transaksi_read'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/banking.png" width="30" height="30"><br> Transaksi</a>
                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->page('transaksi/kuitansi_read'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/print.png" width="30" height="30"><br> Cetak Kuitansi</a>
                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->pageID($id_siswa, 'tabungan/index'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/setor.png" width="30" height="30"><br> Tabungan</a>
                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->pageID($id_siswa, 'konfirmasi/index'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/nilairdm.png" width="30" height="30"> <br>Mon Konfirmasi</a>

                        <a class="btn bg-transparent btn-xs mx-1 text-secondary pt-5" <?php echo $link->page('logout'); ?> style="font-family: consolas;"><img src="../../asset/dokumen/foto/switch.png" width="30" height="30"><br> Keluar</a>
                    </div><!-- /.col -->
                </div>
            </div>
        </div>
    </section>


    <div class="clearfix hidden-md-up"></div>




</div>