<?php

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

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

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

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

    if ($guser['customer'] == '') {
        $customer = $none;
    }
    if ($guser['supplier'] == '') {
        $supplier = $none;
    }
    if ($guser['openbal'] == '') {
        $openbal = $none;
    }
    if ($guser['chcustdtl'] == '') {
        $chcustdtl = $none;
    }
    if ($guser['color'] == '') {
        $color = $none;
    }
    if ($guser['transport'] == '') {
        $transport = $none;
    }
    if ($guser['unit'] == '') {
        $unit = $none;
    }
    if ($guser['openstk'] == '') {
        $openstk = $none;
    }
    if ($guser['staff'] == '') {
        $staff = $none;
    }
    if ($guser['bank'] == '') {
        $bank = $none;
    }
    if ($guser['cash'] == '') {
        $cash = $none;
    }
    if ($guser['expense'] == '') {
        $expense = $none;
    }
    if ($guser['itemgrp'] == '') {
        $itemgrp = $none;
    }
    if ($guser['itemsubgrp'] == '') {
        $itemsubgrp = $none;
    }
    if ($guser['item'] == '') {
        $item = $none;
    }
    if ($guser['group'] == '') {
        $group = $none;
    }
    if ($guser['otherac'] == '') {
        $otherac = $none;
    }
    if ($guser['saletype'] == '') {
        $saletype = $none;
    }
    if ($guser['rawmat'] == '') {
        $rawmat = $none;
    }
    if ($guser['process'] == '') {
        $process = $none;
    }
//    browse($process);
    if ($guser['driver'] == '') {
        $driver = $none;
    }
    
    if ($guser['customer'] == '' && $guser['supplier'] == '' && $guser['openbal'] == '' && $guser['chcustdtls'] == '' && $guser['transport'] == '' 
            && $guser['unit'] == '' && $guser['color'] == '' && $guser['chrateop'] == '' && $guser['staff'] == '' && $guser['bank'] == ''
            && $guser['cash'] == '' && $guser['expense'] == '' && $guser['itemgrp'] == '' && $guser['itemsubgrp'] == '' && $guser['item'] == '' 
            && $guser['rawmat'] == '' && $guser['process'] == '' && $guser['group'] == '' && $guser['otherac'] == '' && $guser['saletype'] == ''
            && $guser['driver'] == '' && $guser['openstk'] == ''
    ) {
        $master = $none;
    }

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

    if ($guser['sale'] == '') {
        $sale = $none;
    }
    if ($guser['creditnotemulti'] == '') {
        $creditnotemulti = $none;
    }
    if ($guser['credoth'] == '') {
        $credoth = $none;
    }
    if ($guser['inward'] == '') {
        $inward = $none;
    }
    if ($guser['damagedgst'] == '') {
        $damagedgst = $none;
    }
    if ($guser['quotation'] == '') {
        $quotation = $none;
    }
    if ($guser['salematmulti'] == '') {
        $salematmulti = $none;
    }
    if ($guser['purchase'] == '') {
        $purchase = $none;
    }
    if ($guser['repgiven'] == '') {
        $repgiven = $none;
    }
    if ($guser['reptaken'] == '') {
        $reptaken = $none;
    }
    if ($guser['amtrequest'] == '') {
        $amtrequest = $none;
    }
    if ($guser['bankrecp'] == '') {
        $bankrecp = $none;
    }
    if ($guser['bankpay'] == '') {
        $bankpay = $none;
    }
    if ($guser['custtokari'] == '') {
        $custtokari = $none;
    }
    if ($guser['cashrecp'] == '') {
        $cashrecp = $none;
    }
    if ($guser['cashpay'] == '') {
        $cashpay = $none;
    }
    if ($guser['contra'] == '') {
        $contra = $none;
    }
    if ($guser['journal'] == '') {
        $journal = $none;
    }
    if ($guser['transfer'] == '') {
        $transfer = $none;
    }
    if ($guser['salegstmulti'] == '') {
        $salegstmulti = $none;
    }
    if ($guser['salegst'] == '') {
        $salegst = $none;
    }
    if ($guser['debitnotegst'] == '') {
        $debitnotegst = $none;
    }
    if ($guser['debothgst'] == '') {
        $debothgst = $none;
    }
    if ($guser['creditnotegst'] == '') {
        $creditnotegst = $none;
    }
    if ($guser['debnote'] == '') {
        $debnote = $none;
    }
    if ($guser['deboth'] == '') {
        $deboth = $none;
    }
    if ($guser['purchgstmulti'] == '') {
        $purchgstmulti = $none;
    }
    if ($guser['outwardgst'] == '') {
        $outwardgst = $none;
    }
    if ($guser['taxinv'] == '') {
        $taxinv = $none;
    }
    if ($guser['purchmatgst'] == '') {
        $purchmatgst = $none;
    }
    if ($guser['tpurchmat'] == '') {
        $tpurchmat = $none;
    }
    if ($guser['quotation'] == '') {
        $quotation = $none;
    }
    
