<?php
//include "./layout/class.php";

//$akun_id = $_GET['i4'];

$cekID = new cekID();
$cekID->cek($tb_lpj, 'id', $id_page);
$format = new format();
$simakom_laporan = new simakom_laporan;

$db = database::getInstance();
$show = $db->runQuery("SELECT * FROM   {$tb_lpj}  WHERE id = '{$id_page}'");
$data = $show->fetch(PDO::FETCH_OBJ);

$v_periode = $simakom_laporan->periodelpj($data->periode, $data->tahun);
$periode = $data->periode;
//BKU
$bku_awal = $simakom_laporan->saldoBulanLalu($periode, $tahun, $tb_transaksi, '', 1);
$bku_debet = $simakom_laporan->lpj_debet($periode, $tahun, $tb_transaksi, '');
$bku_kredit = $simakom_laporan->lpj_kredit($periode, $tahun, $tb_transaksi, '');
$bku_akhir = ($bku_awal + $bku_debet) - $bku_kredit;

//PU Bank
$tarikTunai = $simakom_laporan->tarikTunai($periode, $tahun, $tb_transaksi);
$setorbank = $simakom_laporan->setorBank($periode, $tahun, $tb_transaksi);
//Bank
$filterBank = $simakom_laporan->jenisBank();
$bank_awal = $simakom_laporan->saldoBulanLalu($periode, $tahun, $tb_transaksi, 'and ' . $filterBank, 3);
$bank_debet = $simakom_laporan->lpj_debet($periode, $tahun, $tb_transaksi, 'and ' . $filterBank) - $tarikTunai;
$bank_kredit = $simakom_laporan->lpj_kredit($periode, $tahun, $tb_transaksi, 'and ' . $filterBank) - $setorbank;
$bank_akhir = ($bank_awal + $bank_debet) - $bank_kredit;

//Tunai
$filterTunai = $simakom_laporan->jenisTunai();
$tunai_awal = $simakom_laporan->saldoBulanLalu($periode, $tahun, $tb_transaksi, ' and ' . $filterTunai, 2);
$tunai_debet = $simakom_laporan->lpj_debet($periode, $tahun, $tb_transaksi, ' and ' . $filterTunai) - $setorbank;
$tunai_kredit = $simakom_laporan->lpj_kredit($periode, $tahun, $tb_transaksi, ' and ' . $filterTunai) - $tarikTunai;
$tunai_akhir = ($tunai_awal + $tunai_debet) - $tunai_kredit;
?>

