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

$formname = 'Not Quoted Records';
$maindb = 'leadenq';
$printfile = "";
$file = 'leadrecd.php';
//$fileadd = 'leadenq.php';
$trandbexist = 0;
$grid = '';
$keyfld = "vouchno";
$keycond = " ";
$focusfield = "name";
$mgrpcode = '009';
$zroot = $_SESSION["zdir"];


$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];


$usertype = $_SESSION["usertype"];
$user = $_SESSION['username_' . $dbname];

mysqli_select_db($conn,$zdb);
include("includes/vouchno_generate.php");
include("includes/prev&next.php");

if (isset($_POST["submit"])) {

//    if (isset($_POST["submit"])) {
    $count = $_POST["count"];

    $subvouch = $_REQUEST["subvouch"];
    $quotncall = $_REQUEST["quotncall"];
    $quotcall = $_REQUEST["quotcall"];
    $flwup2dt = $_REQUEST["flwup2dt"];
    $flwup3dt = $_REQUEST["flwup3dt"];
    $postdate = $_REQUEST["postdate"];
    $remddate = $_REQUEST["remddate"];
    $cancresn = $_REQUEST["cancresn"];
    $newvouch = $_REQUEST["newvouch"];
    $confdate = $_REQUEST["confdate"];

    if (!empty($quotncall)) {
        mysqli_query($conn,"UPDATE `leadenq` SET `quotncall`='$quotncall'  WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
    }

    if (!empty($quotcall)) {
        mysqli_query($conn,"UPDATE `leadenq` SET `quotcall`='$quotcall'  WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
    }

    if (!empty($flwup2dt)) {
        mysqli_query($conn,"UPDATE `leadenq` SET `flwup2dt`='$flwup2dt'  WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
    }
    if (!empty($flwup3dt)) {
        mysqli_query($conn,"UPDATE `leadenq` SET `flwup3dt`='$flwup3dt' WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
    }
    if (!empty($postdate)) {
        mysqli_query($conn,"UPDATE `leadenq` SET `postdate`='$postdate', `remddate`='$remddate' WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
    }
    if (!empty($newvouch)) {
        mysqli_query($conn,"UPDATE `leadenq` SET `newvouch`='$newvouch' WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
    }
    if (!empty($cancresn)) {
        mysqli_query($conn,"UPDATE `leadenq` SET `cancresn`='$cancresn' WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
    }
    if (!empty($confdate)) {
        mysqli_query($conn,"UPDATE `leadenq` SET `confdate`='$confdate' WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
    }
//    if (!empty($user)) {
//        mysqli_query($conn,"UPDATE `leadenq` SET `user`='$user' WHERE `vouchno`='$subvouch'")or die(mysqli_error($conn));
//    }

    for ($i = 0; $i < $count; $i++) {
        $msrno = $_POST["srno_$i"];
        $vouchno = $_POST["vouchno_$i"];
        $status = $_POST["status_$i"];
        $quotvisa = $_POST["quotvisa_$i"];
        $quotstaff = $_POST["quotstaff_$i"];
        $remarks = trim($_POST["remarks_$i"]);
        $queuser = trim($_POST["queuser_$i"]);

        if (!empty($msrno)) {
            mysqli_query($conn,"UPDATE `leadenq` SET `status`='$status', `quotvisa`='$quotvisa',`queuser`='$queuser', `remarks`='$remarks' WHERE `vouchno`='$vouchno'")or die(mysqli_error($conn));
        }
    }
    updmess();
}

if (isset($_POST["trnfbutn"])) {


//    if (isset($_POST["submit"])) {

    $count = $_POST["count"];

    for ($i = 0; $i < $count; $i++) {
        $msrno = $_POST["srno_$i"];
        $vouchno = $_POST["vouchno_$i"];
        $status = $_POST["status_$i"];
        $quotvisa = $_POST["quotvisa_$i"];
        $questaff = $_POST["questaff_$i"];
        $remarks = trim($_POST["remarks_$i"]);
        $remarks1 = trim($_POST["remarks_$i"]);
//        $newuser = trim($_POST["newuser_$i"]);
//        browse($newuser);

        if (!empty($msrno)) {

            mysqli_query($conn,"UPDATE `leadenq` SET `status`='$status', `quotvisa`='$quotvisa', `questaff`='$questaff',`remarks`='$remarks',
                                              `remarks1`='$remarks1'  WHERE `vouchno`='$vouchno'")or die(mysqli_error($conn));
        }
    }
    updmess();
}

if (isset($_POST["mailbutn"])) {


//    if (isset($_POST["submit"])) {
    $mailvouch = trim($_POST["mailvouch"]);
    $ename = trim($_POST["ename"]);
    $elastname = trim($_POST["elastname"]);
    $edest = trim($_POST["edest"]);
    $etravdate = $_POST["etravdate"];
    $eremarks = trim($_POST["eremarks"]);
    $emobile = trim($_POST["emobile"]);
    $epackage = trim($_POST["epackage"]);

//    browse($emobile);
    $getnewvouch = mysqli_query($conn,"SELECT * FROM `visamain` WHERE leadvouch='$mailvouch' ") or die(mysqli_error($conn));
    $ledvouch = mysqli_num_rows($getnewvouch);
    $ledget = mysqli_fetch_array($getnewvouch);
    if ($ledvouch > 0) {
        $oldledvouch = $ledget[vouchno];
    } else {
        $gen1 = mysqli_query($conn,"SELECT MAX($keyfld) AS maxcode FROM `visamain` LIMIT 0,1 ") or die(mysqli_error($conn));

        if (mysqli_num_rows($gen1) > 0) {
            $vvouch = mysqli_fetch_assoc($gen1);
            $qlvouch = $vvouch["maxcode"] + 1;
        } else {
            $qlvouch = '1';
        }
    }
    $date = date("Y-m-d");
    if ($ledvouch > 0) {
        mysqli_query($conn,"UPDATE `visamain` SET `name`='$ename', `mobile`='$emobile', `lastname`='$elastname', `deptdate`='$etravdate', `package`='$epackage',
                        `destination`='$edest',leadvouch='$mailvouch',vouchdt='$date' WHERE `vouchno`='$oldledvouch'")or die(mysqli_error($conn));
    } else {
        mysqli_query($conn,"INSERT INTO `visamain`(vouchno, `vouchdt`, `leadvouch`, `mobile`, `name`, `lastname`, `destination`, `deptdate`, `package`,
                                               `username`)
                                        VALUES($qlvouch, '$date', '$mailvouch', '$emobile', '$ename', '$elastname', '$edest',  '$etravdate', '$epackage',
                                               '$user')") or die(mysqli_error($conn));
    }

    $count = $_POST["count"];

    for ($i = 0; $i < $count; $i++) {
        $msrno = $_POST["srno_$i"];
        $vouchno = $_POST["vouchno_$i"];
        $status = $_POST["status_$i"];
        $quotvisa = $_POST["quotvisa_$i"];
        $queuser = $_POST["queuser_$i"];
        $remarks = trim($_POST["remarks_$i"]);
        $remarks1 = trim($_POST["remarks_$i"]);


        if (!empty($msrno)) {
            mysqli_query($conn,"UPDATE `leadenq` SET `status`='$status', `quotvisa`='$quotvisa', `queuser`='$queuser',`remarks`='$remarks',`remarks1`='$remarks1'  WHERE `vouchno`='$vouchno'")or die(mysqli_error($conn));
        }
    }
    updmess();
}

if (isset($_POST["update"])) {

//    if (isset($_POST["submit"])) {
    $count = $_POST["count"];

    for ($i = 0; $i < $count; $i++) {
        $msrno = $_POST["srno_$i"];
        $vouchno = $_POST["vouchno_$i"];
        $status = $_POST["status_$i"];
        $quotvisa = $_POST["quotvisa_$i"];
        $queuser = $_POST["queuser_$i"];
        $remarks = trim($_POST["remarks_$i"]);
        $remarks1 = trim($_POST["remarks1_$i"]);

        if (!empty($msrno)) {
            browse($queuser);
            mysqli_query($conn,"UPDATE `leadenq` SET `status`='$status', `quotvisa`='$quotvisa', `queuser`='$queuser',`remarks`='$remarks', `remarks1`='$remarks1' WHERE `vouchno`='$vouchno'")or die(mysqli_error($conn));
        }
    }
    updmess();
//    header("refresh: 1; $file");
}

if ($addflag != 1) {

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

    $result = mysqli_query($conn,"SELECT * FROM `$maindb` order by `vouchno` desc ") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);
}

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


if (isset($_GET["delete"])) {
    delete($zdb, "$maindb", "$keyfld", $_GET[$keyfld], "$file?mode=last");
//    delete($zdb, "$maindb", "$keyfld", $_GET[$keyfld], "$file?mode=last");
}

include("includes/linkshead.php");
?>
<script src="MyScript/sorttab.js" type="text/javascript"></script>
<!--<script type="text/javascript" src="MyScript/jquery-latest.js"></script> 
<script type="text/javascript" src="MyScript/jquery.tablesorter.js"></script> -->

  <script type="text/javascript" src="MyScript/jquery-1.10.2.min.js"></script>
  <script type="text/javascript" src="MyScript/jquery.tablesorter.min.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $("body").on('change', '.status', getModal);
        $("body").on('change', '.status', getNewVoucher);
        $("body").on('change', '.questaff', getNewModal);
        $("body").on('change', '.quotvisa', getEmailModal);
        $("body").on('click', '.CMail', sendMail);
        $("body").on('click', '.addNewVouch', addNewVoucher);
        $("body").on('click', '.trnfbutn', changeStaff);


        function getModal() {
            var $row = $(this).closest("tr");
            var option_value = $row.find('.status').val();
            var vouchno = $row.find('.vouchno').val();
            var data = {vouchno: vouchno};
            $.ajax({
                type: 'GET',
                dataType: 'json',
                url: "show_lead_dtl.php",
                data: data,
                success: function (response) {
                    //            var option_value = document.getElementById("status").value;
                    if (option_value == "Quoted Not Called") {
                        $('#subvouch').val(vouchno);
//                                    $($row.find('.rate')).val(response.rate);
                        $('.modal-body .quotncall').val(response.quotncall);
                        $("#myModal").modal("show");
                        $(".modal-body #tr1").hide();
                        $(".modal-body #tr2").show();
                        $(".modal-body #tr3").hide();
                        $(".modal-body #tr4").hide();
                        $(".modal-body #tr5").hide();
                        $(".modal-body #tr6").hide();
                        $(".modal-body #tr7").hide();
                        $(".modal-body #tr8").hide();

                    } else if (option_value == "Quoted & Called") {
                        $('#subvouch').val(vouchno);
//                                    $($row.find('.rate')).val(response.rate);
                        $('.modal-body .quotcall').val(response.quotcall);
                        $("#myModal").modal("show");
                        $(".modal-body #tr1").hide();
                        $(".modal-body #tr2").hide();
                        $(".modal-body #tr3").show();
                        $(".modal-body #tr4").hide();
                        $(".modal-body #tr5").hide();
                        $(".modal-body #tr6").hide();
                        $(".modal-body #tr7").hide();
                        $(".modal-body #tr8").hide();

                    } else if (option_value == "Follow up 2") {
                        $('#subvouch').val(vouchno);
//                                    $($row.find('.rate')).val(response.rate);
                        $('.modal-body .flwup2dt').val(response.flwup2dt);
                        $("#myModal").modal("show");
                        $(".modal-body #tr1").hide();
                        $(".modal-body #tr2").hide();
                        $(".modal-body #tr3").hide();
                        $(".modal-body #tr4").show();
                        $(".modal-body #tr5").hide();
                        $(".modal-body #tr6").hide();
                        $(".modal-body #tr7").hide();
                        $(".modal-body #tr8").hide();

                    } else if (option_value == "Follow up 3") {
                        $('#subvouch').val(vouchno);
//                                    $($row.find('.rate')).val(response.rate);
                        $('.modal-body .flwup3dt').val(response.flwup3dt);
                        $("#myModal").modal("show");
                        $(".modal-body #tr1").hide();
                        $(".modal-body #tr2").hide();
                        $(".modal-body #tr3").hide();
                        $(".modal-body #tr4").hide();
                        $(".modal-body #tr5").show();
                        $(".modal-body #tr6").hide();
                        $(".modal-body #tr7").hide();
                        $(".modal-body #tr8").hide();
                    } else if (option_value == "Postponed") {
                        $('#subvouch').val(vouchno);
//                                    $($row.find('.rate')).val(response.rate);
                        $('.modal-body .postdate').val(response.postdate);
                        $('.modal-body .remddate').val(response.remddate);
                        $("#myModal").modal("show");
                        $(".modal-body #tr1").hide();
                        $(".modal-body #tr2").hide();
                        $(".modal-body #tr3").hide();
                        $(".modal-body #tr4").hide();
                        $(".modal-body #tr5").hide();
                        $(".modal-body #tr6").show();
                        $(".modal-body #tr7").hide();
                        $(".modal-body #tr8").hide();
                    } else if (option_value == "Cancelled") {
                        $('#subvouch').val(vouchno);
//                                    $($row.find('.rate')).val(response.rate);
                        $('.modal-body .cancresn').val(response.cancresn);
                        $("#myModal").modal("show");
                        $(".modal-body #tr1").hide();
                        $(".modal-body #tr2").hide();
                        $(".modal-body #tr3").hide();
                        $(".modal-body #tr4").hide();
                        $(".modal-body #tr5").hide();
                        $(".modal-body #tr6").hide();
                        $(".modal-body #tr7").show();
                        $(".modal-body #tr8").hide();
                    }
                    else if (option_value == "Confirmed") {
                        $('#subvouch').val(vouchno);
//                                    $($row.find('.rate')).val(response.rate);
                        $('.modal-body .confdate').val(response.confdate);
                        $("#myModal").modal("show");
                        $(".modal-body #tr1").hide();
                        $(".modal-body #tr2").hide();
                        $(".modal-body #tr3").hide();
                        $(".modal-body #tr4").hide();
                        $(".modal-body #tr5").hide();
                        $(".modal-body #tr6").hide();
                        $(".modal-body #tr7").hide();
                        $(".modal-body #tr8").show();
                    }
                },
                error: function (request, textStatus, errorThrown) {
                    alert(errorThrown);
                }
                //dataType:'json'
            });
//                    $.get('get_followup_date.php', {vouchno: vouchno}, function (data) {
//
//
//
//                    });
        }

        function getEmailModal() {
            var $row = $(this).closest("tr");
            var option_value1 = $row.find('.quotvisa').val();
            var vouchno1 = $row.find('.vouchno').val();
            var data = {vouchno: vouchno1};
            $.ajax({
                type: 'GET',
                dataType: 'json',
                url: "show_cust_dtl.php",
                data: data,
                success: function (response) {
                    //            var option_value = document.getElementById("status").value;
                    if (option_value1 == "Y") {
                        $('#mailvouch').val(vouchno1);
//                                    $($row.find('.rate')).val(response.rate);
                        $('.modal-body .emobile').val(response.mobile);
                        $('.modal-body .ename').val(response.name);
                        $('.modal-body .elastname').val(response.lastname);
                        $('.modal-body .edest').val(response.destination);
                        $('.modal-body .etravdate').val(response.deptdate);
                        $("#emailModal").modal("show");
//                        $(".modal-body #tr2").show();
//                        $(".modal-body #tr1").hide();
//                        $(".modal-body #tr3").hide();
//                        $(".modal-body #tr4").hide();
//                        $(".modal-body #tr5").hide();
//                        $(".modal-body #tr6").hide();

                    }
                },
                error: function (request, textStatus, errorThrown) {
                    alert(errorThrown);
                }
                //dataType:'json'
            });
//                    $.get('get_followup_date.php', {vouchno: vouchno}, function (data) {
//
//
//
//                    });
        }


        function sendMail() {
            var ename = $(".ename").val(), elastname = $(".elastname").val(), edest = $(".edest").val(),
                    etravdate = $(".etravdate").val(), eremarks = $(".eremarks").val(), emobile = $(".emobile").val(), epackage = $(".epackage").val();
            $.post('customer_SendMail.php', {ename: ename, elastname: elastname, edest: edest, etravdate: etravdate, eremarks: eremarks, emobile: emobile, epackage: epackage}, function (data) {
                if (data = "succcess") {
                    alert("Details Are Send To The Visa Department");
                    $("#emailModal").modal("hide");
                }
            });
        }

        function getNewVoucher() {
            var $row = $(this).closest("tr");
            var option_value2 = $row.find('.status').val();
            var vouchno1 = $row.find('.vouchno').val(),
                    name1 = $row.find(".name").val(),
                    lastname1 = $row.find(".lastname").val(),
                    vouchdt1 = $row.find(".vouchdt").val(),
                    mobile1 = $row.find(".mobile").val(),
                    destination1 = $row.find(".destination").val(),
                    deptdate1 = $row.find(".deptdate").val();
            if (option_value2 == "Destination Change") {
                $('#vouchno1').val(vouchno1);
                $('.modal-body .name1').val(name1);
                $('.modal-body .lastname1').val(lastname1);
                $('.modal-body .vouchdt1').val(vouchdt1);
                $('.modal-body .deptdate1').val(deptdate1);
                $('.modal-body .mobile1').val(mobile1);
                $('.modal-body .destination1').val(destination1);
                $("#destchange").modal("show");

            }

        }

        $("#confcanc").click(function () {
            $("#destchange").modal("hide");
        });

        function getNewModal() {
            var $row = $(this).closest("tr");
            var questaff = $row.find('.questaff').val();
            var vouchno1 = $row.find('.vouchno').val(),
                    name1 = $row.find(".name").val(),
                    lastname1 = $row.find(".lastname").val(),
                    vouchdt1 = $row.find(".vouchdt").val(),
                    mobile1 = $row.find(".mobile").val(),
                    destination1 = $row.find(".destination").val(),
                    deptdate1 = $row.find(".deptdate").val();
            if (questaff == "Y") {
                $('.modal-body #vouchno1').val(vouchno1);
                $('.modal-body .name1').val(name1);
                $('.modal-body .lastname1').val(lastname1);
                $('.modal-body .vouchdt1').val(vouchdt1);
                $('.modal-body .deptdate1').val(deptdate1);
                $('.modal-body .mobile1').val(mobile1);
                $('.modal-body .destination1').val(destination1);
                $("#leadtrnf").modal("show");

            }

        }

        function changeStaff() {
            var vouchno1 = $(".vouchno1").val();
            var newuser = $(".newuser").val();

            $.post('customer_leadTrnf.php', {vouchno1: vouchno1, newuser: newuser}, function (data) {
                if (data = "success") {
                    alert("Lead Query is send to " + newuser + " for approval");
                    $("#leadtrnf").modal("hide");
                }
            });

        }

        $("#confcanc").click(function () {
            $("#destchange").modal("hide");
        });

        $("#trnfcanc").click(function () {
            $("#leadtrnf").modal("hide");
        });

        function addNewVoucher() {
            var name1 = $(".name1").val(), lastname1 = $(".lastname1").val(), mobile1 = $(".mobile1").val(),
                    deptdate1 = $(".deptdate1").val(), vouchdt1 = $(".vouchdt1").val(), newdest = $(".newdest").val(), vouchno1 = $(".vouchno1").val();

            $.post('customer_newVouch.php', {name1: name1, lastname1: lastname1, mobile1: mobile1, deptdate1: deptdate1,
                vouchdt1: vouchdt1, vouchno1: vouchno1, newdest: newdest}, function (data) {
                if (data != "") {
                    alert("New Voucher is Generated For this Lead and New lead No is.:" + data);
                    $("#destchange").modal("hide");
                }
            });
        }

        $(".search").click(function () {
            var field = $(".field").val(),
                    search = $(".tsearch").val(),
                    sortby = $(".sortby").val(),
                    sorderby = $(".sorderby").val(),
                    type = "Not Quoted";

            $.post('get_srchall.php', {field: field, search: search,type: type, sortby: sortby, sorderby: sorderby}, function (data) {
//                alert(data);
                $(".mytable").html(data);
            });
        });
        
        $(".btsort").click(function () {
            var field = $(".field").val(),
                    search = $(".tsearch").val(),
                    sortby = $(".sortby").val(),
                    sorderby = $(".sorderby").val(),
                    type = "Not Quoted";

            $.post('get_sortorder.php', {field: field, search: search, sortby: sortby, sorderby: sorderby,type: type}, function (data) {
//                alert(data);
                $(".mytable").html(data);
            });
        });
        
         //        $('table tbody tr  td').on('change', function () {
//            $("#myModal").modal("show");
//            $("#status").val($(this).closest('tr'));
    });
</script>
<script type="text/javascript">
    $(document).keydown(function (event) {
        if (!(String.fromCharCode(event.which).toLowerCase() == 'a' && event.altKey) && !(event.which == 19))
            return true;
        $("#addnew").click();
        event.preventDefault();
        return false;
    });

    $(document).keydown(function (event) {
        //19 for Mac Command+S
        if (!(String.fromCharCode(event.which).toLowerCase() == 's' && event.altKey) && !(event.which == 19))
            return true;
        //alert("Ctrl-s pressed");
        $("#update").click();
        event.preventDefault();
        return false;
    });

    $(document).keydown(function (event) {
        //19 for Mac Command+S
        if (!(String.fromCharCode(event.which).toLowerCase() == 'f' && event.altKey) && !(event.which == 19))
            return true;
        //alert("Ctrl-s pressed");
        $("#btsearch").click();
        event.preventDefault();
        return false;
    });
</script>


<style>
    .button {
        padding: 15px 25px;
        font-size: 15px;
        text-align: center;
        cursor: pointer;
        outline: none;
        color: #fff;
        background-color: #4CAF50;
        border: none;
        border-radius: 15px;
        box-shadow: 0 9px #999;
    }

    .button:hover {background-color: #3e8e41}

    .button:active {
        background-color: #3e8e41;
        box-shadow: 0 5px #666;
        transform: translateY(4px);
    }
    /* Sortable tables */
    table.sortable thead {
        /*background-color:#eee;*/
        /*color:#666666;*/
        font-weight: bold;
        cursor: default;
    }
</style>

</head>
<body>
    <!--    <div id="preloader" class="col-lg-12 text-center">
            <h3 class="text-center">Loading</h3>
            <div id="status">&nbsp;</div>
        </div>-->
    <form action='' method='POST'>
        <!-- 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; ?></h3>
                        <div class="actions pull-right">

                            <i class="fa fa-chevron-down"></i>
                            <!--<i class="fa fa-times"></i>-->
                        </div> 
                        <!--<input type='button' style="float: right;" name='exit' value='Exit' class="btn btn-danger" onClick="window.location.href = '<? Echo $file; ?>'">-->

                    </div> 
                    <div style="padding-left: 0px;">
<!--                        <input id='addnew' value="Add Lead Entry" type="button"  class="btn btn-pad btn-square button" style="background-color:#64CCFC;" onclick="window.location.href = '<?= $fileadd . "?mode=true" ?>'" class="btn btn-labeled btn-success">
                        <i class="fa fa-plus" style="color:#ffffff"></i>    

                        </button>-->

                        <input style="float: right;padding-right: 15px;"  type='submit' id="update" name='update' value='Save' class="btn btn-primary" tabindex="4">

                        <input type='button' class="btn btn-warning search" id='btsearch'  style="float: right;" value="Search" tabindex="3">
                        <input type='text' style="width:200px;float: right;" name='search' class="form-control tsearch"  tabindex="2">
                        <select class="form-control field" style="float:right;width:200px;" autofocus="autofocus" tabindex="1">
                            <option value="1">Name</option>
                            <option value="2">Last Name</option>
                            <option value="3">Book No.</option>
                            <option value="4">Mobile</option>
                            <option value="5">Date</option>
                            <option value="6">Destination</option>
                            <option value="7">Status</option>
                            <option value="8">Remark</option>
                        </select>
                        <label style="float:right;padding-top: 9px;padding-right: 7px;">Search By</label>
                        <label style="float:right;padding-right: 30px;"></label>
<!--                    </div>
                    <div style="padding-left: 0px;">-->
<!--                        <input id='addnew' value="Add Lead Entry" type="button"  class="btn btn-pad btn-square button" style="background-color:#64CCFC;" onclick="window.location.href = '<?= $fileadd . "?mode=true" ?>'" class="btn btn-labeled btn-success">
                        <i class="fa fa-plus" style="color:#ffffff"></i>    -->

                        <!--</button>-->

                        <!--<input style="float: right;padding-right: 15px;"  type='submit' id="update" name='update' value='Save' class="btn btn-primary" tabindex="4">-->

                        <input type='button' class="btn btn-default btsort" id='btsort'  style="float: right;" value="Sort">
                        <!--<input type='text' style="width:200px;float: right;" name='sortbtn' class="form-control sortbtn">-->
                        <select class="form-control sorderby" style="float:right;width:120px;">
                            <option value="1">ASCENDING</option>
                            <option value="2">DESCENDING</option>
                        </select>
                        <label style="float:right;padding-top: 9px;padding-right: 7px;color: #64CCFC;">Order By</label>
                        <select class="form-control sortby" style="float:right;width:100px;">
                            <option value="1">Name</option>
                            <option value="2">Last Name</option>
                            <option value="3">Book No.</option>
                            <option value="4">Mobile</option>
                            <option value="5">Date</option>
                            <option value="6">Destination</option>
                            <option value="7">Status</option>
                            <option value="8">Remark</option>
                        </select>
                        <label style="float:right;padding-top: 9px;padding-right: 7px;color: #64CCFC;">Sort By</label>
                    </div>
                    <br>
                    <div class="panel-body table-responsive" style="width:100%">
                        <table id="dataTable" class="table-bordered" width="100%">
                            <thead>
                                <tr style="background-color: #64CCFC">
                                    <th style="padding-left:5px;">Sr.</th>
                                    <?php
//                                    if ($usertype == 1) {
                                        ?>
                                        <!--<th>Staff</th>-->
                                    <?php // } ?>
                                    <th>Book No.</th>
                                    <th style="text-align:center;">Enq. Date</th>
                                    <th style="text-align:center;" >Name</th>
                                    <th style="text-align:center;">Last Name</th>
                                    <th style="text-align:center;">Mobile</th>
                                    <th style="text-align:center;">Destination</th>
                                    <th style="text-align:center;">Travel Date</th>
                                    <th style="text-align:center;">Status</th>
                                    <th style="text-align:center;">Que to Visa</th>
                                    <!--<th style="text-align:center;">Que to Staff</th>-->
                                    <th style="text-align:center;">Remark</th>
                                    <th style="text-align:center;">New Remark</th>
                                    <!--<th style="text-align:center;">Delete</th>-->
                                </tr>
                            </thead>
                            <tbody class="mytable">
                                <?php
//                                if ($usertype == 1) {
//                                    $srchresult = mysqli_query($conn,"SELECT * FROM `$maindb` WHERE `status` != 'Destination Change'  and `status` != 'Cancelled' and `status` != 'Confirmed' order by vouchno desc") or die(mysqli_error($conn));
//                                } else {
                                    $srchresult = mysqli_query($conn,"SELECT * FROM `$maindb` WHERE `username` ='$user' and `status` = 'Not Quoted' order by vouchno desc") or die(mysqli_error($conn));
//                                }

                                $ctr = 1;

                                while ($row = mysqli_fetch_array($srchresult)) {
                                    
                                    $name = strtoupper($row[name]);
                                    $lastname = strtoupper($row[lastname]);

                                    echo "<tr>";
                                    Echo "<td class=''><input type='text' value='$ctr' name='srno_$ctr' style='border : none;width : 30px;text-align:center;' readonly></td>";
//                                    if ($usertype == 1) {
//                                        Echo "<td class=''><input type='text' value='$row[username]' name='username_$ctr' style='border : none;width : 80px;text-align:center;' readonly></td>";
//                                    }

                                    Echo "<td class=''><a href=\"leadenq.php?vouchno=$row[vouchno]&mode=edit\"><input type='text' value='$row[vouchno]' name='vouchno_$ctr' style='border : none;width : 70px; text-align:center;' readonly class='vouchno'></a></td>";
                                    Echo "<td class=''><input type='date' value='$row[vouchdt]' name='vouchdt_$ctr' style='border : none;width : 120px;text-align:center;' readonly class='vouchdt'></td>";
                                    Echo "<td class=''><a href=\"leadenq.php?vouchno=$row[vouchno]&mode=edit\"><input type='text'value='$name' name='name_$ctr' style='border : none;text-align:center;width:110px;' readonly class='name'></a></td>";
                                    Echo "<td class=''><a href=\"leadenq.php?vouchno=$row[vouchno]&mode=edit\"><input type='text'value='$lastname' name='lastname_$ctr' style='border : none;text-align:center;width:110px;' readonly class='lastname'></a></td>";
                                    Echo "<td class=''><input type='text'value='$row[mobile]' name='mobile_$ctr' style='border : none;text-align:center;width:110px;' readonly class='mobile'></td>";
                                    Echo "<td class=''><a href=\"leadenq.php?vouchno=$row[vouchno]&mode=edit\"><input type='text'value='$row[destination]' name='destination_$ctr' style='border : none;text-align:center;width:100px;' readonly class='destination'></a></td>";
                                    Echo "<td class=''><input type='date' value='$row[deptdate]' name='deptdate_$ctr' style='border : none;text-align:center;width:120px;' readonly class='deptdate'></td>";
                                    ?>
                                    <?php
//                                           echo "</td>";
                                    echo "<td align='left'>"
                                    ?> 
                                <select  name='status_<?= $ctr ?>' id="status"  class="status form-control" style='height:33px;border: 0px;width:150px;'>
                                    <option value='Not Quoted'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Not Quoted") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?> >Not Quoted</option>
                                    <option value='Quoted Not Called'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Quoted Not Called") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Quoted Not Called</option>
                                    <option value='Quoted & Called'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Quoted & Called") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Quoted & Called</option>
                                    <option value='Follow up 2'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Follow up 2") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Follow up 2</option>
                                    <option value='Follow up 3'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Follow up 3") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Follow up 3</option>
                                    <option value='Destination Change'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Destination Change") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Destination Change</option>
                                    <option value='Cancelled'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Cancelled") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Cancelled</option>
                                    <option value='Postponed'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Postponed") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Postponed</option>
                                    <option value='Confirmed'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Confirmed") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Confirmed</option>
                                    <option value='Amendment Requoting'<?php
                                    if ($addflag != 1) {
                                        if ($row["status"] == "Amendment Requoting") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Amendment Requoting</option>
                                </select>

                                <?php
                                echo "</td>";
                                echo "<td align='left'>"
                                ?>
                                <select name='quotvisa_<?= $ctr ?>' id="quotvisa"  class="quotvisa form-control" style='text-align: center;height:33px;width:100px;border: 0px;'>
                                    <option value='N'<?php
                                    if ($addflag != 1) {
                                        if ($row["quotvisa"] == "N") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?> >No</option>
                                    <option value='Y'<?php
                                    if ($addflag != 1) {
                                        if ($row["quotvisa"] == "Y") {
                                            echo "selected='selected'";
                                        }
                                    }
                                    ?>>Yes</option>
                                </select>
                                <?php
                                echo "</td>";
                                Echo "<td class='text-right'><input type='text' value='$row[remarks]' name='remarks_$ctr' style='width:150px;border:none;padding : 0px;text-align:left;' class='remarks'></td>";
                                Echo "<td class='text-right'><input type='text' value='$row[remarks1]' name='remarks1_$ctr' style='width:150px;border:none;border-bottom:1px solid black; padding : 0px;text-align:left;' class='remarks1'></td>";
                                ?>
<!--                                <td class=" buttonform tooltip-bottom text-right" id="hdelete" style="display: <? Echo $deletedisabled ?>" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Delete Record">
                                    <a id='delete' class="btn btn-pad btn-square delete-entry" href="?delete&<?= $keyfld . "=" . $row[vouchno] . "" ?>"  onClick="return confirm('Confrim Delete?');" style="background-color:#D9534F;">
                                        <i class="fa fa-trash" style="color:#ffffff;height:10px;width:10px;"></i>
                                    </a>
                                </td>-->
                                <!--//                                echo "<td><a href=\"?vouchno=$row->vouchno\" onClick=\"return confirm('Confrim Delete?');\"><i class='fa fa-trash-o' style='font-size:1.3em;color:red;cursor:pointer;'></i></a></td>";-->
                                <?php
                                echo "</tr>";
                                $ctr++;
                            }
                            ?>

                            <input type = "text" style="width:1px;display: none;" name = "count" value = "<? Echo $ctr; ?>" readonly="redonly">

                            </tbody> 
                        </table>

                    </div>
                    <!--                    <div class="panel-footer">
                    <?php // include("includes/buttons.php");       ?>
                                        </div>-->
                </div>
            </div>
        </div>
        <?php
        mysqli_select_db($conn,$zdb);

//        $ressubvouch = mysqli_query($conn,"SELECT *,DATE_FORMAT(`flwup2dt`, '%d-%m-%Y')as flwup2dt, DATE_FORMAT(`flwup3dt`, '%d-%m-%Y')as flwup3dt FROM `$maindb` WHERE $keyfld='$subvouch' ") or die(mysqli_error($conn));
//        $getsub = mysqli_fetch_array($ressubvouch);
        ?>
        <div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
            <div class="modal-dialog modal-lg" style="width: 70%;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal"><span>&times;</span></button>
                        <h4 class="modal-title" id="myLargeModalLabel"></h4>
                    </div>
                    <!--<input type='button' style="float: right;" name='exit' value='Exit' class="btn btn-danger" onClick="window.location.href = '<? Echo $file; ?>'">-->
                    <!--<button style="float: right;" type='submit' name='update' value='Update' class="btn btn-success">-->
                    <div class="container">
                        <button id='submit'  type='submit' name='submit' value='Update' class="btn btn-success">Save</button> 
                    </div>

                    <div class="modal-body">
                        <div class="table-responsive">
                            <table>
                                <tr id="tr1">
                                    <td><input type="text" name="subvouch" id="subvouch" value="<?php echo ($addflag != 1) ? $row['subvouch'] : ""; ?>" class="subvouch form-control" value=""></td>
                                </tr>
                                <tr id="tr2">
                                    <td><label class="label-control marg">Quoted Not Called</label></td>
                                    <td><input type="date" name="quotncall" id="quotncall" value="<?php echo ($addflag != 1) ? $row['quotncall'] : ""; ?>" class="quotncall form-control" value=""></td>
                                </tr>
                                <tr id="tr3">
                                    <td><label class="label-control marg">Quoted & Called Date</label></td>
                                    <td><input type="date" name="quotcall" id="quotcall" value="<?php echo ($addflag != 1) ? $row['quotcall'] : ""; ?>" class="quotcall form-control" value=""></td>
                                </tr>
                                <tr id="tr4">
                                    <td><label class="label-control marg">Follow Up 2 Date</label></td>
                                    <td><input type="date" name="flwup2dt" id='flwup2dt' placeholder="" value="<?php echo ($addflag != 1) ? $row['flwup2dt'] : "date('Y-m-d')"; ?>" style="width:175px;" class="form-control flwup2dt"></td>
                                </tr>
                                <tr id="tr5">
                                    <td><label class="label-control marg">Follow Up 3 Date</label></td>
                                    <td><input type="date" name="flwup3dt" id='flwup3dt' placeholder="" value="<?php echo ($addflag != 1) ? $row['flwup3dt'] : "date('Y-m-d')"; ?>" style="width:175px;" class="form-control flwup3dt"></td>
                                </tr>
                                <tr id="tr6">
                                    <td><label class="label-control marg">Postponed Date</label></td>
                                    <td><input type="date" name="postdate" id='postdate' placeholder="" value="<?php echo ($addflag != 1) ? $row['postdate'] : "date('Y-m-d')"; ?>" style="width:175px;" class="form-control postdate"></td>
                                    <td><label class="label-control marg">Reminder Date</label></td>
                                    <td><input type="date" name="remddate" id='remddate' placeholder="" value="<?php echo ($addflag != 1) ? $row['remddate'] : "date('Y-m-d')"; ?>" style="width:175px;" class="form-control remddate"></td>
                                </tr>
                                <tr id="tr7">
                                    <td><label class="label-control marg">Reason</label></td>
                                    <!--<td><input type="text" name="cancresn" id='cancresn' placeholder="" value="<?php echo ($addflag != 1) ? $row['cancresn'] : ""; ?>" style="width:300px;" class="form-control reason"></td>-->
                                    <td>
                                        <select class="form-control select2 cancresn"  autofocus="" name="cancresn" style="width:300px;">
                                            <option value="<? Echo ($addflag != 1 ) ? $row[cancresn] : "" ?>"><? Echo ($addflag != 1 ) ? $row[cancresn] : "" ?></option>
                                            <?
                                            $getsource = mysqli_query($conn,"SELECT * FROM `reason`")or die(mysqli_error($conn));
                                            while ($msource = mysqli_fetch_array($getsource)) {
                                                Echo "<option value='$msource[name]'>$msource[name]</option>";
                                            }
                                            ?>
                                        </select>

                                    </td>
                                </tr>
                                <tr id="tr8">
                                    <td><label class="label-control marg">Confirmed Date</label></td>
                                    <td><input type="date" name="confdate" id='confdate' placeholder="" value="<?php echo ($addflag != 1) ? $row['confdate'] : "date('Y-m-d')"; ?>" style="width:300px;" class="form-control confdate"></td>
                                </tr>
<!--                                <tr id="tr6">
                                    <td><label class="label-control marg">New Voucher</label></td>
                                    <td><input type="text" name="newvouch" id='newvouch' placeholder="" value="" style="width:100px;" class="form-control newvouch"></td>
                                </tr>-->
                            </table>
                        </div>
                    </div>
                    <div class="modal-footer"></div>
                </div>
            </div>
        </div>
        <div class="modal fade bs-example-modal-lg" id="emailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
            <div class="modal-dialog modal-lg" style="width: 70%;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal"><span>&times;</span></button>
                        <h4 class="modal-title" id="myLargeModalLabel"></h4>
                    </div>
                    <!--<input type='button' style="float: right;" name='exit' value='Exit' class="btn btn-danger" onClick="window.location.href = '<? Echo $file; ?>'">-->
                    <!--<button style="float: right;" type='submit' name='update' value='Update' class="btn btn-success">-->
                    <!--<button id='submit'  type='submit' name='submit' value='Update' class="btn btn-success">Save</button>--> 


                    <div class="modal-body">
                        <div class="table-responsive">
                            <table>
                                <tr id="">
                                    <td><label class="label-control marg">Booking No.</label></td>
                                    <td><input type="text" name="mailvouch" id="mailvouch" value="<?php echo ($addflag != 1) ? $row['mailvouch'] : ""; ?>"  style="width:175px;" class="mailvouch form-control" readonly="readonly"></td>
                                    <td><label class="label-control marg">Mobile</label></td>
                                    <td><input type="text" name="emobile" id='mobile1' placeholder="" value="<?php echo ($addflag != 1) ? $row['mobile'] : ""; ?>" style="width:175px;" class="form-control emobile" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Name</label></td>
                                    <td><input type="text" name="ename" id='ename' placeholder="" value="<?php echo ($addflag != 1) ? $row['name'] : ""; ?>" style="width:300px;" class="form-control ename" readonly="readonly"></td>
                                    <td><label class="label-control marg">Last Name</label></td>
                                    <td><input type="text" name="elastname" id='elastname' placeholder="" value="<?php echo ($addflag != 1) ? $row['lastname'] : ""; ?>" style="width:300px;" class="form-control elastname" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Destination</label></td>
                                    <td><input type="text" name="edest" id='edest' placeholder="" value="<?php echo ($addflag != 1) ? $row['destination'] : ""; ?>" style="width:175px;" class="form-control edest" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Travel Date</label></td>
                                    <td><input type="date" name="etravdate" id='etravdate' placeholder="" value="<?php echo ($addflag != 1) ? $row['deptdate'] : ""; ?>" style="width:175px;" class="form-control etravdate" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Remarks</label></td>
                                    <td><input type="text" name="eremarks" id='eremarks' placeholder="" value="<?php echo ($addflag != 1) ? $row['remarks'] : ""; ?>" style="width:400px;" class="form-control eremarks"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Type</label></td>
                                    <td><select name="epackage" id='epackage' class="form-control epackage" style="width:175px;" >
                                            <option></option>   
                                            <option value="P">Package</option>   
                                            <option value="N">Non Package</option>   
                                        </select>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad text-right">
                        <button type="submit" name="mailbutn" id="mailbutn" class="btn btn-primary CMail" style="margin-right: 20px"><i class="fa fa-envelope"></i>Send Mail To Visa Department</button>
                    </div>
                    <div class="modal-footer"></div>
                </div>
            </div>
        </div>
        <div class="modal fade bs-example-modal-lg" id="destchange" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
            <div class="modal-dialog modal-lg" style="width: 70%;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal"><span>&times;</span></button>
                        <h4 class="modal-title" id="myLargeModalLabel"></h4>
                    </div>
                    <!--<input type='button' style="float: right;" name='exit' value='Exit' class="btn btn-danger" onClick="window.location.href = '<? Echo $file; ?>'">-->
                    <!--<button style="float: right;" type='submit' name='update' value='Update' class="btn btn-success">-->
                    <!--<button id='submit'  type='submit' name='submit' value='Update' class="btn btn-success">Save</button>--> 


                    <div class="modal-body">
                        <div class="table-responsive">
                            <table>
                                <tr id="">
                                    <td><label class="label-control marg">Booking No.</label></td>
                                    <td><input type="text" name="vouchno1" id="vouchno1" value="<?php echo ($addflag != 1) ? $row['vouchno'] : ""; ?>"  style="width:175px;" class="vouchno1 form-control" readonly="readonly"></td>
                                    <td><label class="label-control marg">Booking Date</label></td>
                                    <td><input type="date" name="vouchdt1" id="vouchdt1" value="<?php echo ($addflag != 1) ? $row['vouchdt'] : ""; ?>"  style="width:175px;" class="vouchdt1 form-control" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Name</label></td>
                                    <td><input type="text" name="name1" id='name1' placeholder="" value="<?php echo ($addflag != 1) ? $row['name'] : ""; ?>" style="width:300px;" class="form-control name1" readonly="readonly"></td>
                                    <td><label class="label-control marg">Last Name</label></td>
                                    <td><input type="text" name="lastname1" id='lastname1' placeholder="" value="<?php echo ($addflag != 1) ? $row['lastname'] : ""; ?>" style="width:300px;" class="form-control lastname1" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Travel Date</label></td>
                                    <td><input type="date" name="deptdate1" id='deptdate1' placeholder="" value="<?php echo ($addflag != 1) ? $row['deptdate'] : ""; ?>" style="width:175px;" class="form-control deptdate1" readonly="readonly"></td>
                                    <td><label class="label-control marg">Mobile</label></td>
                                    <td><input type="text" name="mobile1" id='mobile1' placeholder="" value="<?php echo ($addflag != 1) ? $row['mobile'] : ""; ?>" style="width:175px;" class="form-control mobile1" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Old Destination</label></td>
                                    <td><input type="text" name="destination1" id='destination1' placeholder="" value="<?php echo ($addflag != 1) ? $row['destination'] : ""; ?>" style="width:175px;" class="form-control destination1" readonly="readonly"></td>
                                    <td><label class="label-control marg">New Destination</label></td>

                                    <td>
                                        <select class="form-control select2 newdest" name="newdest" style="width:300px;">
                                            <option value=""></option>
                                            <?
                                            $getdest = mysqli_query($conn,"SELECT * FROM `destination`")or die(mysqli_error($conn));
                                            while ($mdest = mysqli_fetch_array($getdest)) {
                                                Echo "<option value='$mdest[name]'>$mdest[name]</option>";
                                            }
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>

                    <div class="col-lg-8 col-md-6 col-sm-6 col-xs-6 pad text-right">
                        <label class="label-control marg">Are You Sure You Want to Change the Destination ?</label>                    
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad text-right">
                        <button type="submit" name="confbutn" id="confbutn" class="btn btn-primary addNewVouch" style="margin-right: 20px"><i class="fa"></i>Yes</button>
                        <button type="submit" name="confcanc" id="confcanc" class="btn btn-primary cancVouch" style="margin-right: 20px"><i class="fa"></i>No</button>
                    </div>

                        <!--<button type="submit" name="confbutn" id="confbutn" class="btn btn-primary CMail" style="margin-right: 20px"><i class="fa fa-envelope"></i>Send Mail To Visa Department</button>-->

                    <div class="modal-footer"></div>
                </div>
            </div>
        </div>
        <div class="modal fade bs-example-modal-lg" id="leadtrnf" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
            <div class="modal-dialog modal-lg" style="width: 70%;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal"><span>&times;</span></button>
                        <h4 class="modal-title" id="myLargeModalLabel"></h4>
                    </div>
                    <!--<input type='button' style="float: right;" name='exit' value='Exit' class="btn btn-danger" onClick="window.location.href = '<? Echo $file; ?>'">-->
                    <!--<button style="float: right;" type='submit' name='update' value='Update' class="btn btn-success">-->
                    <!--<button id='submit'  type='submit' name='submit' value='Update' class="btn btn-success">Save</button>--> 


                    <div class="modal-body">
                        <div class="table-responsive">
                            <table>
                                <tr id="">
                                    <td><label class="label-control marg">Booking No.</label></td>
                                    <td><input type="text" name="vouchno1" id="vouchno1" value="<?php echo ($addflag != 1) ? $row['vouchno'] : ""; ?>"  style="width:175px;" class="vouchno1 form-control" readonly="readonly"></td>
                                    <td><label class="label-control marg">Booking Date</label></td>
                                    <td><input type="date" name="vouchdt1" id="vouchdt1" value="<?php echo ($addflag != 1) ? $row['vouchdt'] : ""; ?>"  style="width:175px;" class="vouchdt1 form-control" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Name</label></td>
                                    <td><input type="text" name="name1" id='name1' placeholder="" value="<?php echo ($addflag != 1) ? $row['name'] : ""; ?>" style="width:300px;" class="form-control name1" readonly="readonly"></td>
                                    <td><label class="label-control marg">Last Name</label></td>
                                    <td><input type="text" name="lastname1" id='lastname1' placeholder="" value="<?php echo ($addflag != 1) ? $row['lastname'] : ""; ?>" style="width:300px;" class="form-control lastname1" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">Travel Date</label></td>
                                    <td><input type="date" name="deptdate1" id='deptdate1' placeholder="" value="<?php echo ($addflag != 1) ? $row['deptdate'] : ""; ?>" style="width:175px;" class="form-control deptdate1" readonly="readonly"></td>
                                    <td><label class="label-control marg">Mobile</label></td>
                                    <td><input type="text" name="mobile1" id='mobile1' placeholder="" value="<?php echo ($addflag != 1) ? $row['mobile'] : ""; ?>" style="width:175px;" class="form-control mobile1" readonly="readonly"></td>
                                </tr>
                                <tr id="">
                                    <td><label class="label-control marg">New User</label></td>

                                    <td>
                                        <select class="form-control select2 newuser" name="newuser" style="width:300px;">
                                            <option value=""></option>
                                            <?
                                            $getuser = mysqli_query($conn,"SELECT * FROM `$zroot`.`passmain` where `user` != '$user'")or die(mysqli_error($conn));
                                            while ($muser = mysqli_fetch_array($getuser)) {
                                                Echo "<option value='$muser[user]'>$muser[user]</option>";
                                            }
                                            ?>
                                        </select>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>

                    <div class="col-lg-7 col-md-6 col-sm-6 col-xs-6 pad text-right">
                        <label class="label-control marg">Are You Sure You Want to Transfer the Lead ?</label>                    
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad text-right">
                        <button type="submit" name="trnfbutn" id="trnfbutn" class="btn btn-primary trnfbutn" style="margin-right: 20px"><i class="fa"></i>Yes</button>
                        <button type="submit" name="trnfcanc" id="trnfcanc" class="btn btn-primary trnfcanc" style="margin-right: 20px"><i class="fa"></i>No</button>
                    </div>
                    <div class="modal-footer"></div>
                </div>
            </div>
        </div>
    </form>

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

</body>
</html>
