<?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');

$formname = 'Entry';
$maindb = 'visamain';
$trandb = 'visatran';
$trandb2 = "category";
$file = 'entry.php';
$printfile = "register_sc.php";
$trandbexist = 1;

$grid = '';
$keyfld = "myvouch";
$focusfield = "visatype";
$mgrpcode = '';
$keycond = "";
$source = "NEW";

// $myyear = $_SESSION["tit_" . $dbname];
$myyear = $_SESSION["myyear_" . $dbname];
$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$username = $_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"];
    $vouchdt = $_POST["vouchdt"];
    $manualno = $_POST["manualno"];
    $partyname = $_POST["partyname"];
    $sponsor = mysqli_real_escape_string($conn, $_POST["sponsor"]);
    $broker = $_POST["broker"];
    $email = $_POST["email"];
    $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"];
    $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"];
    $createby = $_POST["createby"];
    $mis = $_POST["mis"];
    $misc = $_POST["misc"];
    $imig = $_POST["imig"];
    $stamp = $_POST["stamp"];
    $total = $_POST["total"];
    $disc = $_POST["disc"];
    $tot = $_POST["tot"];
    $mofa = $_POST["mofa"];

    $purpvisit = $_POST["purpvisit"];
    $inditot = $_POST["inditot"];
    $count = $_POST["items"];
    $count2 = $_POST["items2"];

    $mvouch = $qvouch;

    if ($a == 1) {
        mysqli_query($conn, "LOCK TABLES `$maindb` WRITE, `$trandb` WRITE, `$trandb2` WRITE, accmast WRITE, visasacn WRITE, catgmast 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 `visatype` = '$visatype' 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;

//            $gemn = mysqli_query($conn, "SELECT MAX(mannum) AS maxcode FROM `visamain`") or die(mysqli_error($conn));
//
//            if (mysqli_num_rows($gemn) > 0) {
//                $vvmn = mysqli_fetch_assoc($gemn);
//                $nmanualno = $vvmn["maxcode"] + 1;
//            } else {
//                $nmanualno = '1';
//            }
//            $manualno = "AH-$nmanualno";
//            $mannum = $nmanualno;
        }

        //        browse($mvouch);
        //        browse($voucher);
        ########################################Image Part Start########################################

        $path = "images/" . $myyear . "/";

        $fileName = $qvouch . ".jpg";
        $img_file1 = $path . ($fileName);

        $image_ftype = pathinfo($img_file1, PATHINFO_EXTENSION);
        $size = $_FILES['image']['size'];

        // if ($size < 20000) {
        move_uploaded_file($_FILES["image"]["tmp_name"], $img_file1);
        // } else {
        //     browse("Image size Should be less then 20kb try again upload image");
        //     header("refresh: 1; $file?mode=last");
        // }
        ########################################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;
        //        browse($count) ;

        for ($i = 0; $i <= $count; $i++) {
            $cnt++;
            $srno = $_POST["srno"][$i];
            $paxname = $_POST["paxname"][$i];
            $ppno = $_POST["passport"][$i];
            $passport = trim($ppno);
            $issplace = $_POST["issplace"][$i];
            $issdate = $_POST["issdate"][$i];
            $stampdate = $_POST["stampdate"][$i];
            $releasedt = $_POST["releasedt"][$i];
            $submission_date = $_POST["submission_date"][$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];
            $mofa_date = $_POST["mofa_date"][$i];
            $category = $_POST["category"][$i];
            $cateng = $_POST["cateng"][$i];
            $mofamt_mod = $_POST["mofamt_mod"][$i];
            $imigamt_mod = $_POST["imigamt_mod"][$i];
            $stampamt_mod = $_POST["stampamt_mod"][$i];
            $mis_mod = $_POST["mis_mod"][$i];
            $misc_mod = $_POST["misc_mod"][$i];
            $memcash = $_POST["memcash"][$i];
            $tremark = $_POST["tremark"][$i];
            $tadd = $_POST["tadd"][$i];
            $tfile = $_POST["tfile"][$i];
            $plbirth = $_POST["plbirth"][$i];
            $sex = $_POST["sex"][$i];
            $dob = $_POST["dob"][$i];
            $religion = $_POST["religion"][$i];
            $doe = $_POST["doe"][$i];
            $periodstay = $_POST["periodstay"][$i];
            $delvstatus = $_POST["delvstatus"][$i];

            $dir = "images/" . $myyear . "/" . $mvouch;
            if (is_dir($dir) === false) {
                mkdir($dir);
            }
            $tpath = $dir . "/";

            $tfileNameU = $mvouch . "_" . $cnt . "_user.jpg";
            $tfileNameP = $mvouch . "_" . $cnt . "_pass.jpg";
            $tfileNameV = $mvouch . "_" . $cnt . "_visa.jpg";
            $tfileNameF = $mvouch . "_" . $cnt . "_visa.pdf";

            $timg_fileU = $tpath . ($tfileNameU);
            $timg_fileP = $tpath . ($tfileNameP);
            $timg_fileV = $tpath . ($tfileNameV);
            $timg_fileF = $tpath . ($tfileNameF);



            $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 ($tfileSize < 20000) {
            move_uploaded_file($_FILES["tfile"]["tmp_name"][$i], $timg_fileU);
            // } else {
            //     browse("Image size Should be less then 20kb try again upload image");
            //     header("refresh: 1; $file?mode=last");
            // }
            // 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 ($tfileSize2 < 20000) {
            move_uploaded_file($_FILES["tfile2"]["tmp_name"][$i], $timg_fileP);
            // } else {
            //     browse("Image size Should be less then 20kb try again upload image");
            //     header("refresh: 1; $file?mode=last");
            // }
            // if (!empty($tfileTmpLoc2)) {
            //     move_uploaded_file($tfileTmpLoc2, "$timg_fileP");
            // }

            $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 ($tfileSize3 < 20000) {
            move_uploaded_file($_FILES["tfile3"]["tmp_name"][$i], $timg_fileV);
            // } else {
            //     browse("Image size Should be less then 20kb try again upload image");
            //     header("refresh: 1; $file?mode=last");
            // }
            // if (!empty($tfileTmpLoc3)) {
            //     move_uploaded_file($tfileTmpLoc3, "$timg_fileV");
            // }

            $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]; // 0 for false... and 1 for true
            // if ($tfileSize4 < 20000) {
            move_uploaded_file($_FILES["tfile4"]["tmp_name"][$i], $timg_fileF);
            // } else {
            //     browse("Image size Should be less then 20kb try again upload image");
            //     header("refresh: 1; $file?mode=last");
            // }
            // if (!empty($tfileTmpLoc4)) {
            //     move_uploaded_file($tfileTmpLoc4, "$timg_fileF");
            // }

            if ($mofano != '') {
                if ($mofa_date != '0000-00-00') {
                    $mofadate = date('Y-m-d');
                }
            }

            $gcat = mysqli_query($conn, "SELECT code,name FROM `catgmast` WHERE `name`='$cateng'") or die(mysqli_error($conn));
            if (mysqli_num_rows($gcat) > 0) {
                $fcat = mysqli_fetch_array($gcat);
                $catcode = $fcat['code'];
            } else {
                $gensz1 = mysqli_query($conn, "SELECT MAX(code) AS maxcode FROM `catgmast` where code != '' LIMIT 0,1 ") or die(mysqli_error($conn));
                if (mysqli_num_rows($gensz1) > 0) {
                    $gsz1 = mysqli_fetch_assoc($gensz1);
                    $catcode = $gsz1["maxcode"] + 1;
                } else {
                    $catcode = '1';
                }
                if (!empty($cateng)){
                   mysqli_query($conn, "INSERT INTO `catgmast`(`code`, `name`)
                                                                  VALUES('$catcode',  '$cateng')") or die(mysqli_error($conn));
                }
            }


            if (!empty($paxname)) {

                mysqli_query($conn, "INSERT INTO `visatran`(`myvouch`, `yearno`, `visatype`, `vouchno`, `vouchdt`, `srno`, `paxname`, `passport`,
                                                `issdate`, `issplace`, `carrier`, `fltno`, `fltdate`, `flttime`, `pnrno`,`doe`,`dob`,`religion`,`plbirth`,`sex`,periodstay,
                                                `stampdate`, `mofano`,`mofano2`, `mofa_date`, `category` , `cateng`, `memcash` ,`imagepath`,`imagevisa`, `imagepass`, `visapdf`,
                                                 `delvstatus`, `submission_date`,`releasedt`, `mofamt_mod`, `stampamt_mod`, `imigamt_mod`, `mis_mod`, `misc_mod`,`tremark`,`tadd`)
                                        VALUES ('$mvouch','$myyear','$visatype','$voucher','$vouchdt','$cnt','$paxname','$passport',
                                                '$issdate','$issplace','$carrier','$fltno','$fltdate','$flttime','$pnrno','$doe','$dob','$religion','$plbirth','$sex','$periodstay',
                                                '$stampdate','$mofano','$mofano2', '$mofa_date', N'$category', '$cateng', '$memcash' , '$timg_fileU', '$timg_fileV','$timg_fileP', 
                                                '$timg_fileF', '$delvstatus', '$submission_date', '$releasedt', '$mofamt_mod', '$stampamt_mod', '$imigamt_mod', '$mis_mod', '$misc_mod', '$tremark', '$tadd')") or die(mysqli_error($conn));
            }
        }

        //  for deducting visa nos. / qty from visasacn
//        $getcat = mysqli_query($conn, "SELECT category, cateng, COUNT(*) AS qty FROM `visatran` WHERE vouchno='$mvouch' group by category order by category") or die(mysqli_error($conn));
//        while ($fetcat = mysql_fetch_array($getcat)) {
//               $cateng = $fetcat['cateng'] ;
//               $catgory = $fetcat['catgory'] ;
//               $tqty = $fetcat['qty'] * -1;
//               
//               mysqli_query($conn, "INSERT INTO `visasacn`(`vouchdt`,`vouchno`, `source`, visano, idno,  `category`, `cateng`, `qty`)
//                                                    VALUES('$vouchdt', '$mvouch', '$source', '$visano', '$idno', N'$category', '$cateng', '$tqty')") or die(mysqli_error($conn));
//            
//        }


        $getitt = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE `name`='$broker'") or die(mysqli_error($conn));
        if (mysqli_num_rows($getitt) > 0) {
            $itcode = mysqli_fetch_array($getitt);
            $itemcode = $itcode['accode'];
        } else {
            $gensz1 = mysqli_query($conn, "SELECT MAX(accode) AS maxcode FROM `accmast` where accode != '' LIMIT 0,1 ") or die(mysqli_error($conn));
            if (mysqli_num_rows($gensz1) > 0) {
                $gsz1 = mysqli_fetch_assoc($gensz1);
                $itemcode = $gsz1["maxcode"] + 1;
            } else {
                $itemcode = '51';
            }
            mysqli_query($conn, "INSERT INTO `accmast`(`accode`, `name`, grpcode)
                           VALUES('$itemcode',  '$broker', '040' )") or die(mysqli_error($conn));
        }
        $agcode = $itemcode ;

//        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));
//            }
//        }
        
        ///////   to less from visasacn for pending HR Register

        mysqli_query($conn, "Delete from `visasacn` where `vouchno` = '$mvouch' and source = '$source' ") or die(mysqli_error($conn));
        
        $catqry = mysqli_query($conn, "select category, cateng, count(*) as catnos from `visatran` where `myvouch`='$mvouch' group by cateng") or die(mysqli_error($conn));
        while ($fetqry = mysqli_fetch_array($catqry)) {
               $categ  = $fetqry['category'];
               $cateng = $fetqry['cateng'];
               $catnos = $fetqry['catnos'] * -1;
        
               mysqli_query($conn, "INSERT INTO `visasacn`(`source`, `vouchno`, `vouchdt`, `accode`, `visano`, `idno`, `category`, `cateng`, `qty`)
                                          VALUES ('$source', '$mvouch', '$vouchdt', '$agcode', '$visano', '$idno', N'$categ',  '$cateng', '$catnos')") or die(mysqli_error($conn));
        }
        
        
        ////////////// 
        

        if ($addflag == 1) {

            mysqli_query($conn, "INSERT INTO `$maindb`(`yearno`, `visatype`, `myvouch`, `vouchno`, `vouchdt`, `partyname`, `sponsor`,
                                               `oadd1`, `oadd2`, `oadd3`, `ladd1`, `ladd2`, `ladd3`, `visano`, `hijridate`, purpvisit,
                                               `visaqty`, `drname`, `meddate`, `sector`, `remark`,`remark2`, `reqmed`, `mobile`,
                                               `email`, `broker`, `idno`, `paidby`,`createby`, `contact`, mannum, `manualno`, `imagepath`,`imig`,`stamp`,
                                               `mis`,`mofa`,`misc`,`total`,`disc`,`tot`, `inditot`)
                                               VALUES ('$myyear','$visatype','$qvouch','$voucher','$vouchdt','$partyname',N'$sponsor',
                                                      N'$oadd1',N'$oadd2',N'$oadd3',N'$ladd1',N'$ladd2',N'$ladd3','$visano','$hijridate','$purpvisit',
                                                       '$visaqty','$drname','$meddate','$sector','$remark','$remark2','$reqmed','$mobile',
                                                       '$email',N'$broker','$idno','$paidby','$createby','$contact','$mannum', '$manualno', '$img_file','$imig','$stamp',
                                                       '$mis','$mofa','$misc','$total','$disc','$tot', '$inditot')") 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', `partyname`='$partyname',purpvisit='$purpvisit',
                                                       `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', 
                                                       `visaqty`='$visaqty', `drname`='$drname', `meddate`='$meddate', `sector`='$sector', `remark`='$remark',
                                                       `remark2`='$remark2', `reqmed`='$reqmed', `mobile`='$mobile', `email`='$email', `broker`=N'$broker', `idno`='$idno',
                                                       `paidby`='$paidby', `contact`='$contact', `manualno`='$manualno', `imig`='$imig',`stamp`='$stamp',`mis`='$mis',`createby`='$createby',
                                                       `mofa`='$mofa',`misc`='$misc',`total`='$total',`disc`='$disc',`tot`='$tot',`inditot`='$inditot'  where `myvouch` = '$mvouch' ") or die(mysqli_error($conn));

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


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);
    if ($get['visatype'] == 'W') {
        $vtype = "Work";
    } elseif ($get['visatype'] == 'F') {
        $vtype = "Family";
    } elseif ($get['visatype'] == 'R') {
        $vtype = "Residence";
    } elseif ($get['visatype'] == 'V') {
        $vtype = "Visit";
    } else {
        $vtype = "";
    }
}


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" type="text/javascript"></script>
<script src="MyScript/entry_search.js" type="text/javascript"></script>
<style type="text/css">
    .sticky {
        position: sticky;
        position: -webkit-sticky;
        top: 0;
        background: #7f949d;
        z-index: 10;

    }
</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; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<!--                            <span style="color: #7f949d;font-size: 11px">
                                (Alt+T &nbsp;&nbsp;-&nbsp;&nbsp; New Visa Type)</span>-->
                        </h3>
                    </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: #7f949d">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" required autofocus>
                                    <option value="<?php echo ($addflag != 1) ? $get["visatype"] : "W"; ?>"><?php echo ($addflag != 1) ? $vtype : "Work"; ?></option>
                                    <?php
                                    if ($addflag == 1) {
                                        ?>

                                        <!--<option value='W'>Work</option>-->
                                        <option value='F'>Family</option>
                                        <option value='R'>Residence</option>
                                        <option value='V'>Visit</option>
                                        <?php
                                    }
                                    ?>
                                </select>
                            </div>
                            <!--                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad " >
                                                            <label class="label-control marg">Voucher No.</label>
                                                        </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; ?>">
                                <input type="text" class="form-control form voucher" name="voucher" value="<?php echo ($addflag != 1) ? $get["vouchno"] : ""; ?>" tabindex="-1" readonly>
                            </div>
                            <!-- <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad " style="padding-left: 130px;"> -->
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad " style="width:10.7%">
                                <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.2%;padding-left: 35px;"> -->
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad" style="width:8.4%">
                                <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" style="width:8.4%">
                                <label class="label-control marg" style="color: #7f949d"> 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" maxlength="15" name="manualno" value="<?php echo ($addflag != 1) ? $get["manualno"] : ""; ?>" required style="color: #7f949d;background-color: white;border: 1px solid #5D96E4">
                            </div>

                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                <label class="label-control marg">Agent</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad" style="width:24.66%">
                                <input list='broker' name='broker' value='<?php echo $get['broker'] ?>' class='broker form-control form ' autocomplete="off" required>
                                <datalist id='broker'>
                                    <option value=''>
                                        <?php
                                        $gparty = mysqli_query($conn, "SELECT `name` FROM `accmast` where grpcode = '040' group by `name` order by `name`") or die(mysqli_error($conn));
                                        while ($fparty = mysqli_fetch_array($gparty)) {
                                            echo "<option value='$fparty[name]'>";
                                        }
                                        ?>
                                </datalist>
            <!--<input type="text" class="form-control form broker" id="broker" name="broker" value="<?php echo ($addflag != 1) ? $get["broker"] : ""; ?>">-->
                            </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:#7f949d;color:white;padding-top:3px;padding-bottom:3px; ">
                                    <i class="fa fa-search"></i>
                                </button>
                            </div>
                            <!--                            <div class="col-lg-2 col-md-2 col-sm-1 col-xs-1 text-right pad ">
                                                            <label class="label-control marg">Candidate Name</label>
                                                        </div>
                                                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad " style="width: 21%">
                                                            <input type="text" class="form-control form partyname" name="partyname" value="<?php echo ($addflag != 1) ? $get["partyname"] : ""; ?>" required>
                                                        </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">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"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad" style="width:2.45%">
                                <button id='spnname' type="button" class="btn btn-pad " data-toggle="modal" style="background-color:#7f949d;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" style="width:24.66%">

                                <input type="email" class="form-control form email" name="email" value="<?php echo ($addflag != 1) ? $get["email"] : ""; ?>">
                            </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">Overseas</label>
                                                    </div>
                                                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                                        <input type="text" class="form-control form oadd1" name="oadd1" value="<?php echo ($addflag != 1) ? $get["oadd1"] : ""; ?>">
                                                        <input type="text" class="form-control form oadd2" name="oadd2" value="<?php echo ($addflag != 1) ? $get["oadd2"] : ""; ?>">
                                                        <input type="text" class="form-control form oadd3" name="oadd3" value="<?php echo ($addflag != 1) ? $get["oadd3"] : ""; ?>">
                                                    </div>
                                                    <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad ">
                                                        <label class="label-control marg">Local</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 1add1" name="ladd1" value="<?php echo ($addflag != 1) ? $get["ladd1"] : ""; ?>">
                                                        <input type="text" class="form-control form ladd2" name="ladd2" value="<?php echo ($addflag != 1) ? $get["ladd2"] : ""; ?>">
                                                        <input type="text" class="form-control form ladd3" name="ladd3" value="<?php echo ($addflag != 1) ? $get["ladd3"] : ""; ?>">
                                                    </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">Contact No.</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad" style="width: 21%">
                                                        <input type="text" class="form-control form contact" name="contact" value="<?php echo ($addflag != 1) ? $get["contact"] : ""; ?>" style="color: #5D96E4">
                                                    </div>
                                                    <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 text-right pad " >
                                                        <label class="label-control marg">Mobile No.</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad" style="width: 21%">
                                                        <input type="text" class="form-control form mobile" name="mobile" value="<?php echo ($addflag != 1) ? $get["mobile"] : ""; ?>">
                                                    </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="width:2.45%">
                                <!--                                <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-3 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" style="width:10.55%;">
                                <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="select2 form-control form paidby" style="width:100%">
                                    <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 pad" style="width:2.45%">
                                <!--                                <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">File Created By</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad ">
                                <input type="text" class="form-control form createby" name="createby" value="<?php echo ($addflag != 1) ? $get["createby"] : ""; ?>">
                            </div>
                        </div>
                        <!--                        <div class="row">
                                                    <div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 text-right pad ">
                                                    </div>
                                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad" style="width: 13.5%">
                                                        <button class="form form-control btn btn-primary category">Category</button>
                                                    </div>
                                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad" style="width: 13.5%">
                                                        <button class="form form-control btn btn-primary paxdetail">Pax Detail</button>
                                                    </div>
                                                </div>-->
                        <br>
                        <div class="pax_d">
                            <!--<div class="table-responsive" style="overflow-y: scroll;height:500px">-->
                            <div class="table-responsive" style="overflow-y: scroll;height:500px">
                                <table class="  table-striped table-condensed table-bordered" width="200%">
                                    <thead class="mySearchTr sticky">
                                        <tr>
                                            <th style="width: 1%;" ></th>
                                            <th style="width: 2%;" >Sr.</th>
                                            <th style="width: 17%;" colspan='2' >Pax Name</th>
                                            <th style="width: 2%;" >PDF with /<br>without Amount</th>
                                            <th style="width: 2%;" >Sex</th>
                                            <th style="width: 4%;" >Passport</th>
                                            <th style="width: 2%;" >Immigration<br>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>
                                                <th style="width: 2%;" >Visa PDF</th>

                                                <?php
                                            }
                                            ?>
                                            <th style="width: 2%;" >DOB</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: 2%' >DOI</th>
                                            <th style='width: 2%' >DOE</th>
                                            <th style='width: 4%' >Stamp Date</th>
                                            <!-- <th style='width: 4%' >Released Date</th> -->
                                            <th style='width: 5%'>Submission Date</th>
                                            <th style='width: 5%'>Mofa No.1</th>
                                            <th style='width: 5%'>Mofa No.2</th>
                                            <th style='width: 4%'>Mofa Date</th>
                                            <th style='width: 5%'>Category(Arabic)</th>
                                            <th style='width: 5%'>Category(English)</th>
                                            <th style='width: 5%'>Mofa Amt.</th>
                                            <th style='width: 5%'>Stamp Amt.</th>
                                            <th style='width: 5%'>Immigration</th>
                                            <th style='width: 5%'>M/s. Amt.</th>
                                            <th style='width: 5%'>Miscellaneous</th>
                                            <th style='width: 5%'>Final</th>
                                            <th style='width: 7%'>Remark</th>
                                            <th style='width: 7%'>Address</th>
                                            <th style='width: 2%'>User Photo</th>
                                            <th style='width: 2%'>Visa Upload</th>
                                            <th style='width: 2%'>Passport Upload</th>
                                            <th style='width: 2%'>Contract</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 = "";
                                                }

                                                $visapdf = $row['visapdf'];
                                                //                                                browse($paxname);
                                                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='paxname[]' class='paxname form-control  form' value='$row[paxname]' >";
                                                echo "</td>";
                                                echo "<td>";
                                                echo "<i class='fa fa-pencil edit1 text-center form-control form' style='background-color: #4285f4;color: white'></i>";
                                                echo "</td>";
                                                echo "<td><a href='pax_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]' target='_blank'><i class='fa fa-file-pdf-o visapdf'  style='font-size:28px'></i></a>"
                                                . "&nbsp;&nbsp;<a href='pax_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]&prnamt=N' target='_blank'><i class='fa fa-file-pdf-o visapdf'  style='font-size:28px;color:black'></i></a></td>";
                                                // echo "<td>";
                                                // echo "<a href='pax_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]' target='_blank'><i class='fa fa-2x fa-file-pdf-o' aria-hidden='true'></i></a>";
                                                // echo "</td>";
                                                echo "<td>";
                                                echo "<select class='sex form-control form' 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>";
                                                echo "<input type='text' name='passport[]'  class='passport form-control  form' value='$row[passport]' >";
                                                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 "</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:28px'> </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:28px'></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:28px'></i></a></td>";
                                                echo "<td><a href='visa_barcode.php?visano=$get[visano]&mofano=$row[mofano]&mofano2=$row[mofano2]'  target='_blank'><i class='fa fa-barcode' style='font-size:35px'></i></a></td>";
                                                echo "<td><i class='fa fa-picture-o imgshow'  style='font-size:28px'></i></td>";
                                                // echo "<td><i class='fa fa-file-pdf-o pdfshow'  style='font-size:28px'></i></td>";
                                                echo "<td><a href='visa_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]' target='_blank'><i class='fa fa-file-pdf-o visapdf'  style='font-size:28px'></i></a></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='religion[]' class='religion form-control  form'  value='$row[religion]' ></td>";
                                                // browse($row['religion']);
                                                echo "<td>";
                                                echo "<input type='text' name='plbirth[]' class='plbirth 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><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='doe form-control  form'  value='$row[doe]'  style='width:120px;'></td>";
                                                echo "<td><input type='date' name='stampdate[]' class='stampdate form-control  form'  value='$row[stampdate]'  style='width:120px;'></td>";
                                                // echo "<td><input type='date' name='releasedt[]' class='releasedt form-control  form'  value='$row[releasedt]'  style='width:120px;'></td>";
                                                echo "<td><input type='date' name='submission_date[]' class='submission_date form-control  form'  value='$row[submission_date]'  style='width:120px;'></td>";
                                                echo "<td><input type='text' name='mofano[]' class='mofano form-control  form' value='$row[mofano]' ></td>";
                                                echo "<td><input type='text' name='mofano2[]' class='mofano2 form-control  form' value='$row[mofano2]' ></td>";
                                                echo "<td><input type='date' name='mofa_date[]' class='mofa_date form-control  form'  value='$row[mofa_date]'  style='width:120px;'></td>";
                                                
                                                echo "<td><input type='text' name='category[]' class='category form-control form' value='$row[category]'></td>";

                                                echo "<td>";
                                                echo "<input list='cateng' name='cateng[]' class='cateng form-control form ' autocomplete='off' value='$row[cateng]'> ";
                                                echo "<datalist id='cateng' char='#'>";
                                                echo "<option >";
                                                $mcateng = mysqli_query($conn, "SELECT `name` FROM `catgmast` WHERE code!='' order by `name`") or die(mysqli_error($conn));
                                                while ($tmcateng = mysqli_fetch_array($mcateng)) {
                                                    $catengname = $tmcateng['name'];
                                                    echo "<option value='$catengname'>";
                                                }
                                                echo "</datalist>";
                                                echo "</td>";

                                                echo "<td><input type='text' name='mofamt_mod[]' class='mofamt_mod text-right form-control  form' value='$row[mofamt_mod]' ></td>";
                                                echo "<td><input type='text' name='stampamt_mod[]' class='stampamt_mod text-right form-control  form' value='$row[stampamt_mod]' ></td>";
                                                echo "<td><input type='text' name='imigamt_mod[]' class='imigamt_mod text-right form-control  form' value='$row[imigamt_mod]' ></td>";
                                                echo "<td><input type='text' name='mis_mod[]' class='mis_mod text-right form-control  form' value='$row[mis_mod]' ></td>";
                                                echo "<td><input type='text' name='misc_mod[]' class='misc_mod text-right form-control  form' value='$row[misc_mod]' ></td>";
                                                echo "<td><input type='text' name='memcash[]' class='memcash text-right form-control  form' value='$row[memcash]' ></td>";
                                                echo "<td><input type='text' name='tremark[]' class='tremark  form-control  form' maxlength='30'  value='$row[tremark]' ></td>";
                                                echo "<td><input type='text' name='tadd[]' class='tadd form-control form' value='$row[tadd]' ></td>";

                                                echo "<td>
                                                        <input type='file' name='tfile[]'  class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
                                                echo "<td>
                                                        <input type='file' name='tfile2[]'  class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
                                                echo "<td>
                                                        <input type='file' name='tfile3[]'  class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
                                                echo "<td>
                                                        <input type='file' name='tfile4[]'  class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
                                                echo "</tr>";
                                                $ctr++;
                                            }
                                        } else {
                                            ?>
                                            <tr>
                                                <td><i class='fa fa-close remove'></i></td>
                                                <td><input type='text' name='srno[]' class='srno form-control form' value='1'></td>
                                                <td>
                                                    <input type='text' name='paxname[]' class='paxname form-control  form' value=''>
                                                </td>
                                                <td><i class='fa fa-pencil edit1 text-center form-control  form' style="background-color: #4285f4;color: white"></i></td>
                                                <td><i class='fa fa-2x fa-file-pdf-o' aria-hidden='true'></i></td>
                                                <td>
                                                    <?php
                                                    echo "<select class='sex form-control form' name='sex[]' >";
                                                    echo "<option value=''></option>";
                                                    echo "<option value='M'>M</option>";
                                                    echo "<option value='F'>F</option>";
                                                    echo "</select>";
                                                    ?>
                                                </td>
                                                <td>
                                                    <input type='text' name='passport[]' class='passport 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>";
                                                    ?>
                                                </td>

                                                <td><input type='date' name='dob[]' class='dob form-control  form' value=''></td>
                                                <td><input type='text' name='religion[]' class='religion form-control  form' value='Muslim'></td>
                                                <td><input type='text' name='plbirth[]' class='plbirth form-control  form' value=''></td>
                                                <td><input type='text' name='issplace[]' class='issplace form-control  form' value=''></td>
                                                <td><input type='text' name='periodstay[]' class='periodstay  form-control  form' value='2 Years'></td>
                                                <td><input type='date' name='issdate[]' class='issdate form-control  form' value=''></td>
                                                <td><input type='date' name='doe[]' class='doe form-control  form' value=''></td>
                                                <td><input type='date' name='stampdate[]' class='stampdate form-control  form' value=''></td>
                                                <!-- <td><input type='date' name='releasedt[]' class='releasedt form-control  form' value=''></td> -->
                                                <td><input type='date' name='submission_date[]' class='submission_date 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='text' name='mofano[]' class='mofano form-control  form' value=''></td>
                                                <td><input type='text' name='mofano2[]' class='mofano2 form-control  form' value=''></td>
                                                <td><input type='date' name='mofa_date[]' class='mofa_date form-control  form' value=''></td>
                                                <td><input type='text' name='category[]' class='category form-control  form' value=''></td>
                                                <td>
                                                    <input list='cateng' name='cateng[]' value="" class='cateng form-control form ' autocomplete="off">
                                                    <datalist id='cateng' char="#">
                                                        <option value=''></option>
                                                        <?php
                                                        $mscatengname = mysqli_query($conn, "SELECT `name` FROM `catgmast` WHERE code!='' order by `name` ") or die(mysqli_error($conn));

                                                        while ($fetcatengname = mysqli_fetch_array($mscatengname)) {
                                                            $catengname = $fetcatengname['name'];
                                                            echo "<option value='$catengname'>";
                                                        }
                                                        ?>
                                                    </datalist>
                                                </td>
                                                <td><input type='text' name='mofamt_mod[]' class='mofamt_mod form-control text-right form' value='0'></td>
                                                <td><input type='text' name='stampamt_mod[]' class='stampamt_mod form-control text-right form' value='0'></td>
                                                <td><input type='text' name='imigamt_mod[]' class='imigamt_mod form-control text-right form' value='0'></td>
                                                <td><input type='text' name='mis_mod[]' class='mis_mod form-control text-right form' value='0'></td>
                                                <td><input type='text' name='misc_mod[]' class='misc_mod form-control text-right form' value='0'></td>
                                                <td><input type='text' name='memcash[]' class='memcash form-control text-right form' value='0'></td>
                                                <td><input type='text' name='tremark[]' class='tremark form-control form' maxlength="30" value=''></td>
                                                <td><input type='text' name='tadd[]' class='tadd form-control form' value=''></td>
                                                <td><input type='file' name='tfile[]' class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                <td><input type='file' name='tfile2[]' class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                <td><input type='file' name='tfile3[]' class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                <td><input type='file' name='tfile4[]' class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                </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 : 0; ?>'>
                            </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 class="" style="text-align: center;background-color: #eacfd0;border:2px solid #5D96E4;height: 30px;padding-top: 5px">
                                                    <strong style="color: #5D96E4;font-size:21px">Medical Details</strong>
                                                </div>-->
                        <br>
                        <div style="">
                            <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 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-7 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>
                                <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 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 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">Immigration</label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="imig" class="form-control form text-right 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">M/s. </label>
                                        </div>
                                        <div class="col-lg-3 pad">
                                            <input type="number" step="any" name="mis" class="form-control form text-right 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 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">
                                                        
                                                        <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>
            <div class="modal fade bd-example-modal-lg " id="myEcr1" role="dialog">
                <div class="modal-dialog modal-lg " style="width:1340px;">

                    <!-- Modal content-->
                    <div class="modal-content col-lg-12">
                        <div class="modal-header">
                            <h4 class="modal-title" id="">Detail Part</h4>
                        </div>
                        <br>
                        <br>
                        <div class="col-lg-8">
                            <div class="row">
                                <div class="col-lg-2 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-4 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-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Sex</label>
                                </div>
                                <div class="col-lg-2 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-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">
                                    <input type="text" size="20" value="<?php ?>" class="pass1 form-control form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-2 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Immigration</label>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <select class='delvstatus1 form-control form'>
                                        <option value=''></option>
                                        <option value='E'>ECR</option>
                                        <option value='N'>ECNR</option>
                                    </select>
                                </div>
                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">DOB</label>
                                </div>
                                <div class="col-lg-2 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 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-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="text" value="<?php ?>" class="religion1 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-2 col-md-1 col-sm-6 col-xs-8 pad">
                                    <input type="text" size="20" value="<?php ?>" class="pob1 form-control form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <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-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Duration</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="stay1 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">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="issdate1 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-2 col-md-1 col-sm-6 col-xs-8 pad">
                                    <input type="date" value="<?php ?>" class="doe1 form-control form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <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="stampdate1 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</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="releasedt1 form-control form" /> -->
                                </div>
                                <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 pad" style="font-size: 13px;">
                                    <label class="control-label marg">Submission</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="submission_date1 form-control form" />
                                </div>
                                <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-2 col-md-1 col-sm-6 col-xs-8 pad">
                                    <!-- <input type="text" size="20" value="<?php ?>" class="category1 form-control form" placeholder="Arabic" /> -->
                                    <input list='category1' name='category1' value='' class='category1 form-control form ' autocomplete='off'  placeholder="Arabic">
                                       <datalist id='category1'>
                                        <option value=''>
                                        <?php
                                        $gcat = mysqli_query($conn, "SELECT `name_arabic` FROM `catgmast` WHERE code!='' order by `name_arabic`") or die(mysqli_error($conn));
                                        while ($fcat = mysqli_fetch_array($gcat)) {
                                            echo "<option value = '$fcat[name_arabic]' > ";
                                        } 
                                        ?>
                                     </datalist>
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <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" value="<?php ?>" class="mof1 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-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Mofa</label>
                                </div>
                                <div class="col-lg-2 col-md-1 col-sm-6 col-xs-8 pad" style="width:12%">
                                    <input type="date" value="<?php ?>" class="mofa_date1 form-control form" />
                                </div>
                                <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-2 col-md-1 col-sm-6 col-xs-8 pad">
                                    <!-- <input type="text" size="20" value="<?php ?>" class="category1 form-control form" placeholder="English" /> -->
                                    <input list='cateng1' name='cateng1' value='' class='cateng1 form-control form ' autocomplete='off'  placeholder="English">
                                       <datalist id='cateng1'>
                                        <option value=''>
                                        <?php
                                        $gcateng = mysqli_query($conn, "SELECT `name` FROM `catgmast` WHERE code!='' order by `name`") or die(mysqli_error($conn));
                                        while ($fcateng = mysqli_fetch_array($gcateng)) {
                                            echo "<option value = '$fcateng[name]' > ";
                                        } 
                                        ?>
                                     </datalist>
                                </div>

                            </div>

                            <br>
                            <div class="row">
                                <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-6 col-md-1 col-sm-6 col-xs-8 pad">
                                    <input type="text" value="<?php ?>" class="remark1 form-control form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Address</label>
                                </div>
                                <div class="col-lg-7 col-md-2 col-sm-6 col-xs-8 pad">
                                    <input type="text" value="<?php ?>" class="tadd1 form-control form" />
                                </div>
                            </div>
                            <!-- <br>
                            <div class="row">
                                <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" value="<?php ?>" class="mof1 form-control form" />
                                </div>
                            </div> -->
                        </div>

                        <div class="col-lg-4">
                            <div class="row">
                                <div class="col-lg-4 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg" style="color: #4285F4;">Mofa Amt</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-6 col-xs-8 pad">
                                    <input type="number" size="20" value="<?php ?>" class="mofamt_mod1 form-control text-right form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-4 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg" style="color: #4285F4;">Stamp Amt</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-6 col-xs-8 pad">
                                    <input type="number" size="20" value="<?php ?>" class="stampamt_mod1 form-control text-right form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-4 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg" style="color: #4285F4;">Immigration</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-6 col-xs-8 pad">
                                    <input type="number" size="20" value="<?php ?>" class="imigamt_mod1 form-control text-right form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-4 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg" style="color: #4285F4;">M/s. Amt</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-6 col-xs-8 pad">
                                    <input type="number" size="20" value="<?php ?>" class="mis_mod1 form-control text-right form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-4 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg" style="color: #4285F4;">Miscellaneous</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-6 col-xs-8 pad">
                                    <input type="number" size="20" value="<?php ?>" class="misc_mod1 form-control text-right form" />
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-lg-4 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Total Amt</label>
                                </div>
                                <div class="col-lg-4 col-md-1 col-sm-6 col-xs-8 pad">
                                    <input type="number" value="<?php ?>" tabindex="-1" class="memcash1 form-control text-right form" readonly />
                                </div>
                            </div>
                        </div>
                        <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-primary savepart form">Exit</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" 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: #7f949d">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: 30%;">User</th>
                                <th style="width: 30%;">Passport</th>
                                <th style="width: 30%;">Visa</th>
                            </tr>
                        </thead>
                        <tbody class="tbody4">
                        </tbody>
                    </table>
                </div>

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

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

</html>