<?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'] == '') {
        $customer = $none;
    }
    if ($guser['supplier'] == '') {
        $supplier = $none;
    }
    if ($guser['gsttype'] == '') {
        $gsttype = $none;
    }
    if ($guser['state'] == '') {
        $state = $none;
    }
    if ($guser['area'] == '') {
        $area = $none;
    }
    if ($guser['chcustdtl'] == '') {
        $chcustdtl = $none;
    }
    if ($guser['openbal'] == '') {
        $openbal = $none;
    }
    if ($guser['port'] == '') {
        $transport = $none;
    }
    if ($guser['courier'] == '') {
        $courier = $none;
    }
    if ($guser['staff'] == '') {
        $staff = $none;
    }
    if ($guser['narration'] == '') {
        $narration = $none;
    }
    if ($guser['unit'] == '') {
        $unit = $none;
    }
    if ($guser['godown'] == '') {
        $godown = $none;
    }
    if ($guser['prevbill'] == '') {
        $prevbill = $none;
    }
    if (
            $guser['customer'] == '' && $guser['supplier'] == '' && $guser['gsttype'] == '' && $guser['state'] == '' && $guser['area'] == '' && $guser['chcustdtl'] == '' && $guser['openbal'] == '' && $guser['transport'] == '' && $guser['courier'] == '' && $guser['staff'] == '' && $guser['narration'] == '' && $guser['unit'] == '' && $guser['godown'] == '' && $guser['prevbill'] == ''
    ) {
        $master = $none;
    }

    ######################TRADING INVENTORY######################
    if ($guser['colour'] == '') {
        $colour = $none;
    }
    if ($guser['sale'] == '') {
        $sale = $none;
    }
    if ($guser['inwardexp'] == '') {
        $inwardexp = $none;
    }
    if ($guser['deeminward'] == '') {
        $deeminward = $none;
    }
    if ($guser['deemsale'] == '') {
        $deemsale = $none;
    }
    if ($guser['prodgrp'] == '') {
        $prodgrp = $none;
    }
    if ($guser['product'] == '') {
        $product = $none;
    }
    if ($guser['changeofrates'] == '') {
        $changeofrates = $none;
    }
    if ($guser['openstock'] == '') {
        $openstock = $none;
    }
    if ($guser['tisale'] == '') {
        $tisale = $none;
    }
    if ($guser['saleoth'] == '') {
        $saleoth = $none;
    }
    if ($guser['ticrednote'] == '') {
        $ticrednote = $none;
    }
    if ($guser['ticredoth'] == '') {
        $ticredoth = $none;
    }

    if ($guser['ticredoth'] == '' && $guser['ticrednote'] == '') {
        $ticred = $none;
    }

    if ($guser['tiinward'] == '') {
        $tiinward = $none;
    }
    if ($guser['tidamage'] == '') {
        $tidamage = $none;
    }
    if ($guser['transfer'] == '') {
        $transfer = $none;
    }
    if ($guser['dismantle'] == '') {
        $dismantle = $none;
    }
    if ($guser['tdsrep'] == '') {
        $tdsrep = $none;
    }
    if ($guser['multiinvoice'] == '') {
        $multiinvoice = $none;
    }
    if ($guser['tisalereg'] == '') {
        $tisalereg = $none;
    }
    if ($guser['tiitemwise'] == '') {
        $tiitemwise = $none;
    }
    if ($guser['tiitemgrpwise'] == '') {
        $tiitemgrpwise = $none;
    }
    if ($guser['tipitemreg'] == '') {
        $tipitemreg = $none;
    }
    if ($guser['tiipartyreg'] == '') {
        $tiipartyreg = $none;
    }
    if ($guser['tisalitemwise'] == '') {
        $tisalitemwise = $none;
    }
    if ($guser['ticredreg'] == '') {
        $ticredreg = $none;
    }
    if ($guser['ticredothreg'] == '') {
        $ticredothreg = $none;
    }
    if ($guser['tiinwdreg'] == '') {
        $tiinwdreg = $none;
    }
    if ($guser['tidamreg'] == '') {
        $tidamreg = $none;
    }
    if ($guser['titranreg'] == '') {
        $titranreg = $none;
    }
    if ($guser['tidisreg'] == '') {
        $tidisreg = $none;
    }

    if ($guser['deeminwdreg'] == '') {
        $deeminwdreg = $none;
    }

    if ($guser['colour'] == '' && $guser['sale'] == '' && $guser['inwardexp'] == '' && $guser['deeminward'] == '' && $guser['deemsale'] == '' 
            && $guser['prodgrp'] == '' && $guser['product'] == '' && $guser['changeofrates'] == '' && $guser['openstock'] == '') {
        $ti_master = $none;
    }
    if ($guser['tisalereg'] == '' && $guser['ticredreg'] == '' && $guser['tiinwdreg'] == '' && $guser['tidamreg'] == '' && $guser['titranreg'] == '') {
        $ti_register = $none;
    }
    if (
            $guser['colour'] == '' && $guser['inwardexp'] == '' && $guser['deeminward'] == '' && $guser['deemsale'] == '' && $guser['prodgrp'] == '' && $guser['product'] == '' && $guser['changeofrates'] == '' && $guser['openstock'] == '' && $guser['tisale'] == '' && $guser['saleoth'] == '' && $guser['ticrednote'] == '' && $guser['ticredoth'] == '' && $guser['tiinward'] == '' && $guser['tidamage'] == '' && $guser['transfer'] == '' && $guser['dismantle'] == '' && $guser['tisalereg'] == '' && $guser['tiitemwise'] == '' && $guser['tiitemgrpwise'] == '' && $guser['tipitemreg'] == '' && $guser['tiipartyreg'] == '' && $guser['tisalitemwise'] == '' && $guser['ticredreg'] == '' && $guser['ticredothreg'] == '' && $guser['tiinwdreg'] == '' && $guser['tidamreg'] == '' && $guser['titranreg'] == '' && $guser['tidisreg'] == '' && $guser['deeminwdreg'] == '' && $guser['tds'] == '' && $guser['multiinvoice']
    ) {
        $trading_inventory = $none;
    }
    ######################EXPORTS######################

    if ($guser['exsale'] == '') {
        $exsale = $none;
    }

    if ($guser['expinward'] == '') {
        $expinward = $none;
    }
    if ($guser['exinward'] == '') {
        $exinward = $none;
    }
    if ($guser['proforma'] == '') {
        $proforma = $none;
    }
    if ($guser['exinvoice'] == '') {
        $exinvoice = $none;
    }
    if ($guser['expacklist'] == '') {
        $expacklist = $none;
    }
    if ($guser['certoforg'] == '') {
        $certoforg = $none;
    }
    if ($guser['gsp'] == '') {
        $gsp = $none;
    }
    if ($guser['excourier'] == '') {
        $excourier = $none;
    }
    if ($guser['exsalereg'] == '') {
        $exsalereg = $none;
    }
    if ($guser['exinwdreg'] == '') {
        $exinwdreg = $none;
    }
    if ($guser['proformareg'] == '') {
        $proformareg = $none;
    }
    if ($guser['exinvoicereg'] == '') {
        $exinvoicereg = $none;
    }
    if ($guser['expackreg'] == '') {
        $expackreg = $none;
    }
    if ($guser['excertiorg'] == '') {
        $excertiorg = $none;
    }
    if ($guser['exgsp'] == '') {
        $exgsp = $none;
    }
    if ($guser['newexcertiorg'] == '') {
        $newexcertiorg = $none;
    }
    if ($guser['excourreg'] == '') {
        $excourreg = $none;
    }
    if (
            $guser['exsale'] == '' && $guser['exinward'] == '' && $guser['proforma'] == '' && $guser['exinvoice'] == '' && $guser['expacklist'] == '' && $guser['certoforg'] == '' && $guser['gsp'] == '' && $guser['excourier'] == '' && $guser['exsalereg'] == '' && $guser['exinwdreg'] == '' && $guser['proformareg'] == '' && $guser['exinvoicereg'] == '' && $guser['expackreg'] == '' && $guser['excertiorg'] == '' && $guser['exgsp'] == '' && $guser['newexcertiorg'] == '' && $guser['excourreg'] == ''
    ) {
        $export = $none;
    }

    ################### MANUFACTURING INVENTORY ###################
    if ($guser['item'] == '') {
        $item = $none;
    }
    if ($guser['openstock_item'] == '') {
        $openstock_item = $none;
    }
    if ($guser['packing'] == '') {
        $packing = $none;
    }
    if ($guser['openpack'] == '') {
        $openpack = $none;
    }
    if ($guser['finprod'] == '') {
        $finprod = $none;
    }
    if ($guser['changerate_item'] == '') {
        $changerate_item = $none;
    }
    if ($guser['packgrp'] == '') {
        $packgrp = $none;
    }
    if ($guser['itemgrp'] == '') {
        $itemgrp = $none;
    }
    if ($guser['purchaser_mi'] == '') {
        $purchaser_mi = $none;
    }
    if ($guser['purchaser_exp'] == '') {
        $purchaser_exp = $none;
    }
    if ($guser['purchasep_mi'] == '') {
        $purchasep_mi = $none;
    }
    if ($guser['debnoter_mi'] == '') {
        $debnoter_mi = $none;
    }
    if ($guser['purchord'] == '') {
        $purchord = $none;
    }
    if ($guser['inward_mi'] == '') {
        $inward_mi = $none;
    }
    if ($guser['purcoth_mi'] == '') {
        $purcoth_mi = $none;
    }
    if ($guser['debnotep_mi'] == '') {
        $debnotep_mi = $none;
    }
    if ($guser['production'] == '') {
        $production = $none;
    }
    if ($guser['damrawmat'] == '') {
        $damrawmat = $none;
    }
    if ($guser['midelv'] == '') {
        $midelv = $none;
    }
    if ($guser['purrawreg'] == '') {
        $purrawreg = $none;
    }
    if ($guser['purordreg'] == '') {
        $purordreg = $none;
    }
    if ($guser['mirawmat'] == '') {
        $mirawmat = $none;
    }
    if ($guser['purretreg'] == '') {
        $purretreg = $none;
    }
    if ($guser['prodreg'] == '') {
        $prodreg = $none;
    }
    if ($guser['midamreg'] == '') {
        $midamreg = $none;
    }
    if ($guser['midelvreg'] == '') {
        $midelvreg = $none;
    }
    if ($guser['chqrep'] == '') {
        $chqrep = $none;
    }
    if ($guser['amtrep'] == '') {
        $amtrep = $none;
    }
    if ($guser['item'] == '' && $guser['openstock_item'] == '' && $guser['packing'] == '' && $guser['openpack'] == '' 
            && $guser['finprod'] == '' && $guser['changerate_item'] == '' && $guser['packgrp'] == '' && $guser['itemgrp'] == '') {
        $mi_master = $none;
    }
    if (
            $guser['item'] == '' && $guser['openstock_item'] == '' && $guser['packing'] == '' && $guser['openpack'] == ''
            && $guser['finprod'] == '' && $guser['changerate_item'] == '' && $guser['packgrp'] == '' && $guser['itemgrp'] == ''
            && $guser['purchaser_mi'] == '' && $guser['purchasep_mi'] == '' && $guser['debnoter_mi'] == '' && $guser['purchord'] == '' 
            && $guser['purcoth_mi'] == '' && $guser['debnotep_mi'] == '' && $guser['production'] == '' && $guser['damrawmat'] == ''
            && $guser['midelv'] == '' && $guser['purrawreg'] == '' && $guser['purordreg'] == '' && $guser['mirawmat'] == ''
            && $guser['purretreg'] == '' && $guser['prodreg'] == '' && $guser['midamreg'] == '' && $guser['midelvreg'] == '' && $guser['inward_mi'] == ''
    ) {
        $mi = $none;
    }

    ################### Accounts ###################
    if ($guser['group'] == '') {
        $group = $none;
    }
    if ($guser['other'] == '') {
        $other = $none;
    }
    if ($guser['bank'] == '') {
        $bank = $none;
    }
    if ($guser['cash'] == '') {
        $cash = $none;
    }
    if ($guser['expense'] == '') {
        $expense = $none;
    }
    if ($guser['drawbank'] == '') {
        $drawbank = $none;
    }
    if ($guser['bankrecp'] == '') {
        $bankrecp = $none;
    }
    if ($guser['bankpay'] == '') {
        $bankpay = $none;
    }
    if ($guser['cashrecp'] == '') {
        $cashrecp = $none;
    }
    if ($guser['cashpay'] == '') {
        $cashpay = $none;
    }
    if ($guser['journal'] == '') {
        $journal = $none;
    }
    if ($guser['contra'] == '') {
        $contra = $none;
    }
    if ($guser['contraent'] == '') {
        $contraent = $none;
    }
    if ($guser['bankrecorep'] == '') {
        $bankrecorep = $none;
    }
    if ($guser['bankrecon'] == '') {
        $bankrecon = $none;
    }
    if ($guser['receivablerep'] == '') {
        $receivablerep = $none;
    }
    if ($guser['payablerep'] == '') {
        $payablerep = $none;
    }
    if ($guser['payablerep'] == '' && $guser['receivablerep'] == '') {
        $oustanding = $none;
    }

    if (
            $guser['group'] == '' && $guser['other'] == '' && $guser['bank'] == '' && $guser['cash'] == '' && $guser['expense'] == '' && $guser['drawbank'] == '' &&
            $guser['bankrecp'] == '' && $guser['bankpay'] == '' && $guser['cashrecp'] == '' && $guser['cashpay'] == '' && $guser['journal'] == '' && $guser['contra'] == ''
    ) {
        $accounts = $none;
    }

    ################### MIS REPORTS ###################

    if ($guser['purchsumm'] == '') {
        $purchsumm = $none;
    }
    if ($guser['salesum'] == '') {
        $salesum = $none;
    }
    if ($guser['dailysalsumm'] == '') {
        $dailysalsumm = $none;
    }
    if ($guser['itemsalereg'] == '') {
        $itemsalereg = $none;
    }
    if ($guser['partywisesale'] == '') {
        $partywisesale = $none;
    }
    if ($guser['stkrawmat'] == '') {
        $stkrawmat = $none;
    }
    if ($guser['stkprod'] == '') {
        $stkprod = $none;
    }
    if ($guser['stkpack'] == '') {
        $stkpack = $none;
    }
    if ($guser['stkfingood'] == '') {
        $stkfingood = $none;
    }
    if ($guser['ledger'] == '') {
        $ledger = $none;
    }
    if ($guser['bankbook'] == '') {
        $bankbook = $none;
    }
    if ($guser['cashbook'] == '') {
        $cashbook = $none;
    }
    if ($guser['jvbook'] == '') {
        $jvbook = $none;
    }
    if ($guser['contreg'] == '') {
        $contreg = $none;
    }
    if ($guser['prodhist'] == '') {
        $prodhist = $none;
    }

    if (
            $guser['purchsumm'] == '' && $guser['salesumm'] == '' && $guser['dailysalsumm'] == '' && $guser['stkrawmat'] == '' &&
            $guser['stkprod'] == '' && $guser['stkfingood'] == '' && $guser['ledger'] == '' && $guser['bankbook'] == '' &&
            $guser['cashbook'] == '' && $guser['jvbook'] == '' && $guser['contreg'] == '' && $guser['prodhist'] == '' && 
            $guser['tiipartyreg'] == '' && $guser['tisalitemwise'] == '' && $guser['tiitemwise'] == '' && $guser['tiitemgrpwise'] == '' &&
            $guser['prodhist'] == '' && $guser['stkpack'] == '' && $guser['tdsrep'] == '' && $guser['chqrep'] == '' && $guser['amtrep'] == '') {
        $mis = $none;
    }

    ################### GST REPORTS ###################
    if ($guser['gstr1_1'] == '') {
        $gstr1_1 = $none;
    }
    if ($guser['gstr1_2'] == '') {
        $gstr1_2 = $none;
    }
    if ($guser['gstr1_3'] == '') {
        $gstr1_3 = $none;
    }
    if ($guser['gstr1_4'] == '') {
        $gstr1_4 = $none;
    }
    if ($guser['gstr1_5'] == '') {
        $gstr1_5 = $none;
    }
    if ($guser['gstr1_6'] == '') {
        $gstr1_6 = $none;
    }
    if ($guser['gstr1_9'] == '') {
        $gstr1_9 = $none;
    }
    if ($guser['gstr1_10'] == '') {
        $gstr1_10 = $none;
    }
    if ($guser['gstr1_11'] == '') {
        $gstr1_11 = $none;
    }

    if ($guser['gstr2_b2b'] == '') {
        $gstr2_b2b = $none;
    }
    if ($guser['gstr2_b2bur'] == '') {
        $gstr2_b2bur = $none;
    }
    if ($guser['gstr2_cdnr'] == '') {
        $gstr2_cdnr = $none;
    }
    if ($guser['gstr2_cdnur'] == '') {
        $gstr2_cdnur = $none;
    }
    if ($guser['gstr2_hsn'] == '') {
        $gstr2_hsn = $none;
    }
    if ($guser['gstr3B'] == '') {
        $gstr3B = $none;
    }
    if ($guser['gstr3b'] == '') {
        $gstr3b = $none;
    }
    if ($guser['inougst'] == '') {
        $inougst = $none;
    }
    if ($guser['jvgst'] == '') {
        $jvgst = $none;
    }

    if (
            $guser['gstr1_1'] == '' && $guser['gstr1_2'] == '' && $guser['gstr1_3'] == '' && $guser['gstr1_4'] == '' && $guser['gstr1_5'] == '' &&
            $guser['gstr1_6'] == '' && $guser['gstr1_7'] == '' && $guser['gstr1_8'] == '' && $guser['gstr1_9'] == '' && $guser['gstr1_10'] == '' &&
            $guser['gstr1_11'] == '' && $guser['gstr3b'] == '' && $guser['inougst'] == '' && $guser['jvgst'] == ''
    ) {
        $gst = $none;
    }
    ################### FINALIZATION ###################
    if ($guser['trbal'] == '') {
        $trbal = $none;
    }
    if ($guser['profit'] == '') {
        $profit = $none;
    }
    if ($guser['profshar'] == '') {
        $profshar = $none;
    }
    if ($guser['balsheet'] == '') {
        $balsheet = $none;
    }
    if (
            $guser['balsheet'] == '' && $guser['profshar'] == '' && $guser['profit'] == '' && $guser['trbal'] == ''
    ) {
        $finalization = $none;
    }
}
