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

$user = $_SESSION["username_" . $dbname];

$getuser = mysqli_query($conn, "SELECT * FROM `passmain` WHERE `user`='$user'") or die(mysqli_error($conn));
$guser = mysqli_fetch_array($getuser);

if ($guser['usertype'] != 1) {
    include("includes/menu_rights.php");
}

$admin = $_SESSION["admin_" . $dbname];
$usertype = $_SESSION["usertype"];
$src = "";
$action = isset($_GET["action"]) ? $_GET["action"] : "";
$dispyear = right(($_SESSION["zdbyear_" . $dbname]), 4);
$myear = $_SESSION[$myyear];
//browse($guser['usertype']);
switch ($action) {
    ####################### PROFILES ##########################
    case "profile";
        $head = "Create User";
        $src = '';
        if ($guser['usertype'] == 1) {
            $src = "user.php?mode=last";
        } else {
            $src = "user2.php?mode=last";
        }
        break;
    ####################### MASTERS ##########################

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

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

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

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

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

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

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

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

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

    case "godown";

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

        break;

    case "openbal";
        if ($guser['openbal'] == '') {
            $src = "";
        } else {
            $src = "openbal.php?mode=last&form=openbal";
        }
        break;

    case "openrate";
        if ($guser['changeofrates'] == '') {
            $src = "";
        } else {
            $src = "openrate.php?mode=last&form=openstock";
        }
        break;

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

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

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

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

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

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

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

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

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

    case "saletype";
        if ($guser['gsttype'] == '') {
            $src = "";
        } else {
            $src = "gsttype.php?mode=last&para=gsttype";
        }
        break;

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

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

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

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

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

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


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

    case "changeofrates";
        if ($guser['changeofrates'] == '') {
            $src = "";
        } else {
            $src = "changeRate.php";
        }
        break;

    ####################### TRADING INVENTARY ##########################

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

    case "crednote";
//        if ($guser['ticrednote'] == '') {
//            $src = "";
//        } else {
        $src = "crednote.php?mode=last&credtype=G";
//        }
        break;

    case "ticredoth";
        if ($guser['ticredoth'] == '') {
            $src = "";
        } else {
            $src = "credoth.php?mode=last&credtype=O";
        }
        break;

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

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

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

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

    ####################### MANUFACTURING INVENTARY ##########################

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

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

    case "purchaser_exp";
        //        if ($guser[purchaser_mi] == '') {
        //            $src = "";
        //        } else {
        $src = "purchase_exp.php?mode=last&type=R";
        //        }
        break;

    case "purchaser_mi";
        //        if ($guser[purchaser_mi] == '') {
        //            $src = "";
        //        } else {
        $src = "purchase_mi.php?mode=last&type=R";
        //        }
        break;

    case "purchasep_mi";
        //        if ($guser[purchasep_mi] == '') {
        //            $src = "";
        //        } else {
        $src = "purchase_mi.php?mode=last&type=P";
        //        }
        break;

    case "inward_mi";
        //        if ($guser[purchasep_mi] == '') {
        //            $src = "";
        //        } else {
        $src = "inward_mi.php?mode=last&type=I";
        //        }
        break;

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

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

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

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

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

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

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

    case "debnote";
//        if ($guser['debnoter_mi'] == '') {
//            $src = "";
//        } else {
        $src = "debnote.php?mode=last&type=R";
//        }
        break;

    case "debnotep_mi";
        if ($guser['debnotep_mi'] == '') {
            $src = "";
        } else {
            $src = "debnote_mi.php?mode=last&type=P";
        }
        break;

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

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

    case "purreg";
//        if ($guser['purrawreg'] == '') {
//            $src = "";
//        } else {
        $src = "purreg.php";
//        }
        break;

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

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

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

    ####################### EXPORT INVENTARY ##########################

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

    case "proforma";
        if ($guser['proforma'] == '') {
            $src = "";
        } else {
            $src = "proforma.php?mode=last&form=6";
        }
        break;

    case "exinvoice";
        if ($guser['exinvoice'] == '') {
            $src = "";
        } else {
            $src = "invoexp.php?mode=last&form=6";
        }
        break;

    ####################### TRANSACTIONS ##########################

    case "salea";
        if ($guser['salea'] == '') {
            $src = "";
        } else {
            $src = "sale.php?mode=last&form=6";
        }
        break;


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


    case "saleb";
        if ($guser['saleb'] == '') {
            $src = "";
        } else {
            $src = "sale.php?mode=last&form=13.5";
        }
        break;

    case "spare5";
        if ($guser['salespa'] == '') {
            $src = "";
        } else {
            $src = "salespare.php?mode=last&form=6";
        }
        break;

    case "spare12";
        if ($guser['salespb'] == '') {
            $src = "";
        } else {
            $src = "salespare.php?mode=last&form=13.5";
        }
        break;

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

    case "salegst";
        if ($guser['salegst'] == '') {
            $src = "";
        } else {
            $src = "salegst.php?mode=last&form=6";
        }
        break;

    case "salegstdtl";
        if ($guser['salegst'] == '') {
            $src = "";
        } else {
            $src = "salegst_dtl.php?mode=last";
        }
        break;


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

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

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

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

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

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

    case "debnotegr";
        if ($guser['debnotegr'] == '') {
            $src = "";
        } else {
            $src = "debnote.php?mode=last&form=debnote&type=G";
        }
        break;

    case "debnoteoth";
        if ($guser['debnoteoth'] == '') {
            $src = "";
        } else {
            $src = "debnote.php?mode=last&form=debnote&type=O";
        }
        break;

    case "crednotegr";
        if ($guser['crednotegr'] == '') {
            $src = "";
        } else {
            $src = "crednote.php?mode=last&form=crednote&type=G";
        }
        break;

    case "crednoteoth";
        if ($guser['crednoteoth'] == '') {
            $src = "";
        } else {
            $src = "crednote.php?mode=last&form=crednote&type=O";
        }
        break;

    case "creditnote";
        if ($guser['creditnote'] == '') {
            $src = "";
        } else {
            $src = "creditnote.php?mode=last&form=creditnote&type=G";
        }
        break;

    case "credoth";
//        if ($guser['credoth'] == '') {
//            $src = "";
//        } else {
        $src = "credoth.php?mode=last&=credoth&type=O";
//        }
        break;

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

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


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

    case "multibankpay";
        if ($guser['bankpay'] == '') {
            $src = "";
        } else {
            $src = "bankmultipay.php?mode=last";
        }
        break;

    case "multicashpay";
        if ($guser['bankpay'] == '') {
            $src = "";
        } else {
            $src = "cashmultipay.php?mode=last";
        }
        break;

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

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

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

    case "payablerep";
//        if ($guser['payablerep'] == '') {
//            $src = "";
//        } else {
        $src = "payablerep.php?para=P";
//        }
        break;

    case "receivablerep";
//        if ($guser['payablerep'] == '') {
//            $src = "";
//        } else {
        $src = "payablerep.php?para=R";
//        }
        break;

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

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

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

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

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


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

    case "bankrecorep";
        $src = "bankreco_rep.php";
        break;

    ####################### REPORTS ##########################

    case "withmrp";
        if ($guser['bpmrp'] == '') {
            $src = "";
        } else {
            $src = "barcodelbl.php?report=withmrp";
        }
        break;

    case "purchsumm";
        //        if ($guser['purchsumm'] == '') {
        //            $src = "";
        //        } else {
        $src = "purchsumm.php";
        //        }
        break;


    case "salesumm";
//        if ($guser['salesumm'] == '') {
//            $src = "";
//        } else {
        $src = "salesumm.php";
//        }
        break;


    case "dailysalsumm";
        if ($guser['dailysalsumm'] == '') {
            $src = "";
        } else {
            $src = "dailysalsumm.php";
        }
        break;

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

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

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

    case "withoutmrp";
        if ($guser['bpwmrp'] == '') {
            $src = "";
        } else {
            $src = "barcodelbl.php?report=withoutmrp";
        }
        break;

    case "lwithmrp";
        if ($guser['lpmrp'] == '') {
            $src = "";
        } else {
            $src = "barcodelbl.php?report=lwithmrp";
        }
        break;

    case "lwithoutmrp";
        if ($guser['lpwmrp'] == '') {
            $src = "";
        } else {
            $src = "barcodelbl.php?report=lwithoutmrp";
        }
        break;

    case "withmrp";
        if ($guser['bpmrp'] == '') {
            $src = "";
        } else {
            $src = "barcodelbl.php?report=withmrp";
        }
        break;

    case "withoutmrp";
        if ($guser['bpwmrp'] == '') {
            $src = "";
        } else {
            $src = "barcodelbl.php?report=withoutmrp";
        }
        break;

    case "lwithmrp";
        if ($guser['lpmrp'] == '') {
            $src = "";
        } else {
            $src = "barcodelbl.php?report=lwithmrp";
        }
        break;

    case "lwithoutmrp";
        if ($guser['lpwmrp'] == '') {
            $src = "";
        } else {
            $src = "barcodelbl.php?report=lwithoutmrp";
        }
        break;


    case "inwout";
        if ($guser['rpitemhist'] == '') {
            $src = "";
        } else {
            $src = "inwoutrep.php";
        }
        break;



    case "vatrep";
//        if ($guser['rpvat'] == '') {
//            $src = "";
//        } else {
        $src = "vatrep.php";
//        }
        break;

    case "income";
        if ($guser['incometaxrp'] == '') {
            $src = "";
        } else {
            $src = "taxreg.php?report=income";
        }
        break;

    case "sales";
        if ($guser['salestaxrp'] == '') {
            $src = "";
        } else {
            $src = "taxreg.php?report=sales";
        }
        break;

    case "osrec";
        if ($guser['outsrecevrp'] == '') {
            $src = "";
        } else {
            $src = "osbill.php?para=R";
        }
        break;

    case "ospay";
        if ($guser['outspayrp'] == '') {
            $src = "";
        } else {
            $src = "osbill.php?para=P";
        }
        break;

    case "ledger";
        if ($guser['ledger'] == '') {
            $src = "";
        } else {
            $src = "ledger.php";
        }
        break;

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

    case "stock";
//        if ($guser['stockrp'] == '') {
//            $src = "";
//        } else {
        $src = "stock.php";
//        }
        break;

    case "negstock";
//        if ($guser['stockrp'] == '') {
//            $src = "";
//        } else {
        $src = "negstock.php";
//        }
        break;

    case "stockmov";
//        if ($guser['stockrp'] == '') {
//            $src = "";
//        } else {
        $src = "stockmov.php";
//        }
        break;

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

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

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

    case "tdsrep";
//        if ($guser['stkpack'] == '') {
//            $src = "";
//        } else {
        $src = "tdsrep.php?";
//        }
        break;

    case "bankbook";
        //        if ($guser[rpbankbook] == '') {
        //            browse('1');
        //            $src = "";
        //        } else {
        //            browse('2');
        $src = "bankbook.php?para=B";
        //        }
        break;

    case "cashbook";
        //        if ($guser[rpcashbook] == '') {
        //            $src = "";
        //        } else {
        $src = "bankbook.php?para=C";
        //        }
        break;

    case "expenserep";
        //        if ($guser[rpcashbook] == '') {
        //            $src = "";
        //        } else {
        $src = "expenserep.php";
        //        }
        break;

    case "jvbook";
        //        if ($guser[rpcashbook] == '') {
        //            $src = "";
        //        } else {
        $src = "jvbook.php?para=C";
        //        }
        break;

    case "jvgst";
        //        if ($guser[rpcashbook] == '') {
        //            $src = "";
        //        } else {
        $src = "jvgst.php";
        //        }
        break;

    case "bpaychq";
        if ($guser['bpaychq'] == '') {
            $src = "";
        } else {
            $src = "bkpy_chq.php";
        }
        break;

    case "discreg";
        if ($guser['discrecevrp'] == '') {
            $src = "";
        } else {
            $src = "discreg.php";
        }
        break;

    case "dailyrep";
//        if ($guser['dailyreprp'] == '') {
//            $src = "";
//        } else {
        $src = "dailyrep.php";
//        }
        break;

    case "dailycash";
//        if ($guser['dailyreprp'] == '') {
//            $src = "";
//        } else {
        $src = "dailyrepcash.php";
//        }
        break;

    case "chqrep";
//        if ($guser['rpchqnoqry'] == '') {
//            $src = "";
//        } else {
        $src = "chqrep.php";
//        }
        break;

    case "amtrep";
//        if ($guser['rpamountqry'] == '') {
//            $src = "";
//        } else {
        $src = "amtrep.php";
//        }
        break;

//    case "itemwise";
//        if ($guser['rpitemwise'] == '') {
//            $src = "";
//        } else {
//            $src = "itemwise.php";
//        }
//        break;

    case "itemwisesale";
        if ($guser['rpitemwisesale'] == '') {
            $src = "";
        } else {
            $src = "itemwise_sale.php";
        }
        break;
    case "itemgrpwisesale";
        if ($guser['rpitemgrpwisesale'] == '') {
            $src = "";
        } else {
            $src = "saleitemgrp.php";
        }
        break;
    case "partygrpwisesale";
        if ($guser['rppartygrpwisesale'] == '') {
            $src = "";
        } else {
            $src = "partgrp_sale.php";
        }
        break;


//    case "chqrep";
//        $src = "chqrep.php";
//        break;
//
//    case "amtrep";
//        $src = "amtrep.php";
//        break;
    ####################### REGISTERS ##########################

    case "salereg";
//        if ($guser['tisalereg'] == '') {
//            $src = "";
//        } else {
        $src = "salereg.php";
//        }
        break;

    case "profreg";
        if ($guser['profreg'] == '') {
            $src = "";
        } else {
            $src = "profreg.php";
        }
        break;

    case "itemwise";
        $src = "prodwisesale.php";
        break;

    case "leadprod";
        $src = "leadprodsale.php";
        break;

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

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

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

    case "tiitemgrpwise";
//        if ($guser['tiitemgrpwise'] == '') {
//            $src = "";
//        } else {
        $src = "itemgrpwisereg.php";
//        }
        break;

    case "tipitemreg";
        if ($guser['tipitemreg'] == '') {
            $src = "";
        } else {
            $src = "tipitemreg.php";
        }
        break;

    case "tiipartyreg";
        if ($guser['tiipartyreg'] == '') {
            $src = "";
        } else {
            $src = "tiipartyreg.php";
        }
        break;

    case "tisalitemwise";
        if ($guser['tisalitemwise'] == '') {
            $src = "";
        } else {
            $src = "salitemwisereg.php";
        }
        break;

    case "midelvreg";
        if ($guser['midelvreg'] == '') {
            $src = "";
        } else {
            $src = "midelvreg.php";
        }
        break;

    case "tidisreg";
        if ($guser['tidisreg'] == '') {
            $src = "";
        } else {
            $src = "tidisreg.php";
        }
        break;

//    case "exsalereg";
//        if ($guser['exsalereg'] == '') {
//            $src = "";
//        } else {
//            $src = "exsalereg.php";
//        }
//        break;

    case "inwreg";
//        if ($guser['tiinwdreg'] == '') {
//            $src = "";
//        } else {
        $src = "inwreg.php";
//        }
        break;

    case "outreg";
//        if ($guser['tiinwdreg'] == '') {
//            $src = "";
//        } else {
        $src = "outreg.php";
//        }
        break;

    case "exinwdreg";
        if ($guser['exinwdreg'] == '') {
            $src = "";
        } else {
            $src = "exinwdreg.php";
        }
        break;

    case "exinvoicereg";
        if ($guser['exinvoicereg'] == '') {
            $src = "";
        } else {
            $src = "exinvoicereg.php";
        }
        break;
    case "ticredreg";
        if ($guser['ticredreg'] == '') {
            $src = "";
        } else {
            $src = "ticredreg.php";
        }
        break;

    case "ticredothreg";
        if ($guser['ticredothreg'] == '') {
            $src = "";
        } else {
            $src = "ticredothreg.php";
        }
        break;

    case "damreg";
//        if ($guser['tidamreg'] == '') {
//            $src = "";
//        } else {
        $src = "damreg.php";
//        }
        break;
    case "excreg";
        $src = "excreg.php";
        break;

    case "tranreg";

        $src = "tranreg.php";

        break;

    case "credothreg";

        $src = "credothreg.php";

        break;

    case "lrreg";
//        if ($guser['lrreg'] == '') {
//            $src = "";
//        } else {
        $src = "lrreg.php";
//        }
        break;

    case "saletinreg";
        if ($guser['saletinrg'] == '') {
            $src = "";
        } else {
            $src = "saletinreg.php";
        }
        break;

    case "purexpreg";
//        if ($guser['purchexp'] == '') {
//            $src = "";
//        } else {
        $src = "purexpreg.php";
//        }
        break;

    case "purgstreg";
        if ($guser['purchasegstrg'] == '') {
            $src = "";
        } else {
            $src = "purgstreg.php";
        }
        break;

    case "orderreg";
        if ($guser['ordformrg'] == '') {
            $src = "";
        } else {
            $src = "orderreg.php";
        }
        break;

    case "inwardreg";
        if ($guser['inwardrg'] == '') {
            $src = "";
        } else {
            $src = "inwardreg.php";
        }
        break;

    case "outwardreg";
        if ($guser['outwardrg'] == '') {
            $src = "";
        } else {
            $src = "outwardreg.php";
        }
        break;

    case "debreg";
//        if ($guser['debnoterg'] == '') {
//            $src = "";
//        } else {
        $src = "debreg.php";
//        }
        break;

    case "credreg";
//        if ($guser['crednoterg'] == '') {
//            $src = "";
//        } else {
        $src = "credreg.php";
//        }
        break;

    ####################### SUMMARY ##########################

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

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

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

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

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

    case "crednotevatreg";
        if ($guser['crednotevatreg'] == '') {
            $src = "";
        } else {
            $src = "crednotevatreg.php";
        }
        break;
    ####################### FINALIZATION ##########################

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

    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;


    ########################## GST REPORTS   ########################
    case "gstr1_b2b";
        $src = "gstr1_b2b.php";
        break;

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

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

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

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

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

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

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

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

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

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

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


    case "gstsum";
        $src = "gstsum.php";
        break;
    ////////////////////////GSTR2_PURCHASE////////////////////////////////////////
    case "gstr2_b2b";
        $src = "gstr2_b2b.php";
        break;

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

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

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

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

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

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

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

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

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

    case "gstr2_docs";
        $src = "gstr2_docs.php";
        break;
    /////////////////////////////GST SUMMARY/////////////////////////////
    case "gstsum";
        $src = "gstsum.php";
        break;

    case "gst3b";
        $src = "gstr3b.php";
        break;

    case "gst3bpre";
        $src = "gstr3b_pre.php";
        break;

    ####################### TOOLS ##########################

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

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

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

    case "graph";
        $src = "misdashboard.php";
        break;

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

    case "backup";
//        if ($guser['tlbackup'] == '') {
//            $src = "";
//        } else {
        $src = "backup_ali.php";
//        }
        break;

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

    default :
//        $head = "Home";
//        $src = "misdashboard.php";
//        if ($usertype == 1) {
//            $src = "misdashboard.php";
//        } else {
//            $src = "default.php";
//        }
        $src = "default.php";
}

