<section class="content-header">
    <div class="container-fluid">
        <div id="flash" data-flash="<?= $this->session->flashdata('success'); ?>"></div>
        <div class="row ">
            <div class="col-sm-12">
                <h1>LAP.KEUANGAN - Peng. Harian </h1>
            </div>
        </div>
    </div>
</section>

<div id="flash" data-flash="<?= $this->session->flashdata('success'); ?>"></div>

<section class="content">

    <!-- start pencarian -->
    <div class="container-fluid">
        <form action="" method="get">
            <div class="row mb-3 ">
                <div class="col-12">
                    <?php if (isset($_GET['tgl'])) {
                        $tgl = $_GET['tgl'];
                    } else {
                        $tgl = null;
                    } ?>
                    <div class="input-group align-center">
                        <div class="input-group-prepend">
                            <span class="input-group-text"><i class="fas fa-warehouse"></i></span>
                        </div>

                        <input id="datepickerbulan" placeholder="Pilih Tanggal Arsip" name="tgl" type="text" class="form-control " value="<?= $tgl = $tgl ? $tgl : date('m / Y') ?>" autocomplete="off">

                        <div style="width: 100px" class="input-group-prepend">
                            <button type="submit" class="btn btn-outline-secondary w-100">Pilih</button>
                        </div>
                    </div>
                </div>
        </form>
    </div>
    <!-- ending pencarian -->

    <div class="row">
        <!-- Pendapatan Harian -->
        <div class="col-12 col-md-12 col-sm-12 mb-2">
            <div class="card border-left-primary ">
                <div class="card-body">
                    <div class="row no-gutters align-items-center">
                        <div class="col mr-2">
                            <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Total Pengeluaran (&nbsp;<?= $tgl ?>&nbsp;)</div>
                            <div class="h5 mb-0 font-weight-bold text-gray-800"><?= indo_currency($totpeng) ?>
                            </div>
                        </div>
                        <div class="col-auto">
                            <i class="fas fa-coins fa-2x text-gray-300"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-12 col-md-12 col-sm-12 ">
            <div class="card card-outline card-secondary p-2">

                <table class="table  table-hover table-sm ">
                    <tr class=" text-center">
                        <th class="text-left">tanggal</th>

                        <th class="text-left">Invoice</th>
                        <th class="text-left">Nama Pengeluaran</th>
                        <th class="text-left">Total</th>
                    </tr>
                    <?php
                    if ($inpengharian->num_rows() > 0) {
                        foreach ($inpengharian->result() as $am => $data) {
                    ?>
                            <tr>
                                <td>
                                    <?= $data->tgl_pengcab ?>
                                </td>
                                <td>
                                    <?= $data->invoice_pengcab ?>
                                </td>
                                <td>
                                    <?= $data->nama_pengcab ?>
                                </td>
                                <td>
                                    <?= indo_currency($data->tot_pengcab) ?>
                                </td>
                            </tr>
                    <?php
                        }
                    } else {
                        echo '<tr>
                                <td colspan="8" class="text-center"> Tidak Ada Data Pengeluaran Yang Tersedia </td>
                                </tr>';
                    }
                    ?>
                </table>

            </div>
        </div>

    </div>


</section>