<?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['rawmat'] == '') {
        $rawmat = $none;
    }
    if ($guser['openbal'] == '') {
        $openbal = $none;
    }
    if ($guser['chcustdtl'] == '') {
        $chcustdtl = $none;
    }
    if ($guser['driver'] == '') {
        $driver = $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['customer'] == '' && $guser['supplier'] == ''&&$guser['openbal'] == '' && $guser['chcustdtl'] == '' && $guser['color'] == ''
        &&$guser['transport'] == '' && $guser['unit'] == '' && $guser['openstk'] == '' && $guser['staff'] == '' && $guser['bank'] == ''
        && $guser['cash'] == ''&&$guser['expense'] == '' && $guser['itemgrp'] == ''  &&  $guser['itemsubgrp'] == '' && $guser['item'] == ''
        && $guser['group'] == ''&&$guser['otherac'] == '' && $guser['saletype'] == '' && $guser['rawmat'] == ''
             ){
        $master = $none;
        
    }
    ################## TRANSACTION ##################
        
    if ($guser['purchase'] == '') {
        $purchase = $none;
    }
    if ($guser['purchmat'] == '') {
        $purchmat = $none;
    }
    if ($guser['purchmatgst'] == '') {
        $purchmatgst = $none;
    }
     if ($guser['repgiven'] == '') {
        $repgiven = $none;
    }
      if ($guser['reptaken'] == '') {
        $reptaken = $none;
    }
      if ($guser['amtrequest'] == '') {
        $amtrequest = $none;
    }
    if ($guser['sale'] == '') {
        $sale = $none;
    }
    if ($guser['salegst'] == '') {
        $salegst = $none;
    }
    if ($guser['debnote'] == '') {
        $debnote = $none;
    }
    if ($guser['deboth'] == '') {
        $deboth = $none;
    }
    if ($guser['crednote'] == '') {
        $crednote = $none;
    }
    if ($guser['credoth'] == '') {
        $credoth = $none;
    }
    if ($guser['inward'] == '') {
        $inward = $none;
    }
    if ($guser['outward'] == '') {
        $outward = $none;
    }
    if ($guser['damaged'] == '') {
        $damaged = $none;
    }
    if ($guser['excess'] == '') {
        $excess = $none;
    }
    if ($guser['bankrecp'] == '') {
        $bankrecp = $none;
    }
    if ($guser['color'] == '') {
        $color = $none;
    }
     if ($guser['custtokari'] == '') {
        $custtokari = $none;
    }
    if ($guser['bankpay'] == '') {
        $bankpay = $none;
    }
    if ($guser['cashrecp'] == '') {
        $cashrecp = $none;
    }
    if ($guser['cashpay'] == '') {
        $cashpay = $none;
    }
    if ($guser['contra'] == '') {
        $contra = $none;
    }
    if ($guser['journal'] == '') {
        $journal = $none;
    }
    if ($guser['discgiven'] == '') {
        $discgiven = $none;
    }
    if ($guser['discrecv'] == '') {
        $discrecv = $none;
    }
    if ($guser['taxinv'] == '') {
        $taxinv = $none;
    }
    if ($guser['transfer'] == '') {
        $transfer = $none;
    }

