<?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['maker'] == '')      { $maker = $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['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['color'] == '' && $guser['bank'] == '' &&
        $guser['cash'] == '' && $guser['expense'] == '' && $guser['group'] == '' && $guser['otherac'] == '' && $guser['agency'] == ''){
        $master = $none;
    }
    
    ################## Raw Material #################
    if ($guser['rawmatgrp'] == '')         { $rawmatgrp = $none; }
    if ($guser['rawmat'] == '')            { $rawmat = $none; }
    if ($guser['rawchrateop'] == '')       { $rawchrateop = $none; }
    if ($guser['purchmatgst'] == '')       { $purchmatgst = $none; }
    if ($guser['debnoterawgst'] == '')     { $debnoterawgst = $none; }
    if ($guser['debothgst_raw'] == '')     { $debothgst_raw = $none; }
    if ($guser['debothrawgstreg'] == '')     { $debothrawgstreg = $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['jobgivenreg'] == '')       { $jobgivenreg = $none; }
    if ($guser['rawstock'] == '')          { $rawstock = $none; }
    if ($guser['jobpend'] == '')           { $jobpend = $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['jobord'] == '')            { $jobord = $none; }
    if ($guser['jobordreg'] == '')         { $jobordreg = $none; }
    if ($guser['einvoicermcredgen'] == '') { $einvoicermcredgen = $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['jobpend'] == '' && $guser['rawinwout'] == '' && $guser['rawmatwise'] == '' &&
    $guser['rawmatwisesale'] == '' && $guser['rawgrpwisesale'] == '' && $guser['partygrpwisesale'] == '' && $guser['jobord'] == ''
     && $guser['jobordreg'] == '' && $guser['debothgst_raw'] == '' && $guser['einvoicermcredgen'] == '' && $guser['debnoterawgst'] == '' )
  { $rawmaterial = $none; }

    ################## Products ##################
    if ($guser['itemgrp'] == '')             { $itemgrp = $none; }
    if ($guser['item'] == '')                { $item = $none; }
    if ($guser['chrateop'] == '')            { $chrateop = $none; }
    if ($guser['purchase'] == '')            { $purchase = $none; }
    if ($guser['sale'] == '')                { $sale = $none; }
    if ($guser['debnote'] == '')             { $debnote = $none; }
    if ($guser['creditnotemulti'] == '')     { $creditnotemulti = $none; }
    if ($guser['inwardgst'] == '')           { $inwardgst = $none; }
    if ($guser['outwardgst'] == '')          { $outwardgst = $none; }
    if ($guser['damagedgst'] == '')          { $damagedgst = $none; }
    if ($guser['jobreceived'] == '')         { $jobreceived = $none; }
    if ($guser['einvoicepdgen'] == '')       { $einvoicepdgen = $none; }
    if ($guser['purchgstreg'] == '')         { $purchgstreg = $none; }
    if ($guser['salereg'] == '')             { $salereg = $none; }
    if ($guser['debnotereg'] == '')          { $debnotereg = $none; }
    if ($guser['crdntreg'] == '')            { $crdntreg = $none; }
    if ($guser['inwreg'] == '')              { $inwreg = $none; }
    if ($guser['outreg'] == '')              { $outreg = $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['debothgst'] == '')           { $debothgst = $none; }
    if ($guser['einvoiceslgen'] == '')       { $einvoiceslgen = $none; }
    if ($guser['einvoicecdgen'] == '')       { $einvoicecdgen = $none; }
    if ($guser['partygrpwisesalepr'] == '')  { $partygrpwisesalepr = $none; }
    if ($guser['einvoicepdcredgen'] == '')   { $einvoicepdcredgen = $none; }
    if ($guser['saleamt'] == '')             { $saleamt = $none; }
    if ($guser['crednote'] == '')            { $crednote = $none; }
    if ($guser['saleamtreg'] == '')          { $saleamtreg = $none; }
    if ($guser['purchreg'] == '')            { $purchreg = $none; }
    if ($guser['debreg'] == '')              { $debreg = $none; }
    if ($guser['credreg'] == '')             { $credreg = $none; }
    
   
    if ($guser['itemgrp'] == '' && $guser['item'] == '' && $guser['chrateop'] == '' && $guser['purchase'] == '' && $guser['sale'] == '' &&
    $guser['debnote'] == '' && $guser['creditnotemulti'] == '' && $guser['inwardgst'] == '' && $guser['outwardgst'] == '' &&
    $guser['damagedgst'] == '' && $guser['jobreceived'] == '' && $guser['einvoicepdgen'] == '' && $guser['purchgstreg'] == '' &&
    $guser['salereg'] == '' && $guser['debnotereg'] == '' && $guser['crdntreg'] == '' && $guser['inwreg'] == '' && $guser['damreg'] == '' && 
    $guser['jobrecdreg'] == '' && $guser['stock'] == '' && $guser['inwout'] == '' && $guser['itemwise'] == '' && $guser['itemwisesale'] == '' &&
    $guser['itemgrpwisesale'] == '' && $guser['debothgst'] == '' && $guser['einvoiceslgen'] == '' 
    && $guser['einvoicecdgen'] == '' && $guser['outreg'] == '' && $guser['partygrpwisesalepr'] == '' && $guser['saleamt'] == ''
    && $guser['crednote'] == '' && $guser['saleamtreg'] == '' && $guser['purchreg'] == '' && $guser['debreg'] == '' && $guser['credreg'] == '' 
    && $guser['einvoicepdcredgen'] == '' )
  { $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['dailyrawreport'] == '') { $dailyrawreport = $none; }
    if ($guser['bccrep'] == '')         { $bccrep = $none; }
    if ($guser['discbook'] == '')       { $discbook = $none; }
    if ($guser['jvsingle'] == '')       { $jvsingle = $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['purchase_exp'] == '' && $guser['purchexprep'] == '' && $guser['dailyrawreport'] == '' &&
     $guser['bccrep'] == '' && $guser['discbook'] == '' && $guser['jvsingle'] == '' ) 
    { $accounts = $none; }

    ################## GST Reports ##################
    if ($guser['gstr1_1'] == '')   { $gstr1_1 = $none; }
    if ($guser['gstr1_1_R'] == '') { $gstr1_1_R = $none; }
    if ($guser['gstr1_2'] == '')   { $gstr1_2 = $none; }
    if ($guser['gstr1_3'] == '')   { $gstr1_3 = $none; }
    if ($guser['gstr1_4'] == '')   { $gstr1_4 = $none; }
    if ($guser['gstr1_5'] == '')   { $gstr1_5 = $none; }
    if ($guser['gstr1_6'] == '')   { $gstr1_6 = $none; }
    if ($guser['gstr1_7'] == '')   { $gstr1_7 = $none; }
    if ($guser['gstr1_8'] == '')   { $gstr1_8 = $none; }
    if ($guser['gstr1_9'] == '')   { $gstr1_9 = $none; }
    if ($guser['gstr1_10'] == '')  { $gstr1_10 = $none; }
    if ($guser['gstr1_11'] == '')  { $gstr1_11 = $none; }
    if ($guser['gstr3B'] == '')    { $gstr3B = $none; }
    if ($guser['pugstrep'] == '')  { $pugstrep = $none; }
    if ($guser['slgstrep'] == '')  { $slgstrep = $none; }
    if ($guser['gstsumrep'] == '') { $gstsumrep = $none; }
    if ($guser['gstr2_b2b'] == '') { $gstr2_b2b = $none; }
    if ($guser['gstr2_4'] == '')    { $gstr2_4 = $none; }
    if ($guser['gstr1_10_R'] == '') { $gstr1_10_R = $none; }
    if ($guser['gstr2_b2br'] == '') { $gstr2_b2br = $none; }

    if ($guser['gstr1_1'] == '' && $guser['gstr1_1_R'] == '' && $guser['gstr1_2'] == '' && $guser['gstr1_3'] == '' && $guser['gstr1_4'] == '' &&
    $guser['gstr1_5'] == '' && $guser['gstr1_6'] == '' && $guser['gstr1_7'] == '' && $guser['gstr1_8'] == '' &&
    $guser['gstr1_9'] == '' && $guser['gstr1_10'] == '' && $guser['gstr1_11'] == '' && $guser['gstr3B'] == '' &&
    $guser['pugstrep'] == '' && $guser['slgstrep'] == '' && $guser['gstsumrep'] == '' && $guser['gstr2_b2b'] == ''
     && $guser['gstr2_4'] == '' && $guser['gstr1_10_R'] == '' && $guser['gstr2_b2br'] == '' )
    { $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['closestk'] == '') { $closestk = $none; }

    if ($guser['trbal'] == '' && $guser['profit'] == '' && $guser['profshar'] == '' && $guser['balsheet'] == '' && $guser['closestk'] == '') 
    { $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;
    }
}
?>