        <!-- ============================================================== -->
        <!-- wrapper  -->
        <!-- ============================================================== -->
        <div class="dashboard-wrapper">
            <div class="container-fluid  dashboard-content">
                <!-- ============================================================== -->
                <!-- pageheader -->
                <!-- ============================================================== -->
                <div class="row">
                    <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                        <div class="page-header">
                            <h2 class="pageheader-title">Anomali review 2 hari LPBJ</h2>
                            <div class="page-breadcrumb">
                                <nav aria-label="breadcrumb">
                                    <ol class="breadcrumb">
                                        <li class="breadcrumb-item"><a href="index.php" class="breadcrumb-link"><?php echo namahari_ID(date('Y-m-d')).", ".date('d-m-Y');?>, Dashboard</a></li>
                                        <li class="breadcrumb-item">Pembelian</a></li>
                                        <li class="breadcrumb-item active" aria-current="page"><a href="?menu=anomali-2hari-lpbj" class="breadcrumb-link">Anomali 2 hari LPBJ</a></li>
                                    </ol>
                                </nav>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- ============================================================== -->
                <!-- end pageheader -->
                <!-- ============================================================== -->
                <div class="row">
                    <!-- ============================================================== -->
                    <!-- basic form -->
                    <!-- ============================================================== -->
                    <div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12">
                        <div class="card">
                            <h5 class="card-header">Anomali 2 hari LPBJ</h5>
                            <div class="card-body">
                                <form id="basicform" data-parsley-validate="" action="index.php?menu=anomali-2hari-lpbj" method="post" enctype="multipart/form-data" onsubmit="changeValue()">
                                    <div class="form-group">
                                        <?php 
                                        if(isset($_POST['dtAwal']))
                                            $dtAwal=$_POST['dtAwal'];
                                        else
                                            $dtAwal=date('Y-m-d');

                                        if(isset($_POST['dtAkhir']))
                                            $dtAkhir=$_POST['dtAkhir'];
                                        else
                                            $dtAkhir=date('Y-m-d');
                                        ?>
                                        <label for="inputdtAwal">Tanggal Awal</label>&nbsp;&nbsp;&nbsp;<input id="inputdtAwal" type="date" name="dtAwal" value="<?php echo $dtAwal;?>" required>
                                        &nbsp;&nbsp;&nbsp;<label for="inputdtAkhir">Tanggal Akhir</label>&nbsp;&nbsp;&nbsp;<input id="inputdtAkhir" type="date" name="dtAkhir" value="<?php echo $dtAkhir;?>" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="inputJabatan">Jabatan</label>
                                        <select name="level" class="form-control" id="inputJabatan">
                                            <option value="1" <?php if(isset($_POST['level']) && $_POST['level']=="1") echo "selected";?>>Direksi</option>
                                            <option value="2" <?php if(isset($_POST['level']) && $_POST['level']=="2") echo "selected";?>>Manager</option>
                                            <option value="3" <?php if(isset($_POST['level']) && $_POST['level']=="3") echo "selected";?>>Supervisor</option>
                                        </select>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-6 pl-0">
                                            <p class="text-right">
                                                <button type="submit" name="lihat" class="btn btn-space btn-primary">Lihat</button>
                                                <a href="?menu=daftar-terima-barang.php" class="btn btn-space btn-secondary">Cancel</a>
                                            </p>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>

                    <!-- ============================================================== -->
                    <!-- end basic form -->
                    <!-- ============================================================== -->
                    <?php 
                    $where="";
                    if(isset($_POST['lihat']))
                    {   
                    ?>
                            <!-- ============================================================== -->
                            <!-- data table  -->
                            <!-- ============================================================== -->
                            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="mb-0">Data List Anomali LPBJ</h5>
                                    </div>
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table id="example" class="table table-striped table-bordered second" style="width:100%">
                                                <thead>
                                                    <tr>
                                                        <th>No</th>
                                                        <th>Kode LPBJ</th>
                                                        <th>Requestor</th>
                                                        <th>SPV</th>
                                                        <th>MGR</th>
                                                        <th>DIR</th>
                                                        <th>Option</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php
                                                        $MySQLi = new MySQLi($strDBHostName, $strDBUsername, $strDBPassword, $strDBName);
                                                        switch($_POST['level'])
                                                        {
                                                            case "1": $where=" AND dtSubmitDIR = '1000-01-01' AND  ((strMailDIR=strMailMGR AND strMailDIR=strMailSPV AND TIMESTAMPDIFF(DAY, dtCreate, NOW()) >= 2) OR (strMailDIR<>strMailMGR AND TIMESTAMPDIFF(DAY, dtSubmitMGR, NOW())>=2) OR (strMailDIR=strMailMGR AND strMailDIR<>strMailSPV AND TIMESTAMPDIFF(DAY, dtSubmitSPV, NOW())>=2))";
                                                                      break;
                                                            case "2": $where=" AND dtSubmitMGR = '1000-01-01' AND ((strMailMGR=strMailSPV AND TIMESTAMPDIFF(DAY, dtCreate, NOW())>=2) OR (strMailMGR<>strMailSPV AND TIMESTAMPDIFF(DAY, dtSubmitSPV, NOW())))";
                                                                      break;
                                                            case "3": $where=" AND dtSubmitSPV = '1000-01-01' AND TIMESTAMPDIFF(DAY, dtCreate, NOW())>=2";break;
                                                        }
                                                        $query="SELECT  ID, 
                                                                        strKdLPBJ, 
                                                                        strFullNameREQ, 
                                                                        strFullNameSPV, 
                                                                        strFullNameMGR, 
                                                                        strFullNameDIR, 
                                                                        dtCreate, 
                                                                        dtSubmitSPV, 
                                                                        dtSubmitMGR, 
                                                                        dtSubmitDIR 
                                                                FROM tpc_h_lpbj 
                                                                WHERE stsAktif=1 AND 
                                                                    (dtCreate BETWEEN '".$_POST['dtAwal']." 00:00:00' AND '".$_POST['dtAkhir']." 23:59:59') 
                                                                ".$where; //echo $query;
                                                        $i=1; 
                                                        //echo $query;
                                                        $result=$MySQLi->query($query); 
                                                        while($row=$result->fetch_array()) 
                                                        { 
                                                            if($row['dtSubmitSPV']=="1000-01-01")
                                                                $dtSubmitSPV="Pending";
                                                            else
                                                                $dtSubmitSPV=$row['dtSubmitSPV'];

                                                            if($row['dtSubmitMGR']=="1000-01-01")
                                                                $dtSubmitMGR="Pending";
                                                            else
                                                                $dtSubmitMGR=$row['dtSubmitMGR'];

                                                            if($row['dtSubmitDIR']=="1000-01-01")
                                                                $dtSubmitDIR="Pending";
                                                            else
                                                                $dtSubmitDIR=$row['dtSubmitDIR'];

                                                            echo "<tr>
                                                                    <td>".$i."</td>
                                                                    <td>".$row['strKdLPBJ']."</td>
                                                                    <td>".$row['strFullNameREQ']." / ".$row['dtCreate']."</td>
                                                                    <td>".$row['strFullNameSPV']." / ".$dtSubmitSPV."</td>
                                                                    <td>".$row['strFullNameMGR']." / ".$dtSubmitMGR."</td>
                                                                    <td>".$row['strFullNameDIR']." / ".$dtSubmitDIR."</td>
                                                                    <td><a href='transaksi/persediaan/pemesanan/print.pesan.barang.php?ID=".$row['ID']."' class='btn btn-space btn-primary' target='_blank'>Print Preview</a></td>
                                                                </tr>";
                                                            $i++;
                                                        }
                                                    ?>
                                                </tbody>
                                                <tfoot>
                                                    <tr>
                                                        <th>No</th>
                                                        <th>Kode LPBJ</th>
                                                        <th>Requestor</th>
                                                        <th>SPV</th>
                                                        <th>MGR</th>
                                                        <th>DIR</th>
                                                        <th>Option</th>
                                                    </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- ============================================================== -->
                            <!-- end data table  -->
                            <!-- ============================================================== -->
                    <?php
                    } 
                    ?>
                </div>
            </div>
            <!-- ============================================================== -->
            <!-- footer -->
            <!-- ============================================================== -->
            <div class="footer">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
                            Copyright © 2024 TPC-PACK, Developed By <a href="mailto: jockie@netportal.my.id">JC Comp</a>.
                        </div>
                        <!--<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
                            <div class="text-md-right footer-links d-none d-sm-block">
                                <a href="javascript: void(0);">About</a>
                                <a href="javascript: void(0);">Support</a>
                                <a href="javascript: void(0);">Contact Us</a>
                            </div>
                        </div>-->
                    </div>
                </div>
            </div>
            <!-- ============================================================== -->
            <!-- end footer -->
            <!-- ============================================================== -->
        </div>
<script>
function changeValue() {
    var input = document.getElementById("list_item");
    var selectedValue = input.value;
    var realValue = document.querySelector('option[value="' + selectedValue + '"]').getAttribute("data-realvalue");
    input.value = realValue;
}
</script>