<?php

if (isset($_SESSION["username_" . $dbname])) {
    $user = $_SESSION["username_" . $dbname];
    $getuser = mysqli_query($conn, "SELECT * FROM `passmain` WHERE `user`='$user'")or die(mysqli_error($conn));
    $guser = mysqli_fetch_array($getuser);

    $line = '';

    $none = "style='display:none'";

    ################## MASTERS ##################

    if ($guser['customer'] == '' && $guser['supplier'] == '' && $guser['brand'] == '' && $guser['item'] == '' && $guser['balewgt'] == '' && $guser['currency'] == '' &&
            $guser['transport'] == '' && $guser['expense'] == '' && $guser['cash'] == '' && $guser['opbal'] == '' && $guser['shipper'] == '' && $guser['purexpense'] == '') {
        $masters = $none;
    }
    if ($guser['customer'] == '') {
        $customer = $none;
    }
    if ($guser['supplier'] == '') {
        $supplier = $none;
    }
    if ($guser['brand'] == '') {
        $brand = $none;
    }
    if ($guser['item'] == '') {
        $item = $none;
    }
    if ($guser['balewgt'] == '') {
        $balewgt = $none;
    }
    if ($guser['currency'] == '') {
        $currency = $none;
    }
    if ($guser['transport'] == '') {
        $transport = $none;
    }
    if ($guser['expense'] == '') {
        $expense = $none;
    }
    if ($guser['cash'] == '') {
        $cash = $none;
    }
    if ($guser['opbal'] == '') {
        $opbal = $none;
    }
    if ($guser['shipper'] == '') {
        $shipper = $none;
    }
    if ($guser['purexpense'] == '') {
        $purexpense = $none;
    }

    ################## TRANSACTION ##################
    if ($guser['purchase'] == '' && $guser['sale'] == '' && $guser['creditnote'] == '' && $guser['damaged'] == '' && $guser['cashrecp'] == '' 
    && $guser['cashpay'] == ''  && $guser['shipperent'] == '') {
        $transaction = $none;
    }
    if ($guser['purchase'] == '') {
        $purchase = $none;
    }
    if ($guser['sale'] == '') {
        $sale = $none;
    }
    if ($guser['creditnote'] == '') {
        $creditnote = $none;
    }
    if ($guser['damaged'] == '') {
        $damaged = $none;
    }
    if ($guser['inward'] == '') {
        $inward = $none;
    }
    if ($guser['outward'] == '') {
        $outward = $none;
    }
//    if ($guser['cashrecp'] == '' && $guser['cashrecp'] == '') {
//        $mcash = $none;
//    }
    if ($guser['cashrecp'] == '') {
        $cashrecp = $none;
    }
    if ($guser['cashpay'] == '') {
        $cashpay = $none;
    }
    if ($guser['eta'] == '') {
        $eta = $none;
    }
    if ($guser['proforma'] == '') {
        $proforma = $none;
    }
    if ($guser['shipperent'] == '') {
        $shipperent = $none;
    }

    ################## REGISTERS ##################

    if ($guser['rgsale'] == '' && $guser['rgpurchase'] == '' && $guser['rgcreditnote'] == '' &&
            $guser['rgdamaged'] == '' && $guser['rginward'] == '' && $guser['rgoutward'] == '' && $guser['etareg'] == '') {
        $registers = $none;
    }
    if ($guser['rgsale'] == '') {
        $rgsale = $none;
    }
    if ($guser['rgpurchase'] == '') {
        $rgpurchase = $none;
    }
    if ($guser['rgcreditnote'] == '') {
        $rgcrednotereg = $none;
    }
    if ($guser['rgdamaged'] == '') {
        $rgdamaged = $none;
    }
    if ($guser['rginward'] == '') {
        $rginward = $none;
    }
    if ($guser['rgoutward'] == '') {
        $rgoutward = $none;
    }
    if ($guser['etareg'] == '') {
        $etareg = $none;
    }

    ################## REPORTS ##################
    if ($guser['rpstocknew'] == '' && $guser['rpdailyrep'] == '' && $guser['rpledger'] == '' && $guser['rpcashbook'] == '' && 
            $guser['rpitemhist'] == '' && $guser['rpdeadstock'] == '') {
        $reports = $none;
    }
    if ($guser['rpstocknew'] == '') {
        $stock = $none;
    }
    if ($guser['rpledger'] == '') {
        $rpledger = $none;
    }
    if ($guser['rpdailyrep'] == '') {
        $rpdailyrep = $none;
    }
    if ($guser['rpcashbook'] == '') {
        $rpcashbook = $none;
    }
    if ($guser['rpitemhist'] == '') {
        $rpitemhist = $none;
    }
    if ($guser['rpdeadstock'] == '') {
        $rpdeadstock = $none;
    }

    ################## FINALIZATIONS ##################
     if ($guser['trbal'] == '' && $guser['closstk'] == '' && $guser['profit'] == '' 
             && $guser['profshar'] == '' && $guser['balsheet'] == '' ) {
        $finalizations = $none;
    }
    if ($guser['trbal'] == '') {
        $trbal = $none;
    }
    if ($guser['closstk'] == '') {
        $closstk = $none;
    }
    if ($guser['profit'] == '') {
        $profit = $none;
    }
    if ($guser['profshar'] == '') {
        $profshar = $none;
    }
    if ($guser['balsheet'] == '') {
        $balsheet = $none;
    }
    ################## TOOLS & DASHBOARD ##################
    if ($guser['tlcompany'] == '') {
        $tlcompany = $none;
    }
    if ($guser['tlbackup'] == '') {
        $tlbackup = $none;
    }
    if ($guser['tlprofile'] == '') {
        $tlprofile = $none;
    }
    if ($guser['dstock'] == '') {
        $dstock = $none;
    }
}
?>