<?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['color'] == '')      { $color = $none; }
    if ($guser['rawmatgrp'] == '')  { $rawmatgrp = $none; }
    if ($guser['rawmat'] == '')     { $rawmat = $none; }
    if ($guser['rawchrateop'] == ''){ $rawchrateop = $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['color'] == '' && $guser['rawmatgrp'] == '' &&
        $guser['rawmat'] == '' && $guser['rawchrateop'] == '' && $guser['bank'] == '' && $guser['cash'] == '' &&
        $guser['expense'] == '' && $guser['group'] == '' && $guser['otherac'] == ''){
        $master = $none;
    }

    ################## Raw Material #################
    if ($guser['purchmatgst'] == '')       { $purchmatgst = $none; }
    if ($guser['debnoterawgst'] == '')     { $debnoterawgst = $none; }
    if ($guser['salematgstmulti'] == '')   { $salematgstmulti = $none; }
    if ($guser['crednoterawgst'] == '')    { $crednoterawgst = $none; }
    if ($guser['inwardraw'] == '')         { $inwardraw = $none; }
    if ($guser['outwardraw'] == '')        { $outwardraw = $none; }
    if ($guser['damagedraw'] == '')        { $damagedraw = $none; }
    if ($guser['jobgiven'] == '')          { $jobgiven = $none; }
    if ($guser['einvoicermgen'] == '')     { $einvoicermgen = $none; }
    if ($guser['purchrawgstreg'] == '')    { $purchrawgstreg = $none; }
    if ($guser['debnoterawgstreg'] == '')  { $debnoterawgstreg = $none; }
    if ($guser['slmatmultigstreg'] == '')  { $slmatmultigstreg = $none; }
    if ($guser['crednoterawgstreg'] == '') { $crednoterawgstreg = $none; }
    if ($guser['outregraw'] == '')         { $outregraw = $none; }
    if ($guser['inwregraw'] == '')         { $inwregraw = $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['partygrpwisesale'] == '')  { $partygrpwisesale = $none; }


    if ($guser['rawmatgrp'] == '' && $guser['rawmat'] == '' && $guser['rawchrateop'] == '' && $guser['purchmatgst'] == '' &&
    $guser['debnoterawgst'] == '' && $guser['salematgstmulti'] == '' && $guser['crednoterawgst'] == '' && $guser['inwardraw'] == '' &&
    $guser['outwardraw'] == '' && $guser['damagedraw'] == '' && $guser['jobgiven'] == '' && $guser['einvoicermgen'] == '' &&
    $guser['purchrawgstreg'] == '' && $guser['debnoterawgstreg'] == '' && $guser['slmatmultigstreg'] == '' && $guser['crednoterawgstreg'] == '' &&
    $guser['outregraw'] == '' && $guser['inwregraw'] == '' && $guser['damregraw'] == '' && $guser['jobgivenreg'] == '' &&
    $guser['rawstock'] == '' && $guser['rawinwout'] == '' && $guser['rawmatwise'] == '' &&
    $guser['rawmatwisesale'] == '' && $guser['rawgrpwisesale'] == '' && $guser['partygrpwisesale'] == '')
    { $rawmaterial = $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['dailyrawreport'] == '') { $dailyrawreport = $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'] == '' ){
        $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['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['dailyrawreport'] == '' && $guser['purchase_exp'] == '' && $guser['purchexprep'] == '' )
    { $accounts = $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'] == '')
    { $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;
    }
}
?>