<?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['openbal'] == '') {
        $openbal = $none;
    }
    if ($guser['chcustdtl'] == '') {
        $chcustdtl = $none;
    }
    if ($guser['transport'] == '') {
        $transport = $none;
    }
    if ($guser['unit'] == '') {
        $unit = $none;
    }
    if ($guser['color'] == '') {
        $color = $none;
    }
    if ($guser['chrateop'] == '') {
        $chrateop = $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['rawmat'] == '') {
        $rawmat = $none;
    }
    if ($guser['otherac'] == '') {
        $otherac = $none;
    }
    if ($guser['saletype'] == '') {
        $saletype = $none;
    }

    if (
        $guser['customer'] == ''   && $guser['supplier'] == '' && $guser['openbal'] == ''  && $guser['chcustdtl'] == '' &&
        $guser['transport'] == ''  && $guser['unit'] == ''     && $guser['chrateop'] == '' && $guser['bank'] == '' && 
        $guser['cash'] == ''       && $guser['expense'] == ''  && $guser['color'] == ''    && $guser['itemgrp'] == '' && 
        $guser['itemsubgrp'] == '' && $guser['item'] == ''     && $guser['group'] == ''    && $guser['rawmat'] == '' &&
        $guser['otherac'] == ''    && $guser['saletype'] == ''
    ) {
        $masters = $none;
    }
    ################## TRANSACTION ##################
    if ($guser['sale'] == '') {
        $sale = $none;
    }
    if ($guser['salegstmulti'] == '') {
        $salegmul = $none;
    }
    if ($guser['creditnotegstmulti'] == '') {
        $creditnotegstmulti = $none;
    }
    if ($guser['credothgst'] == '') {
        $credothgst = $none;
    }
    if ($guser['inward'] == '') {
        $inward = $none;
    } 
    if ($guser['damaged'] == '') {
        $damaged = $none;
    }
    if ($guser['salematmulti'] == '') {
        $salematmulti = $none;
    }
    if ($guser['purchase'] == '') {
        $purchase = $none;
    }
    if ($guser['purchgstmulti'] == '') {
        $purchgstmulti = $none;
    }
    if ($guser['repgiven'] == '') {
        $repgiven = $none;
    }
    if ($guser['reptaken'] == '') {
        $reptaken = $none;
    }
    if ($guser['amtrequest'] == '') {
        $amtrequest = $none;
    }
    if ($guser['excess'] == '') {
        $excess = $none;
    }
    if ($guser['bankrecp'] == '') {
        $bankrecp = $none;
    }
    if ($guser['bankpay'] == '') {
        $bankpay = $none;
    }
    if ($guser['custtokari'] == '') {
        $custtokari = $none;
    }
    if ($guser['cashrecp'] == '') {
        $cashrecp = $none;
    }
    if ($guser['cashpay'] == '') {
        $cashpay = $none;
    }
    if ($guser['contra'] == '') {
        $contra = $none;
    }
    if ($guser['journal'] == '') {
        $journal = $none;
    }
    
    if (
         $guser['sale'] == ''      && $guser['salegstmulti'] == '' && $guser['creditnotegstmulti'] == '' && $guser['credothgst'] == '' &&
         $guser['inwardgst'] == '' && $guser['damagedgst'] == ''   && $guser['salematmulti'] == ''       && $guser['purchase'] == ''   && 
         $guser['purchgstmulti'] == '' && $guser['repgiven'] == '' && $guser['reptaken'] == '' && $guser['amtrequest'] == '' && 
         $guser['excess'] == '' && $guser['bankrecp'] == '' && $guser['bankpay'] == '' && $guser['custtokari'] == '' && $guser['cashrecp'] == '' && $guser['cashpay'] == '' &&
         $guser['contra'] == '' && $guser['journal'] == '' 
    ) {
        $transaction = $none;
    }

    ################## REPORTS ##################

    if ($guser['stock'] == '') {
        $stock = $none;
    }
    if ($guser['inwout'] == '') {
        $inwout  = $none;
    }
    if ($guser['ledger'] == '') {
        $ledger = $none;
    }
    if ($guser['ledgergst'] == '') {
        $ledgergst = $none;
    }
    if ($guser['karigrep'] == '') {
        $karigrep = $none;
    }
    if ($guser['itemwise'] == '') {
        $itemwise = $none;
    }
    if ($guser['itemgrpwisesale'] == '') {
        $itemgrpwisesale = $none;
    }
    if ($guser['partygrpwisesale'] == '') {
        $partygrpwisesale = $none;
    }
    if ($guser['leadparty'] == '') {
        $leadparty = $none;
    }
    if ($guser['dailyreport'] == '') {
        $dailyreport = $none;
    }
    if ($guser['dailycashrp'] == '') {
        $dailycashrp = $none;
    }
    if ($guser['dailysalereport'] == '') {
        $dailysalereport = $none;
    }
    if ($guser['bankbook'] == '') {
        $bankbook = $none;
    }
    if ($guser['cashbook'] == '') {
        $cashbook = $none;
    }
    if ($guser['jvbook'] == '') {
        $jvbook = $none;
    }
    if ($guser['pendrep'] == '') {
        $pendrep = $none;
    }
    if ($guser['cartreg'] == '') {
        $cartreg = $none;
    }
    if ($guser['payablerep'] == '') {
        $payablerep= $none;
    }
    if ($guser['receivable'] == '') {
        $receivable = $none;
    }
    
    if (
        $guser['stock'] == ''      && $guser['inwout'] == ''      && $guser['ledger'] == ''          && $guser['ledgergst'] == ''        &&
        $guser['karigrep'] == ''   && $guser['itemwise'] == ''    && $guser['itemgrpwisesale'] == '' && $guser['partygrpwisesale'] == '' && 
        $guser['leadparty'] == ''  && $guser['dailyreport'] == '' && $guser['dailycashrp'] == ''     && $guser['dailysalereport'] == ''  && 
        $guser['bankbook'] == ''   && $guser['cashbook'] == ''    && $guser['jvbook'] == ''          && $guser['pendrep'] == ''          && $guser['cartreg'] == ''&& 
        $guser['payablerep'] == '' && $guser['receivable'] == '' 
    ) {
        $reports = $none;
    }


    ################## REGISTERS ##################

    if ($guser['salereg'] == '') {
        $salereg= $none;
    }
    if ($guser['slmultigstreg'] == '') {
        $slmultigstreg = $none;
    }
    if ($guser['crdntreg'] == '') {
        $crdntreg = $none;
    }
    if ($guser['crdothreg'] == '') {
        $crdothreg = $none;
    }
    if ($guser['inwreg'] == '') {
        $inwreg = $none;
    }
    if ($guser['outreg'] == '') {
        $outreg = $none;
    }
    if ($guser['damreg'] == '') {
        $damreg = $none;
    }
    if ($guser['excessreg'] == '') {
        $excessreg = $none;
    }
    if ($guser['slmatreg'] == '') {
        $slmatreg = $none;
    }
    if ($guser['purchreg'] == '') {
        $purchreg = $none;
    }
    if ($guser['custokar'] == '') {
        $custokar = $none;
    }
    if ($guser['repgivreg'] == '') {
        $repgivreg= $none;
    }
    if ($guser['reprecreg'] == '') {
        $reprecreg = $none;
    }