if($guser['purchmatgst'] == '' && $guser['purchmat'] == '' && $guser['crednote'] == '' 
            &&$guser['credoth'] == '' && $guser['inward'] == '' &&  $guser['outward'] == ''&&$guser['damaged'] == ''&&$guser['excess'] == ''
            &&$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'] == ''){
        $transaction = $none;
        
    }
    ################## REPORTS ##################
    
    if ($guser['stock'] == '') {
        $rpstock = $none;
    }
    if ($guser['inwout'] == '') {
        $rphist = $none;
    }
    if ($guser['rawinwout'] == '') {
        $rprawhist = $none;
    }
    if ($guser['rawstock'] == '') {
        $rprawstock = $none;
    }
    if ($guser['vatrep'] == '') {
        $rpvat = $none;
    }
    if ($guser['ledger'] == '') {
        $rpledger = $none;
    }
    if ($guser['karigrep'] == '') {
        $karigrep = $none;
    }
    if ($guser['fastmvitem'] == '') {
        $fastmvitem = $none;
    }
    if ($guser['slowmvitem'] == '') {
        $slowmvitem = $none;
    }
    if ($guser['labels'] == '') {
        $rplabels = $none;
    }
    if ($guser['chqrep'] == '') {
        $rpchqnoqry = $none;
    }
    if ($guser['amtrep'] == '') {
        $rpamountqry = $none;
    }
    if ($guser['itemwise'] == '') {
        $rpitemwise = $none;
    }
    if ($guser['itemwisesale'] == '') {
        $rpitemwisesale = $none;
    }
    if ($guser['itemgrpwisesale'] == '') {
        $rpitemgrpwisesale = $none;
    }
    if ($guser['partygrpwisesale'] == '') {
        $rppartygrpwisesale = $none;
    }
    if ($guser['leadparty'] == '') {
        $rpleadparty = $none;
    }
    if ($guser['dailyreport'] == '') {
        $rpdailyreport = $none;
    }
    if ($guser['dailysalereport'] == '') {
        $rpdailysalereport = $none;
    }
    if ($guser['bankbook'] == '') {
        $rpbankbook = $none;
    }
    if ($guser['cashbook'] == '') {
        $rpcashbook = $none;
    }
    if ($guser['jvrep'] == '') {
        $rpjvrep = $none;
    }
    if ($guser['exprep'] == '') {
        $rpexpense = $none;
    }
    if ($guser['payablerep'] == '') {
        $rppayable = $none;
    }
    if ($guser['receivable'] == '') {
        $rpreceivable = $none;
    }
    
    if($guser['stock'] == ''&&$guser['inwout'] == ''&& $guser['rawstock'] == ''&& $guser['rawinwout'] ==  '' &&$guser['ledger'] ==  '' &&$guser['karigrep'] == ''
        &&$guser['fastwmvitem'] == ''  && $guser['slowmvitem'] == '' &&  $guser['fastmvitem'] == '' && $guser['labels'] == '' && $guser['itemwise'] == '' && $guser['itemwisesale'] == ''
        &&$guser['partygrpwisesale'] == '' &&$guser['leadparty'] == ''&& $guser['dailyreport'] == ''&&  $guser['itemgrpwisesale'] == ''&& $guser['dailycashrep'] == ''
        &&$guser['bankbook'] == '' && $guser['cashbook'] == '' && $guser['jvbook'] == '' && $guser['pendrep'] == ''){
        $report = $none;
        
    }


    ################## REGISTERS ##################
    if ($guser['purreg'] == '') {
        $rgpurch = $none;
    }
    if ($guser['salereg'] == '') {
        $salereg= $none;
    }
    if ($guser['debnotreg'] == '') {
        $rgdebnote = $none;
    }
     if ($guser['salemulreg'] == '') {
        $salemulreg = $none;
    }
    if ($guser['debothreg'] == '') {
        $rgdeboth = $none;
    }
    if ($guser['crednotreg'] == '') {
        $rgcrednote = $none;
    }
    if ($guser['credothreg'] == '') {
        $rgcredoth = $none;
    }
    if ($guser['inwreg'] == '') {
        $rginward = $none;
    }
    if ($guser['outreg'] == '') {
        $rgoutward = $none;
    }
    if ($guser['slmatreg'] == '') {
        $salematreg = $none;
    }
      if ($guser['purchreg'] == '') {
        $purchreg= $none;
    }
      if ($guser['pumultigstreg'] == '') {
        $pumultigstreg= $none;
    }
      if ($guser['custokar'] == '') {
        $custokar= $none;
    }
     if ($guser['repgivreg'] == '') {
        $repgivreg= $none;
    }
    if ($guser['reprecreg'] == '') {
        $reprecreg= $none;
    }
    if ($guser['damreg'] == '') {
        $rgdamaged = $none;
    }
    if ($guser['excreg'] == '') {
        $rgexcess = $none;
    }
    if ($guser['driverreg'] == '') {
        $rgdriver = $none;
    }
    if ($guser['taxinvreg'] == '') {
        $rgtaxinv = $none;
    }
    if ($guser['balreg'] == '') {
        $rgbalance = $none;
    }
    if($guser['salemulreg'] == ''&&$guser['salereg'] == ''
        && $guser['crednotreg'] == ''&& $guser['credothreg'] == ''
        &&$guser['inwreg'] == ''&&$guser['slmatreg'] == '' && $guser['purchreg'] == ''
        &&$guser['damreg'] == ''&&$guser['pumultigstreg'] == '' && $guser['custokar'] == ''
        &&$guser['repgivreg'] == ''&&$guser['reprecreg'] == ''){
        $register = $none;
        
    }

    ################## TOOLS & DASHBOARD ##################
    if ($guser['trbal'] == '') {
        $fnbalance = $none;
    }
    if ($guser['profit'] == '') {
        $fnprofit = $none;
    }
    if ($guser['profshar'] == '') {
        $fnprofshar = $none;
    }
    if ($guser['balsheet'] == '') {
        $fnbalsheet = $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['combstock'] == '') {
        $combstock = $none;
    }
    
            
    if($guser['compsetup'] == '' && $guser['backup'] == ''
            && $guser['profile'] == ''&& $guser['dstock'] == '' && $guser['combstock'] == '') 
        
    
################## MIS ##################
    if ($guser['karadvbal'] == '') {
        $karadvbal = $none;
    }
    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;
    }
//    browse(($guser['karigpay'] == ''));
//     browse(($guser['karadvbal'] == ''));
//      browse(($guser['karigmatgv'] == ''));
//       browse(($guser['kargoodrc'] == ''));
//        browse(($guser['custnopay'] == ''));
    if(($guser['karigpay'] == ''&&$guser['karadvbal'] == '') && ($guser['karigmatgv'] == ''&&$guser['kargoodrc'] == ''&&$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;
    }
}
?>