$mcred = "";
if ($guser['creditnote'] != "1" && $guser['creditoth'] != "1") {
    $mcred = "style='display: none'";
}
$mbank = "";
if ($guser['bankpay'] != "1" && $guser['bankrecp'] != "1") {
    $mbank = "style='display: none'";
}
$mcash = "";
if ($guser['cashpay'] != "1" && $guser['cashrecp'] != "1") {
    $mcash = "style='display: none'";
}

$mbpmrp = "";
if ($guser['bpmrp'] != "1" && $guser['bpwmrp'] != "1") {
    $mbpmrp = "style='display: none'";
}
$mlpmrp = "";
if ($guser['lpmrp'] != "1" && $guser['lpwmrp'] != "1") {
    $mlpmrp = "style='display: none'";
}
$rpquery = "";
if ($guser['rpchqnoqry'] != "1" && $guser['rpamountqry'] != "1") {
    $rpquery = "style='display: none'";
}

$rpoutstanding = "";
if ($guser['outsrecevrp'] != "1" && $guser['outspayrp'] != "1") {
    $rpoutstanding = "style='display: none'";
}
include("includes/linkshead.php");
?>
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <title><</title>
    <meta name="description" content="Blueprint: Horizontal Slide Out Menu" />
    <meta name="keywords" content="horizontal, slide out, menu, navigation, responsive, javascript, images, grid" />
    <meta name="author" content="Codrops" />
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" type="text/css" href="menu/css/default.css" />
    <link rel="stylesheet" type="text/css" href="menu/css/component.css" />
    <script src="menu/js/modernizr.custom.js"></script>
