<?php

if (isset($_SESSION["username_" . $dbname])) {
    $user = $_SESSION["username_" . $dbname];
    $spec = $_SESSION["spltype_" . $dbname];
    $fseries = $_SESSION["series_" . $dbname];

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

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

    ################## MASTERS ##################
    if ($guser['godown'] == '') {
        $godown = $none;
    }
    if ($guser['unit'] == '') {
        $unit = $none;
    }
    if ($guser['item'] == '') {
        $item = $none;
    }

    if ($guser['godown'] == '' && $guser['unit'] == '' && $guser['item'] == '') {
        $masters = $none;
    }

    ################## TRANSACTION ##################

if ($guser['inward'] == '') {
        $inward = $none;
    }
    if ($guser['outward'] == '') {
        $outward = $none;
    }
    if ($guser['damaged'] == '') {
        $damaged = $none;
    }
    if ($guser['transfer'] == '') {
        $transfer = $none;
    }
    if (($guser['inward'] == '') && ($guser['outward'] == '') && ($guser['damaged'] == '') && ($guser['transfer'] == '')) {
        $transctions = $none;
    }

    ################## REPORTS ##################
    if ($guser['stock'] == '') {
        $stock = $none;
    }
    if ($guser['itemquery'] == '') {
        $itemquery = $none;
    }
    if ($guser['prodhist'] == '') {
        $prodhist = $none;
    }
    if ($guser['nonmoving'] == '') {
        $nonmoving = $none;
    }

    if (($guser['stock'] == '') && ($guser['itemquery'] == '') && ($guser['prodhist'] == '') && ($guser['nonmoving'] == '')) {
        $reports = $none;
    }

    ################## REGISTERS ##################
    if ($guser['inwreg'] == '') {
        $inwreg = $none;
    }
    if ($guser['outreg'] == '') {
        $outreg = $none;
    }
    if ($guser['damreg'] == '') {
        $damreg = $none;
    }
    if ($guser['intrnfreg'] == '') {
        $intrnfreg = $none;
    }
    if ($guser['estreg'] == '') {
        $estreg = $none;
    }

    if (($guser['inwreg'] == '') && ($guser['outreg'] == '') && ($guser['intrnfreg'] == '') && ($guser['estreg'] == '')) {
        $registers = $none;
    }

    ################## TOOLS & DASHBOARD ##################
    if ($guser['compsetup'] == '') {
        $tlcompany = $none;
    }
    if ($guser['backup'] == '') {
        $tlbackup = $none;
    }
    if ($guser['profile'] == '') {
        $tlprofile = $none;
    }
    if ($guser['dstock'] == '') {
        $dstock = $none;
    }
    if ($guser['yearend'] == '') {
        $yearend = $none;
    }
    
    if (($guser['compsetup'] == '') && ($guser['backup'] == '') && ($guser['profile'] == '') && ($guser['dstock'] == '')) {
        $tools = $none;
    }
}
?>