<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$usertype = $_REQUEST['usertype'];

if ($usertype != 1) {
    // browse($usertype);
    include("includes/menu_rights_kacha.php");
}

$admin = $_SESSION["admin_" . $dbname];
$usertype = $_SESSION["usertype_" . $dbname];
$project_title = "KC";
$zroot = $_SESSION["zdir"];
//browse($zroot);

$src = "";
$action = isset($_GET["action"]) ? $_GET["action"] : "";
switch ($action) {

    ####################### MASTERS ##########################
    case "stockent":
        $src = "stockent.php?mode=last";
        break;

    case "bankent":
        $src = "bankent.php?mode=last";
        break;

    case "jointrep":
        $src = "jointrep.php";
        break;

    case "jointsummrep":
        $src = "jointsummrep.php";
        break;


    #########################TOOLS#########################
    case "company":
        $src = "company.php?mode=last";
        break;

    case "profile":  
        $src = "user2.php?mode=last";
        break;

    case "stock":
        $src = "default2.php";
        break;

    case "backup":
        $src = "backup.php";
        break;

    case "balsms":
        $src = "http://vas.gsmash.com/balance.php?username=ABDRAS&password=ABDRAS2017&route=1";
        break;

    case "yearend":
        $src = "yearend.php";
        break;

    default:
        $head = "Home";
        $src = "default.php?mode=last";
}


include("includes/linkshead.php");
$dispyear = right(($_SESSION["zdbyear_" . $dbname]), 4);

$zdb = $_SESSION["zdbyear_" . $dbname];

$compcd = $_SESSION["comp_" . $dbname];

$getcomp = mysqli_query($conn, "SELECT code, name FROM `company` where `code`= '$compcd'") or die(mysqli_error($conn));
$fetcomp = mysqli_fetch_array($getcomp);
$cmpname = $fetcomp['name'];
mysqli_select_db($conn, $zdb);

?>
<script>
    $(document).ready(function () {

        document.addEventListener("keydown", function (zEvent) {
            if (zEvent.ctrlKey && zEvent.altKey && zEvent.code === "KeyE") {
                //                alert('Invalid key Nagvigate Through Menu');

                $(window).keydown(function (event) {
                    if (event.ctrlKey && event.keyCode == 52) {
                        var href = $('#crlink').attr('href');
                        window.location.href = href;
                    }
                });
            }
            if (zEvent.ctrlKey && zEvent.altKey && zEvent.code === "KeyR") {

                $(window).keydown(function (event) {
                    if (event.ctrlKey && event.keyCode == 55) {
                        var href = $('#dclink').attr('href');
                        window.location.href = href;
                    }
                });
            }
        });



    });
</script>