<!--    <style>
        .cbp-hssubmenu > li:hover{
            color: red
        }
    </style>-->
</head>

<body>
    <!--<div class="container-scroller">-->
    <!-- partial:partials/_horizontal-navbar.html -->
    <div class="main">
        <nav class="cbp-hsmenu-wrapper" id="cbp-hsmenu-wrapper">
            <div class="cbp-hsinner">
                <ul class="cbp-hsmenu" style="margin-left: 0px;max-width: 250em;width:100%">
                    <li class="text-left"><b><u><a href="menu.php" style="color:#6A5F85; font-size:20px "><?= $project_title; ?></a></u></b></li>
                    
                    <li <?= $master; ?>>
                        <a href="#">Master</a>
                        <ul class="cbp-hssubmenu">
                            <li <?= $customer; ?>><a href="?action=customer">Customer</a></li>
                            <li <?= $supplier; ?>><a href="?action=supplier">Supplier</a></li>
                            <!-- <li <?= $prodgrp ?>><a href="?action=prodgrp">Product Group</a></li> -->
                            <li <?= $product; ?>><a href="?action=product">Product</a></li>
                            <li <?= $openbal; ?>><a href="?action=openbal">Opening Balance</a></li>
                            <li <?= $chcustdtl; ?>><a href="?action=chcustdtl">Change of Customer Details</a></li>
                            <!-- <li <?= $transporter; ?>><a href="?action=transport">Transporter</a></li> -->

                            <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>
                    <li <?= $transactions ?>>
                        <a href="#">Transactions</a>
                        <ul class="cbp-hssubmenu cbp-hssub-rows">
                            <li <?= $purchase; ?>><a href="?action=purchase">Purchase</a></li>
                            <li <?= $sale; ?>><a href="?action=sale">Sale</a></li>
                            <li <?= $debnote ?>><a href="?action=debnote">Purchase Return / Debit Note</a></li>
                            <li <?= $crednote; ?>><a href="?action=crednote">Goods Return / Credit Note</a></li>
                            <!-- <li <?= $crednote; ?>><a href="?action=credoth">Other Credit Note</a></li> -->
                            <li <?= $inward; ?>><a href="?action=tiinward">Inward</a></li>
                            <li <?= $outward; ?>><a href="?action=tioutward">Outward</a></li>
                            <li <?= $damaged ?>><a href="?action=tidamaged">Damaged</a></li>
                            <!-- <li <?= $damaged ?>><a href="?action=tidamaged">Damaged</a></li>
                            <li <?= $excess; ?>><a href="?action=excess">Excess</a></li> -->
                            <hr>
                            <li <?= $bankrecp ?>><a href="?action=bankrecp">Bank Receipt</a></li>
                            <li <?= $bankpay ?>><a href="?action=bankpay">Bank Payment</a></li>
                            <li <?= $cashrecp; ?>><a href="?action=cashrecp">Cash Receipt</a></li>
                            <li <?= $cashpay; ?>><a href="?action=cashpay">Cash Payment</a></li>
                            <li <?= $contra; ?> > <a href="?action=contra">Contra</a></li>
                            <li <?= $journal; ?>><a href="?action=journal">Journal</a></li>
                        </ul>
                    </li>
                    <li <?= $reports; ?>>
                        <a href="#">Reports</a>
                        <ul class="cbp-hssubmenu">
                            <li <?= $stock; ?>><a href="?action=stock">Stock</a></li>
                            <li <?= $inouthist; ?>><a href="?action=prodhist">Inward / Outward History</a></li>
                            <li <?= $negstock; ?>><a href="?action=negstock">Negative Stock</a></li>
                            <!-- <li <?= $stockmov; ?>><a href="?action=stockmov">Stock Movement</a></li> -->
                            <!-- <li <?= $vat; ?>><a href="?action=vatrep">VAT</a></li>
                            <li <?= $ledger; ?>><a href="?action=ledger">Ledger</a></li> -->
                            <!--<li <?= $labels; ?>><a href="?action=labels">Labels</a></li>-->