if (
    $guser['salereg'] == ''  && $guser['slmultigstreg'] == '' && $guser['crdntreg'] == '' && $guser['crdothreg'] == '' &&
    $guser['inwreg'] == ''   && $guser['outreg'] == ''        && $guser['damreg'] == ''   && $guser['excessreg'] == '' && 
    $guser['slmatreg'] == '' && $guser['purchreg'] == ''      && $guser['custokar'] == '' && $guser['repgivreg'] == '' && 
    $guser['reprecreg'] == '' 
    ) {
        $registers = $none;
    }
    
    ################## 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;
    }

if (
         $guser['karadvbal'] == '' && $guser['karigmatgv'] == '' && $guser['kargoodrc'] == '' &&
         $guser['karigpay'] == ''  &&  $guser['custnopay'] == '' && $guser['custnosale'] == ''  
    ) {
        $mis = $none;
    }
    
    ################## TOOLS & DASHBOARD ##################

//    if ($guser['company'] == '') {
//        $company= $none;
//    }
//    if ($guser['backup'] == '') {
//        $backup = $none;
//    }
//    if ($guser['profile'] == '') {
//        $profile = $none;
//    }
//    if ($guser['balsms'] == '') {
//        $balsms = $none;
//    }
//if (
//         $guser['company'] == '' && $guser['backup'] == '' && $guser['profile'] == '' && $guser['balsms'] == '' 
//    ) {
//        $company1 = $none;
//    }
//    
    
}
?>