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

if ($_GET['para'] == 'I') {

    $formname = "Courier In";
    $action = "courinreg_fr.php";
    $file = "courreg.php?para=I";
} else if ($_GET['para'] == 'O') {

    $formname = "Courier Out";
    $action = "couroutreg_fr.php";
    $file = "courreg.php?para=O";
}

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);

$mfrdate = getzdates($zyear, 'S');
$mtodate = getzdates($zyear, 'E');
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

include("includes/linkshead.php");
?>
<script src="MyScript/item.js" type="text/javascript"></script>
</head>

<body>
    <form method='POST' action="<?= $action; ?>">
        <!-- Default box -->
        <div>
            <div class="col-lg-5 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 class="actions pull-right">
                            <i class="fa fa-chevron-down"></i>
                            <i class="fa fa-times"></i>
                        </div>
                    </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="control-label marg">From Date</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="date" size="80" name="fromdate" value="<?php echo date('2023-11-14') ?>" class="form-control" />
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="control-label marg">To Date</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="date" size="80" name="todate" value="<?php echo date('Y-m-d') ?>" class="form-control" />
                            </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">Pax Name</label>
                            </div>
                            <div class="col-lg-6 col-md-8 col-sm-8 col-xs-8 pad">
                                <select id="paxname" name="paxname" class="form-control paxname select2">
                                    <option value=""></option>
                                    <?php
                                    $mown1 = mysqli_query($conn, "SELECT paxname FROM `courin`  order by `paxname` ") or die(mysqli_error($conn));
                                    while ($trow1 = mysqli_fetch_array($mown1)) {
                                        echo "<option value='$trow1[paxname]'>$trow1[paxname]</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">Passport No</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-8 col-xs-8 pad">
                                <input type="text" name="passport" class="form-control ">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="control-label marg">Medical</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <select id="medical" name="medical" class="form-control select2">
                                    <option value=""></option>
                                    <option value="1">Yes</option>
                                    <option value="2">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 marg">License</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <select id="license" name="license" class="form-control select2">
                                    <option value=""></option>
                                    <option value="1">Yes</option>
                                    <option value="2">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 marg">Photo</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <select id="photo" name="photo" class="form-control select2">
                                    <option value=""></option>
                                    <option value="1">Yes</option>
                                    <option value="2">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">
                                <?php if ($_GET['para'] == "I") {?>
                                <label class="control-label marg">From</label>
                                <?php } else { ?>
                                    <label class="control-label marg">To</label>
                                    <?php }?>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                            <select id="recdfrom" name="recdfrom" class="form-control recdfrom select2">
                                    <option value=""></option>
                                    <?php
                                    $mown1 = mysqli_query($conn, "SELECT recdfrom FROM `courin`  order by `recdfrom` ") or die(mysqli_error($conn));
                                    while ($trow1 = mysqli_fetch_array($mown1)) {
                                        echo "<option value='$trow1[recdfrom]'>$trow1[recdfrom]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <?php if ($_GET['para'] == "I") {?>
                                <label class="control-label marg">Received By</label>
                                <?php } else { ?>
                                    <label class="control-label marg">Given To</label>
                                    <?php }?>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                            <select id="recdby" name="recdby" class="form-control recdby select2">
                                    <option value=""></option>
                                    <?php
                                    $mown1 = mysqli_query($conn, "SELECT recdby FROM `courin`  order by `recdby` ") or die(mysqli_error($conn));
                                    while ($trow1 = mysqli_fetch_array($mown1)) {
                                        echo "<option value='$trow1[recdby]'>$trow1[recdby]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>

                        <div class="panel-footer">
                            <?php include("includes/but_rep.php"); ?>
                            <script>
                                $("#subpdf").hide();
                                //                                $("#excel").hide();
                            </script>
                        </div>
                        <!--</div>-->
                    </div>
                </div>
            </div>
        </div>
    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>

</html>