<style>
    @import url('https://fonts.googleapis.com/css2?family=Bangers&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
    @import url('https://fonts.googleapis.com/css2?family=Ephesis&display=swap');

    .bangers-regular {
        font-family: "Bangers", system-ui;
        font-weight: 400;
        font-style: normal;
    }

    .menu-color {
        color: #554480 !important;
    }

    .menu-color-bg {
        background-color: #554480 !important;
    }
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
</head>

<body class="off-canvas">
    <div id="container" class="sidebar-mini">
        <header id="header">
            <!--logo start-->
            <div class="brand menu-color-bg"
                style="display:flex; justify-content:center; align-items:center; height:60px;">
                <a href="menukc.php"
                    style="display:flex; justify-content:center; align-items:center; width:100%;color:#ffffff;font-size:15px;">
                    HOME
                </a>
            </div>

            <div class="user-nav" style="float: left !important;">
                <ul>
                    <li class="dropdown settings">
                        <a class="dropdown-toggle" href="?action=stockent">
                            <label class="label-control menu-color" style="font-size: 15px;">Stock</label>
                        </a>
                    </li>

                    <li class="dropdown settings">
                        <a class="dropdown-toggle" href="?action=bankent">
                            <label class="label-control menu-color" style="font-size: 15px;">Bank</label>
                        </a>
                    </li>

                    <li class="dropdown settings">
                        <a class="dropdown-toggle" href="?action=jointrep">
                            <label class="label-control menu-color" style="font-size: 15px;">Joint Report</label>
                        </a>
                    </li>

                    <li class="dropdown settings">
                        <a class="dropdown-toggle" href="?action=jointsummrep">
                            <label class="label-control menu-color" style="font-size: 15px;">Joint Summary Report</label>
                        </a>
                    </li>
                </ul>
            </div>


            <div class="user-nav">

                <ul>

                    <li class="dropdown settings"><a href="<?php
                    if ($usertype == 1) {
                        echo "comp.php";
                    } else {
                        echo "#";
                    }
                    ?>">

                    <li class="dropdown settings">
                        <a class="dropdown-toggle" href="year.php">
                            <label class="label-control menu-color" style="font-size: 13px;"><i class="fa fa-calendar"
                                    aria-hidden="true"></i> <?php echo 'Financial Year : ' . $dispyear; ?></label>
                        </a>
                    </li>

                    <li class="dropdown settings">
                        <a class="dropdown-toggle balsms menu-color" data-toggle="dropdown" href="#">
                            <b style="font-size: 20px;"><?php echo $_SESSION["username_" . $dbname]; ?></b> <i
                                class="fa fa-angle-down"></i>
                        </a>
                        <ul class="dropdown-menu animated fadeInDown">
                            <li <?= $tlprofile; ?>><a href="?action=profile"><i class="fa fa-user"></i> Profile</a></li>
                    </li>
                    <li><a id="logout" href="logout.php"><i class="fa fa-power-off"></i> Logout</a></li>
                </ul>
                </li>

                </ul>
            </div>
        </header>


        <!-- AUTO LINKS-->
        <a href="ch_recd.php?mode=last" id="crlink"></a>
        <a href="dailycash.php" id="dclink"></a>


        <!--sidebar left start-->
        <nav class="sidebar sidebar-left">
            <h5 class="sidebar-header">Navigation</h5>
            <ul class="nav nav-pills nav-stacked">
                <!-- <li <?= $masters; ?> class="nav-dropdown">

                    <a href='#' title="Masters"><i class="fa fa-graduation-cap"></i>Masters</a>
                    <ul class='nav-sub'>

                        <li <?= $customer; ?>><a href="?action=customer">Customer</a></li>
                        <li <?= $supplier; ?>><a href="?action=supplier">Supplier</a></li>
                        <li <?= $openbal; ?>><a href="?action=openbal">Opening Balance</a></li>
                        <li <?= $chcustdtls; ?>><a href="?action=chcustdtls">Change of Customer Details</a></li>
                        <li <?= $shopworker; ?>><a href="?action=shopworker">Shop Worker</a></li>
                        <li <?= $staff; ?>><a href="?action=staff">Staff</a></li>
                        <li <?= $unit; ?>><a href="?action=unit">Unit</a></li>
                        <li <?= $color; ?>><a href="?action=color">Color</a></li>


                        <hr>
                        <li <?= $rawmatgrp; ?>><a href="?action=rawmatgrp">Raw Material Group</a></li>
                        <li <?= $rawmat; ?>><a href="?action=rawmat">Raw Material</a></li>
                        <li <?= $rawchrateop; ?>><a href="?action=rawchrateop">Change of Rates</a></li>

                        <hr>

                        <li <?= $bank; ?>><a href="?action=bank">Bank</a></li>
                        <li <?= $cash; ?>><a href="?action=cash">Cash</a></li>
                        <li <?= $expense; ?>><a href="?action=expense">Expense</a></li>
                        <li <?= $group; ?>><a href="?action=group">Group</a></li>
                        <li <?= $otherac; ?>><a href="?action=otherac">Other A/C</a></li>
                    </ul>
                </li> -->



            </ul>
        </nav>
        <!--sidebar left end-->
        <!--main content start-->
        <section class="main-content-wrapper">
            <section id="main-content">
                <div class="col-md-12 pad">
                    <iframe id='frame1' src="<?php echo $src; ?>" name="frame1" style="width: 100%; height:5000px;"
                        frameBorder="0" scrolling="no"></iframe>
                </div>
            </section>
        </section>
    </div>
    <!--main content end-->
    <?php include("includes/linksfoot.php") ?>
</body>

</html>