<?php
$where = "";
switch ($_SESSION['usrLevel']) {
    case 1:
        $where = " ((HEAD.dtSubmitDIR = '1000-01-01' AND HEAD.dtSubmitMGR <> '1000-01-01' AND HEAD.dtSubmitSPV <> '1000-01-01') OR 
                    (HEAD.strMailDIR=HEAD.strMailMGR AND HEAD.dtSubmitMGR = '1000-01-01' AND HEAD.dtSubmitSPV <> '1000-01-01') OR 
                    (HEAD.strMailDIR=HEAD.strMailSPV AND HEAD.dtSubmitSPV = '1000-01-01')) AND strMailDIR='" . $_SESSION['strEmail'] . "'
                    ";
        break;
    case 2:
        $where = " ((HEAD.dtSubmitMGR = '1000-01-01' AND HEAD.dtSubmitSPV <> '1000-01-01') OR 
                    (HEAD.strMailMGR=HEAD.strMailSPV AND HEAD.dtSubmitSPV = '1000-01-01')) AND strMailMGR='" . $_SESSION['strEmail'] . "' 
                    ";
        break;
    case 3:
        $where = " HEAD.dtSubmitSPV = '1000-01-01' AND strMailSPV='" . $_SESSION['strEmail'] . "'";
        break;
}

if ($where <> "") {
    $MySQLi = new MySQLi($strDBHostName, $strDBUsername, $strDBPassword, $strDBName);
    $query = "SELECT IFNULL(SUM(HEAD.stsAktif), '0') AS iJumlahItem 
    FROM tpc_h_lpbj AS HEAD 
    WHERE " . $where . " AND 
        HEAD.stsAktif = 1 
    "; //echo $query;
    $result = $MySQLi->query($query);
    $row = $result->fetch_array();
}
?>

<?php
//if (strtoupper($_SESSION['strJobPosition']) == "ACCOUNTING") {
?>
<!--
        <li class="nav-item ">
            <a class="nav-link active" href="#" data-toggle="collapse" aria-expanded="false" data-target="#submenu-master" aria-controls="submenu-master"><i class="fa fa-fw fa-user-circle"></i>Master<span class="badge badge-success">6</span></a>
            <div id="submenu-master" class="collapse submenu">
                <ul>
                    <li class="nav-item">
                        <a class="nav-link" href="?menu=master-barang">Master Barang</a>
                    </li>
                </ul>
            </div>
        </li>
-->
<?php
//}
?>

<li class="nav-item">
    <a class="nav-link " href="index2.php">
        <i class="bi bi-grid"></i>
        <span>Dashboard</span>
    </a>
</li>

<li class="nav-item">
    <a class="nav-link collapsed" data-bs-target="#components-nav" data-bs-toggle="collapse" href="#">
        <i class="bi bi-cart3"></i><span>Pembelian</span><i class="bi bi-chevron-down ms-auto"></i>
    </a>
    <ul id="components-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">

        <li>
            <a href="components-accordion.html">
                <i class="bi bi-circle"></i><span>Laporan LPBJ</span>
            </a>
        </li>
        <li>
            <a href="components-badges.html">
                <i class="bi bi-circle"></i><span>Average ACC LPBJ</span>
            </a>
        </li>
        <li>
            <a href="components-breadcrumbs.html">
                <i class="bi bi-circle"></i><span>Anomali 2 hari review</span>
            </a>
        </li>
    </ul>
</li>