<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="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-file-earmark-plus"></span> Rekam LPJ Bendahara </b>
                            <a <?php echo $link->page('laporan/lpj/index'); ?> class="btn btn-xs btn-rounded small float-right px-2"> <i class="bi bi-skip-backward-circle"></i> Kembali</a>

                        </div>
                        <form action='' method='post' role='form'>
                            <?php $csrf->token();
                            ?>
                            <input type="text" name="periode" value="<?php echo $data->periode;
                                                                        ?>" hidden>
                            <input type="text" name="tahun" value="<?php echo $data->tahun;
                                                                    ?>" hidden>
                            <input type="text" name="tanggal" value="<?php echo $data->tanggal;
                                                                        ?>" hidden>

                            <div class="card-body">
                                <div class="col-md-12 ml-2 pl-3">

                                    <div class="info-box-content">
                                        <dl class="row">
                                            <dt class="col-sm-3 pt-0">PERIODE</dt>
                                            <dd class="col-sm-9  pt-0"><b>: <?php echo $v_periode; ?></b></dd>
                                            <dt class="col-sm-3">TANGGAL</dt>
                                            <dd class="col-sm-9"><b>: <?php echo $format->dateToIndoLong($data->tanggal); ?></b></dd>

                                        </dl>
                                    </div>

                                    <div class="row">

                                        <label class="col-sm-3 col-form-label">Ubah Tanggal Laporan</label>
                                        <div class="col-md-1">
                                            <input class="form-control form-control-sm fontInput small d-inline" style="text-align:center" pattern="\d{2,2}-\d{2,2}-\d{4}" id="tanggal1" name="tanggal" value="<?php echo $format->dateToIndo($data->tanggal);

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

                                    </div>
                                </div>
                                <div class="row col-12">
                                    <div class="card-body col-md-12">
                                        <div class="row ">
                                            <div class="col-md-2">
                                                <input type="text" name="" class="form-control form-control-sm fontInput text-bold secondary" style="text-align:left" value="JENIS BUKU" placeholder="Saldo Awal" disabled>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="" class="form-control form-control-sm fontInput text-bold" style="text-align:right" value="SALDO AWAL" placeholder="Saldo Awal" disabled>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="" class="form-control form-control-sm fontInput text-bold" style="text-align:right" value="PEMASUKAN" placeholder="Debet" disabled>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="" class="form-control form-control-sm fontInput text-bold" style="text-align:right" value="PENGELUARAN" placeholder="Kredit" disabled>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="" class="form-control form-control-sm fontInput text-bold" style="text-align:right" value="SALDO AKHIR" placeholder="Saldo AKhir" disabled>
                                            </div>
                                        </div>
                                        <div class="row ">
                                            <div class="col-md-2">
                                                <input type="text" name="" class="form-control form-control-sm fontInput text-bold secondary" style="text-align:left" value="Buku Kas Umum" placeholder="Saldo Awal" disabled>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="bku_awal_view" class="form-control form-control-sm fontInput " style="text-align:right" value="<?php echo $format->ribuan($bku_awal); ?>" placeholder="Saldo Awal" disabled>
                                                <input type="text" name="bku_awal" class="form-control form-control-sm fontInput " style="text-align:right" value="<?php echo $bku_awal; ?>" placeholder="Saldo Awal" hidden>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="bku_debet_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($bku_debet); ?>" placeholder="Debet" disabled>
                                                <input type="text" name="bku_debet" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $bku_debet ?>" placeholder="Debet" hidden>

                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="bku_kredit_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($bku_kredit); ?>" placeholder="Kredit" disabled>
                                                <input type="text" name="bku_kredit" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $bku_kredit; ?>" placeholder="Kredit" hidden>

                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="bku_akhir_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($bku_akhir); ?>" placeholder="Saldo AKhir" disabled>
                                                <input type="text" name="bku_akhir" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $bku_akhir; ?>" placeholder="Saldo AKhir" hidden>

                                            </div>
                                        </div>
                                        <div class="row ">
                                            <div class="col-md-2">
                                                <input type="text" name="" class="form-control form-control-sm fontInput text-bold secondary" style="text-align:left" value="Buku Kas Bank" disabled>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="bank_awal_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($bank_awal); ?>" placeholder="Saldo Awal" disabled>
                                                <input type="text" name="bank_awal" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $bank_awal; ?>" placeholder="Saldo Awal" hidden>

                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="bank_debet_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($bank_debet); ?>" placeholder="Debet" disabled>
                                                <input type="text" name="bank_debet" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $bank_debet; ?>" placeholder="Debet" hidden>

                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="bank_kredit_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($bank_kredit); ?>" placeholder="Kredit" disabled>
                                                <input type="text" name="bank_kredit" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $bank_kredit; ?>" placeholder="Kredit" hidden>

                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="bank_akhir_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($bank_akhir); ?>" placeholder="Saldo AKhir" disabled>
                                                <input type="text" name="bank_akhir" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $bank_akhir; ?>" placeholder="Saldo AKhir" hidden>

                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-2">
                                                <input type="text" name="" class="form-control form-control-sm fontInput text-bold secondary" style="text-align:left" value="Buku Kas Tunai" placeholder="Saldo Awal" disabled>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="tunai_awal_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($tunai_awal); ?>" placeholder="Saldo Awal" disabled>
                                                <input type="text" name="tunai_awal" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $tunai_awal; ?>" placeholder="Saldo Awal" hidden>

                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="tunai_debet_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($tunai_debet); ?>" placeholder="Debet" disabled>
                                                <input type="text" name="tunai_debet" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $tunai_debet; ?>" placeholder="Debet" hidden>

                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="tunai_kredit_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($tunai_kredit); ?>" placeholder="Kredit" disabled>
                                                <input type="text" name="tunai_kredit" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $tunai_kredit; ?>" placeholder="Kredit" hidden>

                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="tunai_akhir_view" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $format->ribuan($tunai_akhir); ?>" placeholder="Saldo AKhir" disabled>
                                                <input type="text" name="tunai_akhir" class="form-control form-control-sm fontInput" style="text-align:right" value="<?php echo $tunai_akhir; ?>" placeholder="Saldo AKhir" hidden>

                                            </div>
                                        </div>
                                        <div class="row mt-2 pl-1">
                                            <span class="text-danger">- Cocokan Nilai Saldo Akhir Kas Bank dengan Buku Rekening pada Peridoe yang sama. Jika Terdapat Perbedaan, Uraiakan Penjelasan Perbedaan, pada Kolom Penjelasan Selisih Kas Bank</span>
                                            <span class="text-danger">- Cocokan Nilai Saldo Akhir Kas Tunai dengan Data Riil Uang Tunai sebagaimana diinput di bagian bawah pada Peridoe yang sama. Jika Terdapat Perbedaan, Uraiakan Penjelasan Perbedaan, pada Kolom Penjelasan Selisih Kas Tunai</span>

                                        </div>
                                    </div>
                                    <div class="card-body col-md-5">

                                        <hr>
                                        <label class="col-sm-4 col-form-label text-danger">JUMLAH UANG DI REKENING</label>
                                        <div class="row pl-2">
                                            <label class="col-sm-2 col-form-label text-secondary">REKENING 1</label>
                                            <div class="col-md-2">
                                                <input type="text" name="" id="" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" hidden>
                                            </div>
                                            <div class="col-md-5">
                                                <input type="text" name="rekening_nama1" class="form-control form-control-sm fontInput text-primary" value="<?php echo $data->rekening_nama1; ?>" style="text-align:left" placeholder="Nama/Nomor Rekening">
                                            </div>
                                            <div class="col-md-3">
                                                <input type="text" name="rekening_jumlah1" id="rekening_jumlah1" onkeyup="kalkulasirekening();" class="form-control form-control-sm fontInput text-primary" <?php echo $format->onlyNumber(); ?> value="<?php echo $data->rekening_jumlah1; ?>" style="text-align:right" placeholder="0">
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-2 col-form-label text-secondary">REKENING 2</label>
                                            <div class="col-md-2">
                                                <input type="text" name="" id="" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" hidden>
                                            </div>
                                            <div class="col-md-5">
                                                <input type="text" name="rekening_nama2" class="form-control form-control-sm fontInput text-primary" value="<?php echo $data->rekening_nama2; ?>" style="text-align:left" placeholder="Nama/Nomor Rekening">
                                            </div>
                                            <div class="col-md-3">
                                                <input type="text" name="rekening_jumlah2" id="rekening_jumlah2" onkeyup="kalkulasirekening();" class="form-control form-control-sm fontInput text-primary" <?php echo $format->onlyNumber(); ?> value="<?php echo $data->rekening_jumlah2; ?>" style="text-align:right" placeholder="0">
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-2 col-form-label text-secondary">REKENING 3</label>
                                            <div class="col-md-2">
                                                <input type="text" name="" id="" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" hidden>
                                            </div>
                                            <div class="col-md-5">
                                                <input type="text" name="rekening_nama3" class="form-control form-control-sm fontInput text-primary" value="<?php echo $data->rekening_nama3; ?>" style="text-align:left" placeholder="Nama/Nomor Rekening">
                                            </div>
                                            <div class="col-md-3">
                                                <input type="text" name="rekening_jumlah3" id="rekening_jumlah3" onkeyup="kalkulasirekening();" class="form-control form-control-sm fontInput text-primary" <?php echo $format->onlyNumber(); ?> value="<?php echo $data->rekening_jumlah3; ?>" style="text-align:right" placeholder="0">
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-7 col-form-label text-primary">TOTAL UANG DI REKENING</label>
                                            <div class="col-md-2">
                                                <input type="text" name="" id="" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" hidden>
                                            </div>

                                            <div class="col-md-3">
                                                <input type="text" name="rekening_total" id="rekening_total" onkeyup="kalkulasirekening();" class="form-control form-control-sm fontInput text-primary  text-bold" <?php echo $format->onlyNumber(); ?> value="<?php echo $format->ribuan($data->bank_riil); ?>" style="text-align:right" placeholder="0" disabled>
                                            </div>
                                        </div>
                                        <hr>
                                        <label class="col-sm-4 col-form-label text-danger">JUMLAH UANG DI BRANKAS</label>
                                        <label class="col-sm-12 col-form-label text-primary">Saldo Kas Tunai, terdiri dari uang pecahan :</label>
                                        <div class="row pl-2">


                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 100.000</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_100" value="<?php echo $data->pecahan_100; ?>" id="pecahan_100" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_100" id="total_100" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_100 * 100000); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 75.000</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_75" value="<?php echo $data->pecahan_75; ?>" id="pecahan_75" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_75" id="total_75" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_75 * 75000); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 50.000</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_50" value="<?php echo $data->pecahan_50; ?>" id="pecahan_50" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_50" id="total_50" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_50 * 50000); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 20.000</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_20" value="<?php echo $data->pecahan_20; ?>" id="pecahan_20" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_20" id="total_20" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_20 * 20000); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 10.000</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_10" value="<?php echo $data->pecahan_10; ?>" id="pecahan_10" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_10" id="total_10" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_10 * 10000); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 5.000</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_5" value="<?php echo $data->pecahan_5; ?>" id="pecahan_5" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_5" id="total_5" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_5 * 5000); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 2.000</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_2" value="<?php echo $data->pecahan_2; ?>" id="pecahan_2" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_2" id="total_2" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_2 * 2000); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 1.000</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_1" value="<?php echo $data->pecahan_1; ?>" id="pecahan_1" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr/Kpg" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_1" id="total_1" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_1 * 1000); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 500</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_05" value="<?php echo $data->pecahan_05; ?>" id="pecahan_05" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Kpg" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_05" id="total_05" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_05 * 500); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 200</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_02" value="<?php echo $data->pecahan_02; ?>" id="pecahan_02" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Kpg" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_02" id="total_02" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_02 * 200); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 100</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_01" value="<?php echo $data->pecahan_01; ?>" id="pecahan_01" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Kpg" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_01" id="total_01" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_01 * 100); ?>" disabled>
                                            </div>
                                        </div>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Pecahan 50</label>
                                            <div class="col-md-2">
                                                <input type="text" name="pecahan_005" value="<?php echo $data->pecahan_005; ?>" id="pecahan_005" onkeyup="kalkulasi();" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Kpg" required>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total_005" id="total_005" onkeyup="kalkulasi();" class="form-control form-control-sm  fontInput" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->pecahan_005 * 50); ?>" disabled>
                                            </div>
                                        </div>

                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-primary">TOTAL UANG TUNAI</label>
                                            <div class="col-md-2">
                                                <input type="text" name="" id="" class="form-control form-control-sm fontInput" style="text-align:center" <?php echo $format->onlyNumber(); ?> placeholder="Lbr" hidden>
                                            </div>
                                            <div class="col-md-4">
                                                <input type="text" name="total" id="nilai_total" class="form-control form-control-sm fontInput text-primary text-bold" <?php echo $format->onlyNumber(); ?> style="text-align:right" placeholder="0" value="<?php echo $format->ribuan($data->tunai_riil); ?>" disabled>
                                            </div>
                                        </div>

                                    </div>

                                    <div class="card-body col-md-5">

                                        <hr>
                                        <label class="col-sm-12 col-form-label text-primary">Penjelasan Selisih Kas :</label>
                                        <div class="row pl-2">
                                            <label class="col-sm-4 col-form-label text-primary">Kas Bank :</label>
                                            <div class="col-md-12">
                                                <textarea name="selisihbank_keterangan1" rows="2" class="form-control form-control-sm fontInput small"><?php echo $data->selisihbank_keterangan1; ?></textarea>
                                                <textarea name="selisihbank_keterangan2" rows="2" class="form-control form-control-sm fontInput small"><?php echo $data->selisihbank_keterangan2; ?></textarea>
                                            </div>
                                        </div>
                                        <div class="row pl-2 mt-2 mb-2">
                                            <label class="col-sm-4 col-form-label text-primary">Kas Tunai :</label>
                                            <div class="col-md-12">
                                                <textarea name="selisihtunai_keterangan1" rows="2" class="form-control form-control-sm fontInput small"><?php echo $data->selisihtunai_keterangan1; ?></textarea>
                                                <textarea name="selisihtunai_keterangan2" rows="2" class="form-control form-control-sm fontInput small"><?php echo $data->selisihtunai_keterangan2; ?></textarea>
                                            </div>
                                        </div>
                                        <div class="row pl-2 mt-2 mb-2">
                                            <label class="col-sm-4 col-form-label text-secondary">Catatan terkait LPJ :</label>
                                            <div class="col-md-12">
                                                <textarea name="catatan" rows="6" class="form-control form-control-sm fontInput small"><?php echo $data->catatan; ?></textarea>
                                            </div>
                                        </div>
                                        <hr>
                                        <button type="submit" name="submitLPJ" class="btn btn-primary btn-xs mb-2 btn-rounded small px-2 ml-2"> <i class="bi bi-save"></i> SIMPAN DATA</button>
                                    </div>


                                </div>

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

