<?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"];
    $transport = $_POST["transport"];
    $unit = $_POST["unit"];
    $color = $_POST["color"];
    $chrateop = $_POST["chrateop"];
    $bank = $_POST["bank"];
    $cash = $_POST["cash"];
    $expense = $_POST["expense"];
    $itemgrp = $_POST["itemgrp"];
    $itemsubgrp = $_POST["itemsubgrp"];
    $item = $_POST["item"];
    $group = $_POST["group"];
    $rawmat = $_POST["rawmat"];
    $otherac = $_POST["otherac"];
    $saletype = $_POST["saletype"];

    ################## TRANSACTION ##################
    

    $sale = $_POST["sale"];
    $salegmul = $_POST["salegstmulti"];
    $creditnotegstmulti = $_POST["creditnotegstmulti"];
    $credothgst = $_POST["credothgst"];
    $inward = $_POST["inward"];
    $damaged = $_POST["damaged"];
    $salematmulti = $_POST["salematmulti"];
    $purchase = $_POST["purchase"];
    $purchgstmulti = $_POST["purchgstmulti"];
    $repgiven = $_POST["repgiven"];
    $reptaken = $_POST["reptaken"];
    $amtrequest = $_POST["amtrequest"];
    $excess = $_POST["excess"];
    $bankrecp = $_POST["bankrecp"];
    $bankpay = $_POST["bankpay"];
    $custtokari = $_POST["custtokari"];
    $cashrecp = $_POST["cashrecp"];
    $cashpay = $_POST["cashpay"];
    $contra = $_POST["contra"];
    $journal = $_POST["journal"];

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

    $stock = $_POST["stock"];
    $inwout = $_POST["inwout"];
    $ledger = $_POST["ledger"];
    $ledgergst = $_POST["ledgergst"];
    $karigrep = $_POST["karigrep"];
    $itemwise = $_POST["itemwise"];
    $itemwisesale = $_POST["itemwisesale"];
    $itemgrpwisesale = $_POST["itemgrpwisesale"];
    $partygrpwisesale = $_POST["partygrpwisesale"];
    $leadparty = $_POST["leadparty"];
    $dailyreport = $_POST["dailyreport"];
    $dailycashrp = $_POST["dailycashrp"];
    $dailysalereport = $_POST["dailysalereport"];
    $bankbook = $_POST["bankbook"];
    $cashbook = $_POST["cashbook"];
    $jvbook = $_POST["jvbook"];
    $pendrep = $_POST["pendrep"];
    $cartreg = $_POST["cartreg"];
    $payablerep = $_POST["payablerep"];
    $receivable = $_POST["receivable"];

    ################## REGISTERS ##################
    
    $salereg = $_POST["salereg"];
    $slmultigstreg = $_POST["slmultigstreg"];
    $crdntreg = $_POST["crdntreg"];
    $crdothreg = $_POST["crdothreg"];
    $inwreg = $_POST["inwreg"];
    $outreg = $_POST["outreg"];
    $damreg = $_POST["damreg"];
    $excessreg = $_POST["excessreg"];
    $slmatreg = $_POST["slmatreg"];
    $purchreg = $_POST["purchreg"];
    $custokar = $_POST["custokar"];
    $repgivreg = $_POST["repgivreg"];
    $reprecreg = $_POST["reprecreg"];


    ################## MIS ##################
    
    $karadvbal = $_POST["karadvbal"];
    $karigmatgv = $_POST["karigmatgv"];
    $kargoodrc = $_POST["kargoodrc"];
    $karigpay = $_POST["karigpay"];
    $custnopay = $_POST["custnopay"];
    $custnosale = $_POST["custnosale"];


    ################## TOOLS ##################
    $company = $_POST["company"];
    $backup = $_POST["backup"];
    $profile = $_POST["profile"];
    $balsms = $_POST["balsms"];

    
    $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`, `usertype`, `spltype`, `customer`, `supplier`,  `openbal`,`transport`,
                              `chcustdtl`, `unit`,`color`,`chrateop`,`bank`,`cash`,`expense`,`itemgrp`,`itemsubgrp`,`item`, `rawmat`,
                              `group`, `otherac`,`saletype`,`sale`,`salegstmulti`,`creditnotegstmulti`, `credothgst`,`inward`,`damaged`,`salematmulti`,`purchase`,
                              `purchgstmulti`,`repgiven`,`reptaken`,`amtrequest`,`bankrecp`,`bankpay`,  `custtokari`, `cashrecp`, `cashpay`,`contra`,`journal`,`stock`,`inwout`,`ledger`,
                              `ledgergst`,`karigrep`,`itemwise`,`itemwisesale`,`itemgrpwisesale`,`partygrpwisesale`,`leadparty`,`dailyreport`,`dailycashrp`,`bankbook`,`cashbook`,
                              `jvbook`, `pendrep`,`cartreg`, `payablerep`, `receivable`,  `salereg`, `slmultigstreg`,`crdntreg`,`crdothreg`,`inwreg`,`outreg`,`damreg`,`excessreg`,
                              `slmatreg`,`purchreg`,`custokar`,`repgivreg`,`reprecreg`,`karadvbal`,`karigmatgv`,`kargoodrc`,`karigpay`,`custnopay`,`custnosale`) 
                        VALUES('$qvouch', '$user', '$password', '$usertype', '$spltype', '$customer', '$supplier', '$openbal','$transport',
                              '$chcustdtl','$unit','$color','$chrateop','$bank', '$cash','$expense','$itemgrp','$itemsubgrp','$item','$rawmat',
                              '$group', '$otherac','$saletype','$sale','$salegstmulti','$creditnotegstmulti','$credothgst','$inward','$damaged','$salematmulti','$purchase',
                              '$purchgstmulti','$repgiven','$reptaken','$amtrequest','$bankrecp','$bankpay','$custtokari', '$cashrecp', '$cashpay','$contra', '$journal','$stock','$inwout','$ledger',
                              '$ledgergst','$karigrep','$itemwise','$itemwisesale','$itemgrpwisesale','$partygrpwisesale','$leadparty','$dailyreport','$dailycashrp','$bankbook','$cashbook',
                              '$jvbook','$pendrep', '$cartreg', '$payablerep','$receivable', '$salereg','$slmultigstreg','$crdntreg','$crdothreg','$inwreg','$outreg','$damreg', '$excessreg',
                              '$slmatreg','$purchreg','$custokar','$repgivreg','$reprecreg','$karadvbal','$karigmatgv','$kargoodrc','$karigpay','$custnopay','$custnosale')") 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', `spltype`='$spltype',`usertype`='$usertype',
                                        `customer`='$customer', `supplier`='$supplier', `openbal`='$openbal',`transport`='$transport',`chcustdtl`='$chcustdtl',
                                        `unit`='$unit',  `color`='$color',`chrateop`='$chrateop', `bank`='$bank',`cash`='$cash', `expense`='$expense',
                                        `itemgrp`='$itemgrp', `itemsubgrp`='$itemsubgrp',`item`='$item', `rawmat`='$rawmat',`group`='$group',`otherac`='$otherac', 
                                        `saletype`='$saletype', 
                                        `sale`='$sale', `salegstmulti`='$salegstmulti', `creditnotegstmulti`='$creditnotegstmulti', `credothgst`='$credothgst', `inward`='$inward',
                                        `damaged`='$damaged', `salematmulti`='$salematmulti',`purchase`='$purchase' , `purchgstmulti`='$purchgstmulti' , `repgiven`='$repgiven', `reptaken`='$reptaken', 
                                        `amtrequest`='$amtrequest', `bankrecp`='$bankrecp',`bankpay`='$bankpay', `custtokari`='$custtokari',`cashrecp`='$cashrecp', `cashpay`='$cashpay', `contra`='$contra',
                                        `journal`='$journal',`stock`='$stock', `inwout`='$inwout', `ledger`='$ledger', `ledgergst`='$ledgergst',`karigrep`='$karigrep' ,
                                        `itemwise`='$itemwise',
                                        `itemwisesale`='$itemwisesale', `itemgrpwisesale`='$itemgrpwisesale', `partygrpwisesale`='$partygrpwisesale',
                                        `leadparty`='$leadparty', `dailyreport`='$dailyreport', `dailycashrp`='$dailycashrp',
                                        `bankbook`='$bankbook', `cashbook`='$cashbook', `jvbook`='$jvbook', `pendrep`='$pendrep', `cartreg`='$cartreg', `payablerep`='$payablerep',
                                        `receivable`='$receivable',`salereg`='$salereg', `slmultigstreg`='$slmultigstreg' ,
                                        `crdntreg`='$crdntreg', `crdothreg`='$crdothreg', `inwreg`='$inwreg', `outreg`='$outreg', `damreg`='$damreg',
                                        `excessreg`='$excessreg', `slmatreg`='$slmatreg', `purchreg`='$purchreg', `custokar`='$custokar', `repgivreg`='$repgivreg', `reprecreg`='$reprecreg',
                                        `karadvbal`='$karadvbal', `karigmatgv`='$karigmatgv' ,`kargoodrc`='$kargoodrc', `karigpay`='$karigpay', `custnopay`='$custnopay', `custnosale`='$custnosale'
                                         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 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" 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="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">                                    
                                    <?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">Transaction</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">MIS</a></li>
                                <li class=""><a href="#tab_6" data-toggle="tab" aria-expanded="false">Tools</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</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="broker" 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">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">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>
                                        <label class="col-sm-4 control-label marg">Change Of Rates/Opening Stock</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">Item 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">Item Sub Group</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  masters" id="itemsubgrp" name="itemsubgrp" value="1" <?
                                            if ($get['itemsubgrp'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>

                                        <label class="col-sm-4 control-label marg">Item</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>
                                        <div class="row">
                                            <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>
                                            <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>
                                            <label class="col-sm-4 control-label marg">Sale Type</label>
                                            <div class="col-sm-2" style="margin-top:6px">
                                                <input type="checkbox" class="form  masters" id="saletype" name="saletype" value="1" <?
                                                if ($get['saletype'] == 1) {
                                                    Echo "checked";
                                                }
                                                ?>>
                                            </div>
                                        </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="Stransactions" value="1">
                                        </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  transactions" id="sale" name="sale" value="1" <?
                                            if ($get['sale'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Sale Multi Gst</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="purchase" name="salegstmulti" value="1" <?
                                            if ($get['salegstmulti'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Sale Return / Credit Note - Good Return Multi </label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="creditnotegstmulti" name="creditnotegstmulti" value="1" <?
                                            if ($get['creditnotegstmulti'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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  transactions" id="credothgst" name="credothgst" value="1" <?
                                            if ($get['credothgst'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Inward</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="inward" name="inward" value="1" <?
                                            if ($get['inward'] == 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="damaged" name="damaged" value="1" <?
                                            if ($get['damaged'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Material Given To Karigar</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="salematmulti" name="salematmulti" value="1" <?
                                            if ($get['salematmulti'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Goods Received From Karigar</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="purchase" name="purchase" value="1" <?
                                            if ($get['purchase'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Goods Received From Karigar-GST</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="purchgstmulti" name="purchgstmulti" value="1" <?
                                            if ($get['purchgstmulti'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Repair Given To Karigar</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="repgiven" name="repgiven" value="1" <?
                                            if ($get['repgiven'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Repair Recd. From Karigar</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="reptaken" name="reptaken" value="1" <?
                                            if ($get['reptaken'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Amount Request</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="amtrequest" name="amtrequest" value="1" <?
                                            if ($get['amtrequest'] == 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">Customer To Karigar</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="custtokari" name="custtokari" value="1" <?
                                            if ($get['custtokari'] == 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  transactions" 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  transactions" 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  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">Journal</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  transactions" id="journal" name="journal" value="1" <?
                                            if ($get['journal'] == 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">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">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">Ledger GST</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="ledgergst" name="ledgergst" value="1" <?
                                            if ($get['ledgergst'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Karigar Report</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="karigrep" name="karigrep" value="1" <?
                                            if ($get['karigrep'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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>
                                    </div>
                                    <div class="row">
                                        <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>
                                        <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>
                                    </div>
                                    <div class="row">
                                        <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>
                                        <label class="col-sm-4 control-label marg">Leading Party</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="leadparty" name="leadparty" value="1" <?
                                            if ($get['leadparty'] == 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="dailyreport" name="dailyreport" value="1" <?
                                            if ($get['dailyreport'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Daily Cash Report</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="dailycashrp" name="dailycashrp" value="1" <?
                                            if ($get['dailycashrp'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <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>
                                        <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>
                                    </div>
                                    <div class="row">
                                        <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  reports" id="jvbook" name="jvbook" value="1" <?
                                            if ($get['jvbook'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Pending Repair</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="pendrep" name="pendrep" value="1" <?
                                            if ($get['pendrep'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Cartoonwise Report</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  reports" id="cartreg" name="cartreg" value="1" <?
                                            if ($get['cartreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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="receivable" name="receivable" value="1" <?
                                            if ($get['receivable'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <div class="row">
                                            <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>
                                </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">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>
                                        <label class="col-sm-4 control-label marg">Sale Gst Multi</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="slmultigstreg" name="slmultigstreg" value="1" <?
                                            if ($get['slmultigstreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Sale Return / Credit Note- Good Returns</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="crdntreg" name="crdntreg" value="1" <?
                                            if ($get['crdntreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <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  registers" 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</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="inwreg" name="inwreg" value="1" <?
                                            if ($get['inwreg'] == 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  registers" 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">Outreg</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="outreg" name="outreg" value="1" <?
                                            if ($get['outreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
<!--                                        <label class="col-sm-4 control-label marg">Excess</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="excessreg" name="excessreg" value="1" <?
                                            if ($get['excessreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>-->
                                       
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Material Given to Karigar</label>
                                         <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="slmatreg" name="slmatreg" value="1" <?
                                            if ($get['slmatreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Goods Received From Karigar</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" 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">Customer To Karigar</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="custokar" name="custokar" value="1" <?
                                            if ($get['custokar'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Repair Given Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="repgivreg" name="repgivreg" value="1" <?
                                            if ($get['repgivreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Repair Recd Register</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  registers" id="reprecreg" name="reprecreg" value="1" <?
                                            if ($get['reprecreg'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                </div> 
                                <div class="tab-pane" id="tab_5">
                                    <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="Sfinalization" value="1">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Karigar Advance/Balance</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="karadvbal" name="karadvbal" value="1" <?
                                            if ($get['karadvbal'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Karigar Material Given</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="karigmatgv" name="karigmatgv" value="1" <?
                                            if ($get['karigmatgv'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Karigar Item Received</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="kargoodrc" name="kargoodrc" value="1" <?
                                            if ($get['kargoodrc'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Karigar Payment</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="karigpay" name="karigpay" value="1" <?
                                            if ($get['karigpay'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Customer No Payment</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="custnopay" name="custnopay" value="1" <?
                                            if ($get['custnopay'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Cutomer No Sale</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  finalization" id="custnosale" name="custnosale" value="1" <?
                                            if ($get['custnosale'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                </div> 
                                <div class="tab-pane" id="tab_6">
                                    <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="Stools" value="1">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Company Setup</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  tools" id="company" name="company" value="1" <?
                                            if ($get['company'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Backup</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  tools" id="backup" name="backup" value="1" <?
                                            if ($get['backup'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label class="col-sm-4 control-label marg">Profile</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  tools" id="profile" name="profile" value="1" <?
                                            if ($get['profile'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                        <label class="col-sm-4 control-label marg">Balance SMS</label>
                                        <div class="col-sm-2" style="margin-top:6px">
                                            <input type="checkbox" class="form  tools" id="balsms" name="balsms" value="1" <?
                                            if ($get['balsms'] == 1) {
                                                Echo "checked";
                                            }
                                            ?>>
                                        </div>
                                    </div>
                                </div> 
                               
                            </div>  
                        </div>
                    </div>
                    <div class="panel-footer">
                        <? 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"); ?>