//    For Dropdown
    if ($guser['crednotemulti'] == ''  && $guser['credoth'] == '') {
        $mcred = $none;
    }
    
//    For Bank Dropdown
    
    if ($guser['bankrecp'] == ''  && $guser['bankpay'] == '' && $guser['custtokari'] == '') {
        $mbank = $none;
    }
    
//    For Cash Dropdown
    if ($guser['cashrecp'] == ''  && $guser['cashpay'] == '') {
        $mcash = $none;
    }

    if ($guser['sale'] == '' && $guser['creditnotemulti'] == ''  && $guser['credoth'] == '' && $guser['inward'] == '' && $guser['damagedgst'] == '' 
            && $guser['quotation'] == '' && $guser['salematmulti'] == '' && $guser['purchase'] == ''
            && $guser['repgiven'] == '' && $guser['reptaken'] == '' && $guser['amtrequest'] == '' && $guser['bankrecp'] == '' && $guser['bankpay'] == '' 
            && $guser['custtokari'] == '' && $guser['cashrecp'] == '' && $guser['cashpay'] == '' && $guser['contra'] == '' && $guser['journal'] == ''
            && $guser['transfer'] == '' && $guser['salegstmulti'] == '' && $guser['salegst'] == '' && $guser['debitnotegst'] == '' && $guser['debothgst'] == ''
            && $guser['creditnotegst'] == '' && $guser['debnote'] == '' && $guser['deboth'] == '' && $guser['purchgstmulti'] == ''
            && $guser['outwardgst'] == '' && $guser['taxinv'] == ''  && $guser['quotation'] == '' 
    ) {
        $transaction = $none;
    }

    ################## MANUFACTURING ##################

    if ($guser['saleord'] == '') {
        $saleord = $none;
    }
    if ($guser['purchmat'] == '') {
        $purchmat = $none;
    }
    if ($guser['purretrawmat'] == '') {
        $purretrawmat = $none;
    }
    if ($guser['inwardraw'] == '') {
        $inwardraw = $none;
    }
    if ($guser['outwardraw'] == '') {
        $outwardraw = $none;
    }
    if ($guser['damraw'] == '') {
        $damraw = $none;
    }
    if ($guser['jobgiven'] == '') {
        $jobgiven = $none;
    }
    if ($guser['jobrecvd'] == '') {
        $jobrecvd = $none;
    }
    if ($guser['finandpack'] == '') {
        $finandpack = $none;
    }
    if ($guser['slordreg'] == '') {
        $slordreg = $none;
    }
    if ($guser['pendslord'] == '') {
        $pendslord = $none;
    }
    if ($guser['purtrwreg'] == '') {
        $purtrwreg = $none;
    }
