<?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['prodgrp'] == '') {
        $prodgrp = $none;
    }
    if ($guser['product'] == '') {
        $product = $none;
    }
    if ($guser['godown'] == '') {
        $godown = $none;
    }
    if ($guser['transporter'] == '') {
        $transporter = $none;
    }
    if ($guser['chcustdtl'] == '') {
        $chcustdtl = $none;
    }
    if ($guser['openbal'] == '') {
        $openbal = $none;
    }
    if ($guser['bank'] == '') {
        $bank = $none;
    }
    if ($guser['cash'] == '') {
        $cash = $none;
    }
    if ($guser['expense'] == '') {
        $expense = $none;
    }
    if ($guser['group'] == '') {
        $group = $none;
    }
    if ($guser['otherac'] == '') {
        $otherac = $none;
    }
    if ($guser['paytype'] == '') {
        $paytype = $none;
    }
    if (
            $guser['customer'] == '' && $guser['supplier'] == '' && $guser['prodgrp'] == '' &&
            $guser['product'] == '' && $guser['godown'] == '' && $guser['transporter'] == '' && $guser['chcustdtl'] == '' && $guser['openbal'] == '' &&
            $guser['bank'] == '' && $guser['cash'] == '' && $guser['expense'] == '' && $guser['group'] == '' && $guser['otherac'] == '' &&
            $guser['paytype'] == ''
    ) {
        $master = $none;
    }

    ###################### TRANSACTIONS ######################
    if ($guser['purchase'] == '') {
        $purchase = $none;
    }
    if ($guser['sale'] == '') {
        $sale = $none;
    }
    if ($guser['debnote'] == '') {
        $debnote = $none;
    }
    if ($guser['crednote'] == '') {
        $crednote = $none;
    }
    if ($guser['inward'] == '') {
        $inward = $none;
    }
    if ($guser['outward'] == '') {
        $outward = $none;
    }
    if ($guser['damaged'] == '') {
        $damaged = $none;
    }
    if ($guser['excess'] == '') {
        $excess = $none;
    }
    if ($guser['transfer'] == '') {
        $transfer = $none;
    }
    if ($guser['bankrecp'] == '') {
        $bankrecp = $none;
    }
    if ($guser['bankpay'] == '') {
        $bankpay = $none;
    }
    if ($guser['cashrecp'] == '') {
        $cashrecp = $none;
    }
    if ($guser['cashrecp'] == '') {
        $cashrecp = $none;
    }
    if ($guser['cashpay'] == '') {
        $cashpay = $none;
    }
    if ($guser['contra'] == '') {
        $contra = $none;
    }
    if ($guser['journal'] == '') {
        $journal = $none;
    }

    if (
            $guser['purchase'] == '' && $guser['sale'] == '' && $guser['debnote'] == '' && $guser['crednote'] == '' && $guser['inward'] == '' && $guser['outward'] == '' && $guser['damaged'] == '' && $guser['excess'] == '' && $guser['bankrecp'] == '' && $guser['bankpay'] == '' && $guser['cashrecp'] == '' && $guser['cashpay'] == '' && $guser['contra'] == '' && $guser['journal'] == ''
    ) {
        $transactions = $none;
    }
    ###################### REPORTS ######################

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

    if ($guser['inouthist'] == '') {
        $inouthist = $none;
    }
    if ($guser['vat'] == '') {
        $vat = $none;
    }
    if ($guser['ledger'] == '') {
        $ledger = $none;
    }
    if ($guser['ledgernew'] == '') {
        $ledgernew = $none;
    }
    if ($guser['itemwisepl'] == '') {
        $itemwisepl = $none;
    }
    if ($guser['itemwisesl'] == '') {
        $itemwisesl = $none;
    }
    if ($guser['itemwisegrpsl'] == '') {
        $itemwisegrpsl = $none;
    }
    if ($guser['tipartysl'] == '') {
        $tipartysl = $none;
    }
    if ($guser['leadparty'] == '') {
        $leadparty = $none;
    }
    if ($guser['dailyrep'] == '') {
        $dailyrep = $none;
    }
    if ($guser['dailycash'] == '') {
        $dailycash = $none;
    }
    if ($guser['bankbook'] == '') {
        $bankbook = $none;
    }
    if ($guser['cashbook'] == '') {
        $cashbook = $none;
    }
    if ($guser['multiinv'] == '') {
        $multiinv = $none;
    }
    if ($guser['exprep'] == '') {
        $exprep = $none;
    }
    if ($guser['osrec'] == '') {
        $osrec = $none;
    }
    if ($guser['ospay'] == '') {
        $ospay = $none;
    }
    if (
            $guser['stock'] == '' && $guser['inouthist'] == '' && $guser['vat'] == '' && $guser['ledger'] == '' && $guser['ledgernew'] == '' && $guser['ospay'] == '' &&
            $guser['itemwisepl'] == '' && $guser['itemwisesl'] == '' && $guser['itemwisegrpsl'] == '' && $guser['tipartysl'] == '' && $guser['osrec'] == '' &&
            $guser['leadparty'] == '' && $guser['dailyrep'] == '' && $guser['multiinv'] == '' && $guser['dailycash'] == '' && $guser['bankbook'] == '' && $guser['cashbook'] == '' &&
            $guser['exprep'] == ''
    ) {
        $reports = $none;
    }


    ################### Registers ###################
    if ($guser['purreg'] == '') {
        $purreg = $none;
    }
    if ($guser['salreg'] == '') {
        $salreg = $none;
    }
    if ($guser['inwreg'] == '') {
        $inwreg = $none;
    }
    if ($guser['outreg'] == '') {
        $outreg = $none;
    }
    if ($guser['debreg'] == '') {
        $debreg = $none;
    }
    if ($guser['credreg'] == '') {
        $credreg = $none;
    }
    if ($guser['damreg'] == '') {
        $damreg = $none;
    }
    if ($guser['excreg'] == '') {
        $excreg = $none;
    }
    if ($guser['minstkreg'] == '') {
        $minstkreg = $none;
    }
    if ($guser['tranreg'] == '') {
        $tranreg = $none;
    }

    if (
            $guser['purreg'] == '' && $guser['salreg'] == '' && $guser['inwreg'] == '' && $guser['outreg'] == '' &&
            $guser['debreg'] == '' && $guser['credreg'] == '' && $guser['damreg'] == '' && $guser['excreg'] == '' && $guser['minstkreg'] == '' && $guser['tranreg'] == ''
    ) {
        $registers = $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;
    }

    ################### FINALIZATION ###################
    if ($guser['closestk'] == '') {
        $closestk = $none;
    }
    if ($guser['trbal'] == '') {
        $trbal = $none;
    }
    if ($guser['profloss'] == '') {
        $profloss = $none;
    }
    if ($guser['profshar'] == '') {
        $profshar = $none;
    }
    if ($guser['balsheet'] == '') {
        $balsheet = $none;
    }
    if (
            $guser['closestk'] == '' && $guser['trbal'] == '' && $guser['profloss'] == '' && $guser['profshar'] == '' && $guser['balsheet'] == ''
    ) {
        $finalization = $none;
    }
}
