<?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];
$password = $_SESSION["password_" . $dbname];
$spectype = $_SESSION["spltype_" . $dbname];

//browse($spectype);
if ($spectype == "1") {
    $speccond = "and `compchng`='1'";
} else {
    $speccond = "and `compchng`=''";
}

$keycond = "and `spltype`='$spectype'";
//browse($spectype);

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"];
    $spltype = $_POST["spltype"];
    ################## MASTERS ##################
    $customer = $_POST["customer"];
    $supplier = $_POST["supplier"];
    $openbal = $_POST["openbal"];
    $chcustdtl = $_POST["chcustdtl"];
    $driver = $_POST["driver"];
    $transport = $_POST["transport"];
   
    $unit = $_POST["unit"];
    $color = $_POST["color"];
    $rawmatgrp = $_POST["rawmatgrp"];   
    $rawmat = $_POST["rawmat"];    
    $rawchrateop = $_POST["rawchrateop"];
//    $openstk = $_POST["openstk"];
    $staff = $_POST["staff"];
    $bank = $_POST["bank"];
    $cash = $_POST["cash"];
    $expense = $_POST["expense"];
    $itemgrp = $_POST["itemgrp"];
//    $itemsubgrp = $_POST["itemsubgrp"];
    $item = $_POST["item"];
    $chrateop= $_POST["chrateop"];
    $group = $_POST["group"];
    $otherac = $_POST["otherac"];
