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

include("includes/menu_rights.php");
$utype = $_SESSION['usertype'];
$admin = $_SESSION["admin_" . $dbname];
$src = "";
$action = isset($_GET["action"]) ? $_GET["action"] : "";
switch ($action) {

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

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

    case "designation";
        $src = "desig.php?mode=last";
        break;

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

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

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

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

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

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

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

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

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

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

####################### TRANSACTION ##########################
    case "genbill";
        $src = "genbill.php?mode=last";
        break;
    
    case "challan";
        $src = "chalmain.php?mode=last";
        break;
    
    case "chal_print";
        $src = "chal_print.php?mode=last";
        break;

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

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

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

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

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

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

    case "visacupd";
        $src = "passcupd.php?mode=last";
        break;

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

    case "canclead";
        $src = "cancldmn.php?mode=last";
        break;

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

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

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

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

    case "bankbook";
        $src = "bankbook.php?para=B";
        break;

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

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

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

    case "salproc";
        $src = "salproc.php";
        break;

    case "gengstchal";
        $src = "gengstchal.php";
        break;

######################### REPORTS ###########################
    case "certrecv";
        $src = "certrecv.php";
        break;

    case "totleads";
        $src = "leadreg.php";
        break;

    case "confreg";
        $src = "confreg.php";
        break;

    case "stafflead";
        $src = "stldreg.php";
        break;

    case "diaprint";
        $src = "diaprint.php";
        break;

    case "passimage";
        $src = "passimgreg.php?mode=last";
        break;

    case "passzip";
        $src = "passzipreg.php?mode=last";
        break;


    case "dailycash";
        $src = "dailycashrp.php?mode=last";
        break;

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

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

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

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

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

    case "gstinvrep";
        $src = "gstinvrep.php?mode=last";
        break;
    
    case "challprint";
        $src = "chal_print.php?mode=last";
        break;

########################## REGISTERS ########################
    case "chalreg";
        $src = "chalreg.php";
        break;

    case "leadreg";
        $src = "leadreg.php";
        break;

    case "transreg";
        $src = "trnfreg.php";
        break;

    case "cashrecd_print";
        $src = "cashrecd_print.php";
        break;

    case "leadquery";
        $src = "ldstfreg.php";
        break;

    case "expreg";
        $src = "expreg.php";
        break;

    case "persexpreg";
        $src = "persexpreg.php";
        break;

    case "discgvreg";
        $src = "discgvreg.php";
        break;

    case "gstinvreg";
        $src = "gstinvreg.php";
        break;

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

    case "profile";

        if ($utype == 1) {
            $src = "user.php?mode=last";
        } else {
            $src = "user2.php?mode=last";
        }
        break;

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

    case "remdpost";
        $src = "postreg.php";
        break;
#####ALERTS####

    case "postpone";
        $src = "postponed.php?mode=last";
        break;

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

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

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

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

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

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

    case "amendrequote";
        $src = "amendquot.php?mode=last";
        break;

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

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

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

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

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

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

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

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

    
        ####################### FINALIZATION ##########################

    case "trbal";
        //        if ($guser[fntrialbal] == '') {
        //            $src = "";
        //        } else {
        $src = "trbal.php?mode=last";
        //        }
        break;

    case "profit";
        //        if ($guser[fnprofit] == '') {
        //            $src = "";
        //        } else {
        $src = "profit.php?mode=last";
        //        }
        break;

    case "profshar";
        //        if ($guser[fnprofshar] == '') {
        //            $src = "";
        //        } else {
        $src = "profshar.php?mode=last";
        //        }
        break;

    case "balsheet";
        //        if ($guser[fnbalsheet] == '') {
        //            $src = "";
        //        } else {
        $src = "balsheet.php?mode=last";
        //        }
        break;


    default :
        $head = "Home";

        $src = "chalmain.php?mode=last";
}

include("includes/linkshead.php");
$dispyear = right(($_SESSION["zdbyear_" . $dbname]), 4);
?>
</head>
<body class="off-canvas">
    <div id="container" class="sidebar-mini">
        <header id="header">
            <!--logo start-->
            <div class="brand"><a href="menu.php" class="logo"><?php Echo $project_name; ?></a></div>
            <!--logo end-->
            <div class="toggle-navigation toggle-left">
                <button type="button" class="btn btn-default" id="toggle-left" data-toggle="tooltip" data-placement="right" title="Toggle Navigation">
                    <i class="fa fa-bars"></i>
                </button>
            </div>
            <div class="user-nav">
                <ul>
                    <li class="dropdown settings">
                        <a class="dropdown-toggle" href="year.php">
                            <label class="label-control" style="font-size: 13px"><i class="fa fa-calendar" aria-hidden="true"></i> <?php echo 'Financial Year : ' . LEFT($dispyear,2) . RIGHT($dispyear,2); ?></label>
                        </a>
                    </li>
                    <!--<li <?= $dstock; ?> class="dropdown settings"><label class="label-control" style="font-size: 20px;"><i class="fa fa-list"></i>  <a href="?action=stock">Stock</a></label></li>-->
