<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');
header("Content-Type: text/html;charset=UTF-8");

//mysqli_query($conn, "SET NAMES 'utf8'");
//mysqli_query($conn, 'SET CHARACTER SET utf8');
//
/////////////NVQINT/////////////////

$formname = 'Entry';
$maindb = 'visamain';
$trandb = 'visatran';
$trandb2 = "category";

$file = 'entry.php';
$printfile = "register_sc.php";
$trandbexist = 1;

$grid = '';
$keyfld = "myvouch";
$focusfield = "visatype";
$mgrpcode = '';
$keycond = "";
$myyear = $_SESSION["tit_" . $dbname];

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$adduser = $_SESSION["username_" . $dbname];
$zroot = $_SESSION["zdir"];
$modet = $_GET["mode"];

mysqli_select_db($conn, $zdb);
include("includes/vouchno_generate.php");
include("includes/prev&next.php");
if (isset($_POST["submit"])) {
    $a = 1;

    $visatype = $_POST["visatype"];
    $voucher = $_POST["voucher"];
    $vouchno = $_POST["vouchno"];
    $vouchdt = $_POST["vouchdt"];

    //    $manualno = $_POST["manualno"];

    $partyname = $_POST["partyname"];
    $sponsor = mysqli_real_escape_string($conn, $_POST["sponsor"]);
    $broker = $_POST["broker"];
    $email = $_POST["email"];
    //    $address = $_POST["address"];
    $oadd1 = $_POST["oadd1"];
    $oadd2 = $_POST["oadd2"];
    $oadd3 = $_POST["oadd3"];
    $ladd1 = $_POST["ladd1"];
    $ladd2 = $_POST["ladd2"];
    $ladd3 = $_POST["ladd3"];
    $contact = $_POST["contact"];
    $visano = $_POST["visano"];
    $hijridate = $_POST["hijridate"];
    $catgmain = $_POST["catgmain"];

    $sector = $_POST["sector"];
    $visaqty = $_POST["visaqty"];
    $mobile = $_POST["mobile"];
    $drname = $_POST["drname"];
    $meddate = $_POST["meddate"];
    $idno = $_POST["idno"];
    $remark = $_POST["remark"];
    $remark2 = $_POST["remark2"];
    $paidby = $_POST["paidby"];
    $branch = $_POST["branch"];
    $mis = $_POST["mis"];
    $misc = $_POST["misc"];
    $imig = $_POST["imig"];
    $stamp = $_POST["stamp"];
    $total = $_POST["total"];
    $disc = $_POST["disc"];
    $tot = $_POST["tot"];
    $mofa = $_POST["mofa"];
    $feid = $_POST["feid"];
    $fepass = $_POST["fepass"];
    $purpvisit = $_POST["purpvisit"];
    $reqmed = $_POST["reqmed"];
    $compname = $_POST["compname"];
    $enttype = $_POST["enttype"];

    $count = $_POST["items"];
    $count2 = $_POST["items2"];
    $prefix = $_POST["prefix"];

    $mvouch = $qvouch;
    if ($a == 1) {

        mysqli_query($conn, "LOCK TABLES `$maindb` WRITE, `$trandb` WRITE, `$trandb2` WRITE, accmast WRITE, actran WRITE");

        if ($addflag == 1) {
            $gen1 = mysqli_query($conn, "SELECT MAX($keyfld) AS maxcode FROM `$maindb` where vouchno != '' 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;

            $gevo = mysqli_query($conn, "SELECT MAX(vouchno) AS maxcode FROM `visamain` where `prefix` = '$prefix' LIMIT 0,1 ") or die(mysqli_error($conn));

            if (mysqli_num_rows($gevo) > 0) {
                $vvoucher = mysqli_fetch_assoc($gevo);
                $qvoucher = $vvoucher["maxcode"] + 1;
            } else {
                $qvoucher = '1';
            }
            $voucher = $qvoucher;

            $vouchno = $voucher;
        }

        $manualno = $prefix . $vouchno;

        $gac = mysqli_query($conn, "SELECT accode,name FROM `accmast` where `name` = '$broker' ") or die(mysqli_error($conn));
        if (mysqli_num_rows($gac) > 0) {
            $fage = mysqli_fetch_assoc($gac);
            $agentcode = $fage["accode"];
        } else {
            $geac = mysqli_query($conn, "SELECT MAX(accode) AS maxcode FROM `accmast` where `accode` != '' LIMIT 0,1 ") or die(mysqli_error($conn));

            if (mysqli_num_rows($geac) > 0) {
                $feac = mysqli_fetch_assoc($geac);
                $agentcode = $feac["maxcode"] + 1;
            } else {
                $agentcode = '51';
            }
            mysqli_query($conn, "INSERT INTO `accmast`(accode, `name`, `init`, grpcode)
                                        VALUES('$agentcode','$broker', 'AGN', '040')") or die(mysqli_error($conn));
        }

        //        browse($voucher);
        ########################################Image Part Start########################################
        //        browse($myyear);
        $path = "images/" . $myyear . "/" . $mvouch;
        //        browse($path);
        if (is_dir($path) === false) {
            mkdir($path);
        }
        //            browse($dir);
        $tpath1 = $path . "/";

        $fileName = $mvouch . ".jpg";
        $img_file = $path . ($fileName);

        $tfileNameEV = $mvouch . "_evisa.jpg";
        $timg_fileEV = $tpath1 . ($tfileNameEV);

        $tfileTmpLoc5 = $_FILES["evisa"]["tmp_name"]; // File in the PHP tmp folder
        $tfileType5 = $_FILES["evisa"]["type"]; // The type of file it is
        $tfileSize5 = $_FILES["evisa"]["size"]; // File size in bytes
        $tfileErrorMsg5 = $_FILES["evisa"]["error"];
        //        browse($tfileTmpLoc5);
        if (!empty($tfileTmpLoc5)) {
            move_uploaded_file($tfileTmpLoc5, "$timg_fileEV");
        }

        $fileTmpLoc = $_FILES["file"]["tmp_name"]; // File in the PHP tmp folder
        $fileType = $_FILES["file"]["type"]; // The type of file it is
        $fileSize = $_FILES["file"]["size"]; // File size in bytes
        $fileErrorMsg = $_FILES["file"]["error"]; // 0 for false... and 1 for true

        if (!empty($fileTmpLoc)) {
            if (move_uploaded_file($fileTmpLoc, "$img_file")) {
                browse("$fileName upload is complete");
            } else {
                browse("move_uploaded_file function failed");
            }
        }


        ################################### Image Part End  ########################################

        mysqli_query($conn, "Delete from `$trandb` where `myvouch`='$mvouch'") or die(mysqli_error($conn));
        //        mysqli_query($conn, "Delete from `$trandb` where `myvouch`='$mvouch' AND visatype = '$visatype'") or die(mysqli_error($conn));
        $cnt = 0;
        for ($i = 0; $i <= $count; $i++) {
            $cnt++;
            $srno = $_POST["srno"][$i];
            $paxname = $_POST["paxname"][$i];
            $agenttran = $_POST["agenttran"][$i];
            $passport = $_POST["passport"][$i];
            $passrecd = $_POST["passrecd"][$i];
            $address = $_POST["address"][$i];
            $issplace = $_POST["issplace"][$i];
            $issdate = $_POST["issdate"][$i];
            $stampdate = $_POST["stampdate"][$i];
            $stampstatus = $_POST["stampstatus"][$i];
            $carrier = $_POST["carrier"][$i];
            $fltno = $_POST["fltno"][$i];
            $fltdate = $_POST["fltdate"][$i];
            $flttime = $_POST["flttime"][$i];
            $pnrno = $_POST["pnrno"][$i];
            $mofano = $_POST["mofano"][$i];
            $mofano2 = $_POST["mofano2"][$i];
            $passrerem = $_POST["passrerem"][$i];
            $passredt = $_POST["passredt"][$i];
            $arndate = $_POST["arndate"][$i];
            $arn = $_POST["arn"][$i];
            $jobdesig = $_POST["jobdesig"][$i];

            $imigdate = $_POST["imigdate"][$i];
            $imigstatus = $_POST["imigstatus"][$i];
            $category = $_POST["category"][$i];
            $passdeliver = $_POST["passdeliver"][$i];
            $remtran = $_POST["remtran"][$i];
            $invno = $_POST["invno"][$i];
            $jobid = $_POST["jobid"][$i];
            //            $category = mysqli_real_escape_string($conn, $_POST["category"]);


            $tfile = $_POST["tfile"][$i];
            $plbirth = $_POST["plbirth"][$i];
            $sex = $_POST["sex"][$i];
            $dob = $_POST["dob"][$i];

            $religion = $_POST["religion"][$i];
            $doe = $_POST["doe"][$i];
            $submission_date = $_POST["submission_date"][$i];
            $mofa_date = $_POST["mofa_date"][$i];
            $periodstay = $_POST["periodstay"][$i];
            $delvstatus = $_POST["delvstatus"][$i];
            $tmobile = $_POST["tmobile"][$i];
            //            browse($category);
            $dir = "images/" . $myyear . "/" . $mvouch;
            if (is_dir($dir) === false) {
                mkdir($dir);
            }
            //            browse($dir);
            $tpath = $dir . "/";

            $tfileNameU = $mvouch . "_" . $cnt . "_user.jpg";
            $tfileNameV = $mvouch . "_" . $cnt . "_visa.jpg";
            $tfileNameP = $mvouch . "_" . $cnt . "_pass.jpg";
            $tfileNamePB = $mvouch . "_" . $cnt . "_passb.jpg";

            $timg_fileU = $tpath . ($tfileNameU);
            $timg_fileP = $tpath . ($tfileNameP);
            $timg_filePB = $tpath . ($tfileNamePB);
            $timg_fileV = $tpath . ($tfileNameV);

            $tfileTmpLoc = $_FILES["tfile"]["tmp_name"][$i]; // File in the PHP tmp folder
            $tfileType = $_FILES["tfile"]["type"][$i]; // The type of file it is
            $tfileSize = $_FILES["tfile"]["size"][$i]; // File size in bytes
            $tfileErrorMsg = $_FILES["tfile"]["error"][$i]; // 0 for false... and 1 for true

            if (!empty($tfileTmpLoc)) {
                move_uploaded_file($tfileTmpLoc, "$timg_fileU");
            }


            $tfileTmpLoc2 = $_FILES["tfile2"]["tmp_name"][$i]; // File in the PHP tmp folder
            $tfileType2 = $_FILES["tfile2"]["type"][$i]; // The type of file it is
            $tfileSize2 = $_FILES["tfile2"]["size"][$i]; // File size in bytes
            $tfileErrorMsg2 = $_FILES["tfile2"]["error"][$i]; // 0 for false... and 1 for true

            if (!empty($tfileTmpLoc2)) {
                move_uploaded_file($tfileTmpLoc2, "$timg_fileV");
            }

            $tfileTmpLoc3 = $_FILES["tfile3"]["tmp_name"][$i]; // File in the PHP tmp folder
            $tfileType3 = $_FILES["tfile3"]["type"][$i]; // The type of file it is
            $tfileSize3 = $_FILES["tfile3"]["size"][$i]; // File size in bytes
            $tfileErrorMsg3 = $_FILES["tfile3"]["error"][$i]; // 0 for false... and 1 for true

            if (!empty($tfileTmpLoc3)) {
                move_uploaded_file($tfileTmpLoc3, "$timg_fileP");
            }


            $tfileTmpLoc4 = $_FILES["tfile4"]["tmp_name"][$i]; // File in the PHP tmp folder
            $tfileType4 = $_FILES["tfile4"]["type"][$i]; // The type of file it is
            $tfileSize4 = $_FILES["tfile4"]["size"][$i]; // File size in bytes
            $tfileErrorMsg4 = $_FILES["tfile4"]["error"][$i];

            if (!empty($tfileTmpLoc4)) {
                move_uploaded_file($tfileTmpLoc4, "$timg_filePB");
            }



            if (!empty($paxname)) {
                mysqli_query($conn, "INSERT INTO `visatran`(`myvouch`, `yearno`, `visatype`, `vouchno`, `vouchdt`, `srno`, `paxname`, `passport`,`passrecd`,`arndate`,`arn`,`jobdesig`,`jobid`,`imigdate`,`imigstatus`,agenttran,
                                                `issdate`, `issplace`, `carrier`, `fltno`, `fltdate`, `flttime`, `pnrno`,`doe`,`submission_date`,`mofa_date`,`dob`,`religion`,`plbirth`,`sex`,periodstay,
                                                `stampdate`,`stampstatus`, `mofano`,`mofano2`,`category`,`passdeliver`,`remtran`, `invno`,`imagepath`,imagevisa, imagepass,imagepassback, delvstatus,tmobile,address,passrerem,passredt,`adduser`)
                                        VALUES ('$mvouch','$myyear','$visatype','$voucher','$vouchdt','$cnt','$paxname','$passport','$passrecd','$arndate','$arn','$jobdesig','$jobid','$imigdate','$imigstatus','$agenttran',
                                                '$issdate','$issplace','$carrier','$fltno','$fltdate','$flttime','$pnrno','$doe','$submission_date','$mofa_date','$dob','$religion','$plbirth','$sex','$periodstay',
                                                '$stampdate','$stampstatus','$mofano','$mofano2',N'$category','$passdeliver','$remtran','$invno','$timg_fileU', '$timg_fileV','$timg_fileP','$timg_filePB','$delvstatus','$tmobile','$address','$passrerem','$passredt', '$adduser')") or die(mysqli_error($conn));
            }
        }

        mysqli_query($conn, "Delete from `$trandb2` where `myvouch`='$mvouch' AND visatype = '$visatype'") or die(mysqli_error($conn));
        $cnt2 = 0;
        for ($j = 0; $j <= $count2; $j++) {
            $cnt2++;
            $srno2 = $_POST["srno2"][$j];
            $type = $_POST["type"][$j];
            $noqty = $_POST["noqty"][$j];

            if (!empty($type)) {
                mysqli_query($conn, "INSERT INTO `category`(`myvouch`, `yearno`, `visatype`, `vouchno`, `srno`,
                                                `descrip`, `noqty`)
                                        VALUES ('$mvouch','$myyear','$visatype','$voucher','$cnt2',N'$type','$noqty')") or die(mysqli_error($conn));
            }
        }
        $source = "VISA";
        mysqli_query($conn, "DELETE FROM `actran` WHERE `vouchno` = '$mvouch' AND `source` = '$source' ") or die(mysqli_error($conn));
        if ($tot > 0) {
            $minus_amt = ($tot * -1);

            // sale part
            mysqli_query($conn, "INSERT INTO `actran`(date, vouchno,`godown`, source, trnno, accode, grpcode, amount)
                            VALUES ('$vouchdt','$mvouch','$godown', '$source', '001', '30','005', '$tot')") or die(mysqli_error($conn));

            // party part
            mysqli_query($conn, "INSERT INTO `actran`(date, vouchno, `godown`, source, trnno, accode, grpcode, amount)
                                VALUES ('$vouchdt','$mvouch','$godown', '$source', '002', '$agentcode','040', '$minus_amt')") or die(mysqli_error($conn));
        }

        if ($addflag == 1) {

            mysqli_query($conn, "INSERT INTO `$maindb`(`yearno`, `visatype`, `myvouch`, `vouchno`,`prefix`, `vouchdt`, `partyname`, `sponsor`,
                                               `oadd1`, `oadd2`, `oadd3`, `ladd1`, `ladd2`, `ladd3`, `visano`, `hijridate`, `catgmain`, `purpvisit`,
                                               `visaqty`, `drname`, `meddate`, `sector`, `remark`,`remark2`, `reqmed`, `mobile`,`compname`,
                                               `email`, `broker`, `idno`, `paidby`, `branch`, `contact`, `manualno`, `imagepath`,`imig`,`stamp`,`evisa`,
                                               `mis`,`mofa`,`misc`,`total`,`disc`,`tot`, `agentcode`,`feid`,`fepass`, `enttype`, `adduser`)
                                               VALUES ('$myyear','$visatype','$qvouch','$voucher','$prefix','$vouchdt', '$partyname',N'$sponsor',
                                                      N'$oadd1',N'$oadd2',N'$oadd3',N'$ladd1',N'$ladd2',N'$ladd3','$visano','$hijridate', '$catgmain' ,'$purpvisit',
                                                       '$visaqty','$drname','$meddate','$sector','$remark','$remark2','$reqmed','$mobile','$compname',
                                                       '$email',N'$broker','$idno','$paidby', '$branch','$contact','$manualno','$img_file','$imig','$stamp','$timg_fileEV',
                                                       '$mis','$mofa','$misc','$total','$disc','$tot','$agentcode','$feid','$fepass', '$enttype', '$adduser')") or die(mysqli_error($conn));

            insmess();
            $mvouch = $qvouch;
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        } else {

            mysqli_query($conn, "UPDATE `$maindb` SET  `vouchdt`='$vouchdt',`prefix`='$prefix', `partyname`='$partyname', `purpvisit`='$purpvisit',`feid`='$feid', `fepass`='$fepass',
                                                       `sponsor`=N'$sponsor', `oadd1`=N'$oadd1', `oadd2`=N'$oadd2', `oadd3`=N'$oadd3', `ladd1`=N'$ladd1',
                                                       `ladd2`=N'$ladd2', `ladd3`=N'$ladd3', `visano`='$visano', `hijridate`='$hijridate', `catgmain`='$catgmain', 
                                                       `visaqty`='$visaqty', `drname`='$drname', `meddate`='$meddate', `sector`='$sector', `remark`='$remark',
                                                       `remark2`='$remark2', compname='$compname', `reqmed`='$reqmed', `mobile`='$mobile', `email`='$email', `broker`=N'$broker', `idno`='$idno',
                                                       `paidby`='$paidby', `branch`='$branch', `contact`='$contact', `manualno`='$manualno', `imig`='$imig',`stamp`='$stamp',`mis`='$mis',
                                                       `mofa`='$mofa',`misc`='$misc',`total`='$total',`disc`='$disc',`tot`='$tot' , `enttype`='$enttype', `edituser`='$adduser'  where `myvouch` = '$mvouch' ") or die(mysqli_error($conn));

            //            updmess(); 
            //            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        }
    }
    mysqli_query($conn, "UNLOCK TABLES");
}
//        browse(1);


if ($addflag != 1) {

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

    mysqli_query($conn, "SET NAMES 'utf8'");
    mysqli_query($conn, 'SET CHARACTER SET utf8');
    $result = mysqli_query($conn, "SELECT *, date_format(`vouchdt`,'%d-%m-%Y') as mydt FROM `$maindb` WHERE $keyfld='$getvouch'") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);

    $visaget = $get['visatype'];
    $getrtype = [
        'W' => 'Work',
        'F' => 'Recruitment',
        'R' => 'Residence',
        'V' => 'Family Visit',
        'P' => 'Personal Visit',
        'T' => 'Temporary Work',
        'E' => 'Employment',
        'D' => 'Extend Return',
        'B' => 'Business Visit',
        'C' => 'Commecial Visit'
    ];
    $gvisatype = $getrtype[$visaget];
}


if (isset($_GET["delete"])) {
    $path = "images/" . $myyear . "/";
    $path2 = "images/" . $myyear . "/" . $_GET[$keyfld];

    $tqry = mysqli_query($conn, "SELECT * FROM `$trandb` WHERE `myvouch`='$_GET[$keyfld]' ORDER BY srno") or die(mysqli_error($conn));
    while ($nrow = mysqli_fetch_array($tqry)) {
        $imgpath = $nrow['imagepath'];
        unlink($imgpath);
    }



    delete($zdb, "$maindb", "$keyfld", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$trandb", "$keyfld", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$trandb2", "$keyfld", $_GET[$keyfld], "$file?mode=last");
    unlink($path . $_GET[$keyfld] . ".jpg");
    rmdir($path2);
}

include("includes/linkshead.php");
?>
<script src="MyScript/entry.js?a=2" type="text/javascript"></script>
<script src="MyScript/shortkeys.js" type="text/javascript"></script>
<!--<script src="MyScript/entry_search.js" type="text/javascript"></script>-->
<style>
    .tranedit {
        text-transform: uppercase;
        font-weight: bolder;
        float: right;
        color: #b91646;
    }
</style>
</head>

<body>
    <form action='' method='POST' enctype="multipart/form-data" accept-charset="utf-8">
        <!-- Default box -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                            <?php echo $formname; ?><span style="float: right;color:black"><?= $get['adduser'] ?><br><span style="color:#5D96E4;"><?= $get['edituser'] ?></span></span></h3>
                        <!--                            <span style="color: #5D96E4;font-size: 11px">
                                (Alt+T &nbsp;&nbsp;-&nbsp;&nbsp; New Visa Type)</span>-->
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg visa" style="color: #5D96E4">Visa Type</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad ">
                                <select name="visatype" class=" form-control form focusfield visatype" style="width: 100px;" required autofocus>
                                    <option value="<?php echo ($addflag != 1) ? $gvisatype : "W"; ?>"><?php echo ($addflag != 1) ? $gvisatype : "Work / Service"; ?></option>
                                    <?php
                                    if ($addflag == 1) {
                                    ?>
                                        <!--<option value='W'>Work</option>-->
                                        <option value='F'>Recruitment</option>
                                        <option value='R'>Residence</option>
                                        <option value='V'>Family Visit</option>
                                        <option value='P'>Personal Visit</option>
                                        <option value='T'>Temporary Work</option>
                                        <option value='E'>Employment</option>
                                        <option value='B'>Business Visit</option>
                                        <option value='C'>Commercial Visit</option>
                                    <?php
                                    }
                                    ?>
                                </select>
                            </div>

                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad ">
                                <input type="hidden" class="form-control form addflag addflg" value="<?php echo ($addflag != 1) ? $addflag : $addflag; ?>">
                                <input type="hidden" class="form-control form myvouch" value="<?php echo ($addflag != 1) ? $qvouch : $qvouch; ?>">
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Date</label>
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="date" class="form-control form vouchdt" name="vouchdt" value="<?php echo ($addflag != 1) ? $get["vouchdt"] : date("Y-m-d"); ?>" required>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad">
                                <label class="label-control marg" style="color: #5D96E4"> File No.</label>
                            </div>


                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad ">
                                <input type="text" class="form-control form manualno" id="manualno" name="manualno" value="<?php echo ($addflag != 1) ? $get["manualno"] : ""; ?>" required style="color: #5D96E4;background-color: white;border: 1px solid #5D96E4" readonly>
                                <input type="hidden" class="form-control form prefix" id="prefix" name="prefix" value="<?php echo ($addflag != 1) ? $get["prefix"] : ""; ?>" required style="color: #5D96E4;background-color: white;border: 1px solid #5D96E4; width:30%">
                                <input type="hidden" class="form-control form voucher" name="vouchno" value="<?php echo ($addflag != 1) ? $get["vouchno"] : ""; ?>" tabindex="-1" required readonly>
                            </div>


                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad agen">
                                <label class="label-control marg">Agent</label>
                            </div>
                            <div class="col-lg-2 col-md-1 col-sm-1 col-xs-1 pad agen">
                                <!--<input type="text" class="form-control form broker" id="broker" name="broker" value="<?php echo ($addflag != 1) ? $get["broker"] : ""; ?>">-->
                                <input list='broker' name='broker' value="<?php echo ($addflag != 1) ? $get["broker"] : ""; ?>" class='broker form-control form ' autocomplete="off">
                                <datalist id='broker' char="#">
                                    <option value=''></option>
                                    <?php
                                    $me = mysqli_query($conn, "SELECT `accode`,name FROM `accmast` where grpcode = '040' order by name") or die(mysqli_error($conn));

                                    while ($te = mysqli_fetch_array($me)) {
                                        $ename = $te['name'];
                                        echo "<option value='$ename'>";
                                    }
                                    ?>
                                </datalist>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad compagen">
                                <label class="label-control marg">Company</label>
                            </div>
                            <div class="col-lg-2 col-md-1 col-sm-1 col-xs-1 pad compagen">
                                <input list='compname' name='compname' value="<?php echo ($addflag != 1) ? $get["compname"] : ""; ?>" class='compname form-control form ' autocomplete="off">
                                <datalist id='compname' char="#">
                                    <option value=''></option>
                                    <?php
                                    $cme = mysqli_query($conn, "SELECT compname FROM `visamain` group by compname order by compname") or die(mysqli_error($conn));

                                    while ($cte = mysqli_fetch_array($cme)) {
                                        $cename = $cte['compname'];
                                        echo "<option value='$cename'>";
                                    }
                                    ?>
                                </datalist>
                            </div>
                            <div class="col-lg-2 col-xs-12 pad">
                                <a class="btn btn-primary showPdfModal" style="padding: 3px 15px">Pdf Upload</a>
                            </div>

                            <!--                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 pad"  style="">
                            
                                                            <input type="file" class="form-control form efile text-left" name="evisa" value="<?php // Echo ($addflag != 1) ? $get["evisa"] : "";               
                                                                                                                                                ?>">
                                                        </div>-->
                            <?php if ($addflag != 1) {
                            ?>
                                <!--                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 pad"  style="">
                                
                                                                    <i class='fa fa-picture-o imgshow1'  style='font-size:28px'></i>
                                                                </div>-->
                            <?php } ?>

                        </div>
                        <!--                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad" style="width:2.45%">
                                                        <button id='brksrch' type="button" class="btn btn-pad " data-toggle="modal"  style="background-color:#5D96E4;color:white;padding-top:3px;padding-bottom:3px; ">
                                                            <i class="fa fa-search"></i>
                                                        </button>
                                                    </div>-->
                        <div class="row">
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Sponsor Name</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                <!--<input type="text" class="form-control form sponsor" name="sponsor" id="sponsor" value="<?php echo ($addflag != 1) ? $get["sponsor"] : ""; ?>">-->
                                <input list='sponsor' name='sponsor' value="<?php echo ($addflag != 1) ? $get["sponsor"] : ""; ?>" class='sponsor form-control form ' autocomplete="off">
                                <datalist id='sponsor' char="#">
                                    <option value=''></option>
                                    <?php
                                    $mes = mysqli_query($conn, "SELECT `sponsor` FROM `visamain` where sponsor != '' order by sponsor") or die(mysqli_error($conn));

                                    while ($tes = mysqli_fetch_array($mes)) {
                                        $sname = $tes['sponsor'];
                                        echo "<option value='$sname'>";
                                    }
                                    ?>
                                </datalist>
                            </div>
                            <!--                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad" style="">
                                                            <button id='spnname' type="button" class="btn btn-pad " data-toggle="modal"  style="background-color:#5D96E4;color:white;padding-top:3px;padding-bottom:3px; ">
                                                                <i class="fa fa-search"></i>
                                                            </button>
                                                        </div>-->
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Visa No.</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                <input type="text" class="form-control form visano" id="visano" name="visano" value="<?php echo ($addflag != 1) ? $get["visano"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">ID No.</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad ">
                                <input type="text" class="form-control form idno" name="idno" value="<?php echo ($addflag != 1) ? $get["idno"] : ""; ?>">
                            </div>

                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Email</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">

                                <input type="email" class="form-control form email" name="email" value="<?php echo ($addflag != 1) ? $get["email"] : ""; ?>">
                            </div>
                            <!--                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad " >
                                                            <label class="label-control marg ">E-Visa</label>
                                                        </div>-->




                        </div>
                        <div class="row">

                            <div class="col-lg-1 col-md-3 col-sm-1 col-xs-1 text-right pad">
                                <label class="label-control marg">Place</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <select name="sector" class=" form-control form  sector" required>
                                    <option value="<?php echo ($addflag != 1) ? $get["sector"] : "MUMBAI"; ?>"><?php echo ($addflag != 1) ? $get["sector"] : "MUMBAI"; ?></option>
                                    <option value="MUMBAI">MUMBAI</option>
                                    <option value="New DELHI">NEW DELHI</option>

                                </select>
                            </div>
                            <!--                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad" style="">
                                                                                            <button id='spnname' type="button" class="btn btn-pad " data-toggle="modal"  style="background-color:#5D96E4;color:white;padding-top:3px;padding-bottom:3px; ">
                                                                                                <i class="fa fa-search"></i>
                                                                                            </button>
                                                        </div>-->
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad  ">
                                <label class="label-control marg">Visa Qty.</label>
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-1 col-xs-1 pad">
                                <input type="text" class="form-control form visaqty" name="visaqty" value="<?php echo ($addflag != 1) ? $get["visaqty"] : ""; ?>">
                            </div>

                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg branch" style="color: #5D96E4">Branch</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad ">
                                <select name="branch" class=" form-control form focusfield branch" required autofocus>
                                    <option value=""></option>
                                    <option <?php
                                            if ($get['branch'] == 'M') {
                                                echo "selected=selected";
                                            }
                                            ?> value='M'>Mumbai</option>
                                    <option <?php
                                            if ($get['branch'] == 'N') {
                                                echo "selected=selected";
                                            }
                                            ?> value='N'>New Delhi</option>
                                    <option <?php
                                            if ($get['branch'] == 'L') {
                                                echo "selected=selected";
                                            }
                                            ?> value='L'>Lucknow</option>
                                </select>
                            </div>


                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Hijiri</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form hijridate" name="hijridate" value="<?php echo ($addflag != 1) ? $get["hijridate"] : ""; ?>">
                            </div>





                        </div>
                        <div class="row">
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad">
                                <label class="label-control marg">Paid By</label>
                            </div>
                            <div class="col-lg-2 col-md-1 col-sm-1 col-xs-1 pad">
                                <select id="paidby" name="paidby" class=" form-control form paidby">
                                    <option value=""></option>
                                    <option <?php
                                            if ($get['paidby'] == 'C') {
                                                echo "selected=selected";
                                            }
                                            ?> value='C'>Cash</option>
                                    <option <?php
                                            if ($get['paidby'] == 'R') {
                                                echo "selected=selected";
                                            }
                                            ?> value='R'>Credit</option>
                                    <option <?php
                                            if ($get['paidby'] == 'U') {
                                                echo "selected=selected";
                                            }
                                            ?> value='U'>UPI / RTGS</option>

                                </select>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">FE ID</label>
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form feid" name="feid" value="<?php echo ($addflag != 1) ? $get["feid"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">FE Password</label>
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form fepass" name="fepass" value="<?php echo ($addflag != 1) ? $get["fepass"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Category</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form catgmain" name="catgmain" value="<?php echo ($addflag != 1) ? $get["catgmain"] : ""; ?>">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Remarks</label>
                            </div>
                            <div class="col-lg-5 col-md-5 col-sm-3 col-xs-3 pad">
                                <input type="text" class="form-control form remark" name="remark" value="<?php echo ($addflag != 1) ? $get["remark"] : ""; ?>">
                                <input type="text" class="form-control form remark" name="remark2" value="<?php echo ($addflag != 1) ? $get["remark2"] : ""; ?>">
                            </div>
                            <div class="col-lg-2 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">File Type</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <select name="enttype" class="form-control form enttype" style="width: 100px;" required>
                                    <option value="<?= ($addflag != 1) ? $get['enttype'] : ""; ?>"> <?= ($addflag != 1) ? $get['enttype'] : "Direct"; ?></option>
                                    <option value="Direct">Direct</option>
                                    <option value="Indirect">Indirect</option>
                                </select>
                            </div>

                        </div>
                        <br>
                        <div class="pax_d">
                            <div class="table-responsive">
                                <table class="  table-striped table-condensed table-bordered" width=215%">
                                    <thead class="mySearchTr">
                                        <tr>
                                            <th style="width: 1%;"></th>
                                            <th style="width: 2%;">Sr.</th>
                                            <th colspan='2' style="width: 4%;">Passport</th>
                                            <th style="width: 15%;">Pax Name</th>
                                            <th style="width: 4%;">Sex</th>
                                            <th style="width: 10%;" class="compagen">Agent</th>
                                            <!--<th style="width: 4%;">Passport</th>-->
                                            <th style="width: 4%;">Passport <br>Received</th>
                                            <th colspan='2' style="width: 5%;">Emigration<br>Status</th>
                                            <th style='width: 5%'>Mofa No.1</th>
                                            <th style='width: 4%'>Mofa Date</th>
                                            <th style='width: 5%'>Mofa No.2</th>
                                            <th style='width: 4%'>Stamp Status</th>
                                            <?php
                                            if ($addflag != 1) {
                                            ?>
                                                <th style="width: 2%;">Visa</th>
                                                <th style="width: 2%;">UT</th>
                                                <th style="width: 2%;">DL</th>
                                                <th style="width: 2%;">Barcode</th>
                                                <th style="width: 2%;">Image</th>
                                            <?php
                                            }
                                            ?>
                                            <th style="width: 2%;">DOB</th>
                                            <!--                                                <th style="width: 2%;">FE ID</th> 
                                            <th style="width: 2%;">FE PASSWORD</th> -->
                                            <th style="width: 5%;">Religion</th>
                                            <th style="width: 5%;">POB</th>
                                            <th style="width: 5%;">POI</th>
                                            <th style="width: 5%;">Stay<br> Period</th>
                                            <th style='width: 1%'>DOI</th>
                                            <th style='width: 1%'>DOE</th>
                                            <th style='width: 2%'>Submission Date</th>
                                            <!--<th style='width: 5%'>Carrier</th>-->
                                            <!--<th style='width: 4%'>Flight No.</th>-->
                                            <!--<th style='width: 2%'>Flight Date</th>-->
                                            <!--<th style='width: 4%'>Flight Time</th>-->
                                            <!--<th style='width: 5%'>PNR No.</th>-->
                                            <th style='width: 4%'>Stamp Date</th>
                                            <th style='width: 5%'>Category</th>
                                            <th style='width: 5%'>Passport <br>Delivery</th>
                                            <th style='width: 15%'>Remark</th>
                                            <th style='width: 5%'>Inv No.</th>
                                            <th style='width: 15%'>Address</th>
                                            <th style='width: 5%'>Passport Released Date</th>
                                            <th style='width: 2%'>Passport Released Remark</th>
                                            <th style='width: 2%'>User Photo</th>
                                            <th style='width: 2%'>Visa Upload</th>
                                            <th style='width: 2%'>Passport Front</th>
                                            <th style='width: 2%'>Passport Back</th>

                                        </tr>
                                    </thead>
                                    <tbody class="tbody">
                                        <?php
                                        if ($addflag != 1) {
                                            $qry = mysqli_query($conn, "SELECT * FROM `$trandb` WHERE `myvouch`='$get[myvouch]' ORDER BY srno") or die(mysqli_error($conn));
                                            $ctr = 0;
                                            while ($row = mysqli_fetch_array($qry)) {

                                                if ($row['delvstatus'] == 'E') {
                                                    $dlvstatus = "ECR";
                                                } elseif ($row['delvstatus'] == 'N') {
                                                    $dlvstatus = "ECNR";
                                                } else {
                                                    $dlvstatus = "";
                                                }


                                                echo "<tr>";
                                                echo "<td><i class='fa fa-close remove'></i></td>";
                                                echo "<td>";
                                                echo "<input type='text' name='srno[]' class='srno form-control form' value='$row[srno]'>";
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<input type='text' name='passport[]'  class='passport form-control  form' value='$row[passport]' >";
                                                echo "</td>";
                                                echo "<td>";

                                                echo "<i class='fa fa-pencil edit1 form-control form'></i>";

                                                echo "</td>";
                                                echo "<td>";
                                                echo "<input type='text' name='paxname[]' class='paxname form-control  form' value='$row[paxname]' >";
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<select class='form-control form sex' name='sex[]' >";
                                                echo "<option value='$row[sex]'>$row[sex]</option>";
                                                echo "<option value='M'>M</option>";
                                                echo "<option value='F'>F</option>";
                                                echo "</select>";
                                                echo "</td>";
                                                echo "<td class='compagen'>";
                                        ?>
                                                <input list='agenttran' name='agenttran[]' value="<?php echo ($addflag != 1) ? $row["agenttran"] : ""; ?>" class='agenttran  form-control form ' autocomplete="off">
                                                <datalist id='agenttran' char="#">
                                                    <option value=''></option>
                                                    <?php
                                                    $meg = mysqli_query($conn, "SELECT `accode`,name FROM `accmast` where grpcode = '040' order by name") or die(mysqli_error($conn));

                                                    while ($teg = mysqli_fetch_array($meg)) {
                                                        $egname = $teg['name'];
                                                        echo "<option value='$egname'>";
                                                    }
                                                    ?>
                                                </datalist>
                                                <?php
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<input type='date' name='passrecd[]'  class='passrecd form-control  form' value='$row[passrecd]' >";
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<select class='delvstatus form-control form' name='delvstatus[]' >";
                                                echo "<option value='$row[delvstatus]'>$dlvstatus</option>";
                                                echo "<option value='E'>ECR</option>";
                                                echo "<option value='N'>ECNR</option>";
                                                echo "</select>";

                                                echo "<input type='hidden' class='form-control form arndate'    name='arndate[]'    value='$row[arndate]'>";
                                                echo "<input type='hidden' class='form-control form arn'    name='arn[]'    value='$row[arn]'>";
                                                echo "<input type='hidden' class='form-control form jobdesig' name='jobdesig[]' value='$row[jobdesig]'>";
                                                echo "<input type='hidden' class='form-control form jobid' name='jobid[]'     value='$row[jobid]'>";
                                                echo "<input type='hidden' class='form-control form text-right imigdate' name='imigdate[]'      value='$row[imigdate]'>";
                                                echo "<input type='hidden' class='form-control form imigstatus' name='imigstatus[]'    value='$row[imigstatus]'>";
                                                echo "<input type='hidden' class='form-control form tmobile'    name='tmobile[]'    value='$row[tmobile]'>";

                                                echo "</td>";
                                                echo "<td>";
                                                if ($row['delvstatus'] == 'E' && $get['visatype'] == 'W') {
                                                    echo "<i class='fa fa-pencil edit form-control form'></i>";
                                                }
                                                echo "</td>";
                                                echo "<td><input type='text' name='mofano[]' class='mofano form-control  form' value='$row[mofano]' ></td>";
                                                echo "<td><input type='date' name='mofa_date[]' class='mofdate form-control  form'  value='$row[mofa_date]'  style='width:120px;'></td>";
                                                echo "<td><input type='text' name='mofano2[]' class='mofano2 form-control  form' value='$row[mofano2]' ></td>";
                                                echo "<td>";
                                                echo "<select class='form-control form stampstatus' name='stampstatus[]' >";
                                                echo "<option value='$row[stampstatus]'>$row[stampstatus]</option>";
                                                echo "<option value=''></option>";
                                                echo "<option value='Y'>Yes</option>";
                                                echo "<option value='N'>No</option>";
                                                echo "</select>";
                                                echo "</td>";

                                                echo "<td><a href='visaapp_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]' target='_blank'><i class='fa fa-cc-visa' style='font-size:24px'> </i></a></td>";
                                                echo "<td><a href='undertaking_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]'  target='_blank'><i class='fa fa-file-text'  style='font-size:24px'></i></a></td>";
                                                echo "<td><a href='license_pdf.php?visano=$get[visano]&paxname=$row[paxname]'  target='_blank'><i class='fa fa-clipboard'  style='font-size:24px'></i></a></td>";
                                                echo "<td><a href='visa_barcode.php?visano=$get[visano]&mofano=$row[mofano]'  target='_blank'><i class='fa fa-barcode' style='font-size:27px'></i></a></td>";
                                                echo "<td><i class='fa fa-picture-o imgshow'  style='font-size:28px'></i></td>";

                                                echo "<td><input type='date' name='dob[]' class='dob form-control  form'  value='$row[dob]' style='width:120px;'></td>";
                                                //                                                    Echo "<td><input type='text' name='feid[]' class='feid form-control  form'  value='$row[feid]' style='width:60px;'></td>";
                                                //                                                    Echo "<td><input type='text' name='fepassword[]' class='fepassword form-control  form'  value='$row[fepassword]' style='width:60px;'></td>";
                                                echo "<td>";
                                                echo "<select class='form-control form religion' name='religion[]' >";
                                                echo "<option value='$row[religion]'>$row[religion]</option>";
                                                echo "<option value='Muslim'>Muslim</option>";
                                                echo "<option value='Non Muslim'>Non Muslim</option>";
                                                echo "</select>";
                                                echo "</td>";
                                                //                                                Echo "<td><input type='text' name='religion[]' class='religion form-control  form'  value='$row[religion]' ></td>";
                                                echo "<td>";
                                                echo "<input type='text' name='plbirth[]' class='pob form-control  form' value='$row[plbirth]' >";
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<input type='text' name='issplace[]' class='issplace form-control  form' value='$row[issplace]'>";
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<select class='form-control form periodstay' name='periodstay[]' >";
                                                echo "<option value='$row[periodstay]'>$row[periodstay]</option>";
                                                echo "<option value=''></option>";
                                                echo "<option value='1 year'>1 year</option>";
                                                echo "<option value='2 year'>2 year</option>";
                                                echo "<option value='90 days'>90 days</option>";
                                                echo "</select>";
                                                echo "</td>";
                                                //                                                Echo "<td><input type='text' name='periodstay[]' class='periodstay form-control  form'  value='$row[periodstay]'></td>";
                                                echo "<td><input type='date' name='issdate[]' class='issdate form-control  form'  value='$row[issdate]'  style='width:120px;'></td>";
                                                echo "<td><input type='date' name='doe[]' class='expdate form-control  form'  value='$row[doe]'  style='width:120px;'></td>";
                                                echo "<td><input type='date' name='submission_date[]' class='subdate form-control  form'  value='$row[submission_date]'  style='width:120px;'></td>";
                                                //                                                Echo "<td><input type='text' name='carrier[]' class='carrier form-control  form' value='$row[carrier]' ></td>";
                                                //                                                Echo "<td><input type='text' name='fltno[]' class='fltno form-control  form' value='$row[fltno]' ></td>";
                                                //                                                Echo "<td><input type='date' name='fltdate[]' class='fltdate form-control  form'  value='$row[fltdate]'  style='width:120px;'></td>";
                                                //                                                Echo "<td><input type='text' name='flttime[]' class='flttime form-control  form' value='$row[flttime]' ></td>";
                                                //                                                Echo "<td><input type='text' name='pnrno[]' class='pnrno form-control  form' value='$row[pnrno]' ></td>";
                                                echo "<td><input type='date' name='stampdate[]' class='stampdate form-control  form'  value='$row[stampdate]'  style='width:120px;'></td>";
                                                echo "<td>";
                                                echo "<input list='category' name='category[]' class='size  cat form-control form ' autocomplete='off' value='$row[category]'> ";
                                                echo "<datalist id='category' char='#'>";
                                                echo "<option >";

                                                $msize = mysqli_query($conn, "SELECT `category` FROM `visatran` group by category") or die(mysqli_error($conn));

                                                while ($tsize = mysqli_fetch_array($msize)) {
                                                    $sizename = $tsize['category'];
                                                    echo "<option value='$sizename'>";
                                                }
                                                echo "</datalist>";
                                                echo "</td>";
                                                echo "<td><input type='date' name='passdeliver[]' class='passdeliver form-control  form'  value='$row[passdeliver]'  style='width:120px;'></td>";
                                                echo "<td><input type='text' name='remtran[]' class='remtran form-control  form'  value='$row[remtran]'  style='width:120px;'></td>";
                                                echo "<td><input type='text' name='invno[]' class='invno form-control  form'  value='$row[invno]'  style='width:120px;'></td>";
                                                echo "<td><input type='text' name = 'address[]' class ='address form-control form' value='$row[address]' style='width:120px;'></td>";
                                                echo "<td><input type='date' name='passredt[]' class='passredt form-control  form'  value='$row[passredt]'  style='width:120px;'></td>";

                                                echo "<td><input type='text' name = 'passrerem[]' class ='passrerem form-control form' value='$row[passrerem]' style='width:120px;'></td>";
                                                echo "<td>
                                                        <input type='file' name='tfile[]'  class='form file1 btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
                                                echo "<td>
                                                        <input type='file' name='tfile2[]'  class='form file2 btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
                                                echo "<td>
                                                        <input type='file' name='tfile3[]'  class='form  file3 btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
                                                echo "<td>
                                                        <input type='file' name='tfile4[]'  class='form file4 btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
                                                //                                                Echo "<td><img class='preview'  style='height:98px;width:98px;display:inline' src='$row[imagepath]?a=" . mt_rand() . "' alt='your image'></td>";
                                                //                                                Echo "<td><img class='preview'  style='height:98px;width:98px;display:inline' src='$row[imagepath]?a=" . mt_rand() . "' alt='your image'></td>";
                                                echo "</tr>";
                                                $ctr++;
                                                ?>
                                                <p class="tranedit"><?php echo $row['adduser'] ?></p>
                                            <?php
                                            }
                                        } else {
                                            ?>
                                            <tr>
                                                <td><i class='fa fa-close remove form-control form'></i></td>
                                                <td><input type='text' name='srno[]' class='srno form-control sex form' value='1'></td>
                                                <td>
                                                    <input type='text' name='passport[]' class='passport form-control  form' value=''>
                                                </td>
                                                <td><i class='fa fa-pencil edit1'></i></td>
                                                <td>
                                                    <input type='text' name='paxname[]' class='paxname form-control  form' value=''>
                                                </td>
                                                <td>
                                                    <?php
                                                    echo "<select class='form-control sex form' name='sex[]' >";
                                                    echo "<option value= ''></option>";
                                                    echo "<option value='M'>M</option>";
                                                    echo "<option value='F'>F</option>";
                                                    echo "</select>";
                                                    ?>
                                                </td>
                                                <td class="compagen">

                                                    <input list='agenttran' name='agenttran[]' value="<?php echo ($addflag != 1) ? $get["agenttran"] : ""; ?>" class='agenttran  form-control form ' autocomplete="off">
                                                    <datalist id='agenttran' char="#">
                                                        <option value=''></option>
                                                        <?php
                                                        $meg = mysqli_query($conn, "SELECT `accode`,name FROM `accmast` where grpcode = '040' order by name") or die(mysqli_error($conn));

                                                        while ($teg = mysqli_fetch_array($meg)) {
                                                            $egname = $teg['name'];
                                                            echo "<option value='$egname'>";
                                                        }
                                                        ?>
                                                    </datalist>
                                                </td>
                                                <td>
                                                    <input type='date' name='passrecd[]' class='passrecd form-control  form' value=''>
                                                </td>
                                                <td>
                                                    <?php
                                                    echo "<select class='delvstatus form-control form' name='delvstatus[]' >";
                                                    echo "<option value=''></option>";
                                                    echo "<option value='E'>ECR</option>";
                                                    echo "<option value='N'>ECNR</option>";
                                                    echo "</select>";

                                                    echo "<input type='hidden' class='form-control form tmobile'    name='tmobile[]'    value=''>";
                                                    echo "<input type='hidden' class='form-control form arndate'    name='arndate[]'    value=''>";
                                                    echo "<input type='hidden' class='form-control form arn'    name='arn[]'    value=''>";
                                                    echo "<input type='hidden' class='form-control form jobdesig' name='jobdesig[]' value=''>";
                                                    echo "<input type='hidden' class='form-control form jobid'     name='jobid[]'     value=''>";
                                                    echo "<input type='hidden' class='form-control form text-right imigdate'      name='imigdate[]'      value=''>";
                                                    echo "<input type='hidden' class='form-control form imigstatus'    name='imigstatus[]'    value=''>";
                                                    ?>
                                                </td>
                                                <td><i class='fa fa-pencil edit'></i></td>
                                                <td><input type='text' name='mofano[]' class='mofano form-control  form' value=''></td>
                                                <td><input type='date' name='mofa_date[]' class='mofdate form-control  form' value=''></td>
                                                <td><input type='text' name='mofano2[]' class='mofano2 form-control  form' value=''></td>
                                                <?
                                                echo "<td>";
                                                echo "<select class='form-control form stampstatus' name='stampstatus[]' >";
                                                echo "<option value='$row[stampstatus]'>$row[stampstatus]</option>";
                                                echo "<option value='Y'>Yes</option>";
                                                echo "<option value='N'>No</option>";
                                                echo "</select>";
                                                echo "</td>";
                                                ?>

                                                <td><input type='date' name='dob[]' class='dob form-control  form' value=''></td>
                                                <!--                                                    <td><input type='text' name='feid[]' class='issdate form-control  form'  value=''></td>
                                        <td><input type='text' name='fepassword[]' class='issdate form-control  form'  value=''></td>-->
                                                <?
                                                echo "<td>";
                                                echo "<select class='form-control form religion' name='religion[]' >";
                                                echo "<option value='$row[religion]'>$row[religion]</option>";
                                                echo "<option value='Muslim'>Muslim</option>";
                                                echo "<option value='Non Muslim'>Non Muslim</option>";
                                                echo "</select>";
                                                echo "</td>";
                                                ?>
                                                <!--<td><input type='text' name='religion[]' class='religion form-control  form'  value='Muslim'></td>-->
                                                <td><input type='text' name='plbirth[]' class='pob form-control  form' value=''></td>
                                                <td><input type='text' name='issplace[]' class='issplace form-control  form' value=''></td>
                                                <?
                                                echo "<td>";
                                                echo "<select class='form-control form periodstay' name='periodstay[]' >";
                                                echo "<option value='$row[periodstay]'>$row[periodstay]</option>";
                                                echo "<option value=''></option>";
                                                echo "<option value='1 year'>1 year</option>";
                                                echo "<option value='2 year'>2 year</option>";
                                                echo "<option value='90 days'>90 days</option>";
                                                echo "</select>";
                                                echo "</td>";
                                                ?>
                                                <!--<td><input type='text' name='periodstay[]' class='periodstay form-control  form' value=''></td>-->
                                                <td><input type='date' name='issdate[]' class='issdate form-control  form' value=''></td>
                                                <td><input type='date' name='doe[]' class='expdate form-control  form' value=''></td>
                                                <td><input type='date' name='submission_date[]' class='subdate form-control  form' value=''></td>
                                                <!--                                                <td><input type='text' name='carrier[]' class='carrier form-control  form' value='' ></td>
                                        <td><input type='text' name='fltno[]' class='fltno form-control  form' value='' ></td>
                                        <td><input type='date' name='fltdate[]' class='fltdate form-control  form'  value='' ></td>
                                        <td><input type='text' name='flttime[]' class='flttime form-control  form' value='' ></td>
                                        <td><input type='text' name='pnrno[]' class='pnrno form-control  form' value='' ></td>-->
                                                <td><input type='date' name='stampdate[]' class='stampdate form-control  form' value=''></td>

                                                <td>
                                                    <input list='category' name='category[]' value="" class='size cat form-control form ' autocomplete="off">
                                                    <datalist id='category' char="#">
                                                        <option value=''></option>
                                                        <?php
                                                        $msize = mysqli_query($conn, "SELECT `category` FROM `visatran` group by category ") or die(mysqli_error($conn));

                                                        while ($tsize = mysqli_fetch_array($msize)) {
                                                            $sizename = $tsize['category'];
                                                            echo "<option value='$sizename'>";
                                                        }
                                                        ?>
                                                    </datalist>
                                                </td>
                                                <td><input type='date' name='passdeliver[]' class='passdeliver form-control  form' value=''></td>
                                                <td><input type='text' name='remtran[]' class='remtran form-control  form' value=''></td>
                                                <td><input type='text' name='invno[]' class='invno form-control  form' value=''></td>
                                                <td><input type='text' name='address[]' class='address form-control  form' value='' style='width:120px;'></td>
                                                <td><input type='date' name='passredt[]' class='passredt form-control  form' value=''></td>

                                                <td><input type='text' name='passrerem[]' class='passrerem form-control  form' value='' style='width:120px;'></td>


                                                <td><input type='file' name='tfile[]' class='form btn btn-primary ' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                <td><input type='file' name='tfile2[]' class='form btn btn-primary ' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                <td><input type='file' name='tfile3[]' class='form btn btn-primary ' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                    <!--<input type='button'  class='form btn btn-primary showimg' style='padding: 0px;margin: 0px;display:inline;width:98px'>-->
                                                </td>
                                                <td><input type='file' name='tfile4[]' class='form btn btn-primary ' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                    <!--<input type='button'  class='form btn btn-primary showimg' style='padding: 0px;margin: 0px;display:inline;width:98px'>-->
                                                </td>
                                                <!--<td><img class='preview' style='height:98px;display:inline' src='' alt='your image'></td>-->
                                            </tr>
                                        <?php
                                        }
                                        ?>
                                    </tbody>
                                </table>
                            </div>
                            <div>
                                <button type='button' class='btn btn-success btn-square form' id='addnew'>
                                    <i class='fa fa-plus' style='color:#ffffff' data-toggle='tooltip' title='Add Row'></i>
                                </button>
                                <input type='hidden' name='items' id="items" class='items form-control  form' value='<?php echo ($addflag != 1) ? $ctr : 1; ?>'>
                            </div>
                        </div>
                        <div class=' cat_d' style="display: none">
                            <div class="table-responsive">
                                <table class="table-striped table-condensed table-bordered" width="40%">
                                    <thead class="mySearchTr">
                                        <tr>
                                            <th style="width: 2%;"></th>
                                            <th style="width: 3%;">Sr.</th>
                                            <th style="width: 20%;">Type</th>
                                            <th style="width: 10%;">Qty.</th>
                                        </tr>
                                    </thead>
                                    <tbody class="tbody2">
                                        <?php
                                        if ($addflag != 1) {
                                            $qry2 = mysqli_query($conn, "SELECT * FROM `$trandb2` WHERE `myvouch`='$get[myvouch]' ORDER BY srno") or die(mysqli_error($conn));
                                            $ctr2 = 0;
                                            while ($row2 = mysqli_fetch_array($qry2)) {
                                                echo "<tr>";
                                                echo "<td><i class='fa fa-close remove'></i></td>";
                                                echo "<td>";
                                                echo "<input type='text' name='srno2[]' class='srno2 form-control form' value='$row2[srno]'>";
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<input type='text' name='type[]'  class='type form-control  form' value='$row2[descrip]' >";
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<input type='text' name='noqty[]'  class='noqty form-control  form' value='$row2[noqty]' >";
                                                echo "</td>";
                                                echo "</tr>";
                                                $ctr2++;
                                            }
                                        } else {
                                        ?>
                                            <tr>
                                                <td><i class='fa fa-close remove'></i></td>
                                                <td><input type='text' name='srno2[]' class='srno2 form-control form' value='1'></td>
                                                <td>
                                                    <input type='text' name='type[]' class='type form-control  form' value=''>
                                                </td>
                                                <td>
                                                    <input type='text' name='noqty[]' class='noqty form-control  form' value=''>
                                                </td>
                                            </tr>
                                        <?php
                                        }
                                        ?>
                                    </tbody>
                                </table>
                            </div>
                            <div>
                                <button type='button' class='btn btn-success btn-square form' id='addnew2'>
                                    <i class='fa fa-plus' style='color:#ffffff' data-toggle='tooltip' title='Add Row'></i>
                                </button>
                                <input type='hidden' name='items2' id="items2" class='items2 form-control  form' value='<?php echo ($addflag != 1) ? $ctr2 : 0; ?>'>
                            </div>
                        </div>
                        <br>

                        <div>
                            <div class="col-lg-12 col-xs-12 pad">
                                <div class="col-lg-6 col-xs-12 pad">
                                    <!--                                <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                                                        <label class="label-control marg">Doctor Name</label>
                                                                    </div>
                                                                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                                                        <input type="text" class="form-control form drname" name="drname" value="<?php echo ($addflag != 1) ? $get["drname"] : ""; ?>">
                                                                    </div>
                                                                    <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                                                        <label class="label-control marg">Date</label>
                                                                    </div>
                                                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad" style="width:10.55%;" >
                                                                        <input type="date" class="form-control form meddate" name="meddate"  value="<?php echo ($addflag != 1) ? $get["meddate"] : date("Y-m-d"); ?>">
                                                                    </div>-->

                                </div>
                                <div class="col-lg-6 col-xs-12 pad">
                                    <div class="col-lg-12 col-xs-12 pad">

                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad text-right">
                                            <label class="label-control marg">Mofa</label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="mofa" class="form-control form text-right tottotal mofa" value="<?php echo ($addflag != 1) ? $get['mofa'] : "0"; ?>">
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-xs-12 pad">
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad text-right">
                                            <label class="label-control marg">Stamping</label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="stamp" class="form-control form text-right totamt stamp" value="<?php echo ($addflag != 1) ? $get['stamp'] : "0"; ?>">
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-xs-12 pad">
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad text-right">
                                            <label class="label-control marg">Emigration</label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="imig" class="form-control form text-right totamt imig" value="<?php echo ($addflag != 1) ? $get['imig'] : "0"; ?>">
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-xs-12 pad">
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad text-right">
                                            <label class="label-control marg">Other Charges </label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="mis" class="form-control form text-right totamt mis" value="<?php echo ($addflag != 1) ? $get['mis'] : "0"; ?>">
                                        </div>
                                    </div>



                                    <div class="col-lg-12 col-xs-12 pad">
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad text-right">
                                            <label class="label-control marg">Miscellaneous</label>
                                        </div>

                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="misc" class="form-control  text-right totadv form misc" value="<?php echo ($addflag != 1) ? $get['misc'] : "0"; ?>">
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-xs-12 pad">
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad text-right">
                                            <label class="label-control marg">Total</label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="total" required="true" class="form-control form text-right total" value="<?php echo ($addflag != 1) ? $get['total'] : "0"; ?>" readonly tabindex="-1">
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-xs-12 pad">
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad text-right">
                                            <label class="label-control marg">Discount</label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="disc" required="true" class="form-control form text-right disc" value="<?php echo ($addflag != 1) ? $get['disc'] : "0"; ?>">
                                        </div>
                                    </div>
                                    <div class="col-lg-12 col-xs-12 pad">

                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad"></div>
                                        <div class="col-lg-3 pad text-right">
                                            <label class="label-control marg">Final Amount</label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="tot" required="true" class="form-control form text-right tot" value="<?php echo ($addflag != 1) ? $get['tot'] : "0"; ?>" readonly tabindex="-1">
                                        </div>
                                    </div>

                                </div>

                            </div>
                        </div>
                        <br>
                        <!--<div class="row" style="text-align: center;background-color: #eacfd0;border:2px solid #5D96E4;height: 30px;padding-top: 5px">-->
                        <!--                            <strong style="color: #5D96E4;font-size:21px"><center>Medical Details</center></strong>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Doctor Name</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="text" class="form-control form drname" name="drname" value="<?php echo ($addflag != 1) ? $get["drname"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Date</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad" style="width:10.55%;" >
                                <input type="date" class="form-control form meddate" name="meddate"  value="<?php echo ($addflag != 1) ? $get["meddate"] : date("Y-m-d"); ?>">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Required Medical</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad" style="width:27.2%;" >
                                <input type="text" class="form-control form reqmed" name="reqmed" value="<?php echo ($addflag != 1) ? $get["reqmed"] : ""; ?>">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Choose File</label>
                        </div>
                        <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="file" name="file" id="file" class="form btn btn-primary" >
                        </div>
                        <div class="col-lg-2" style="float:right">
                            <img id="preview" style="height:130px" src="<?php echo ($addflag != 1) ? $get['imagepath'] . "?a=" . mt_rand() : "" ?>" alt="your image"/>
                        </div>
                    </div>-->
                    </div>
                    <div class="panel-footer">
                        <? include("includes/buttons.php"); ?>
                    </div>
                </div>
                <div class="modal fade bd-example-modal-lg" id="myEcr" role="dialog">
                    <div class="modal-dialog modal-lg">

                        <!-- Modal content-->
                        <div class="modal-content">
                            <div class="modal-header">
                                <!--<button class="close" data-dismiss="modal"><span>&times;</span></button>-->
                                <h4 class="modal-title" id="">Employment And ECR</h4>
                            </div>

                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">ARN Date</label>
                                </div>
                                <div class="col-lg-2 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="date" size="80" value="<?php ?>" class="darndate form-control form" />
                                </div>

                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">ARN</label>
                                </div>
                                <div class="col-lg-3 col-md-3 col-sm-8 col-xs-8 pad">
                                    <input type="text" class="darn form-control form ">
                                </div>
                            </div>
                            <br>

                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Job Designation</label>
                                </div>
                                <div class="col-lg-2 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="text" class="djobdes form-control form ">
                                </div>

                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg">Job ID</label>
                                </div>
                                <div class="col-lg-3 col-md-3 col-sm-8 col-xs-8 pad">
                                    <input type="text" class="djobid form-control form ">
                                </div>
                            </div>
                            <br>


                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Emigration Date</label>
                                </div>
                                <div class="col-lg-2 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="date" value="<?php ?>" class="dimgdate form-control form" />
                                </div>

                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Emigration Status</label>
                                </div>
                                <div class="col-lg-3 col-md-3 col-sm-8 col-xs-8 pad">
                                    <select id="imgstatus" class="dimgstatus form-control form">
                                        <option></option>
                                        <option value="P">Pending</option>
                                        <option value="C">Cleared</option>
                                        <option value="N">Cancelled</option>
                                        <option value="S">Submitted</option>
                                    </select>
                                </div>
                            </div>
                            <br>

                            <div class="modal-footer">
                                <button type="button" class="btn btn-primary form savelight ">Save</button>
                                <button type="button" class="btn btn-secondary form" data-dismiss="modal">Close</button>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="modal fade bd-example-modal-lg" id="myEcr1" role="dialog">
                    <div class="modal-dialog modal-lg">

                        <!-- Modal content-->
                        <div class="modal-content">
                            <div class="modal-header">
                                <!--<button class="close" data-dismiss="modal"><span>&times;</span></button>-->
                                <h4 class="modal-title" id="">Detail Part</h4>
                            </div>
                            <br>

                            <div class="row">
                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Passport</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="text" size="20" value="<?php ?>" class="pass1 form-control form" />
                                </div>

                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Mobile No.</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-6 col-xs-8 pad">
                                    <input type="text" size="20" value="<?php ?>" class="tmobile1 mobileno form-control form" />
                                </div>

                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg compagen">Agent</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-6 col-xs-8 pad">
                                    <input list='agenttran1' name='' class='agenttran1  form-control form compagen' autocomplete="off">
                                    <datalist id='agenttran1' char="#">
                                        <option value=''></option>
                                        <?php
                                        $meg1 = mysqli_query($conn, "SELECT `accode`,name FROM `accmast` where grpcode = '040' order by name") or die(mysqli_error($conn));

                                        while ($teg1 = mysqli_fetch_array($meg1)) {
                                            $egname1 = $teg1['name'];
                                            echo "<option value='$egname1'>";
                                        }
                                        ?>
                                    </datalist>
                                </div>

                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Received Date</label>
                                </div>
                                <div class="col-lg-2 col-md-1 col-sm-6 col-xs-8 pad">
                                    <input type="date" value="<?php ?>" class="recd1 form-control form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Pax Name</label>
                                </div>
                                <div class="col-lg-3 col-md-2 col-sm-6 col-xs-8 pad" style="width:32%">
                                    <input type="text" size="40" value="<?php ?>" class="pax1 form-control form" />
                                </div>
                                <!--                                <div class="col-lg-2 col-md-1 col-sm-6 col-xs-8 pad">
                                
                                                                </div> -->
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Sex</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <?php
                                    echo "<select class='form-control form form sex1' >";
                                    echo "<option value=''></option>";
                                    echo "<option value='M'>M</option>";
                                    echo "<option value='F'>F</option>";
                                    echo "</select>";
                                    ?>
                                </div>
                                <div class="col-lg-2 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">DOB</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="dob1 form-control form" />
                                </div>

                            </div>


                            <br>
                            <div class="row">
                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Religion</label>
                                </div>
                                <div class="col-lg-1 col-md-2 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <?
                                    echo "<select class='form-control form form reg1' >";
                                    echo "<option value=''></option>";
                                    echo "<option value='Muslim'>Muslim</option>";
                                    echo "<option value='Non Muslim'>Non Muslim</option>";
                                    //                                    echo "<option value='90 days'>90 days</option>";
                                    echo "</select>";
                                    ?>
                                    <!--<input type="text" size="20"  value="<?php ?>"class="reg1 form-control form"/>-->
                                </div>


                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">POB</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="text" size="20" value="<?php ?>" class="pob1 form-control form" />
                                </div>
                                <div class="col-lg-2  col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">POI</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="text" size="20" value="<?php ?>" class="poi1 form-control form" />
                                </div>
                                <div class="col-lg-2 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Stay Period</label>
                                </div>

                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">

                                    <?php
                                    echo "<select class='form-control form form stay1' >";
                                    echo "<option value=''></option>";
                                    echo "<option value='2 year'>2 year</option>";
                                    echo "<option value='1 year'>1 year</option>";
                                    echo "<option value='90 days'>90 days</option>";
                                    echo "</select>";
                                    ?>
                                    <!--<input type="text" size="20"  value="<?php ?>"class="stay1 form-control form"/>-->
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">DOI</label>
                                </div>
                                <div class="col-lg-1 col-md-2 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="doi1 form-control form" />

                                </div>


                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">DOE</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="doe1 form-control form" />

                                </div>
                                <div class="col-lg-2  col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Submission Date</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="sub1 form-control form" />

                                </div>
                                <div class="col-lg-2 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Mofa No.1</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="text" size="20" value="<?php ?>" class="mof1 form-control form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Mofa Date </label>
                                </div>
                                <div class="col-lg-1 col-md-2 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="mofd1 form-control form" />

                                </div>


                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Mofa No.2</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="text" size="20" value="<?php ?>" class="mof2 form-control form" />
                                </div>

                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Stamp Status</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <?php
                                    echo "<select class='form-control form form stampstatus1' >";
                                    echo "<option value=''></option>";
                                    echo "<option value='Y'>Yes</option>";
                                    echo "<option value='N'>No</option>";
                                    echo "</select>";
                                    ?>
                                </div>


                                <div class="col-lg-2  col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Stamp Date</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="stamp1 form-control form" />

                                </div>


                            </div>
                            <br>
                            <div class="row">

                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Category</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="text" size="20" value="<?php ?>" class="cat1 form-control form" />
                                </div>
                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Passport Delivery</label>
                                </div>
                                <div class="col-lg-1 col-md-2 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="pasd1 form-control form" />

                                </div>
                                <!--                                <div class="col-lg-1 text-right pad">
                                                                     <button type="button" class="btn btn-primary sms">Mofa SMS</button>
                                                                </div>-->




                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Remark</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="text" size="20" value="<?php ?>" class="rem1 form-control form" />
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad">
                                    <!--<input type="text" size="20" />-->
                                </div>

                            </div>
                            <div class="row">

                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Address</label>
                                </div>
                                <div class="col-lg-5 col-md-5 col-sm-6 col-xs-8 pad" style="width:41%">
                                    <input type="text" size="60" value="<?php ?>" class="add1 form-control form" />
                                </div>

                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Released Date</label>
                                </div>
                                <div class="col-lg-5 col-md-5 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="passredt1 form-control form" />
                                </div>

                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Released Remark</label>
                                </div>
                                <div class="col-lg-5 col-md-5 col-sm-6 col-xs-8 pad" style="width:20%">
                                    <input type="text" size="20" value="<?php ?>" class="passrerem1 form-control form" />
                                </div>

                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-3 text-right pad">
                                    <input type="button" name="mofasms" class="btn mofasms btn-primary form" value="Mofa SMS">
                                </div>
                                <div class="col-lg-3 text-right pad">
                                    <input type="button" name="stampsms" class="btn stampsms btn-primary form" value="Stamp SMS">
                                </div>
                                <div class="col-lg-3 text-right pad">
                                    <input type="button" name="passportsms" class="btn passportsms btn-primary form" value="Passport SMS">
                                </div>
                            </div>
                            <!-- <div class="row">
                                <div class="col-lg-3" style="padding-left:25px">
                                    <input type='file' name='tfile[]' class='form btn btn-primary '>
                                </div>
                                <div class="col-lg-3">
                                    <input type='file' name='tfile2[]' class='form btn btn-primary ' >
                                </div>
                                <div class="col-lg-3">
                                    <input type='file' name='tfile3[]' class='form btn btn-primary ' >
                                </div>
                                <div class="col-lg-2">
                                    <input type='file' name='tfile4[]' class='form btn btn-primary ' >
                                </div>
                            </div> -->
                            <!-- <div class="row">
                                <div class="col-lg-3" style="text-align: center">
                                   <label class="control-label marg">User Photo</label>
                                </div>
                                <div class="col-lg-3" style="text-align: center">
                                   <label class="control-label marg">Visa Upload</label>
                                </div>
                                <div class="col-lg-3" style="text-align: center">
                                   <label class="control-label marg">Passport Front</label>
                                </div>
                                <div class="col-lg-3" style="text-align: center">
                                   <label class="control-label marg">Passport Back</label>
                                </div>
                                
                            </div> -->




                            <!--                                    <div class="col-lg-1  col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                                    <label class="control-label marg">User Upload</label>
                                                                </div>
                                                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad">
                                                                    <input type="file" value="<?php ?>"class="use1 form-control"/>
                            
                                                                </div>
                                                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                                                    <label class="control-label marg">Visa Upload</label>
                                                                </div>
                                                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad">
                                                                    <input type="file"   value="<?php ?>"class="vis1 form-control"/>
                                                                </div>
                            
                                                                <div class="col-lg-2  col-md-2 col-sm-3 col-xs-3 text-right pad">
                                                                    <label class="control-label marg">Passport Front</label>
                                                                </div>
                                                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad">
                                                                    <input type="file" value="<?php ?>"class="pasf1 form-control"/>
                            
                                                                </div>
                            
                                                                <div class="col-lg-2 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                                    <label class="control-label marg">Passport Back</label>
                                                                </div>-->



                            <!--                            <div class="row">
                                                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                <label class="control-label marg">Emigration Date</label>
                                                            </div>
                                                            <div class="col-lg-2 col-md-4 col-sm-6 col-xs-8 pad">
                                                                <input type="date" value="<?php ?>"class="dimgdate form-control"/>
                                                            </div>
                            
                                                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                <label class="control-label marg">Emigration Status</label>
                                                            </div>
                                                            <div class="col-lg-3 col-md-3 col-sm-8 col-xs-8 pad">
                                                                <select id="imgstatus" class="dimgstatus form-control">
                                                                    <option></option>   
                                                                    <option value="P">Pending</option>
                                                                    <option value="C">Cleared</option>
                                                                    <option value="N">Cancelled</option>
                                                                </select>
                                                            </div>
                                                        </div>-->
                            <br>

                            <div class="modal-footer">
                                <button type="button" class="btn btn-primary savepart form">Exit</button>
                                <!--<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>-->
                            </div>

                        </div>
                    </div>
                </div>
            </div>

    </form>

    <div class="modal fade" id="myModal" role="dialog">
        <div class="modal-dialog">

            <!-- Modal content-->
            <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 Sponsor's Name</h4>
                </div>
                <div class="modal-body">
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <div class="row">
                            <div class="col-lg-3">
                                <input type="text" id="sponsrch" class="form-control " placeholder="Search Here">
                            </div>
                        </div>
                        <table class='table table-condensed tabel-bordered'>
                            <thead>
                                <tr>
                                    <th>Name</th>
                                </tr>
                            </thead>
                            <tbody class="modalbody">
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade pdfUploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Pdf Upload & Download</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-10 upload">
                            <!--                            <p>To Download Right Click And Click On Save As..</p>-->
                            <form id="pdf_upload_form" enctype="multipart/form-data" method="post">
                                <div class="col-lg-12">
                                    <span class="btn btn-default btn-file btn-square btn-warning  form">
                                        Choose File <input type="file" name="file2" id="file2">
                                    </span>
                                    <?
                                    $mlen = strlen($qvouch);
                                    $myvouch = str_repeat("0", 6 - $mlen) . $qvouch;
                                    ?>
                                    <input type="hidden" name="pdfvouchno" id="pdfvouchno" value='<?php echo ($addflag != 1) ? $get['myvouch'] : "$myvouch"; ?>'>
                                    <input type="hidden" name="series" id="pdfseries" value="<?php echo ($addflag != 1) ? $fseries : "$fseries"; ?>">
                                    <input type="button" value="Upload File" class="btn btn-square pdfUpload form" style="background-color: #C0CA33; color: white">
                                </div>
                                <div class="col-lg-12">
                                    <div class="progress2">
                                        <progress id="progressBar2" class="progress-bar2" role="progressbar" value="0" max="100" style="width:100%;color: red;"></progress>
                                    </div>
                                    <h3 id="status2"></h3>
                                    <p id="loaded_n_total2"></p>
                                </div>
                            </form>
                        </div>
                        <div class="col-lg-10 upload">
                            <?
                            $imgpath = $get['pdfpath'] . "?a=" . mt_rand(0, 500);
                            //browse($imgpath);
                            if ($get['pdfpath'] == "") {
                                $show = "style='display:none'";
                            } else {
                                $show = "style='display:block'";
                            }
                            ?>
                            <a id="show" class="btn btn-primary btn-square" href="<?php echo $imgpath; ?>" target="_blank" <?php echo $show; ?>>Cick to View & Download Pdf</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="myBroker" role="dialog">
        <div class="modal-dialog">

            <!-- Modal content-->
            <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 Broker's Name</h4>
                </div>
                <div class="modal-body">
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <div class="row">
                            <div class="col-lg-3">
                                <input type="text" id="broksrch" class="form-control " placeholder="Search Here">
                            </div>
                        </div>
                        <table class='table table-condensed tabel-bordered'>
                            <thead>
                                <tr>
                                    <th>Name</th>
                                </tr>
                            </thead>
                            <tbody class="brokbody">
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fad VisaModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-md">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel" style="color: #5D96E4">Visa Types</h4>
                </div>
                <div class="modal-body">
                    <table class="table-striped table-condensed table-bordered" width="40%">
                        <thead class="mySearchTr">
                            <tr>
                                <th style="width: 2%;"></th>
                                <th style="width: 10%;">Name</th>
                            </tr>
                        </thead>
                        <tbody class="tbody3">
                            <?php
                            $vtype = mysqli_query($conn, "SELECT * FROM `visatype`  ORDER BY name") or die(mysqli_error($conn));
                            $ctr3 = 0;
                            while ($fvtype = mysqli_fetch_array($vtype)) {
                                echo "<tr>";
                                echo "<td><i class='fa fa-close remove rdel' ></i></td>";
                                echo "<td>";
                                echo "<input type='text' name='tname' class='tname form-control form' value='$fvtype[name]' readonly maxlength='10'>";
                                echo "<input type='hidden' name='code' class='code form-control form' value='$fvtype[code]'>";
                                echo "</td>";
                                echo "</tr>";
                            }
                            ?>
                        </tbody>
                    </table>
                </div>
                <div class="modal-footer">
                    <input type='button' class="btn btn-primary newsave" value='save'>
                    <button type='button' class='btn btn-success btn-square form' id='addnew3'>
                        <i class='fa fa-plus' style='color:#ffffff' data-toggle='tooltip' title='Add Row'></i>
                    </button>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fad imgModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-md">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel" style="color: #5D96E4">Images</h4>
                </div>
                <div class="modal-body">
                    <table class="table-striped table-condensed table-bordered" width="100%">
                        <thead class="mySearchTr">
                            <tr>
                                <th style="width: 20%;">User</th>
                                <th style="width: 20%;">Visa</th>
                                <th style="width: 20%;">Passport</th>
                            </tr>
                        </thead>
                        <tbody class="tbody4">

                        </tbody>
                    </table>
                </div>

            </div>
        </div>
    </div>
    <div class="modal fad imgModal1" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" width="50%">
        <div class="modal-dialog modal-md">
            <div class="modal-content" style="width:50%">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel" style="color: #5D96E4">Images</h4>
                </div>
                <div class="modal-body">
                    <table class="table-striped table-condensed table-bordered" width="100%">
                        <thead class="mySearchTr">
                            <tr>
                                <th style="width: 20%;height: 20%;">E-Visa</th>
                                <!--                                <th style="width: 20%;">Visa</th> 
                                <th style="width: 20%;">Passport Front</th> 
                                <th style="width: 20%;">Passport Back</th> -->
                            </tr>
                        </thead>
                        <tbody class="tbody5">

                        </tbody>
                    </table>
                </div>

            </div>
        </div>
    </div>

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

</html>