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

$formname = 'Booking Form';
$maindb = 'hotelpmain';
$trandb = 'hotelptran';

$printfile = "estimate_print.php";
$file = 'bookform.php';
$trandbexist = 1;
$keyfld = "vouchno";
$source = "PU";

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

$zroot = $_SESSION["zdir"];

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

if (isset($_POST["submit"])) {
    $a = 1;
    $qvouch = $_POST["vouchno"];
    $vouchdt = $_POST["vouchdt"];
    $city = $_POST["city"];
    $hotelnm = $_POST["hotelnm"];
    $hotelcatg = $_POST["hotelcatg"];
    $agent = $_POST["agent"];
    $netamt = $_POST['netamt'];
    $totamt = $_POST["totamt"];

    $count = $_POST["items"];

    $mvouch = $qvouch;

    $salecode = 11;

    if ($a == 1) {
        // mysqli_query($conn, "LOCK TABLES `$maindb` WRITE, `$trandb` WRITE ");

        if ($addflag == 1) {
            $gen1 = mysqli_query($conn, "SELECT MAX(vouchno) 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;
        }

        #################################TRAN PART #################################

        mysqli_query($conn, "DELETE FROM `$trandb` WHERE `$keyfld`='$mvouch'") or die(mysqli_error($conn));
        mysqli_query($conn, "DELETE FROM `roomsacn` WHERE `$keyfld`='$mvouch' and source = '$source' ") or die(mysqli_error($conn));

        $srl = 0;
        $batch = date("Y-m-d") . $mvouch;
        $cnt = 0;
        for ($i = 0; $i <= $count; $i++) {

            $srno = $_POST["srno_$i"];
            $checkin = $_POST["checkin_$i"];
            $checkout = $_POST["checkout_$i"];
            $nonights = $_POST["nonights_$i"];
            $roomcatg = $_POST["roomcatg_$i"];
            $roomtype = $_POST["roomtype_$i"];
            $qty = $_POST["qty_$i"];
            $rate = $_POST["rate_$i"];
            $amount = $_POST["amount_$i"];
            $remarks = mysqli_real_escape_string($conn, $_POST["remarks_$i"]);

            $nigctr = $nonights;

            if (!empty($checkin)) {
                $srl++;
                mysqli_query($conn, "INSERT INTO `$trandb`(`vouchno`, `vouchdt`, `srno`, `checkin`, `checkout`, `nonights`, `roomcatg`, `roomtype`, 
                                                            `qty`, `rate`, `amount`, `remarks`)
                                                    VALUES('$mvouch', '$vouchdt', '$srl', '$checkin', '$checkout', '$nonights', '$roomcatg', '$roomtype',
                                                           '$qty', '$rate', '$amount', '$remarks' )") or die(mysqli_error($conn));



                $bookdate = $checkin;
                for ($r = 0; $r < $nigctr; $r++) {

                    mysqli_query($conn, "INSERT INTO `roomsacn`(`source`, `vouchno`, `bookdate`, `hotel`, `city`, 
                                                                      `roomcatg`, `roomtype`, `qty`, `rate`, `hotelcatg`)
                                                      VALUES('$source', '$mvouch', '$bookdate', '$hotelnm', '$city', 
                                                                      '$roomcatg', '$roomtype', '$qty', '$rate', '$hotelcatg' )") or die(mysqli_error($conn));

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $checkout) {
                        break;
                    }
                }
            }
        }

        #################################TRAN PART END #################################
        ############################## MAIN ######################################################
        if ($addflag == 1) {

            mysqli_query($conn, "INSERT INTO `$maindb`(`vouchno`, `vouchdt`, `city`, `hotelnm`, `hotelcatg`, `agent`)
                                               VALUES ($qvouch, '$vouchdt',  '$city', '$hotelnm','$hotelcatg', '$agent')") or die(mysqli_error($conn));
            insmess();
            $mvouch = $qvouch; //1
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        } else {
            $mvouch = $qvouch; //1
            mysqli_query($conn, "UPDATE `$maindb` SET `vouchdt`='$vouchdt', `city`='$city', `hotelnm`='$hotelnm', `hotelcatg`='$hotelcatg', `agent`='$agent'
                                     WHERE `vouchno`= '$mvouch' ") or die(mysqli_error($conn));
            updmess();
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        }

        ################################# MAIN PART END #################################
    }
}

if ($addflag != 1) {

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

    $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld='$getvouch'") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);

    $mhotel = mysqli_query($conn, "SELECT code,hotelnm FROM hotels where code='$get[hotelnm]'") or die(mysqli_error($conn));
    $thotel = mysqli_fetch_array($mhotel);

    $mhotcatg = mysqli_query($conn, "SELECT code,name FROM hotelcatg where code='$get[hotelcatg]'") or die(mysqli_error($conn));
    $thotcatg = mysqli_fetch_array($mhotcatg);

    $mhotcity = mysqli_query($conn, "SELECT code,name FROM city where code='$get[city]'") or die(mysqli_error($conn));
    $thotcity = mysqli_fetch_array($mhotcity);

    $magent = mysqli_query($conn, "SELECT accode,name FROM accmast where accode='$get[agent]'") or die(mysqli_error($conn));
    $lagent = mysqli_fetch_array($magent);
}

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

if (isset($_GET["delete"])) {
    delete($zdb, "$maindb", "$keyfld", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$trandb", "$keyfld", $_GET[$keyfld], "$file?mode=last");
    $delcond = " source = '$source' and vouchno = '$_GET[vouchno]' ";
}

include("includes/linkshead.php");
?>
<style>
    .nav-tabs {
        text-transform: uppercase;
        font-weight: bold;
        width: 1400px;
    }
</style>
<script src="MyScript/shortkeys.js?a=2" type="text/javascript"></script>
<script src="MyScript/hotelpurch.js?a=3" type="text/javascript"></script>
<script src="MyScript/hotelpurch_search.js?a=2" type="text/javascript"></script>
</head>

<body>
    <form action='' method='POST'>
        <!-- Default box -->
        <div>
            <div class="col-lg-12 col-md-10 col-sm-12 col-xs-12  pad">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title" style="color:inherit"><?php echo $formname; ?></h3>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-1  col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">No.</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 pad">
                                <input type="text" class="form-control text-size form" name="vouchno" value="<?php echo ($addflag != 1) ? $get["vouchno"] : "$qvouch"; ?>" required readonly>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg">Date</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-4 col-xs-4 pad">
                                <input type="date" class="form-control form focusfield" name="vouchdt" value="<?php echo ($addflag != 1) ? $get["vouchdt"] : date('Y-m-d'); ?>" autofocus>
                            </div>
                        </div>

                        <div class="row">

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

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

                        </div>

                        <div class="row">

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

                        </div>

                        <div class="row">

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

                        </div>

                        <div class="row">

                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Dep. Date</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="date" class="form-control form" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Dep. Time</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="time" class="form-control form" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Dep. PNR</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="text" class="form-control form" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Dep. Flt.No.</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="text" class="form-control form" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>">
                            </div>

                        </div>

                        <div class="row">

                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Arrival Date</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="date" class="form-control form" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Arrv. Time</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="time" class="form-control form" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Arrv. PNR</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="text" class="form-control form" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Arrv. Flt.No.</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="text" class="form-control form" name="name" value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>">
                            </div>

                        </div>

                        <div class="row">

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

                        </div>

                        <div class="nav-tabs-custom">
                            <ul class="nav nav-tabs" align="center">
                                <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">CHARGES</a></li>
                                <li class="" style="margin-left:50px"> <a href="#tab_2" data-toggle="tab" aria-expanded="false">ADDRESS</a></li>
                                <li class="" style="margin-left:50px"> <a href="#tab_3" data-toggle="tab" aria-expanded="false">ROOM DETAILS </a></li>
                            </ul>
                            <div class="tab-content">
                                <div class="tab-pane active" id="tab_1">

                                    <div class="panel panel-default">
                                        <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">Remarks</label>
                                            </div>
                                            <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="text" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                                <input type="text" class="form-control form" name="add2" value="<?php echo ($addflag != 1) ? $get["add2"] : ""; ?>">
                                                <input type="text" class="form-control form" name="add3" value="<?php echo ($addflag != 1) ? $get["add3"] : ""; ?>">
                                            </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">Reffered By</label>
                                            </div>
                                            <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="text" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                                <input type="text" class="form-control form" name="add2" value="<?php echo ($addflag != 1) ? $get["add2"] : ""; ?>">
                                                <input type="text" class="form-control form" name="add3" value="<?php echo ($addflag != 1) ? $get["add3"] : ""; ?>">
                                            </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">Cancellation Date </label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="date" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Passport Limit</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="date" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                            </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">Half Payment Dt. </label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="date" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Full Payment Dt.</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="date" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                            </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">Discount Remark</label>
                                            </div>
                                            <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="text" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                            </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">Ziyarat : </label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="checkbox" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                            </div>
                                                <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="checkbox" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                            </div>
                                        </div>


                                    </div>
                                </div>
                                <div class="tab-pane " id="tab_2">

                                    <div class="panel panel-default">

                                        <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">Name </label>
                                            </div>
                                            <div class="col-lg-4 col-md-2 col-sm-2 col-xs-2 pad">
                                               <input type="text" name="name" class="form-control form name" value="<?php echo ($addflag != 1) ? $get['name'] : ""; ?>" >
                                            </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">Address</label>
                                            </div>
                                            <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="text" class="form-control form" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>">
                                                <input type="text" class="form-control form" name="add2" value="<?php echo ($addflag != 1) ? $get["add2"] : ""; ?>">
                                                <input type="text" class="form-control form" name="add3" value="<?php echo ($addflag != 1) ? $get["add3"] : ""; ?>">
                                            </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">City</label>
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                                <input type="text" class="form-control form" name="city" value="<?php echo ($addflag != 1) ? $get["city"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Pin</label>
                                            </div>
                                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 pad">
                                                <input type="text" class="form-control form " name="pin" value="<?php echo ($addflag != 1) ? $get["pin"] : ""; ?>">
                                            </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">State</label>
                                            </div>
                                            <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4 pad">
                                                <select name="state" class="form-control form state select2" style="width:100%">
                                                    <option value="<?php echo ($addflag != 1) ? $get['state'] : ""; ?>"><?php echo ($addflag != 1) ? $get['state'] : " "; ?></option>
                                                    <?php
                                                    $mown4 = mysqli_query($conn, "SELECT `code`, `name` FROM `state` ORDER BY name") or die(mysqli_error($conn));
                                                    while ($trow4 = mysqli_fetch_array($mown4)) {
                                                        echo "<option value='$trow4[name]'>$trow4[name]</option>";
                                                    }
                                                    ?>
                                                </select>
                                            </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">Tel.</label>
                                            </div>
                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="text" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                            </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">Mobile</label>
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                                <input type="text" class="form-control form  " name="mobile" value="<?php echo ($addflag != 1) ? $get["mobile"] : ""; ?>">
                                            </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">Email</label>
                                            </div>
                                            <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="email" class="form-control form email" name="email" value="<?php echo ($addflag != 1) ? $get["email"] : ""; ?>">
                                            </div>
                                        </div>

                                    </div>
                                </div><!-- /.tab_2 -->

                                <div class="tab-pane " id="tab_3">

                                    <div class="panel panel-default">

                                    <div class="row">
                               
                                <div class="panel-body">
                                    <div class='' align="center">
                                        <table class="table table-striped table-condensed table-bordered" style="width:50%">
                                            <thead class="mySearchTr">
                                                <tr>
                                                    <th style="width: 5%;text-align: right;">Room Type</th>
                                                    <th style="width: 4%;text-align: center;">MAKKA</th>
                                                    <th style="width: 7%;text-align: center;">MADINA</th>
                                                    <th style="width: 10%;text-align: center;">OTHER</th>
                                                </tr>
                                            </thead>
                                            <tbody id="tabledata">
                                               
                                                   <tr>
                                                       <td>Single</td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td></td>
                                                   </tr>

                                                   <tr>
                                                       <td>Double/2 In a Room</td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td></td>
                                                   </tr>

                                                   <tr>
                                                       <td>Triple/3 In a Room</td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td></td>
                                                   </tr>

                                                   <tr>
                                                       <td>Quad/4 In a Room</td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td></td>
                                                   </tr>

                                                   <tr>
                                                       <td>Quint/5 In a Room</td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td></td>
                                                   </tr>

                                                   <tr>
                                                       <td>Suite/6 In a Room</td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td></td>
                                                   </tr>

                                                   <tr>
                                                       <td>No Bed</td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td></td>
                                                   </tr>

                                                   <tr>
                                                       <td>Room No.</td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                       <td> 
                                                          <input type="number" class="form-control form " name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>">
                                                       </td>
                                                   </tr>
                                                   
                                            </tbody>
                                        </table>

                                        <div class="row">
                                            <div class="col-lg-6 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Bus No.</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="number" class="form-control form email" name="email" value="<?php echo ($addflag != 1) ? $get["email"] : ""; ?>">
                                            </div>
                                        </div>
                                    </div>

                                    </div>

                                </div><!-- /.tab_3 -->

                            </div><!-- /.tab-content -->
                        </div><!-- /.tab-pane -->



                        <div class="row">

                            <div class="col-lg-10 col-md-7 col-sm-8 col-xs-8 text-right pad">
                                <?php include("includes/buttons.php"); ?>
                            </div>

                        </div>

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

        </div>

    </form>
    
    <div class="modal fade bs-example-modal-lg searchModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Search <? echo $formname; ?></h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-2">
                            <select class="form-control sfield">
                                <option value="1">Voucher</option>
                                <option value="2">Date</option>
                                <option value="3">City</option>
                                <option value="4">Hotel Name</option>
                                <option value="5">Category</option>
                                <option value="6">Agent</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control soperator">
                                <option value="">Type of Search</option>
                                <option value="%">Like</option>
                                <option value="=">Exactly</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control sortBy">
                                <option value="">Sort By</option>
                                <option value="1">Voucher</option>
                                <option value="2">Date</option>
                                <option value="3">City</option>
                                <option value="4">Hotel Name</option>
                                <option value="5">Category</option>
                                <option value="6">Agent</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control orderAs">
                                <option value="desc">Desc</option>
                                <option value="asc">Asc</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <input type="text" value="" class="form-control ssearch" placeholder="Search Here">
                        </div>
                        <div class="col-lg-2">
                            <input type="button" class="btn btn-primary sload" value="Search">
                        </div>
                    </div>
                    <div class="col-lg-12 sloader text-center">
                    </div>
                    <div class="col-lg-12 snoRecord text-center">
                        <h3>NO RECORDS FOUND</h3>
                    </div>
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <table id="" class="table-striped table-condensed table-bordered" width="100%">
                            <thead>
                                <tr class="mySearchTr">
                                    <th style="width:8%">Voucher</th>
                                    <th style="width:13%">Date</th>
                                    <th style="width:10%">City</th>
                                    <th style="width:20%">Hotel Name</th>
                                    <th style="width:10%">Category</th>
                                    <th style="width:10%">Agent</th>
                                    <th style="width:5%">Action</th>
                                </tr>
                            </thead>
                            <tbody class="sTbody">
                            </tbody>
                        </table>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 text-right search-action-bar">
                            <input type="button" class="btn btn-primary sprev" value="Previous">
                            <input type="button" class="btn btn-primary snext" value="Next">
                        </div>
                    </div>
                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>
    <?php include("includes/linksfoot.php"); ?>
</body>

</html>