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

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

$zyear = right($zdb, 4);
$mfrdate = getzdates($zyear, 'S');
$mtodate = getzdates($zyear, 'E');
$tourcode = $_SESSION['tourcode'];
$tourname = $_SESSION['tourname'];
$para = $_GET['para'];
if ($para == "RV") {
    $formname = "Revenue Register";
    $action = "revenue_fr.php";
} elseif ($para == "PR") {
    $formname = "Payment Received";
    $action = "paymrecd_fr.php";
} elseif ($para == "DC") {
    $formname = "Discount Register";
    $action = "discount_fr.php";
} elseif ($para == "AG") {
    $formname = "Agewise Register";
    $action = "agewise_fr.php";
} elseif ($para == "FA") {
    $formname = "Outstanding Final Amount";
    $action = "finalamt_fr.php";
} elseif ($para == "TT") {
    $formname = "Outstanding Ticket & Tour";
    $action = "tktour_fr.php";
} elseif ($para == "PW") {
    $formname = "Outstanding Paxwise";
    $action = "paxwise_fr.php";
} else {
    $formname = "Citywise Register";
    $action = "citywise_fr.php";
}

$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

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

<body>
    <form method='POST' action="<?= $action; ?>" id="form1">
        <div class="col-lg-8 col-md-12 col-sm-12 col-xs-12  pad">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><?php echo $formname; ?></h3>
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Tour</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <select class="form-control select2 tour" name="tour" required>
                                <option value="<?= $tourcode ?>"><?= $tourname ?></option>
                                <?php
                                //                                $gettour = mysqli_query($conn, "SELECT code,name FROM tour order by name") or die(mysqli_error($conn));
                                //                                while ($fettour = mysqli_fetch_array($gettour)) {
                                //                                    echo "<option value='$fettour[code]'>$fettour[name]</option>";
                                //                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Name</label>
                        </div>
                        <div class="col-lg-6 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="text" name="name" class="form-control name" autofocus="autofocus">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg" style="color: #2FBFFD;">Regn. No.</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="text" name="regnno" class="form-control regnno">
                        </div>
                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg" style="color: #2FBFFD;">Pax. No.</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="text" name="paxno" class="form-control paxno">
                        </div>
                        <?php if ($para == "AG") { ?>
                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg" style="color: blue;">Only Infant</label>
                            </div>
                            <div class="col-lg-1 col-md-5 col-sm-8 col-xs-8 pad">
                                <input type="checkbox" name="inf" value="1" class="form-control inf" style="width: 30px">
                            </div>
                        <?php } ?>

                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Group</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <!-- <input type="text" name="group" class="form-control group"> -->
                            <select name="group" class="form-control group select2" style="width:100%">
                                <option value=""></option>
                                <?php
                                $mgrp = mysqli_query($conn, "SELECT distinct(`groupno`) FROM bookform where groupno != '' AND tourno = '$tourcode'") or die(mysqli_error($conn));
                                while ($tgrp = mysqli_fetch_array($mgrp)) {
                                    echo "<option value='$tgrp[groupno]'>$tgrp[groupno]</option>";
                                }
                                ?>
                            </select>
                        </div>
                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Class</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <!-- <input type="text" name="class" class="form-control class"> -->
                            <select name="class[]" class="form-control class select2" style="width:100%" multiple>
                                <option value=""></option>
                                <?php
                                $mgrp = mysqli_query($conn, "SELECT distinct(`batchno`) FROM bookform where batchno != '' AND tourno = '$tourcode' ") or die(mysqli_error($conn));
                                while ($tgrp = mysqli_fetch_array($mgrp)) {
                                    echo "<option value='$tgrp[batchno]'>$tgrp[batchno]</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Tour No.</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="text" name="tourno" class="form-control tourno">
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">City</label>
                        </div>
                        <div class="col-lg-4 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="text" name="city" class="form-control city">
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">State</label>
                        </div>
                        <div class="col-lg-4 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="text" name="state" class="form-control state">
                        </div>
                    </div>

                    <br>

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Passport Expiry In</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <select class='form-control select2 ppexpiry' name='ppexpiry'>
                                <option value="99">All</option>
                                <option value="1">1 Month</option>
                                <option value="2">2 Month</option>
                                <option value="3">3 Month</option>
                                <option value="4">4 Month</option>
                                <option value="5">5 Month</option>
                                <option value="6">6 Month</option>
                            </select>
                        </div>
                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Passport In Hand</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <select class='form-control select2 ppinhand' name='ppinhand'>
                                <option value="B">Both</option>
                                <option value="Y">Yes</option>
                                <option value="N">No</option>
                            </select>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control ">Dep. Date</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="date" id="depdate" name="depdate" class="form-control depdate" />
                        </div>
                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Dep. PNR</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <select class='form-control select2 deppnr' name='deppnr'>
                                <option value="A">All</option>
                                <option value="P">Pending</option>
                            </select>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Airlines/Carrier</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="text" name="airlines" class="form-control airlines">
                        </div>
                    </div>

                    <br>

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Agent Name</label>
                        </div>
                        <div class="col-lg-6 col-md-5 col-sm-8 col-xs-8 pad">
                            <!-- <input type="text" name="agent" class="form-control agent"> -->
                            <select name="agent" class="form-control agent select2" style="width:100%">
                                <option value=""></option>
                                <?php
                                $mgrp = mysqli_query($conn, "SELECT distinct(`agent`) FROM bookform where agent != '' AND tourno = '$tourcode'") or die(mysqli_error($conn));
                                while ($tgrp = mysqli_fetch_array($mgrp)) {
                                    echo "<option value='$tgrp[agent]'>$tgrp[agent]</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control ">Arrival Date</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="date" id="arrvdate" name="arrvdate" class="form-control arrvdate" />
                        </div>
                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Arrival PNR</label>
                        </div>
                        <div class="col-lg-2 col-md-5 col-sm-8 col-xs-8 pad">
                            <select class='form-control select2 arrvpnr' name='arrvpnr'>
                                <option value="A">All</option>
                                <option value="P">Pending</option>
                            </select>
                        </div>
                    </div>
                </div>

                <a href="tktour_suf_fr.php" id="crlink" ></a>

                   <div class="panel-footer">
                        <?php include("includes/but_rep.php"); ?>
                    </div>
            </div>
        </div>
    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>

</html>