<script type='text/javascript'>
    function kalkulasi() {
        var txt100 = parseFloat(document.getElementById('pecahan_100').value);
        var txt75 = parseFloat(document.getElementById('pecahan_75').value);
        var txt50 = parseFloat(document.getElementById('pecahan_50').value);
        var txt20 = parseFloat(document.getElementById('pecahan_20').value);
        var txt10 = parseFloat(document.getElementById('pecahan_10').value);
        var txt5 = parseFloat(document.getElementById('pecahan_5').value);
        var txt2 = parseFloat(document.getElementById('pecahan_2').value);
        var txt1 = parseFloat(document.getElementById('pecahan_1').value);
        var txt05 = parseFloat(document.getElementById('pecahan_05').value);
        var txt02 = parseFloat(document.getElementById('pecahan_02').value);
        var txt01 = parseFloat(document.getElementById('pecahan_01').value);
        var txt005 = parseFloat(document.getElementById('pecahan_005').value);

        var result100 = ((txt100) * 100000);
        var result75 = ((txt75) * 75000);
        var result50 = ((txt50) * 50000);
        var result20 = ((txt20) * 20000);
        var result10 = ((txt10) * 10000);
        var result5 = ((txt5) * 5000);
        var result2 = ((txt2) * 2000);
        var result1 = ((txt1) * 1000);
        var result05 = ((txt05) * 500);
        var result02 = ((txt02) * 200);
        var result01 = ((txt01) * 100);
        var result005 = ((txt005) * 50);

        var nilai_total = (result100 + result75 + result50 + result20 + result10 + result5 + result2 + result1 + result05 + result02 + result01 + result005);
        //if (!isNaN(nilai_total)) {
        document.getElementById('total_100').value = formatNumber(result100);
        document.getElementById('total_75').value = formatNumber(result75);
        document.getElementById('total_50').value = formatNumber(result50);
        document.getElementById('total_20').value = formatNumber(result20);
        document.getElementById('total_10').value = formatNumber(result10);
        document.getElementById('total_5').value = formatNumber(result5);
        document.getElementById('total_2').value = formatNumber(result2);
        document.getElementById('total_1').value = formatNumber(result1);
        document.getElementById('total_05').value = formatNumber(result05);
        document.getElementById('total_02').value = formatNumber(result02);
        document.getElementById('total_01').value = formatNumber(result01);
        document.getElementById('total_005').value = formatNumber(result005);

        document.getElementById('nilai_total').value = formatNumber(nilai_total);
        // }
    }
</script>

<script type='text/javascript'>
    function kalkulasirekening() {
        var txt1 = parseFloat(document.getElementById('rekening_jumlah1').value);
        var txt2 = parseFloat(document.getElementById('rekening_jumlah2').value);
        var txt3 = parseFloat(document.getElementById('rekening_jumlah3').value);


        var nilai_total = (txt1 + txt2 + txt3);
        //if (!isNaN(nilai_total)) {
        //document.getElementById('rekening_jumlah1').value = formatNumber(txt1);
        //document.getElementById('rekening_jumlah2').value = formatNumber(txt2);
        //document.getElementById('rekening_jumlah3').value = formatNumber(txt3);


        document.getElementById('rekening_total').value = formatNumber(nilai_total);
        // }
    }
</script>
<?php

$select = new form();
//$select->selectScript();
$class = new simakom_laporan();


if (isset($_POST['submitLPJ'])) {
    $csrf = $csrf->cekToken();

    $save = $class->insertRekamLPJ($tb_lpj, $id_page);
} else {
    echo "";
};