//    if ($guser['inwrawreg'] == '') {
//        $inwrawreg = $none;
//    }
    if ($guser['outrawreg'] == '') {
        $outrawreg = $none;
    }
    if ($guser['damrawreg'] == '') {
        $damrawreg = $none;
    }
    if ($guser['jobgvnreg'] == '') {
        $jobgvnreg = $none;
    }
    if ($guser['jobrecdreg'] == '') {
        $jobrecdreg = $none;
    }
    if ($guser['packreg'] == '') {
        $packreg = $none;
    }
    if ($guser['pendjob'] == '') {
        $pendjob = $none;
    }
    if ($guser['pendpack'] == '') {
        $pendpack = $none;
    }

    if ($guser['saleord'] == '' && $guser['purchmat'] == '' && $guser['purretrawmat'] == '' && $guser['inwardraw'] == '' && $guser['outwardraw'] == ''
            && $guser['damraw'] == '' && $guser['jobgiven'] == '' && $guser['jobrecvd'] == '' && $guser['finandpack'] == '' && $guser['slordreg'] == ''
            && $guser['pendslord'] == '' && $guser['purtrwreg'] == '' && $guser['outrawreg'] == '' 
            && $guser['damrawreg'] == ''&& $guser['jobgvnreg'] == '' && $guser['jobrecdreg'] == '' && $guser['packreg'] == '' && $guser['pendjob'] == '' 
            && $guser['pendpack'] == '') {
        $manufact = $none;
    }

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

    if ($guser['stock'] == '') {
        $stock = $none;
    }
    if ($guser['inwout'] == '') {
        $inwout = $none;
    }
    if ($guser['rawstock'] == '') {
        $rawstock = $none;
    }
    if ($guser['rawinwout'] == '') {
        $rawinwout = $none;
    }
    if ($guser['ledger'] == '') {
        $ledger = $none;
    }
    if ($guser['karigrep'] == '') {
        $karigrep = $none;
    }
    if ($guser['fastmvitem'] == '') {
        $fastmvitem = $none;
    }
    if ($guser['slowmvitem'] == '') {
        $slowmvitem = $none;
    }
    if ($guser['itemwise'] == '') {
        $itemwise = $none;
    }
    if ($guser['itemwisesale'] == '') {
        $itemwisesale = $none;
    }
    if ($guser['itemgrpwisesale'] == '') {
        $itemgrpwisesale = $none;
    }
    if ($guser['partygrpwisesale'] == '') {
        $rppartygrpwisesale = $none;
    }
    if ($guser['leadparty'] == '') {
        $leadparty = $none;
//        browse($leadparty);
    }
    if ($guser['dailyreport'] == '') {
        $dailyreport = $none;
    }
    if ($guser['bankbook'] == '') {
        $bankbook = $none;
    }
    if ($guser['cashbook'] == '') {
        $cashbook = $none;
    }
    if ($guser['jvbook'] == '') {
        $jvbook = $none;
    }
    if ($guser['pendrep'] == '') {
        $pendrep = $none;
    }
    if ($guser['vatrep'] == '') {
        $vatrep = $none;
    }
    if ($guser['dailycashrp'] == '') {
        $dailycashrp = $none;
    }
    if ($guser['dailysalereport'] == '') {
        $dailysalereport = $none;
    }
    if ($guser['expenserep'] == '') {
        $expenserep = $none;
    }
    if ($guser['payablerep'] == '') {
        $payablerep = $none;
    }
    if ($guser['receivable'] == '') {
        $receivable = $none;
    }
    if ($guser['labels'] == '') {
        $labels = $none;
    }
    if ($guser['chqrep'] == '') {
        $chqrep = $none;
    }
    if ($guser['amtrep'] == '') {
        $amtrep = $none;
    }
    
    if ($guser['stock'] == '' && $guser['inwout'] == '' && $guser['rawstock'] == '' && $guser['rawinwout'] == '' && $guser['ledger'] == ''
            && $guser['karigrep'] == '' && $guser['fastwmvitem'] == '' && $guser['slowmvitem'] == '' && $guser['itemwisesale'] == ''
            && $guser['itemgrpwisesale'] == '' && $guser['partygrpwisesale'] == '' && $guser['leadparty'] == '' && $guser['dailyreport'] == '' 
            && $guser['bankbook'] == '' && $guser['cashbook'] == '' && $guser['jvbook'] == '' && $guser['pendrep'] == '' && $guser['vatrep'] == ''
            && $guser['dailycashrp'] == '' && $guser['dailysalereport'] == '' && $guser['expenserep'] == '' && $guser['payablerep'] == ''
            && $guser['receivable'] == '' && $guser['labels'] == '' && $guser['chqrep'] == '' && $guser['amtrep'] == '' 
            ) {
        $report = $none;
    }


    ################## REGISTERS ##################
    if ($guser['purmatreg'] == '') {
        $purmatreg = $none;
    }
    if ($guser['salereg'] == '') {
        $salereg = $none;
    }
    if ($guser['crdntreg'] == '') {
        $crdntreg = $none;
    }
    if ($guser['crdothreg'] == '') {
        $crdothreg = $none;
    }
    if ($guser['inwreg'] == '') {
        $inwreg = $none;
    }
    if ($guser['inwrawreg'] == '') {
        $inwrawreg = $none;
    }
    if ($guser['damreg'] == '') {
        $damreg = $none;
    }
    if ($guser['slmatreg'] == '') {
        $slmatreg = $none;
    }
    if ($guser['purchreg'] == '') {
        $purchreg = $none;
    }
    if ($guser['custokar'] == '') {
        $custokar = $none;
    }
    if ($guser['repgivreg'] == '') {
        $repgivreg = $none;
    }
    if ($guser['reprecreg'] == '') {
        $reprecreg = $none;
    }
    if ($guser['slmultigstreg'] == '') {
        $slmultigstreg = $none;
    }
    if ($guser['pumultigstreg'] == '') {
        $pumultigstreg = $none;
    }
    if ($guser['crednotreg'] == '') {
        $pumultigstreg = $none;
    }
    
    if ($guser['purmatreg'] == '' && $guser['salereg'] == '' && $guser['crdntreg'] == '' && $guser['crdothreg'] == '' && $guser['inwreg'] == ''
            && $guser['inwrawreg'] == '' && $guser['damreg'] == '' && $guser['slmatreg'] == '' && $guser['purchreg'] == '' && $guser['custokar'] == '' 
            && $guser['repgivreg'] == '' && $guser['reprecreg'] == '' && $guser['slmultigstreg'] == '' && $guser['pumultigstreg'] == '' && $guser['crednotreg'] == '') {
        $register = $none;
    }

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

    ################## TOOLS & DASHBOARD ##################
    if ($guser['compsetup'] == '') {
        $compsetup = $none;
    }
    if ($guser['backup'] == '') {
        $backup = $none;
    }
    if ($guser['profile'] == '') {
        $profile = $none;
    }
    if ($guser['dstock'] == '') {
        $dstock = $none;
    }
    if ($guser['combstock'] == '') {
        $combstock = $none;
    }


    if ($guser['compsetup'] == '' && $guser['backup'] == '' && $guser['profile'] == '' && $guser['dstock'] == '' && $guser['combstock'] == '') {
        $tools = $none;
    }


