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

$usertype    = $_SESSION["usertype_" . $dbname];
//browse($usertype);
if ($usertype != 1) {
    include("includes/menu_rights.php");
}
$admin = $_SESSION["admin_" . $dbname];
$src = "";
$action = isset($_GET["action"]) ? $_GET["action"] : "";
switch ($action) {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        ####################### TRANSACTION ##########################
    case "purchase";
        $src = "purchase.php?mode=last";
        break;

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

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

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

    case "salegst";
        $src = "salegst.php?mode=last&para=5";
        break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    case "rpbillostock";
        $src = "bill_o_stock.php";
        break;

    case "checkstock";
        $src = "check_stock.php";
        break;

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

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

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

    case "itemhist";
        $src = "inwoutrep.php";
        break;

    case "stocknew";
        $src = "stock_new.php";
        break;

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

    case "stockflow";
        $src = "stock_flow.php";
        break;

    case "stockflowbr";
        $src = "stock_flow_br.php";
        break;

    case "stockold";
        $src = "stock_old.php";
        break;

    case "stockonlyshade";
        $src = "stock_shade.php";
        break;


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

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

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

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

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

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

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

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

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

    case "crednotereg";
        $src = "credbrreg.php";
        break;

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

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

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

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

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

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


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

        ########################## FINAALIZATION ########################
    case "trbal";
        $src = "trbal.php";
        break;

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

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

    case "etareg";
        $src = "shipperreg.php";
        break;

    case "remdalert";
        $src = "shipeta.php";
        break;


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

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

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

    case "profile";

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

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

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

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

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

include("includes/linkshead.php");
?>
</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>
                    <?php
                    $zdb = $_SESSION["zdbyear_" . $dbname];
                    $srchresult = mysqli_query($conn, "SELECT vouchno FROM $zdb.`shipmain` WHERE releasedt = '0000-00-00'  and vouchno != '' group by vouchno order by eta") or die(mysqli_error($conn));
                    if (mysqli_num_rows($srchresult) > 0 ) {
                         $remno = mysqli_num_rows($srchresult);
                    } else {
                        $remno = 0;
                    }
                    ?>
                    <li <?= $remdalert; ?> class="dropdown settings"><a href="?action=remdalert"><label class="label-control" style="font-size: 18px;color: #B91646;"> Reminders : <?php echo $remno; ?></label></a></li>

                    <li class="dropdown settings"><a href="year.php"><label class="label-control" style="font-size: 14px;color: #1ABC9C;"> Financial Year : <?php echo $_SESSION["tit_" . $dbname]; ?></label></a></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 <?= $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 <?= $tlyearend; ?>><a href="?action=yearend"><i class="fa fa-calendar"></i>Year End</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 <?= $masters; ?> 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">Customer</a></li>
                        <li <?= $supplier; ?>><a href="?action=supplier">Supplier</a></li>
                        <li <?= $shipper; ?>><a href="?action=shipper">Shipper</a></li>
                        <li <?= $godown; ?>><a href="?action=godown">Godown</a></li>
                        <li <?= $brand; ?>><a href="?action=brand">Brand / Logo</a></li>
                        <li <?= $item; ?>><a href="?action=item">Item</a></li>
                        <li <?= $balewgt; ?>><a href="?action=balewgt">Bale Weight</a></li>
                        <li <?= $currency; ?>><a href="?action=currency">Currency</a></li>
                        <li <?= $transport; ?>><a href="?action=transport">Transport</a></li>
                        <li <?= $expense; ?>><a href="?action=expense">Expense</a></li>
                        <li <?= $purexpense; ?>><a href="?action=purexpense">Purchase Expense</a></li>
                        <li <?= $cash; ?>><a href="?action=cash">Cash</a></li>
                        <li <?= $opbal; ?>><a href="?action=opbal">Opening Balance</a></li>
                        <!-- <li <?= $changeRate; ?>><a href="?action=changeRate">Change of Rate</a></li>
                        <li <?= $broker; ?>><a href="?action=broker">Broker</a></li>
                        <li <?= $destination; ?>><a href="?action=destination">Destination</a></li>
                        <li <?= $bank; ?>><a href="?action=bank">Bank</a></li>
                        <li <?= $narration; ?>><a href="?action=narration">Narration</a></li>
                        <li <?= $address; ?>><a href="?action=address">Address</a></li> -->
                    </ul>
                </li>
                <li <?= $transaction; ?> class="nav-dropdown">
                    <a href="#" title="Transaction"><i class="fa fa-usd"></i>Transaction</a>
                    <ul class='nav-sub'>
                        <li <?= $purchase; ?>><a href="?action=purchase">Purchase</a></li>
                        <li <?= $sale; ?>><a href="?action=sale">Sale</a></li>
                        <li <?= $proforma; ?>><a href="?action=proforma">Proforma</a></li>
                        <li <?= $creditnote; ?>><a href="?action=crednote">Credit Note/Sale Return</a></li>
                        <!--<li <?= $transfer; ?>><a href="?action=transfer">Transfer</a></li>-->

                        <li <?= $damaged; ?>><a href="?action=damaged">Damaged</a></li>
                        <li <?= $inward; ?>><a href="?action=inward">Inward</a></li>
                        <li <?= $outward; ?>><a href="?action=outward">Outward</a></li>
                        <hr>
                        <li <?= $cashrecp; ?>><a href="?action=cashrecp">Cash Receipt</a></li>
                        <li <?= $cashpay; ?>><a href="?action=cashpay">Cash Payment</a></li>
                        <!--<li <?= $shipperent; ?>><a href="?action=shipperent">Shipper Entry</a></li>-->
                        <li <?= $shipperent; ?>><a href="?action=shipperent">Container ETA</a></li>
                </li>
                <!-- <li <?= $excess; ?>><a href="?action=excess">Excess</a></li>
                    <li <?= $contra; ?>><a href="?action=contra">Contra</a></li>
                    <li <?= $discgiven; ?>><a href="?action=">Discount Given</a></li>
                    <li <?= $discrecv; ?>><a href="?action=">Discount Recd.</a></li> 
                 <li <?= $debitnote; ?>><a href="?action=debitnote">Debit Note/Purchase Return</a></li> 
                 <li <?= $debitnotegst; ?>><a href="?action=debitnotegst">Debit Note GST /Purchase Return</a></li>
                        <li <?= $creditnotegst; ?>><a href="?action=creditnotegst">Credit Note GST /Sale Return</a></li> 
                        <li <?= $purchgst; ?>><a href="?action=purchgst">Purchase GST</a></li>
                        <li <?= $salegst; ?>><a href="?action=salegst">Sale GST</a></li>
                <li <?= $mbank; ?> class="nav-dropdown">
                            <a href="#">Bank<i></i></a> 
                            <ul class="nav-sub">
                                <li <?= $bankrecp; ?>><a href="?action=bankrecp">Receipt</a></li>
                                <li <?= $bankpay; ?>><a href="?action=bankpay">Payment</a></li>
                            </ul>
                        </li> -->
            </ul>
            </li>
            <li <?= $registers; ?> class="nav-dropdown">
                <a href='#'><i class="fa fa-registered"></i>Registers</a>
                <ul class='nav-sub'>
                    <li <?= $rgpurchase; ?>><a href="?action=purchreg">Purchase</a></li>
                    <li <?= $rgsale; ?>><a href="?action=salereg">Sale</a></li>
                    <li <?= $rgcrednotereg; ?>><a href="?action=crednotereg">Credit Note</a></li>
                    <li <?= $rgdamaged; ?>><a href="?action=damreg">Damaged</a></li>
                    <li <?= $rginward; ?>><a href="?action=inwreg">Inward</a></li>
                    <li <?= $rgoutward; ?>><a href="?action=outwreg">Outward</a></li>
                    <li <?= $etareg; ?>><a href="?action=etareg">Container ETA</a></li>
                </ul>
            </li>
            <li <?= $reports; ?> class="nav-dropdown">
                <a href='#'><i class="fa fa-file"></i>Reports</a>
                <ul class='nav-sub'>
                    <li <?= $stock; ?>><a href="?action=stock">Stock</a></li>
                    <!--<li <?= $stocknew; ?>><a href="?action=stocknew">Stock (Containerwise)</a></li>-->
                    <li <?= $rpledger; ?>><a href="?action=ledger">Ledger</a></li>
                    <li <?= $rpdailyrep; ?>><a href="?action=dailyrep">Daily Report</a></li>
                    <li <?= $rpcashbook; ?>><a href="?action=cashbook">Cash Book</a></li>
                    <li <?= $itemhist; ?>><a href="?action=itemhist">Item History</a></li>
                    <!-- <li <?= $rpdeadstock; ?>><a href="?action=deadstock">Dead Stock</a></li> -->
                </ul>
            </li>
            <li <?= $finalizations; ?> class="nav-dropdown">
                <a href='#'><i class="fa fa-calendar-check-o"></i>Finalization</a>
                <ul class='nav-sub'>
                    <!--                            <li <?= $closstk; ?>><a href="?action=closstk">Closing Stock</a></li>-->
                    <li <?= $trbal; ?>><a href="?action=trbal">Trial Balance</a></li>
                    <li <?= $closstk; ?>><a href="?action=closstk">Closing Stock</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:5000px;" frameBorder="0" scrolling="no"></iframe>
                </div>
            </section>
        </section>
    </div>
    <!--main content end-->
    <?php include("includes/linksfoot.php") ?>
</body>

</html>