//    $Srawmaterial = $_POST["Srawmaterial"];

    

    ################## TRANSACTION ##################
   
    $purchmat = $_POST["purchmat"];
    $salematmulti = $_POST["salematmulti"];
    $inwardraw = $_POST["inwardraw"];
    $damagedraw = $_POST["damagedraw"];
    $purchraw = $_POST["purchraw"];
    $slmatreg = $_POST["slmatreg"];
    $inwregraw = $_POST["inwregraw"];
    $damregraw = $_POST["damregraw"];
    $rawstock = $_POST["rawstock"];
    $rawinwout = $_POST["rawinwout"];
    $rawmatwise = $_POST["rawmatwise"];
    $rawmatwisesale = $_POST["rawmatwisesale"];
    $rawmgrpsl = $_POST["rawmgrpsl"];
    $partygrpwisesaleraw = $_POST["partygrpwisesaleraw"];
    $sale = $_POST["sale"];
    $debnote = $_POST["debnote"];
    $deboth = $_POST["deboth"];
    $crednote = $_POST["crednote"];
    $credoth = $_POST["credoth"];
    $inwardgst = $_POST["inwardgst"];
    $damgedgst = $_POST["damgedgst"];
    $purchreg = $_POST["purchreg"];
    $inward = $_POST["inward"];
    $outward = $_POST["outward"];
    $damaged = $_POST["damaged"];
    $excess = $_POST["excess"];
    $discgiven = $_POST["discgiven"];
    $discrecv = $_POST["discrecv"];
    $taxinv = $_POST["taxinv"];
    $transfer = $_POST["transfer"];

    ################## REPORTS ##################
    $rpstock = $_POST["stock"];
    $purchase = $_POST["purchase"];
    $reptaken = $_POST["reptaken"];
    $creditnotemulti = $_POST["creditnotemulti"];
    $reprecreg = $_POST["reprecreg"];
    $crdgrreg = $_POST["crdgrreg"];
    $crdothreg = $_POST["crdothreg"];
    $rphist = $_POST["inwout"];
    $rpvat = $_POST["vatrep"];   
    $rplabels = $_POST["labels"];
    $rpchqnoqry = $_POST["chqrep"];
    $rpamountqry = $_POST["amtrep"];
    $rpitemwise = $_POST["itemwise"];
    $rpitemwisesale = $_POST["itemwisesale"];
    $rpitemgrpwisesale = $_POST["itemgrpwisesale"];
    $rppartygrpwisesale = $_POST["partygrpwisesale"];   
    $rpdailysalereport = $_POST["dailysalereport"];   
    $rpjvrep = $_POST["jvrep"];
    $rpexpense = $_POST["exprep"];
    $rppayable = $_POST["payablerep"];
    $rpreceivable = $_POST["receivable"];

    ################## REGISTERS ##################
    $rgpurch = $_POST["purreg"];
    $rgsale = $_POST["salereg"];   
    $damagedgst = $_POST["damagedgst"];
    $cashrecp = $_POST["cashrecp"];
    $cashpay = $_POST["cashpay"];
    $contra = $_POST["contra"];
    $journal = $_POST["journal"];
    $rpledger = $_POST["ledger"];
    $rpdailyreport = $_POST["dailyreport"];    
    $dailycashrp = $_POST["dailycashrp"];
     $rpbankbook = $_POST["bankbook"];
     $rpcashbook = $_POST["cashbook"];
     $jvbook = $_POST["jvbook"];
    $rgdebnote = $_POST["debnotreg"];
    $rpleadparty = $_POST["leadparty"];
    $rgdeboth = $_POST["debothreg"];
    $rgcrednote = $_POST["crednotreg"];
    $rgcredoth = $_POST["credothreg"];
    $rginward = $_POST["inwreg"];
    $rgoutward = $_POST["outreg"];
    $bankpay = $_POST["bankpay"];
    $bankrecp = $_POST["bankrecp"];
    $account = $_POST["account"];
    $rgdamaged = $_POST["damreg"];
    $rgexcess = $_POST["excreg"];
    $rgdriver = $_POST["driverreg"];
    $rgtaxinv = $_POST["taxinvreg"];
    $rgbalance = $_POST["balreg"];


    ################## FINALIZATION ##################
    $fnbalance = $_POST["trbal"];
    $fnprofit = $_POST["profit"];
    $fnprofshar = $_POST["profshar"];
    $fnbalsheet = $_POST["balsheet"];


    ################## TOOLS ##################
    $tlcompany = $_POST["compsetup"];
    $tlbackup = $_POST["backup"];
    $tlprofile = $_POST["profile"];
    $dstock = $_POST["dstock"];

    ################## New Fields ##################
    $purexp = $_POST["purexp"];
    $salegmul = $_POST["salegmul"];
    $dailycashrep = $_POST["dailycashrep"];
    $purexpreg = $_POST["purexpreg"];
    $purgstreg = $_POST["purgstreg"];
    $salegstreg = $_POST["salegstreg"];
    $salemulreg = $_POST["salemulreg"];
    $b2brep = $_POST["b2brep"];
    $b2bsmrep = $_POST["b2bsmrep"];
    $b2blgrep = $_POST["b2blgrep"];
    $gstcreddebrep = $_POST["gstcreddebrep"];
    $gstcreddeburdrep = $_POST["gstcreddeburdrep"];
    $gstexprep = $_POST["gstexprep"];
    $gstadvrecdrep = $_POST["gstadvrecdrep"];
    $gstadvadjrep = $_POST["gstadvadjrep"];
    $gstnilrep = $_POST["gstnilrep"];
    $gstdocrep = $_POST["gstdocrep"];
    $count = $_POST["items"];


    if (isset($_POST["name"])) {
        $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE `user`= '$user' AND code != '$qvouch' and `spltype`='$spectype'") 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($cono)) {
                $company = mysqli_query($conn, "SELECT `name` FROM `company` WHERE `code`='$cono'")or die(mysqli_error($conn));
                $co = mysqli_fetch_array($company);
                $cname = $co['name'];

                mysqli_query($conn, "INSERT INTO `$trandb`(`username`,`cono`,`cname`, `finyear`, `yearname`, `startdate`, `lastdate`, `spltype`) 
                    VALUES ('$qvouch', '$cono', '$cname', '$finyear', '$yearname', '$startdate', '$lastdate', '$spltype')") or die(mysqli_error($conn));
            }
        }

