<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$formname = 'User Creation';
$maindb = 'passmain';
$trandb = 'usercomp';
$printfile = "";
$file = 'user.php';
$trandbexist = 0;
$grid = '';
$keyfld = "code";

$admin = $_SESSION["admin_" . $dbname];
$username = $_SESSION["username_" . $dbname];

include("includes/vouchno_generate.php");
include("includes/prev&next.php");

if (isset($_POST["submit"])) {
    $a = 1;
    $user = $_POST["user"];
    $password = $_POST["password"];
    $usertype = $_POST["usertype"];
    $series = $_POST["series"];
    $count = $_POST["items"];
    ################## MASTERS ##################
    $customer = $_POST["customer"];
    $cacacust = $_POST["cacacust"];
    $prodgrp = $_POST["prodgrp"];
    $product = $_POST["product"];
    $changeofrates = $_POST["changeofrates"];
    $unit = $_POST["unit"];
    $pump = $_POST["pump"];
    $stockoil = $_POST["stockoil"];
    $credcard = $_POST["credcard"];
    $tank = $_POST["tank"];
    $dipconv = $_POST["dipconv"];
    $openbal = $_POST["openbal"];
    $supplier = $_POST["supplier"];
    $shift = $_POST["shift"];
    $department = $_POST["department"];
    $staff = $_POST["staff"];
    $vehiclemod = $_POST["vehiclemod"];
    $mgroup = $_POST["mgroup"];
    $bank = $_POST["bank"];
    $cash = $_POST["cash"];
    $expense = $_POST["expense"];
    $other = $_POST["other"];
    $gsttype = $_POST["gsttype"];
    $drawbank = $_POST["drawbank"];
    $narration = $_POST["narration"];

    ################## TRANSACTIONS ##################

    $sale = $_POST["sale"];
    $salecash = $_POST["salecash"];
    $cardsale = $_POST["cardsale"];
    $cashandcarry = $_POST["cashandcarry"];
    $pumpreading = $_POST["pumpreading"];
    $stockreading = $_POST["stockreading"];
    $dipread = $_POST["dipread"];
    $purfuel = $_POST["purfuel"];
    $purchoil = $_POST["purchoil"];
    $debnote = $_POST["debnote"];

    $deboth = $_POST["deboth"];
    $damage = $_POST["damage"];
    $bankrecp = $_POST["bankrecp"];
    $bankpay = $_POST["bankpay"];
    $cashrecp = $_POST["cashrecp"];
    $cashpay = $_POST["cashpay"];
    $cardrecp = $_POST["cardrecp"];
    $contra = $_POST["contra"];
    $discrecv = $_POST["discrecv"];
    $jv = $_POST["jv"];
    $bankrecon = $_POST["bankrecon"];
    $rementry = $_POST["rementry"];
    $slipent = $_POST["slipent"];

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

    $stock = $_POST["stock"];
    $inwout = $_POST["inwout"];
    $invoicefs = $_POST["invoicefs"];
    $invoicefm = $_POST["invoicefm"];
    $slipqry = $_POST["slipqry"];
    $vehqry = $_POST["vehqry"];
    $ledger = $_POST["ledger"];
    $bankbook = $_POST["bankbook"];
    $cashbook = $_POST["cashbook"];
    $payslip = $_POST["payslip"];
    $chqqryno = $_POST["chqqryno"];
    $chqqry = $_POST["chqqry"];
    $accstmt = $_POST["accstmt"];
    $expreg = $_POST["expreg"];
    $replremd = $_POST["replremd"];
    $recorep = $_POST["recorep"];
    $dayrep = $_POST["dayrep"];
    $recmulti = $_POST["recmulti"];
    $receivablerep = $_POST["receivablerep"];
    $payablerep = $_POST["payablerep"];
    $salediff = $_POST["salediff"];
    $tcsreg = $_POST["tcsreg"];
    $tdsregsl = $_POST["tdsregsl"];
    $tdsregpu = $_POST["tdsregpu"];
    $envlop = $_POST["envlop"];

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

    $slipreg = $_POST["slipreg"];
    $salereg = $_POST["salereg"];
    $invreg = $_POST["invreg"];
    $dreadreg = $_POST["dreadreg"];
    $preadreg = $_POST["preadreg"];
    $sreadreg = $_POST["sreadreg"];
    $cacareg = $_POST["cacareg"];
    $acccred = $_POST["acccred"];
    $damreg = $_POST["damreg"];
    $purreg = $_POST["purreg"];
    $prgstreg = $_POST["prgstreg"];
    $debnotereg = $_POST["debnotereg"];
    $debothreg = $_POST["debothreg"];
    $pendledr = $_POST["pendledr"];
    $stktrnrg = $_POST["stktrnrg"];
    $depinou = $_POST["depinou"];

    ################## SUMMARIES ##################

    $acmnsumm = $_POST["acmnsumm"];
    $credsumm = $_POST["credsumm"];
    $salesumm = $_POST["salesumm"];
    $invsumm = $_POST["invsumm"];
    $banksumm = $_POST["banksumm"];
    $cashsumm = $_POST["cashsumm"];
    $pursumm = $_POST["pursumm"];
    $prodsumm = $_POST["prodsumm"];
    $pgrpsumm_p = $_POST["pgrpsumm_p"];
    $pgrpsumm_s = $_POST["pgrpsumm_s"];
    $mon_prsl = $_POST["mon_prsl"];

    ################## GST ##################

    $gstr1_b2b = $_POST["gstr1_b2b"];
    $gstr1_b2bl = $_POST["gstr1_b2bl"];
    $gstr1_b2cs = $_POST["gstr1_b2cs"];

    ################## MIS ##################

    $shiftrep = $_POST["shiftrep"];
    $daychart = $_POST["daychart"];
    $rmrep = $_POST["rmrep"];
    $rmrep_d = $_POST["rmrep_d"];
    $prodsale = $_POST["prodsale"];
    $grpsale = $_POST["grpsale"];
    $creditac = $_POST["creditac"];
    $ministk = $_POST["ministk"];
    $vatmon = $_POST["vatmon"];
    $vatmon_s = $_POST["vatmon_s"];
    $gstr1_2 = $_POST["gstr1_2"];

    ################## FINALISATION ##################

    $closstk = $_POST["closstk"];
    $trbal = $_POST["trbal"];
    $profit = $_POST["profit"];
    $profshar = $_POST["profshar"];
    $balsheet = $_POST["balsheet"];

//    ################## TOOLS ##################
//    $tlcompany = $_POST["tlcompany"];
//    $tlbackup = $_POST["tlbackup"];
//    $tlprofile = $_POST["tlprofile"];
//    //    $dstock = $_POST["dstock"];


    if (isset($_POST["user"])) {
        $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE `user`= '$user' AND code != '$qvouch'") or die(mysqli_error($conn));
        if (mysqli_num_rows($result) > 0) {
            $a = 0;
            browse("Name Already Exist");
            header("refresh: 1; $file?code=$qvouch&mode=last");
        }
    }

    if ($a == 1) {
        if ($addflag == 1) {
            $gen1 = mysqli_query($conn, "SELECT MAX($keyfld) AS maxcode FROM `$maindb` LIMIT 0,1 ") or die(mysqli_error($conn));

            if (mysqli_num_rows($gen1) > 0) {
                $vvouch = mysqli_fetch_assoc($gen1);
                $qvouch = $vvouch["maxcode"] + 1;
            } else {
                $qvouch = '1';
            }
            $mvouch = $qvouch;
        }

        #################################TRAN PART #################################

        mysqli_query($conn, "DELETE FROM `$trandb` WHERE `username`='$qvouch'") or die(mysqli_error($conn));

        for ($i = 0; $i < $count; $i++) {
            //            $cono = $_POST["cono_$i"];
            $finyear = $_POST["finyear_$i"];
            $yearname = $_POST["yearname_$i"];
            $startdate = $_POST["startdate_$i"];
            $lastdate = $_POST["lastdate_$i"];

            if (!empty($finyear)) {
                mysqli_query($conn, "INSERT INTO `$trandb`(`username`,`cono`, `finyear`, `yearname`, `startdate`, `lastdate`) 
                    VALUES ('$qvouch', '1', '$finyear', '$yearname', '$startdate', '$lastdate')") or die(mysqli_error($conn));
            }
        }
        ############################## MAIN  ######################################################

        if ($addflag == 1) {

            $usecode = mysqli_query($conn, "SELECT code FROM `passmain` WHERE user='$username'") or die(mysqli_error($conn));
            $getuser = mysqli_fetch_object($usecode);
            $code = $getuser->code;

            mysqli_query($conn, "INSERT INTO `$maindb`(code, `user`, `password`, `usertype`, `customer`, `cacacust`, `prodgrp`, `product`, `changeofrates`, `unit`, `pump`, `stockoil`, `credcard`, `tank`, 
                                                      `dipconv`, `openbal`, `supplier`, `shift`, `department`, `staff`, `vehiclemod`, `mgroup`, `bank`, `cash`, `expense`, `other`, `gsttype`, `drawbank`, `narration`, 
                                                      `sale`, `salecash`, `cardsale`, `cashandcarry`, `pumpreading`, `stockreading`, `dipread`, `purfuel`, `purchoil`, `debnote`, `deboth`, `damage`, `bankrecp`, `bankpay`, 
                                                      `cashrecp`, `cashpay`, `cardrecp`, `contra`, `discrecv`, `jv`, `bankrecon`, `rementry`, `slipent`, `stock`, `inwout`, `invoicefs`, `invoicefm`, `slipqry` `vehqry`,
                                                      `ledger`, `bankbook`, `cashbook`, `payslip`, `chqqryno`, `chqqry`, `accstmt`, `expreg`, `replremd`, `recorep`, `dayrep`, `recmulti`, `receivablerep`, `payablerep`,
                                                      `salediff`, `tcsreg`, `tdsregsl`, `tdsregpu`, `envlop`, `slipreg`, `salereg`, `invreg`, `dreadreg`, `preadreg`, `sreadreg`, `cacareg`, `acccred`, `damreg`, `purreg`,
                                                      `prgstreg`, `debnotereg`, `debothreg`, `pendledr`, `stktrnrg`, `depinou`, `acmnsumm`, `credsumm`, `salesumm`, `invsumm`, `banksumm`, `cashsumm`, `pursumm`, `pgrpsumm_p`,
                                                      `prodsumm`, `pgrpsumm_s`, `mon_prsl`, `gstr1_b2b`, `gstr1_b2bl`, `gstr1_b2cs`, `shiftrep`, `daychart`, `rmrep`, `rmrep_d`, `prodsale`, `grpsale`, `creditac`, `ministk`, `vatmon`, 
                                                      `vatmon_s`, `gstr1_2`, `closstk`, `trbal`, `profit`, `profshar`, `balsheet` )                                      
                                              VALUES($qvouch, '$user', '$password', '$usertype', '$customer', '$cacacust', '$prodgrp', '$product', '$changeofrates', '$unit', '$pump', '$stockoil', '$credcard', '$tank',
                                                      '$dipconv', '$openbal', '$supplier', '$shift', '$department', '$staff', '$vehiclemod', '$mgroup', '$bank', '$cash', '$expense', '$other', '$gsttype', '$drawbank', '$narration',
                                                      '$sale', '$salecash', '$cardsale', '$cashandcarry', '$pumpreading', '$stockreading', '$dipread', '$purfuel', '$purchoil', '$debnote', '$deboth', '$damage', '$bankrecp', '$bankpay',
                                                      '$cashrecp', '$cashpay', '$cardrecp', '$contra', '$discrecv', '$jv', '$bankrecon', '$rementry', '$slipent', '$stock', '$inwout', '$invoicefs', '$invoicefm', '$slipqry',
                                                      '$vehqry','$ledger', '$bankbook', '$cashbook', '$payslip', '$chqqryno', '$chqqry', '$accstmt', '$expreg', '$replremd', '$recorep', '$dayrep', '$recmulti', '$receivablerep', '$payablerep',
                                                      '$salediff', '$tcsreg', '$tdsregsl', '$tdsregpu', '$envlop', '$slipreg', '$salereg', '$invreg', '$dreadreg', '$preadreg', '$sreadreg', '$cacareg', '$acccred', '$damreg', '$purreg', 
                                                      '$prgstreg', '$debnotereg', '$debothreg', '$pendledr', '$stktrnrg', '$depinou', '$acmnsumm', '$credsumm', '$salesumm', '$invsumm', '$banksumm', '$cashsumm', '$pursumm', '$pgrpsumm_p',
                                                      '$prodsumm', '$pgrpsumm_s', '$mon_prsl', '$gstr1_b2b', '$gstr1_b2bl', '$gstr1_b2cs', '$shiftrep', '$daychart', '$rmrep', '$rmrep_d', '$prodsale', '$grpsale', '$creditac', '$ministk', '$vatmon',
                                                      '$vatmon_s', '$gstr1_2' , '$closstk', '$trbal', '$profit', '$profshar', '$balsheet')") or die(mysqli_error($conn));
            insmess();
            $mvouch = $qvouch;
            header("refresh: 1;
            $file?$keyfld = $mvouch&mode = edit");
        } else {
            $mvouch = $qvouch;

            $usecode = mysqli_query($conn, "SELECT code FROM `passmain` WHERE user = '$username'") or die(mysqli_error($conn));
            $getuser = mysqli_fetch_object($usecode);
            $code = $getuser->code;

            mysqli_query($conn, "UPDATE `$maindb` SET `user` = '$user', `password` = '$password', `usertype` = '$usertype', `customer` = '$customer', `cacacust`='$cacacust', `prodgrp`='$prodgrp', `product`='$product',
                                                      `changeofrates`='$changeofrates', `unit`='$unit', `pump`='$pump', `stockoil`='$stockoil', `credcard`='$credcard', `tank`='$tank', `dipconv`='$dipconv', `openbal`='$openbal',
                                                      `supplier`='$supplier', `shift`='$shift', `department`='$department', `staff`='$staff', `vehiclemod`='$vehiclemod', `mgroup`='$mgroup', `bank`='$bank', `cash`='$cash',
                                                      `expense`='$expense', `other`='$other', `gsttype`='$gsttype', `drawbank`='$drawbank', `narration`='$narration', `sale`='$sale', `salecash`='$salecash', `cardsale`='$cardsale',  
                                                      `cashandcarry`='$cashandcarry', `pumpreading`='$pumpreading', `stockreading`='$stockreading', `dipread`='$dipread', `purfuel`='$purfuel', `purchoil`='$purchoil', `debnote`='$debnote',
                                                      `deboth`='$deboth', `damage`='$damage', `bankrecp`='$bankrecp', `bankpay`='$bankpay', `cashrecp`='$cashrecp', `cashpay`='$cashpay', `cardrecp`='$cardrecp', `contra`='$contra', `discrecv`='$discrecv',
                                                      `jv`='$jv', `bankrecon`='$bankrecon', `rementry`='$rementry', `slipent`='$slipent', `stock`='$stock', `inwout`='$inwout', `invoicefs`='$invoicefs', `invoicefm`='$invoicefm', `slipqry`='$slipqry',
                                                      `vehqry`='$vehqry', `ledger`='$ledger', `bankbook`='$bankbook', `cashbook`='$cashbook', `payslip`='$payslip', `chqqryno`='$chqqryno', `chqqry`='$chqqry', `accstmt`='$accstmt', `expreg`='$expreg', `replremd`='$replremd', 
                                                      `recorep`='$recorep', `dayrep`='$dayrep', `recmulti`='$recmulti', `receivablerep`='$receivablerep', `payablerep`='$payablerep', `salediff`='$salediff', `tcsreg`='$tcsreg', `tdsregsl`='$tdsregsl',
                                                      `tdsregpu`='$tdsregpu', `envlop`='$envlop', `slipreg`='$slipreg', `salereg`='$salereg', `invreg`='$invreg', `dreadreg`='$dreadreg', `preadreg`='$preadreg', `sreadreg`='$sreadreg', `cacareg`='$cacareg',
                                                      `acccred`='$acccred', `damreg`='$damreg', `purreg`='$purreg', `prgstreg`='$prgstreg', `debnotereg`='$debnotereg', `debothreg`='$debothreg', `pendledr`='$pendledr', `stktrnrg`='$stktrnrg', `depinou`='$depinou',
                                                      `acmnsumm`='$acmnsumm', `credsumm`='$credsumm', `salesumm`='$salesumm', `invsumm`='$invsumm', `banksumm`='$banksumm', `cashsumm`='$cashsumm', `pursumm`='$pursumm', `pgrpsumm_p`='$pgrpsumm_p', `prodsumm`='$prodsumm',
                                                      `pgrpsumm_s`='$pgrpsumm_s', `mon_prsl`='$mon_prsl', `gstr1_b2b`='$gstr1_b2b', `gstr1_b2bl`='$gstr1_b2bl', `gstr1_b2cs`='$gstr1_b2cs', `shiftrep`='$shiftrep', `daychart`='$daychart', `rmrep`='$rmrep',
                                                      `rmrep_d`='$rmrep_d', `prodsale`='$prodsale', `grpsale`='$grpsale', `creditac`='$creditac', `ministk`='$ministk', `vatmon`='$vatmon', `vatmon_s`='$vatmon_s', `gstr1_2`='$gstr1_2', `closstk`='$closstk',
                                                      `trbal`='$trbal', `profit`='$profit', `profshar`='$profshar', `balsheet`='$balsheet'  WHERE code = '$mvouch'") or die(mysqli_error($conn));
            updmess();
            header("refresh: 1;
            $file?$keyfld = $mvouch&mode = edit");
        }
    }
}

if ($addflag != 1) {

    $getvouch = '';
    if ($addflag == 0) {
        $getvouch = $_GET[$keyfld];
    } else {
        $getvouch = $qvouch;
    }

    $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld = '$getvouch'") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);
}

$senable = "";
$cenable = "";

/* DELETE */
if (isset($_GET["delete"])) {
    delete($zdb, "$maindb", "$keyfld", $_GET[$keyfld], "$file?mode = last");
}
?>
<?php include("includes/linkshead.php"); ?>
<style>
    input[type=checkbox] {
        width: 20px;
        height: 20px;
    }
</style>
<script src="MyScript/user.js" type="text/javascript"></script>

<body>
    <!-- Default box -->
    <form action='' method='POST'>
        <!-- Default box -->
        <div class="">
            <div class="col-lg-6">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><?php echo $formname; ?></h3>
                        <div class="actions pull-right">
                            <i class="fa fa-chevron-down"></i>
                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <label class="col-sm-3 control-label marg">User Name</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control form user" name="user" placeholder="User Name" autocomplete="off" value='<? echo ($addflag != 1) ? $get['user'] : ''; ?>' required="" autofocus>
                            </div>
                        </div>
                        <div class="row">
                            <label class="col-sm-3 control-label marg">Password</label>
                            <div class="col-sm-6">
                                <input type="password" class="form-control form password" name="password" id="password" autocomplete="off" placeholder="Password" value='<? echo ($addflag != 1) ? $get['password'] : ''; ?>' required="">
                            </div>
                        </div>
                        <div class="row">
                            <label class="col-sm-3 control-label marg">Confirm Pass</label>
                            <div class="col-sm-6">
                                <input type="password" name="confpass" id="confpass" class="form-control form confpass" placeholder="Confirm Password" required="" value='<? echo ($addflag != 1) ? $get['password'] : ''; ?>'>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6">
                                <p id="alert"></p>
                            </div>
                        </div>
                        <div class="row">
                            <label class="col-sm-3 control-label marg">User Type</label>
                            <div class="col-sm-6">

                                <select class='form-control select2 form' name="usertype" id="usertype" required>
<?php
if ($addflag != 1) {
    $usertype = "";
    if ($get['usertype'] == 1) {
        $ucode = "1";
        $usertype = "Supervisor";
    }
    if ($get['usertype'] == 2) {
        $ucode = "2";
        $usertype = "Admin";
    }
    if ($get['usertype'] == 3) {
        $ucode = "3";
        $usertype = "Staff";
    }
    echo "<option value='$ucode'>$usertype</option>";
}
?>
                                    <option value="1">Supervisor</option>
                                    <option value="2">Admin</option>
                                    <option value="3">Staff</option>
                                </select>
                            </div>
                        </div>
                        <div class="nav-tabs-custom">
                            <ul class="nav nav-tabs">
                                <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">Master</a></li>
                                <li class=""><a href="#tab_2" data-toggle="tab" aria-expanded="false">Transactions</a></li>
                                <li class=""><a href="#tab_3" data-toggle="tab" aria-expanded="false">Reports</a></li>
                                <li class=""><a href="#tab_4" data-toggle="tab" aria-expanded="false">Registers</a></li>
                                <li class=""><a href="#tab_5" data-toggle="tab" aria-expanded="false">Summaries</a></li>
                                <li class=""><a href="#tab_6" data-toggle="tab" aria-expanded="false">GST</a></li>
                                <li class=""><a href="#tab_7" data-toggle="tab" aria-expanded="false">MIS</a></li>
                                <li class=""><a href="#tab_8" data-toggle="tab" aria-expanded="false">Finalization</a></li>
                            </ul>
                            <div class="tab-content">
                                <div class="tab-pane active" id="tab_1">
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Smasters" value="1">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Customer - Normal</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="customer" name="customer" value="1" <?
                                                   if ($get['customer'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Customer - Cash & Carry</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="cacacust" name="cacacust" value="1" <?
                                                   if ($get['cacacust'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Product Group</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="prodgrp" name="prodgrp" value="1" <?
                                                   if ($get['prodgrp'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Product</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="product" name="product" value="1" <?
                                                   if ($get["product"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Change of Rates</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="changeofrates" name="changeofrates" value="1" <?
                                                   if ($get['changeofrates'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Unit</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="unit" name="unit" value="1" <?
                                                   if ($get['unit'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Pump</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="pump" name="pump" value="1" <?
                                                   if ($get['pump'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Stock Oil</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="stockoil" name="stockoil" value="1" <?
                                                   if ($get['stockoil'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>

                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Credit Card</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="credcard" name="credcard" value="1" <?
                                                   if ($get['credcard'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Tank</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="tank" name="tank" value="1" <?
                                                   if ($get['tank'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Dip Conversion</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="dipconv" name="dipconv" value="1" <?
                                                   if ($get["dipconv"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Opening Balance</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="openbal" name="openbal" value="1" <?
                                                   if ($get["openbal"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Supplier</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="supplier" name="supplier" value="1" <?
                                                   if ($get["supplier"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                           
                                 
                                        <label class="col-sm-4 control-label marg">Shift</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="shift" name="shift" value="1" <?
                                                   if ($get["shift"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Department</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="department" name="department" value="1" <?
                                                   if ($get["department"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Staff</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="staff" name="staff" value="1" <?
                                                   if ($get["staff"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Vehicle Model</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="vehiclemod" name="vehiclemod" value="1" <?
                                                   if ($get["vehiclemod"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Group</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="mgroup" name="mgroup" value="1" <?
                                                   if ($get["mgroup"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Bank</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="bank" name="bank" value="1" <?
                                                   if ($get["bank"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Cash</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="cash" name="cash" value="1" <?
                                                   if ($get["cash"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">    
                                        <label class="col-sm-4 control-label marg">Expense</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="expense" name="expense" value="1" <?
                                                   if ($get["expense"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Other A/c</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="other" name="other" value="1" <?
                                                   if ($get["other"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">    
                                        <label class="col-sm-4 control-label marg">GST Type</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="gsttype" name="gsttype" value="1" <?
                                                   if ($get["gsttype"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Drawee Bank</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="drawbank" name="drawbank" value="1" <?
                                                   if ($get["drawbank"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Narration</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="narration" name="narration" value="1" <?
                                                   if ($get["narration"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                </div><!-- /.tab-pane -->
                                <div class="tab-pane" id="tab_2">
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Stransactions" value="1">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Sale - Credit Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="sale" name="sale" value="1" <?
                                                   if ($get['sale'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Sale - Cash Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="salecash" name="salecash" value="1" <?
                                                   if ($get['salecash'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Card Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="cardsale" name="cardsale" value="1" <?
                                                   if ($get["cardsale"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Cash and Carry</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="cashandcarry" name="cashandcarry" value="1" <?
                                                   if ($get["cashandcarry"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Pump Reading</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="pumpreading" name="pumpreading" value="1" <?
                                                   if ($get["pumpreading"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Stock Reading</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="stockreading" name="stockreading" value="1" <?
                                                   if ($get['stockreading'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>  
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Dip Reading</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="dipread" name="dipread" value="1" <?
                                                   if ($get['dipread'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Purchase - Fuel</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="purfuel" name="purfuel" value="1" <?
                                                   if ($get['purfuel'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>                                                                      
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Purchase - Oil</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="purchoil" name="purchoil" value="1" <?
                                                   if ($get['purchoil'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Debit Note - Goods Return</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="debnote" name="debnote" value="1" <?
                                                   if ($get['debnote'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>                                                                      
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Debit Note - Others</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="deboth" name="deboth" value="1" <?
                                                   if ($get['deboth'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Damaged</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="damage" name="damage" value="1" <?
                                                   if ($get['damage'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>                                                                      
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Bank - Receipt</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="bankrecp" name="bankrecp" value="1" <?
                                                   if ($get["bankrecp"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Bank - Payment</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="bankpay" name="bankpay" value="1" <?
                                                   if ($get["bankpay"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">   
                                        <label class="col-sm-4 control-label marg">Cash - Receipt</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="cashrecp" name="cashrecp" value="1" <?
                                                   if ($get['cashrecp'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Cash - Payment</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="cashpay" name="cashpay" value="1" <?
                                                   if ($get["cashpay"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Fleet Card Receipt</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="cardrecp" name="cardrecp" value="1" <?
                                                   if ($get["cardrecp"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Contra / Transfer</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="contra" name="contra" value="1" <?
                                                   if ($get['contra'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Discount - Received</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="discrecv" name="discrecv" value="1" <?
                                                   if ($get["discrecv"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">JV</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="jv" name="jv" value="1" <?
                                                   if ($get["jv"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Bank Reconciliation</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="bankrecon" name="bankrecon" value="1" <?
                                                   if ($get["bankrecon"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Reminder Entry</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="rementry" name="rementry" value="1" <?
                                                   if ($get["rementry"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Slip Entry</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="slipent" name="slipent" value="1" <?
                                                   if ($get["slipent"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                </div><!-- /.tab-pane -->
                                <div class="tab-pane" id="tab_3">
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Sreports" value="1">
                                        </div>
                                    </div>

                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Current Stock</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="stock" name="stock" value="1" <?
                                                   if ($get["stock"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Inward / Outward</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="inwout" name="inwout" value="1" <?
                                                   if ($get['inwout'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>

                                    <div class="row">                                        
                                        <label class="col-sm-4 control-label marg">Invoice - Single</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="invoicefs" name="invoicefs" value="1" <?
                                                   if ($get["invoicefs"] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Invoice - Multiple</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="invoicefm" name="invoicefm" value="1" <?
                                                   if ($get['invoicefm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Slip no. Query</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="slipqry" name="slipqry" value="1" <?
                                                   if ($get['slipqry'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Vehicle Query</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="vehqry" name="vehqry" value="1" <?
                                                   if ($get['vehqry'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Ledger</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="ledger" name="ledger" value="1" <?
                                                   if ($get['ledger'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Bank Book</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="bankbook" name="bankbook" value="1" <?
                                                   if ($get['bankbook'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Cash Book</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="cashbook" name="cashbook" value="1" <?
                                                   if ($get['cashbook'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Pay Slip</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="payslip" name="payslip" value="1" <?
                                                   if ($get['payslip'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Cheque Query - No</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="chqqryno" name="chqqryno" value="1" <?
                                                   if ($get['chqqryno'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Cheque Query - Amount</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="chqqry" name="chqqry" value="1" <?
                                                   if ($get['chqqry'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">    
                                        <label class="col-sm-4 control-label marg">Invoicewise Ledger</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="accstmt" name="accstmt" value="1" <?
                                                   if ($get['accstmt'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Expense</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="expreg" name="expreg" value="1" <?
                                                   if ($get['expreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Reminder</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="replremd" name="replremd" value="1" <?
                                                   if ($get['replremd'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    
                                        <label class="col-sm-4 control-label marg">Bank Reconciliation</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="recorep" name="recorep" value="1" <?
                                                   if ($get['recorep'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Daily Report</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="dayrep" name="dayrep" value="1" <?
                                                   if ($get['dayrep'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Receipt Print</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="recmulti" name="recmulti" value="1" <?
                                                   if ($get['recmulti'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Outstanding - Receivable</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="receivablerep" name="receivablerep" value="1" <?
                                                   if ($get['receivablerep'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Outstanding - Payable</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="payablerep" name="payablerep" value="1" <?
                                                   if ($get['payablerep'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Sale Difference</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="salediff" name="salediff" value="1" <?
                                                   if ($get['salediff'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">TCS Report</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="tcsreg" name="tcsreg" value="1" <?
                                                   if ($get['tcsreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">TDS - Receivable</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="tdsregsl" name="tdsregsl" value="1" <?
                                                   if ($get['tdsregsl'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">TDS - Payable</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="tdsregpu" name="tdsregpu" value="1" <?
                                                   if ($get['tdsregpu'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Envelope Print</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="envlop" name="envlop" value="1" <?
                                                   if ($get['envlop'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>

                                </div><!-- /.tab-pane-->
                                <div class="tab-pane" id="tab_4">
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Sregisters" value="1">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Slip</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="slipreg" name="slipreg" value="1" <?
                                                   if ($get['slipreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="salereg" name="salereg" value="1" <?
                                                   if ($get['salereg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Invoice</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="invreg" name="invreg" value="1" <?
                                                   if ($get['invreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Dip Reading</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="dreadreg" name="dreadreg" value="1" <?
                                                   if ($get['dreadreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Pump Reading</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="preadreg" name="preadreg" value="1" <?
                                                   if ($get['preadreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Stock Reading</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="sreadreg" name="sreadreg" value="1" <?
                                                   if ($get['sreadreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Cash & Carry</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="cacareg" name="cacareg" value="1" <?
                                                   if ($get['cacareg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Accountwise Credit</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="acccred" name="acccred" value="1" <?
                                                   if ($get['acccred'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Damaged</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="damreg" name="damreg" value="1" <?
                                                   if ($get['damreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>

                                        <label class="col-sm-4 control-label marg">Purchase - Fuel</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="purreg" name="purreg" value="1" <?
                                                   if ($get['purreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Purchase - Oil</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="prgstreg" name="prgstreg" value="1" <?
                                                   if ($get['prgstreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Debit Note - Goods Return</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="debnotereg" name="debnotereg" value="1" <?
                                                   if ($get['debnotereg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Debit Note - Other</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="debothreg" name="debothreg" value="1" <?
                                                   if ($get['debothreg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Pending Invoice Amount</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="pendledr" name="pendledr" value="1" <?
                                                   if ($get['pendledr'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Stock Transfer</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="stktrnrg" name="stktrnrg" value="1" <?
                                                   if ($get['stktrnrg'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Dept.Inward Outward</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="depinou" name="depinou" value="1" <?
                                                   if ($get['depinou'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>

                                </div><!-- /.tab-pane-->
                                <div class="tab-pane" id="tab_5">
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Ssummaries" value="1">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Account Monthly</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="acmnsumm" name="acmnsumm" value="1" <?
                                                   if ($get['acmnsumm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Credit Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="credsumm" name="credsumm" value="1" <?
                                                   if ($get['credsumm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="salesumm" name="salesumm" value="1" <?
                                                   if ($get['salesumm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Invoice</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="invsumm" name="invsumm" value="1" <?
                                                   if ($get['invsumm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Bank</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="banksumm" name="banksumm" value="1" <?
                                                   if ($get['banksumm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Cash</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="cashsumm" name="cashsumm" value="1" <?
                                                   if ($get['cashsumm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Purchase</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="pursumm" name="pursumm" value="1" <?
                                                   if ($get['pursumm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Product</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="prodsumm" name="prodsumm" value="1" <?
                                                   if ($get['prodsumm'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>

                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Product Group - Purchase</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="pgrpsumm_p" name="pgrpsumm_p" value="1" <?
                                                   if ($get['pgrpsumm_p'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Product Group - Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="pgrpsumm_s" name="pgrpsumm_s" value="1" <?
                                                   if ($get['pgrpsumm_s'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>

                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Monthwise Purhcase & Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  summaries" id="mon_prsl" name="mon_prsl" value="1" <?
                                                   if ($get['mon_prsl'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                </div>
                                <div class="tab-pane" id="tab_6">
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Sgst" value="1">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall"><mark style="background-color:black;color:white">Sales</mark></label>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">B2B</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  gst" id="gstr1_b2b" name="gstr1_b2b" value="1" <?
                                                   if ($get['gstr1_b2b'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">B2C Large (Unregistered)</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  gst" id="gstr1_b2bl" name="gstr1_b2bl" value="1" <?
                                                   if ($get['gstr1_b2bl'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">B2C Small (Unregistered)</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  gst" id="gstr1_b2cs" name="gstr1_b2cs" value="1" <?
                                                   if ($get['gstr1_b2cs'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    
                                </div>
                                <!-- /.tab-pane -->
                                <div class="tab-pane" id="tab_7">
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Smis" value="1">
                                        </div>
                                    </div>
                                    <div class="row">                                        
                                        <label class="col-sm-4 control-label marg">Shift Chart</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="shiftrep" name="shiftrep" value="1" <?
                                                   if ($get['shiftrep'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Daily Chart</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="daychart" name="daychart" value="1" <?
                                                   if ($get['daychart'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">RM / Daily Cash - Summary</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="rmrep" name="rmrep" value="1" <?
                                                   if ($get['rmrep'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">RM / Daily Cash - Detail</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="rmrep_d" name="rmrep_d" value="1" <?
                                                   if ($get['rmrep_d'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Productwise Sale </label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="prodsale" name="prodsale" value="1" <?
                                                   if ($get['prodsale'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Product Groupwise Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="grpsale" name="grpsale" value="1" <?
                                                   if ($get['grpsale'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">

                                        <label class="col-sm-4 control-label marg">Over Credit A/c.</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="creditac" name="creditac" value="1" <?
                                                   if ($get['creditac'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Minimum Stock</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="ministk" name="ministk" value="1" <?
                                                   if ($get['ministk'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Monthwise Vat Report - Purchase</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="vatmon" name="vatmon" value="1" <?
                                                   if ($get['vatmon'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Monthwise Vat Report - Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="vatmon_s" name="vatmon_s" value="1" <?
                                                   if ($get['vatmon_s'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>                                        
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Purchase GST - Excel</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  mis" id="gstr1_2" name="gstr1_2" value="1" <?
                                                   if ($get['gstr1_2'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                  
                                </div> <!-- /.tab-pane-->
                                
                                <div class="tab-pane" id="tab_8">
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Sfinalization" value="1">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Closing Stock</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="closstk" name="closstk" value="1" <?
                                                   if ($get['closstk'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Trial Balance</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="trbal" name="trbal" value="1" <?
                                                   if ($get['trbal'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Profit & Loss</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="profit" name="profit" value="1" <?
                                                   if ($get['profit'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Profit Sharing</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="profshar" name="profshar" value="1" <?
                                                   if ($get['profshar'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Balance Sheet</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="balsheet" name="balsheet" value="1" <?
                                                   if ($get['balsheet'] == 1) {
                                                       echo "checked";
                                                   }
                                                   ?>>
                                        </div>
                                    </div>
                                </div>
                            </div><!-- /.tab-content -->
                        </div>
                    </div>
                    <div class="panel-footer">
<?php include("includes/buttons.php"); ?>
                    </div>
                </div>
            </div>
            <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12 pad">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">Year Details</h3>
                        <div class="actions pull-right">
                            <i class="fa fa-chevron-down"></i>
                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="table-responsive">
                            <table class="table table-striped table-condensed table-bordered" width="100%">
                                <thead class="mySearchTr">
                                    <tr>
                                        <th width="3%"></th>
                                        <th width="10%">Year</th>
                                        <th width="10%">Name</th>
                                        <th width="10%">From</th>
                                        <th width="10%">To</th>
                                    </tr>
                                </thead>
                                <tbody class="tbody">
<?php
if ($addflag != 1) {
    $ctr = 0;
    $gettran = mysqli_query($conn, "SELECT `cono`,`finyear`,`startdate`,`lastdate`,`yearname` FROM `usercomp` WHERE `username`='$get[code]' ORDER BY `cono`") or die(mysqli_error($conn));
    while ($tran = mysqli_fetch_array($gettran)) {

        $fetyear = mysqli_query($conn, "SELECT `finyear` FROM `compyear` WHERE `finyear`='$tran[finyear]'") or die(mysqli_error($conn));
        $fyear = mysqli_fetch_array($fetyear);

        echo "<tr>";
        echo "<td><i class='fa fa-close remove' style='display:none;'></i></td>";
        echo "<td>";
        echo "<select class='form-control form finyear select2' name='finyear_$ctr' style='width:100%'>";
        echo "<option value='$fyear[finyear]'>$fyear[finyear]</option>";
        $gyear = mysqli_query($conn, "SELECT `finyear` FROM `compyear`") or die(mysqli_error($conn));
        while ($year = mysqli_fetch_array($gyear)) {
            echo "<option value='$year[finyear]'>$year[finyear]</option>";
        }
        echo "</select>";
        echo "</td>";
        echo "<td><input type='text' class='form-control form yearname' name='yearname_$ctr' value='$tran[yearname]' readonly></td>";
        echo "<td><input type='text' class='form-control form startdate' name='startdate_$ctr' value='$tran[startdate]' readonly></td>";
        echo "<td><input type='text' class='form-control form lastdate' name='lastdate_$ctr' value='$tran[lastdate]' readonly></td>";
        echo "</tr >";
        $ctr++;
    }
} else {
    ?>
                                        <tr>
                                            <td><i class='fa fa-close remove'></i></td>
                                            <td>
                                                <select class="form-control form finyear select2" name="finyear_0" style='width:100%' required>
                                                    <option value=""></option>
    <?php
    $gyear = mysqli_query($conn, "SELECT `finyear` FROM `compyear`") or die(mysqli_error($conn));
    while ($year = mysqli_fetch_array($gyear)) {
        echo "<option value='$year[finyear]'>$year[finyear]</option>";
    }
    ?>
                                                </select>
                                            </td>
                                            <td><input type="text" class="form-control form yearname" name="yearname_0" value="" readonly></td>
                                            <td><input type="text" class="form-control form startdate" name="startdate_0" value="" readonly></td>
                                            <td><input type="text" class="form-control form lastdate" name="lastdate_0" value="" readonly></td>
                                        </tr>
    <?
}
?>
                                </tbody>
                            </table>
                        </div>
                        <div class="col-lg-12 pad">
                            <button type="button" class="btn btn-primary btn-square form" id="addnew">
                                <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                            </button>
                            <input type="hidden" id="items" name="items" value="<?php echo ($addflag != 1) ? $ctr : 1; ?>" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Search
<? echo $formname; ?>
                    </h4>
                </div>
                <div class="modal-body">
                    <div class=" table-responsive">
                        <table id="example1" class="table table-striped">
                            <thead>
                                <tr class="mySearchTr">
                                    <th>code</th>
                                    <th>Name</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
<?php
if ($addflag != 1) {
    $srchresult = mysqli_query($conn, "SELECT * FROM `$maindb`") or die(mysqli_error($conn));
    while ($row = mysqli_fetch_array($srchresult)) {
        echo "<tr>";
        echo "<td align='left'>$row[code]</td>";
        echo "<td align='left'>$row[user]</td>";
        echo "<td align='left'><a href=\"$file?mode=edit&$keyfld=$row[$keyfld]\"><i class='fa fa-pencil' style='font-size:1.3em;color:#00C0EF;cursor:pointer;'></i></a></td>";
        echo "</tr>";
    }
}
?>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>
</body>

</html>
<?php include("includes/linksfoot.php"); ?>