<?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_array($getuser);
    $line = '';

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

    ################## MASTERS ##################
    if ($guser['customer'] == '') { $customer = $none; }
    if ($guser['maker'] == '')    { $maker = $none; }
    if ($guser['supplier'] == '') { $supplier = $none; }
    if ($guser['openbal'] == '')  { $openbal = $none; }
    if ($guser['transport'] == ''){ $transport = $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['customer'] == '' && $guser['maker'] == '' && $guser['supplier'] == '' &&
    $guser['openbal'] == '' && $guser['transport'] == '' && $guser['bank'] == '' &&
    $guser['cash'] == '' && $guser['expense'] == '' && $guser['group'] == '' && $guser['otherac'] == ''){
        $master = $none;
    }
    
    ################## RAW MATERIAL ##################
    if ($guser['color'] == '')    { $color = $none; }
    if ($guser['rawmatgrp'] == '') { $rawmatgrp = $none; }
    if ($guser['rawmat'] == '') { $rawmat = $none; }
    if ($guser['rawchrateop'] == '') { $rawchrateop = $none; }
    if ($guser['purchmat'] == '') { $purchmat = $none; }
    if ($guser['debnoteraw'] == '') { $debnoteraw = $none; }
    if ($guser['debothgst_raw'] == '') { $debothgst_raw = $none; }
    if ($guser['salemat'] == '') { $salemat = $none; }
    if ($guser['crednoteraw'] == '') { $crednoteraw = $none; }
    if ($guser['inwardraw'] == '') { $inwardraw = $none; }
    if ($guser['outwardraw'] == '') { $outwardraw = $none; }
    if ($guser['damagedraw'] == '') { $damagedraw = $none; }
    if ($guser['purchrawreg'] == '') { $purchrawreg = $none; }
    if ($guser['debnoterawreg'] == '') { $debnoterawreg = $none; }
    if ($guser['slmatmultireg'] == '') { $slmatmultireg = $none; }
    if ($guser['crednoterawreg'] == '') { $crednoterawreg = $none; }
    if ($guser['inwregraw'] == '') { $inwregraw = $none; }
    if ($guser['outregraw'] == '') { $outregraw = $none; }
    if ($guser['damregraw'] == '') { $damregraw = $none; }
    if ($guser['rawstock'] == '') { $rawstock = $none; }
    if ($guser['rawinwout'] == '') { $rawinwout = $none; }
    if ($guser['rawmatwise'] == '') { $rawmatwise = $none; }
    if ($guser['rawmatwisesale'] == '') { $rawmatwisesale = $none; }
    if ($guser['rawgrpwisesale'] == '') { $rawgrpwisesale = $none; }

    if ($guser['purchmat'] == '' && $guser['debnoteraw'] == '' && $guser['debothgst_raw'] == '' && $guser['salemat'] == '' &&
    $guser['rawmatgrp'] == '' && $guser['rawmat'] == '' && $guser['rawchrateop'] == '' && $guser['color'] == '' &&
    $guser['crednoteraw'] == '' && $guser['inwardraw'] == '' && $guser['outwardraw'] == '' && $guser['damagedraw'] == '' &&
    $guser['purchrawreg'] == '' && $guser['debnoterawreg'] == '' && $guser['slmatmultireg'] == '' && $guser['crednoterawreg'] == '' &&
    $guser['inwregraw'] == '' && $guser['outregraw'] == '' && $guser['damregraw'] == '' && $guser['rawstock'] == '' &&
    $guser['rawinwout'] == '' && $guser['rawmatwise'] == '' && $guser['rawmatwisesale'] == '' && $guser['rawgrpwisesale'] == '' )
  { $rawmaterial = $none; }

    ################## Products ##################
    if ($guser['itemgrp'] == ''){ $itemgrp = $none; }
    if ($guser['item'] == ''){ $item = $none; }
    if ($guser['chrateop'] == ''){ $chrateop = $none; }
    if ($guser['saleamt'] == ''){ $saleamt = $none; }
    if ($guser['purchase'] == '') { $purchase = $none; }
    if ($guser['sale'] == '') { $sale = $none; }
    if ($guser['debnote'] == '') { $debnote = $none; }
    if ($guser['debothgst'] == '') { $debothgst = $none; }
    if ($guser['crednote'] == '') { $crednote = $none; }
    if ($guser['inwardgst'] == '') { $inwardgst = $none; }
    if ($guser['outwardgst'] == '') { $outwardgst = $none; }
    if ($guser['damagedgst'] == '') { $damagedgst = $none; }
    if ($guser['saleamtreg'] == ''){ $saleamtreg = $none; }
    if ($guser['purchreg'] == ''){ $purchreg = $none; }
    if ($guser['salereg'] == '') { $salereg = $none; }
    if ($guser['debreg'] == ''){ $debreg = $none; }
    if ($guser['crdntreg'] == '') { $crdntreg = $none; }
    if ($guser['inwreg'] == '') { $inwreg = $none; }
    if ($guser['damreg'] == '') { $damreg = $none; }
    if ($guser['jobrecdreg'] == '') { $jobrecdreg = $none; }
    if ($guser['stock'] == '') { $stock = $none; }
    if ($guser['inwout'] == '') { $inwout = $none; }
    if ($guser['itemwise'] == '') { $itemwise = $none; }
    if ($guser['itemwisesale'] == '') { $itemwisesale = $none; }
    if ($guser['itemgrpwisesale'] == '') { $itemgrpwisesale = $none; }
    if ($guser['partygrpwisesale'] == '') { $partygrpwisesale = $none; }
    if ($guser['credreg'] == ''){ $credreg = $none; }
    if ($guser['outreg'] == '') { $outreg = $none; }
    if ($guser['partygrpwisesalepr'] == '') { $partygrpwisesalepr = $none; }

   
    if ($guser['saleamt'] == '' && $guser['purchase'] == '' && $guser['sale'] == '' && $guser['debnote'] == '' && 
    $guser['itemgrp'] == '' &&$guser['item'] == '' && $guser['chrateop'] == '' && $guser['itemgrpwisesale'] == '' && $guser['partygrpwisesale'] == '' &&
    $guser['debothgst'] == '' &&$guser['crednote'] == '' && $guser['inwardgst'] == '' && $guser['outwardgst'] == '' &&
    $guser['damagedgst'] == '' && $guser['saleamtreg'] == '' && $guser['purchreg'] == '' && $guser['salereg'] == '' && 
    $guser['debreg'] == '' && $guser['crdntreg'] == '' && $guser['inwreg'] == '' && $guser['damreg'] == '' &&
    $guser['jobrecdreg'] == '' && $guser['stock'] == '' && $guser['inwout'] == '' && $guser['itemwise'] == '' && 
    $guser['itemwisesale'] == '' && $guser['credreg'] == '' && $guser['outreg'] == '' && $guser['partygrpwisesalepr'] == '' )
  { $product = $none; }

    ############### ACCOUNT #####################
    if ($guser['bankrecp'] == '')    { $bankrecp = $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['discgvn'] == '')     { $discgvn = $none; }
    if ($guser['discrecd'] == '')    { $discrecd = $none; }
    if ($guser['bankrecon'] == '')   { $bankrecon = $none; }
    if ($guser['purchase_exp'] == '') { $purchase_exp = $none; }
    if ($guser['ledger'] == '')      { $ledger = $none; }
    if ($guser['receivable'] == '')  { $receivable = $none; }
    if ($guser['payable'] == '')     { $payable = $none; }
    if ($guser['leadparty'] == '')   { $leadparty = $none; }
    if ($guser['dailyreport'] == '') { $dailyreport = $none; }
    if ($guser['dailycashrp'] == '') { $dailycashrp = $none; }
    if ($guser['bankbook'] == '')    { $bankbook = $none; }
    if ($guser['cashbook'] == '')    { $cashbook = $none; }
    if ($guser['jvbook'] == '')      { $jvbook = $none; }
    if ($guser['bankrecorep'] == '') { $bankrecorep = $none; }
    if ($guser['dailyrawreport'] == '') { $dailyrawreport = $none; }

    if ($guser['bankrecp'] == '' && $guser['bankpay'] == '') {
        $mbank = $none;
    }
    if ($guser['cashrecp'] == '' && $guser['cashpay'] == '') {
        $mcash = $none;
    }
    if ($guser['discgvn'] == '' && $guser['discrecd'] == '') {
        $mdiscount = $none;
    }
    

    if ($guser['bankrecp'] == '' && $guser['bankpay'] == '' && $guser['cashrecp'] == '' && $guser['cashpay'] == '' && $guser['contra'] == '' &&
    $guser['journal'] == '' && $guser['discgvn'] == '' && $guser['discrecd'] == '' && $guser['bankrecon'] == '' &&
    $guser['ledger'] == '' && $guser['receivable'] == '' && $guser['payable'] == '' && $guser['leadparty'] == '' &&
    $guser['dailyreport'] == '' && $guser['dailycashrp'] == '' && $guser['bankbook'] == '' && $guser['cashbook'] == '' && $guser['jvbook'] == '' && 
    $guser['bankrecorep'] == '' && $guser['purchase_exp'] == '' && $guser['purchexprep'] == '' && $guser['dailyrawreport'] == '' ) 
    { $accounts = $none; }

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

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

    ################## TOOLS & DASHBOARD ##################
    if ($guser['trbal'] == '') {
        $fnbalance = $none;
    }
    if ($guser['profit'] == '') {
        $fnprofit = $none;
    }
    if ($guser['profshar'] == '') {
    $fnprofshar = $none;
    }
    if ($guser['balsheet'] == '') {
        $fnbalsheet = $none;
    }
    if ($guser['balsheet'] == '' && $guser['trbal'] == '' && $guser['profit'] == '' && $guser['profshar'] == '') {
    $finalization = $none;
    }

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


    ################## New Fields ##################
    if ($guser['purexp'] == '') {
        $purexp = $none;
    }
    if ($guser['salegmul'] == '') {
        $salemul = $none;
    }
    if ($guser['dailycashrep'] == '') {
        $dailycashrep = $none;
    }
    if ($guser['purexpreg'] == '') {
        $purexpreg = $none;
    }
    if ($guser['purgstreg'] == '') {
        $purgstreg = $none;
    }
    if ($guser['salegstreg'] == '') {
        $salegstreg = $none;
    }
    if ($guser['salemulreg'] == '') {
        $salemulreg = $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;
    }
}
?>