############################## MAIN  ######################################################

        if ($addflag == 1) {

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

            mysqli_query($conn, "INSERT INTO `$maindb`(`code`, `user`, `password`, `spltype`, `usertype`, `customer`, `supplier`, `openbal`, `chcustdtl`, `transport`,
                                `staff`, `unit`,`color`,`rawmatgrp`,`rawmat`,`rawchrateop`,`itemgrp`, `item`, `chrateop`,  `bank`, `cash`, `expense`,  `group`, 
                                `otherac`,`purchmat`,`salematmulti`,`inwardraw`, `damagedraw`, `purchraw`,`slmatreg`,`inwregraw`,`damregraw`,`rawstock`,`rawinwout`,`rawmatwise`,`rawmatwisesale`,`partygrpwisesaleraw`,
                                `purchase`, `sale`,`reptaken` ,`creditnotemulti`,`credoth`,`inwardgst`, `damagedgst`, `purchreg`,`salereg`,`reprecreg`,`crdgrreg`,`crdothreg`,
                                `inwreg`,`damreg`,`stock`, `inwout`, `itemwise`,`itemwisesale`,`partygrpwisesale`,
                                `account`,`bankrecp`,`cashrecp`, `bankpay`,  `cashpay`, `contra`, `journal`,
                                `ledger`,`leadparty`, `dailyreport`,`dailycashrp`,`bankbook`, `cashbook`,`jvbook `,
                                
                                `labels`, `chqrep`, `amtrep`,   `itemgrpwisesale`,  
                                 `dailysalereport`, `jvrep`, `exprep`, `payablerep`, `receivable`,
                                `purreg`, `debnotreg`, `debothreg`, `crednotreg`, `credothreg`,`outreg`, `excreg`,
                                `driverreg`, `taxinvreg`, `balreg`, `trbal`, `profit`, `profshar`, `balsheet`, `compsetup`, `backup`, `profile`, `dstock`, 
                                `transfer`, `purexp`, `salegmul`, `purexpreg`, `purgstreg`, `salegstreg`, `salemulreg`, `dailycashrep`,`b2brep`,
                                `b2bsmrep`,`b2blgrep`,`gstcreddebrep`,`gstcreddeburdrep`,`gstexprep`, `gstadvrecdrep`,`gstadvadjrep`,`gstnilrep`,`gsthsnrep`,
                                 `gstdocrep`)
                        VALUES('$qvouch', '$user', '$password', '$spltype', '$usertype', '$customer', '$supplier', '$openbal', '$chcustdtl', '$transport', 
                                  '$staff','$unit','$color','$rawmatgrp','$rawmat','$rawchrateop', '$itemgrp', '$item','$chrateop', '$bank', '$cash', '$expense', '$group',
                                '$otherac','$purchmat','$salematmulti' ,'$inwardraw','$damagedraw','$purchraw','$slmatreg','$inwregraw','$damregraw','$rawstock','$rawinwout','$rawmatwise','$rawmatwisesale',
                                '$partygrpwisesaleraw', '$purchase', '$sale', '$reptaken','$creditnotemulti', '$credoth','$inwardgst','$damagedgst','$purchreg','$rgsale','$reprecreg','$crdgrreg ','$crdothreg',
                                '$rginward','$rgdamaged', '$rpstock', '$rphist','$rpitemwise','$rpitemwisesale','$rppartygrpwisesale',
                                '$account ','$bankrecp','$cashrecp','$bankpay',  '$cashpay', '$contra', '$journal', 
                                '$rpledger', '$rpleadparty', '$rpdailyreport','$dailycashrp','$rpbankbook', '$rpcashbook','$jvbook',
                                    
                                '$rplabels', '$rpchqnoqry', '$rpamountqry','$rpitemgrpwisesale', 
                                 '$rpdailysalereport',  '$rpjvrep', '$rpexpense', '$rppayable', '$rpreceivable',
                                '$rgpurch','$rgdebnote', '$rgdeboth', '$rgcrednote', '$rgcredoth',  '$rgoutward',  '$rgexcess',
                                '$rgdriver', '$rgtaxinv', '$rgbalance', '$fnbalance', '$fnprofit', '$fnprofshar', '$fnbalsheet', '$tlcompany', '$tlbackup', '$tlprofile',
                                '$dstock', '$transfer','$purexp', '$salegmul', '$dailycashrep', '$purexpreg', '$purgstreg', '$salegstreg', '$salemulreg', '$b2brep',
                                '$b2bsmrep','$b2blgrep','$gstcreddebrep','$gstcreddeburdrep','$gstexprep', '$gstadvrecdrep','$gstadvadjrep','$gstnilrep','$gsthsnrep',
                                '$gstdocrep')") or die(mysqli_error($conn));
            insmess();
            $mvouch = $qvouch;
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit&spltype=$spectype");
        } else {
            $mvouch = $qvouch;

            $usecode = mysqli_query($conn, "SELECT code FROM `passmain` WHERE user='$username' and `password`='$password' and `spltype`='$spltype'")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', `supplier`='$supplier', `openbal`='$openbal',`chcustdtl`='$chcustdtl',
                                        `transport`='$transport', `driver`='$driver', `unit`='$unit',`color` = '$color',`rawmatgrp`= '$rawmatgrp',`rawmat`='$rawmat',
                                         `rawchrateop`='$rawchrateop',  `staff`='$staff',
                                        `bank`='$bank',`cash`='$cash', `expense`='$expense', `itemgrp`='$itemgrp', `itemsubgrp`='$itemsubgrp',
                                        `item`='$item', `chrateop` = '$chrateop',`group`='$group', `otherac`='$otherac',`purchmat`='$purchmat',`salematmulti`='$salematmulti',`inwardraw`='$inwardraw',
                                        `damagedraw`='$damagedraw' ,`purchraw`='$purchraw',`slmatreg`='$slmatreg',`inwregraw`='$inwregraw',`damregraw`='$damregraw',`rawstock`='$rawstock',`rawinwout`='$rawinwout',`rawmatwise`='$rawmatwise',`rawmatwisesale`='$rawmatwisesale',`rawmgrpsl`='$rawmgrpsl',`partygrpwisesaleraw`='$partygrpwisesaleraw',`saletype`='$saletype', `purchase`='$purchase',
                                        `sale`='$sale',`reptaken`='$reptaken',`creditnotemulti`='$creditnotemulti',`debnote`='$debnote', `deboth`='$deboth', `crednote`='$crednote', `credoth`='$credoth',`inwardgst`='$inwardgst',`damagedgst`='$damagedgst',`purchreg`='$purchreg',
                                        `inward`='$inward', `outward`='$outward', `damaged`='$damaged', `excess`='$excess', `bankrecp`='$bankrecp',`account`='$account',
                                        `bankpay`='$bankpay', `cashrecp`='$cashrecp', `cashpay`='$cashpay', `contra`='$contra', `journal`='$journal',
                                        `discgiven`='$discgiven', `discrecv`='$discrecv', `taxinv`='$taxinv', `stock`='$rpstock', `inwout`='$rphist', `vatrep`='$rpvat',
                                        `ledger`='$rpledger', `labels`='$rplabels', `chqrep`='$rpchqnoqry', `amtrep`='$rpamountqry', `itemwise`='$rpitemwise',
                                        `itemwisesale`='$rpitemwisesale', `itemgrpwisesale`='$rpitemgrpwisesale', `partygrpwisesale`='$rppartygrpwisesale',
                                        `leadparty`='$rpleadparty', `dailyreport`='$rpdailyreport', `dailycashrp`='$dailycashrp',`dailysalereport`='$rpdailysalereport',
                                        `bankbook`='$rpbankbook', `cashbook`='$rpcashbook',`jvbook`='$jvbook', `jvrep`='$rpjvrep', `exprep`='$rpexpense', `payablerep`='$rppayable',
                                        `receivable`='$rpreceivable', `purreg`='$rgpurch', `salereg`='$rgsale',`reprecreg`='$reprecreg', `crdgrreg`='$crdgrreg',`crdothreg`='$crdothreg',`debnotreg`='$rgdebnote',`debothreg`='$rgdeboth',
                                        `crednotreg`='$rgcrednote', `credothreg`='$rgcredoth', `inwreg`='$rginward', `outreg`='$rgoutward', `damreg`='$rgdamaged',
                                        `excreg`='$rgexcess', `driverreg`='$rgdriver', `taxinvreg`='$rgtaxinv', `balreg`='$rgbalance', `trbal`='$fnbalance',
                                        `profit`='$fnprofit', `profshar`='$fnprofshar', `balsheet`='$fnbalsheet', `compsetup`='$tlcompany', `backup`='$tlbackup',
                                        `profile`='$tlprofile', `dstock`='$dstock', `transfer`='$transfer',`purexp`='$purexp', `salegmul`='$salegmul', 
                                        `dailycashrep`='$dailycashrep', `purexpreg`='$purexpreg', `purgstreg`='$purgstreg', `salegstreg`='$salegstreg',
                                        `salemulreg`='$salemulreg', `b2brep`='$b2brep', `b2bsmrep`='$b2bsmrep',`b2blgrep`='$b2blgrep',`gstcreddebrep`='$gstcreddebrep',
                                        `gstcreddeburdrep`='$gstcreddeburdrep',  `gstexprep`='$gstexprep', `gstadvrecdrep`='$gstadvrecdrep',
                                        `gstadvadjrep`='$gstadvadjrep',`gstnilrep`='$gstnilrep',`gsthsnrep`='$gsthsnrep', `gstdocrep`='$gstdocrep'
                                         WHERE code = '$mvouch' and `spltype`='$spltype' ") or die(mysqli_error($conn));
            updmess();
//            browse($spectype);
            header("refresh: 1; $file?$keyfld=$mvouch&spltype=$spectype&mode=edit");
        }
    }
}

