<?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));
//    print table ($getuser);
    $guser = mysqli_fetch_array($getuser);
    $line = '';

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

    ################## MASTERS ##################
    if ($guser['customer'] == '')  { $customer = $none; }
    if ($guser['supplier'] == '')  { $supplier = $none; }
    if ($guser['agency'] == '')    { $agency = $none; }
    if ($guser['openbal'] == '')   { $openbal = $none; }
    if ($guser['transport'] == '') { $transport = $none; }
    if ($guser['itemgrp'] == '')   { $itemgrp = $none; }
    if ($guser['item'] == '')      { $item = $none; }
    if ($guser['chrateop'] == '')  { $chrateop = $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['supplier'] == '' && $guser['agency'] == '' && $guser['openbal'] == '' &&
        $guser['transport'] == '' && $guser['itemgrp'] == '' && $guser['item'] == '' && $guser['chrateop'] == '' &&
        $guser['bank'] == '' && $guser['cash'] == '' && $guser['expense'] == '' && $guser['group'] == '' && $guser['otherac'] == ''){
        $master = $none;
    }

    
    ################## Product #################
    if ($guser['purchase'] == '')          { $purchase = $none; }
    if ($guser['debnote'] == '')           { $debnote = $none; }
    if ($guser['sale'] == '')              { $sale = $none; }
    if ($guser['creditnotemulti'] == '')   { $creditnotemulti = $none; }
    if ($guser['inwardgst'] == '')         { $inwardgst = $none; }
    if ($guser['outwardgst'] == '')        { $outwardgst = $none; }
    if ($guser['damagedgst'] == '')        { $damagedgst = $none; }
    if ($guser['einvoiceslgen'] == '')     { $einvoiceslgen = $none; }
    if ($guser['purchgstreg'] == '')       { $purchgstreg = $none; }
    if ($guser['debnotereg'] == '')        { $debnotereg = $none; }
    if ($guser['salereg'] == '')           { $salereg = $none; }
    if ($guser['crdntreg'] == '')          { $crdntreg = $none; }
    if ($guser['inwreg'] == '')            { $inwreg = $none; }
    if ($guser['outreg'] == '')            { $outreg = $none; }
    if ($guser['damreg'] == '')            { $damreg = $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['partygrpwisesalepr'] == '')  { $partygrpwisesalepr = $none; }


    if ($guser['purchase'] == '' && $guser['debnote'] == '' && $guser['sale'] == '' && $guser['creditnotemulti'] == '' &&
    $guser['inwardgst'] == '' && $guser['outwardgst'] == '' && $guser['damagedgst'] == '' && $guser['einvoiceslgen'] == '' &&
    $guser['purchgstreg'] == '' && $guser['debnotereg'] == '' && $guser['salereg'] == '' && $guser['crdntreg'] == '' &&
    $guser['inwreg'] == '' && $guser['outreg'] == '' && $guser['damreg'] == '' && $guser['stock'] == '' &&
    $guser['inwout'] == '' && $guser['itemwise'] == '' && $guser['itemwisesale'] == '' && $guser['itemgrpwisesale'] == '' &&
    $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['jventry'] == '')     { $jventry = $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['purchexprep'] == '') { $purchexprep = $none; }

    if ($guser['bankrecp'] == '' && $guser['bankpay'] == '' && $guser['cashrecp'] == '' && $guser['cashpay'] == '' && $guser['contra'] == '' &&
    $guser['journal'] == '' && $guser['jventry'] == '' && $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'] == '')
    { $accounts = $none; }
   
    if ($guser['bankrecp'] == '' && $guser['bankpay'] == ''){
       $mbank = $none; 
    }
    if ($guser['cashrecp'] == '' && $guser['cashpay'] == ''){
       $mcash = $none; 
    }
    if ($guser['discgvn'] == '' && $guser['discrecd'] == ''){
       $mdiscount = $none; 
    }

    ################## GST Reports ##################
    if ($guser['gstr1_1'] == '')   { $gstr1_1 = $none; }
    if ($guser['gstr1_4'] == '')   { $gstr1_4 = $none; }
    if ($guser['gstr1_5'] == '')   { $gstr1_5 = $none; }
    if ($guser['gstr1_10'] == '')  { $gstr1_10 = $none; }

    if ($guser['gstr1_1'] == '' &&  $guser['gstr1_4'] == '' && $guser['gstr1_5'] == '' && $guser['gstr1_10'] == '' && $guser['gstr1_11'] == '' && $guser['gstr3B'] == '' )
    { $gstreports = $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;
    }


    ################## 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;
    }
}
?>