<!--                            <li <?= $stock; ?>><a href="?action=stock">Query Cheque No.</a></li>
                            <li <?= $stock; ?>><a href="?action=stock">Query Amount</a></li>-->
                            <li <?= $itemwisesl; ?>><a href="?action=itemwise">Itemwise Sale</a></li>
                            <li <?= $itemwisepl; ?>><a href="?action=itemwisepl">Itemwise P/L</a></li>
                            <!-- <li <?= $itemwisepl; ?>><a href="?action=itemwisepl">Itemwise P/L</a></li>
                            <li <?= $itemwisegrpsl; ?>><a href="?action=tiitemgrpwise">Itemwise Group Sale</a></li> -->
                            <li <?= $tipartysl; ?>><a href="?action=partywisesale">Partywise Sale</a></li>
                            <li <?= $leadparty; ?>><a href="?action=leadparty">Leading Parties</a></li>
                            <li <?= $leadprod; ?>><a href="?action=leadprod">Leading Products</a></li>
                            <li <?= $bankbook; ?>><a href="?action=bankbook">Bank Book</a></li>
                            <li <?= $cashbook; ?>><a href="?action=cashbook">Cash Book</a></li>
                            <li <?= $dailyrep; ?>><a href="?action=dailyrep">Daily Report</a></li>
                            <!-- <li <?= $dailyrep; ?>><a href="?action=dailyrep">Daily Report</a></li>
                            <li <?= $dailycash; ?>><a href="?action=dailycash">Daily Cash</a></li> -->
                            <!-- <hr>
                            <li <?= $bankbook; ?>><a href="?action=bankbook">Bank Book</a></li>
                            <li <?= $cashbook; ?>><a href="?action=cashbook">Cash Book</a></li>
                            <li <?= $exprep; ?>><a href="?action=expenserep">Expense</a></li> -->
                         
                         </ul>
                    </li>
                    
                    <li <?= $registers; ?>>
                        <a href="#">Registers</a>
                        <ul class="cbp-hssubmenu">
                            <li <?= $purreg; ?>><a href="?action=purreg">Purchase</a></li>
                            <li <?= $salereg; ?>><a href="?action=salereg">Sale</a></li>
                            <li <?= $debreg; ?>><a href="?action=debreg">Debit Note</a></li>
                            <li <?= $credreg; ?>><a href="?action=credreg">Credit Note</a></li>