################## MIS ##################
    if ($guser['karadvbal'] == '') {
        $karadvbal = $none;
    }
//    browse($karadvbal);
    if ($guser['karigmatgv'] == '') {
        $karigmatgv = $none;
    }
    if ($guser['kargoodrc'] == '') {
        $kargoodrc = $none;
    }
    if ($guser['karigpay'] == '') {
        $karigpay = $none;
    }
    if ($guser['custnopay'] == '') {
        $custnopay = $none;
    }
    if ($guser['custnosale'] == '') {
        $custnosale = $none;
    }

    if (($guser['karadvbal'] == '' && $guser['karigmatgv'] == '') && ($guser['kargoodrc'] == '' && $guser['karigpay'] == '' 
            && $guser['custnopay'] == '' && $guser['custnosale'] == '')) {
        $mis = $none;
    }
    
    
    
    ################## New Fields ##################
//    if ($guser['purexp'] == '') {
//        $purexp = $none;
//    }
//    if ($guser['salegstmulti'] == '') {
//        $salegmul = $none;
//    }
//    if($guser['debnote'] == '' && $guser['deboth'] == '' ){
//        $mdeb = $none;
//    }
//    if($guser['crednote'] == '' && $guser['credoth'] == ''){
//        $mcred = $none;
//    }
//    if ($guser['dailycashrep'] == '') {
//        $dailycashrep = $none;
//    }
//    if ($guser['salematmulti'] == '') {
//        $salematmulti = $none;
//    }
//    if($guser['bankpay'] == '' && $guser['bankrecp'] == ''&& $guser['custtokari'] == '' ){
//        $mbank = $none;
//    }
//    if($guser['cashrecp'] == '' && $guser['cashpay'] == ''){
//        $mcash = $none;
//    }
//    if($guser['chqrep'] == '' && $guser['amtrep'] == ''){
//        $rpquery = $none;
//    }
//    if ($guser['purexpreg'] == '') {
//        $purexpreg = $none;
//    }
//    if ($guser['debothreg'] == ''&& $guser['debnotreg'] == '') {
//        $rgdebitnote = $none;
//    }
//    if ($guser['crednotreg'] == ''&& $guser['credothreg'] == '') {
//        $rgcreditnote = $none;
//    }
//    if ($guser['pendrep'] == '') {
//        $rpendrep = $none;
//    }
//    if($guser['payablerep'] == '' && $guser['receivable'] == ''){
//        $rpoutstanding = $none;
//    }
//    if ($guser['purgstreg'] == '') {
//        $purgstreg = $none;
//    }
//    if ($guser['slgstreg'] == '') {
//        $slgstreg = $none;
//    }
//   
//    if ($guser['b2brep'] == '') {
//        $b2brep = $none;
//    }
//    if ($guser['b2bsmrep'] == '') {
//        $b2bsmrep = $none;
//    }
//    if ($guser['b2blgrep'] == '') {
//        $b2blgrep = $none;
//    }
//    if ($guser['gstcreddebrep'] == '') {
//        $gstcreddebrep = $none;
//    }
//    if ($guser['gstcreddeburdrep'] == '') {
//        $gstcreddeburdrep = $none;
//    }
//    if ($guser['gstexprep'] == '') {
//        $gstexprep = $none;
//    }
//    if ($guser['gstadvrecdrep'] == '') {
//        $gstadvrecdrep = $none;
//    }
//    if ($guser['gstadvadjrep'] == '') {
//        $gstadvadjrep = $none;
//    }
//    if ($guser['gstnilrep'] == '') {
//        $gstnilrep = $none;
//    }
//    if ($guser['gsthsnrep'] == '') {
//        $gsthsnrep = $none;
//    }
//    if ($guser['gstdocrep'] == '') {
//        $gstdocrep = $none;
//    }
}
?>