<!--                    <li class="profile-photo"><img src="assets/img/avatar.png" alt="" class="img-circle"></li>-->
                    <li class="dropdown settings">
                        <a class="dropdown-toggle" 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 <?= $tlyearsele; ?>><a href="year.php"><i class="fa fa-calender-o"></i>Year Selection</a></li>
                            <li <?= $tlcompany; ?>><a href="?action=company"><i class="fa fa-building-o"></i> Company SetUp</a></li>
                            <li <?= $tlbackup; ?>><a href="?action=backup"><i class="fa fa-cloud-download"></i> Backup</a></li>
                            <li <?= $tlprofile; ?>><a href="?action=profile"><i class="fa fa-user"></i> Profile</a></li>
<!--                            <li <?= $tlbackup; ?>><a href="?action=backup"><i class="fa fa-cloud-download"></i> Backup</a></li>
                            <li <?= $tlprofile; ?>><a href="?action=profile"><i class="fa fa-user"></i> Profile</a></li>-->
                            <!--<li <?= $tlenvprint; ?>><a href="?action=envprint"><i class="fa fa-envelope"></i>Envelope Print</a></li>-->
                            <!--<li <?= $tlshopping; ?>><a href="?action=shopping"><i class="fa fa-shop"></i>Shopping</a></li>-->
                            <!--<li <?= $tltransfer; ?>><a href="?action=transfer"><i class="fa fa-transfer"></i>Transfer</a></li>-->

                            <li><a href="logout.php"><i class="fa fa-power-off"></i> Logout</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </header>
        <!--sidebar left start-->
        <nav class="sidebar sidebar-left">
            <h5 class="sidebar-header">Navigation</h5>
            <ul class="nav nav-pills nav-stacked">
                <li class="nav-dropdown">
                    <a href="#" title="UI Elements"><i class="fa fa-graduation-cap"></i>Masters</a>
                    <ul class="nav-sub">
                        <li <?= $customer; ?>><a href="?action=customer">Party</a></li>
                        <li <?= $item; ?>><a href="?action=item">Item</a></li>
                        <li <?= $designation; ?>><a href="?action=designation">Designation</a></li> 
                        <li <?= $staff; ?>><a href="?action=staff">Staff</a></li>
                        <li <?= $expense; ?>><a href="?action=expense">Expense</a></li>
                        <li <?= $metric; ?>><a href="?action=metric">Metric</a></li>
                        <li <?= $nbmetric; ?>><a href="?action=nbmetric">NB Metric</a></li>
                        <li <?= $guagemetric; ?>><a href="?action=guage">Guage Metric</a></li>
                        <li <?= $area; ?>><a href="?action=area">Area</a></li>
                        <li <?= $openbal; ?>><a href="?action=openbal">Opening Balance</a></li>
                        <li <?= $bank; ?>><a href="?action=bank">Bank</a></li>
                        <li <?= $narration; ?>><a href="?action=narration">Narration</a></li>
                        <li <?= $narrmast; ?>><a href="?action=narrmast">Pers. Expense Party</a></li>
                        <li <?= $diamaster; ?>><a href="?action=diamaster">Dia Master</a></li>
                    </ul>
                </li>
                <li class="nav-dropdown">
                    <a href="#" title="Transaction"><i class="fa fa-usd"></i>Transaction</a>
                    <ul class='nav-sub'>
                        <li <?= $challan; ?>><a href="?action=challan">Challan</a></li>
                        <li <?= $genbill; ?>><a href="?action=genbill">Generation  GST Challan</a></li>
                        <li <?= $cashrecd; ?>><a href="?action=cashrecd">Cash Receipt</a></li>
                        <li <?= $expensevoch; ?>><a href="?action=expensevoch">Cash Payment / Expense</a></li>
                        <li <?= $bankrecp; ?>><a href="?action=bankrecp">Bank Receipt</a></li>
                        <li <?= $bankpay; ?>><a href="?action=bankpay">Bank Payment</a></li>
                        <li <?= $persexpense; ?>><a href="?action=persexpense">Personal Expense</a></li>
                        <!--<li <?= $openbal; ?>><a href="?action=openbal">Opening Balance</a></li>-->
                        <li <?= $discgive; ?>><a href="?action=discgive">Discount Given</a></li>
                        <hr>
                        <li <?= $attendance; ?>><a href="?action=attendance">Attendance</a></li>
                        <li <?= $attendedit; ?>><a href="?action=attendedit">Attendance(Edit)</a></li>
                        <li <?= $salprocess; ?>><a href="?action=salproc">Salary Process</a></li>
                        <hr>
                    </ul>
                </li>
                <li class="nav-dropdown">
                    <a href='#'><i class="fa fa-file"></i>Reports</a>
                    <ul class='nav-sub'>
                        <li <?= $challprint; ?>><a href="?action=challprint">Challan Print</a></li>
                        <li <?= $gstinvrep; ?>><a href="?action=gstinvrep">GST Invoice Print</a></li>
                        <li <?= $summparty; ?>><a href="?action=summparty">Summary Partywise</a></li>
                        <li <?= $ledger; ?>><a href="?action=ledger">Ledger</a></li>
                        <li <?= $labels; ?>><a href="?action=labels">Labels</a></li>
                        <li <?= $query; ?>><a href="?action=query">Query</a></li>
                        <li <?= $analysis; ?>><a href="?action=analysis">Analysis</a></li>
                        <li <?= $diaprint; ?>><a href="?action=diaprint">Dia Print</a></li>
                        <li <?= $bankbook; ?>><a href="?action=bankbook">Bank Book</a></li>
                        <li <?= $partratecomp; ?>><a href="?action=partratecomp">Party Rate Compare</a></li>
                        <li <?= $calcbonus; ?>><a href="?action=calcbonus">Calculate Bonus</a></li>
                        <li <?= $dailycash; ?>><a href="?action=dailycash">Daily Cash Report</a></li>
                    </ul>
                </li>
                <li class="nav-dropdown">
                    <a href='#'><i class="fa fa-registered"></i>Registers</a>
                    <ul class='nav-sub'>
                        <li <?= $chalreg; ?>><a href="?action=chalreg">Challan Register</a></li>
                        <!--<li <?= $chalreg; ?>><a href="?action=chalreg">Challan Register</a></li>-->
                        <li <?= $gstinvreg; ?>><a href="?action=gstinvreg">GST Invoice</a></li>
                        <!--<li <?= $cashrecdreg; ?>><a href="?action=cashrecdreg">Cash Recd.</a></li>-->
                        <li <?= $cashrecd_print; ?>><a href="?action=cashrecd_print">Cash Recd.</a></li>
                        <li <?= $expreg; ?>><a href="?action=expreg">Expense</a></li>
                        <li <?= $attendreg; ?>><a href="?action=attendreg">Attendance Register</a></li>
                        <li <?= $stafattend; ?>><a href="?action=stafattend">Staff Attendance</a></li>
                        <li <?= $salreg; ?>><a href="?action=salreg">Salary Register</a></li>
                        <li <?= $bonusreg; ?>><a href="?action=bonusreg">Bonus Register</a></li>
                        <li <?= $shopreg; ?>><a href="?action=shopreg">Shopping Register</a></li>
                        <li <?= $persexpreg; ?>><a href="?action=persexpreg">Personal Expense Register</a></li>
                        <!--<li <?= $balsheet; ?>><a href="?action=balsheet">Balance Sheet</a></li>-->
                        <li <?= $discgvreg; ?>><a href="?action=discgvreg">Discount Given</a></li>
                    </ul>
                </li>
                <li class="nav-dropdown">
                        <a href="#"><i class="fa fa-money"></i>Finalization</a>
                        <ul class="nav-sub">
                            <li <?= $trbal; ?>><a href="?action=trbal">Trial Balance</a></li>
                            <li <?= $profit; ?>><a href="?action=profit">Profit / Loss</a></li>
                            <li <?= $profshar; ?>><a href="?action=profshar">Profit Sharing</a></li>
                            <li <?= $balsheet; ?>><a href="?action=balsheet">Balance Sheet</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 src="<?php echo $src; ?>" name="frame1" style="width: 100%; height:1000px;"  frameBorder="0" scrolling="yes"></iframe>
                </div>
            </section>
        </section>
    </div>
    <!--main content end-->
    <?php include("includes/linksfoot.php") ?>
</body>
</html>