<!--                            <li <?= $openstock_item; ?>><a href="?action=openstock_item">Tax Invoice GST</a></li>
                            <li <?= $openstock_item; ?>><a href="?action=openstock_item">Tax Invoice VAT</a></li>-->
                            <!--<li <?= $taxpurch; ?>><a href="?action=openpack">Tax Purchase</a></li>-->
                            <li <?= $inwreg; ?>><a href="?action=inwreg">Inward</a></li>
                            <li <?= $outreg; ?>><a href="?action=outreg">Outward</a></li>
                            <li <?= $damreg; ?>><a href="?action=damreg">Damaged</a></li>
                            <!-- <li <?= $credothreg; ?>><a href="?action=credothreg">Credit Note-Others</a></li> -->
                            <!-- <li <?= $damreg; ?>><a href="?action=damreg">Damaged</a></li>
                            <li <?= $excreg; ?>><a href="?action=excreg">Excess</a></li> -->
                            
                        </ul>
                    </li>
                 
                     <li <?= $finalization; ?>>
                        <a href="#">Finalization</a>
                        <ul class="cbp-hssubmenu">
                            <li <?= $closestk; ?>><a href="?action=closstk">Closing Stock</a></li>
                            <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> 

                    <li class="dropdown settings" style="float: right">
                        <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 : ' . $dispyear; ?></label>
                        </a>
                    </li>
                    <li class="dropdown settings" style="float: right">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <b><? echo $_SESSION["username_" . $dbname] ?></b>
                        </a>
                        <ul class="dropdown-menu">
                            <li <? $tlcompany; ?>><a href="?action=company"><i class="fa fa-building-o"></i> Company Setup</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>
                            <?php
//                            if ($myear == "1001") {
//                                echo "<li $tlbackup><a href='?action=upload_backup'><i class='fa fa-cloud-download'></i> Upload Backup</a></li>";
//                            }
                            ?>
                            <li><a href="logout.php"><i class="fa fa-power-off"></i> Logout</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
    </div>
    <div class="">
        <iframe src="<?php echo $src; ?>" name="frame1" class="frame1" style="width: 100%; height:5000px;" frameBorder="0" scrolling="no"></iframe>
    </div>
    <script src="menu/js/cbpHorizontalSlideOutMenu.min.js"></script>
    <script>
        var menu = new cbpHorizontalSlideOutMenu(document.getElementById('cbp-hsmenu-wrapper'));
    </script>    
</body>


<!-- Mirrored from www.urbanui.com/yoraui/template/demo/horizontal-default-light/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 02 Jul 2019 11:04:23 GMT -->
</html>