if ($addflag != 1) {

    $getvouch = '';
    if ($addflag == 0) {
        $getvouch = $_GET[$keyfld];
    } else {
        $getvouch = $qvouch;
    }
//    browse($speccond);
    $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld='$getvouch' $keycond") 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" 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" name="password" id="pass" 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"  placeholder="Cofirm 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">                                    
                                    <?php
                                    if ($addflag != 1) {
                                        $usertyp = "";
                                        if ($get['usertype'] == 1) {
                                            $ucode = "1";
                                            $usertyp = "Admin";
                                        }
                                        if ($get['usertype'] == 2) {
                                            $ucode = "2";
                                            $usertyp = "Supervisor";
                                        }
                                        if ($get['usertype'] == 3) {
                                            $ucode = "3";
                                            $usertyp = "Staff";
                                        }
                                        echo "<option value='$ucode'>$usertyp</option>";
                                    }
                                    ?>
                                    <option value=""></option>
                                    <option value="3">Staff</option>
                                    <option value="2">Supervisor</option>
                                    <option value="1">Admin</option>
                                </select>
                            </div>
                        </div>
                        <?php
                        if ($spectype == "1") {
                            ?>
                            <div class="row">
                                <label class="col-sm-4 control-label marg">Special</label>
                                <div class="col-sm-2" style="margin-top:6px">
                                    <input type="checkbox" class="form  spltype" id="spltype" name="spltype" value="1" <?
                                    if ($get['spltype'] == 1) {
                                        Echo "checked";
                                    }
                                    ?>>
                                </div>
                            </div>
                        <?php } ?>
<!--                        <div class="nav-tabs-custom">
                            <ul class="nav nav-tabs">
                                <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">Masters</a></li>
                                <li class=""><a href="#tab_2" data-toggle="tab" aria-expanded="false">Raw Material</a></li>
                                <li class=""><a href="#tab_3" data-toggle="tab" aria-expanded="false">Product</a></li>
                                <li class=""><a href="#tab_4" data-toggle="tab" aria-expanded="false">Accounts</a></li>
                                <li class=""><a href="#tab_5" data-toggle="tab" aria-expanded="false">Finalization</a></li>
                                <li class=""><a href="#tab_6" data-toggle="tab" aria-expanded="false">Tools & DashBoard</a></li>
                                <li class=""><a href="#tab_7" data-toggle="tab" aria-expanded="false">Gst Reports</a></li>
                            </ul>
                            <div class="tab-content">
                                <div class="tab-pane active" id="tab_1">
                                    <div class="row">
                                        <label class="col-sm-6 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-1" 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</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">Karigar/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>
                                    </div>
                                    <div class="row">
                                        <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>
                                        <label class="col-sm-4 control-label marg">Change Of Customer Details</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="chcustdtl" name="chcustdtl" value="1" <?
                                            if ($get['chcustdtl'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Transporter</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="transport" name="transport" value="1" <?
                                            if ($get['transport'] == 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">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>
                                        <label class="col-sm-4 control-label marg">Color</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="color" name="color" value="1" <?
                                            if ($get['color'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Raw Material Group</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="rawmatgrp" name="rawmatgrp" value="1" <?
                                            if ($get['rawmatgrp'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Raw Material</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="rawmat" name="rawmat" value="1" <?
                                            if ($get['rawmat'] == 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="rawchrateop" name="rawchrateop" value="1" <?
                                            if ($get['rawchrateop'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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="itemgrp" name="itemgrp" value="1" <?
                                            if ($get['itemgrp'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <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="item" name="item" value="1" <?
                                            if ($get['item'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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="chrateop" name="chrateop" value="1" <?
                                            if ($get['chrateop'] == 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">Group</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="group" name="group" value="1" <?
                                            if ($get['group'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                     <div class="row">
                                        <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="otherac" name="otherac" value="1" <?
                                            if ($get['otherac'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                     </div>
                                </div>  
                                <div class="tab-pane" id="tab_2">
                                    <div class="row">
                                        <label class="col-sm-6 control-label marg selectall">Select All/UnSelect All</label>
                                        <div class="col-sm-4" style="margin-top:6px">
                                            <input type="checkbox" class="form " id="Srawmaterial" value="1"
                                         
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Purchase Raw Material</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="purchmat" name="purchmat" value="1" <?
                                            if ($get['purchmat'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Sale Raw Material</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="salematmulti" name="salematmulti" value="1" <?
                                            if ($get['salematmulti'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Inward Raw Material </label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  inwardraw" id="inwardraw" name="inwardraw" value="1" <?
                                            if ($get['inwardraw'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Damaged Raw Material</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  damagedraw" id="damagedraw" name="damagedraw" value="1" <?
                                            if ($get['damagedraw'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Purchase Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="purchraw" name="purchraw" value="1" <?
                                            if ($get['purchraw'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Sale Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="slmatreg" name="slmatreg" value="1" <?
                                            if ($get['slmatreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Inward Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="inwregraw" name="inwregraw" value="1" <?
                                            if ($get['inwregraw'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Damaged Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="damregraw" name="damregraw" value="1" <?
                                            if ($get['damregraw'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Stock</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="rawstock" name="rawstock" value="1" <?
                                            if ($get['rawstock'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Inward/Outward History</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="rawinwout" name="rawinwout" value="1" <?
                                            if ($get['rawinwout'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Raw Material Wise P/L</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="rawmatwise" name="rawmatwise" value="1" <?
                                            if ($get['rawmatwise'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Raw Material Wise Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="rawmatwisesale" name="rawmatwisesale" value="1" <?
                                            if ($get['rawmatwisesale'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Raw Material Groupwise Sale </label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="rawmgrpsl" name="rawmgrpsl" value="1" <?
                                            if ($get['rawmgrpsl'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                            
                                        </div>
                                        <label class="col-sm-4 control-label marg">Partywise Raw Material Group Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  rawmaterial" id="partygrpwisesaleraw" name="partygrpwisesaleraw" value="1" <?
                                            if ($get['partygrpwisesaleraw'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                </div>
                                     
                                <div class="tab-pane" id="tab_3">
                                    <div class="row">
                                        <label class="col-sm-6 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">Purchase</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="purchase" name="purchase" value="1" <?
                                            if ($get['purchase'] == 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  reports" id="sale" name="sale" value="1" <?
                                            if ($get['sale'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Purchase Return </label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="reptaken" name="reptaken" value="1" <?
                                            if ($get['reptaken'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Sale Return/Credit Note-Goods Return</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="creditnotemulti" name="creditnotemulti" value="1" <?
                                            if ($get['creditnotemulti'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Sale Return/Credit Note-Others</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="credoth" name="credoth" value="1" <?
                                            if ($get['credoth'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Inward</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="inwardgst" name="inwardgst" value="1" <?
                                            if ($get['inwardgst'] == 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  reports" id="damagedgst" name="damagedgst" value="1" <?
                                            if ($get['damagedgst'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Purchase Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="purchreg" name="purchreg" value="1" <?
                                            if ($get['purchreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Sale Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="salereg" name="salereg" value="1" <?
                                            if ($get['salereg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Purchase Return Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="reprecreg" name="reprecreg" value="1" <?
                                            if ($get['reprecreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Sale Return/Credit Note-Goods Return Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="crdgrreg" name="crdgrreg" value="1" <?
                                            if ($get['crdgrreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Sale Return/Credit Note-Other  Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="crdothreg" name="crdothreg" value="1" <?
                                            if ($get['crdothreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Inward Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="inwreg" name="inwreg" value="1" <?
                                            if ($get['inwreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Damaged Register </label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="damreg" name="damreg" value="1" <?
                                            if ($get['damreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">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 History</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">Itemwise P/L </label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="itemwise" name="itemwise" value="1" <?
                                                if ($get['itemwise'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">ItemWise Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="itemwisesale" name="itemwisesale" value="1" <?
                                            if ($get['itemwisesale'] == 1) {
                                            Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg"> Item Groupwise Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="itemgrpwisesale" name="itemgrpwisesale" value="1" <?
                                                if ($get['itemgrpwisesale'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Partywise Item Group Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="partygrpwisesale" name="partygrpwisesale" value="1" <?
                                            if ($get['partygrpwisesale'] == 1) {
                                            Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                </div>

                                <div class="tab-pane" id="tab_4">
                                    <div class="row">
                                        <label class="col-sm-6 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">Accounts</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="account" name="account" value="1" <?
                                                if ($get['account'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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  registers" id="bankrecp" name="bankrecp" value="1" <?
                                            if ($get['bankrecp'] == 1) {
                                            Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <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  registers" id="bankpay" name="bankpay" value="1" <?
                                                if ($get['bankpay'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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  registers" id="cashrecp" name="cashrecp" value="1" <?
                                            if ($get['cashrecp'] == 1) {
                                            Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <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  registers" id="cashpay" name="cashpay" value="1" <?
                                                if ($get['cashpay'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Contra</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" 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">Journal</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="journal" name="journal" value="1" <?
                                                if ($get['journal'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Ledger</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="ledger" name="ledger" value="1" <?
                                            if ($get['ledger'] == 1) {
                                            Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Leading Parties</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="leadparty" name="leadparty" value="1" <?
                                                if ($get['leadparty'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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  registers" id="dailyreport" name="dailyreport" value="1" <?
                                            if ($get['dailyreport'] == 1) {
                                            Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Daily Cash</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="dailycashrp" name="dailycashrp" value="1" <?
                                                if ($get['dailycashrp'] == 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  registers" 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  registers" id="cashbook" name="cashbook" value="1" <?
                                                if ($get['cashbook'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Journal Book</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="jvbook" name="jvbook" value="1" <?
                                            if ($get['jvbook'] == 1) {
                                            Echo "checked";
                                            }
                                            ?>>
                                        </div>

                                    </div>-->

                                <!--</div>--> 
                            <!--</div>-->
                             
                        </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="17%">Company</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`,`cname`,`finyear`,`startdate`,`lastdate`,`yearname` FROM `usercomp` WHERE `username`='$get[code]' ORDER BY `cono`")or die(mysqli_error($conn));
                                        while ($tran = mysqli_fetch_array($gettran)) {
                                            $fetcomp = mysqli_query($conn, "SELECT `code`,`name` FROM `company` WHERE `code`='$tran[cono]'")or die(mysqli_error($conn));
                                            $fcomp = mysqli_fetch_array($fetcomp);

                                            $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 cono select2' name='cono_$ctr' style='width:100%'>";
                                            Echo "<option value='$fcomp[code]'>$fcomp[name]</option>";
                                            $gcomp = mysqli_query($conn, "SELECT `code`,`name` FROM `company` where code !='' $speccond")or die(mysqli_error($conn));
                                            while ($comp = mysqli_fetch_array($gcomp)) {
                                                Echo "<option value='$comp[code]'>$comp[name]</option>";
                                            }
                                            Echo "</select>";
                                            Echo "</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` where finyear != '' group by finyear")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 cono select2" name="cono_0" style='width:100%' required>
                                                    <option value=""></option>
                                                    <?php
                                                    $gcomp = mysqli_query($conn, "SELECT `code`,`name` FROM `company` where code !='' $speccond")or die(mysqli_error($conn));

                                                    while ($comp = mysqli_fetch_array($gcomp)) {
                                                        Echo "<option value='$comp[code]'>$comp[name]</option>";
                                                    }
                                                    ?>
                                                </select>
                                            </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` group by finyear")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` where code!='' $keycond")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"); ?>