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

$db1 = "courintran";
$db2 = "courouttran";
$formname = "Pending Passport Courier ";
$file = "pendppcour.php";


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


$agent = $_POST["agent"];
$agentcond = "";

if (!empty($agent)){
    $agentcond = "AND a.ref = '$agent'";
}

mysqli_select_db($conn, $zdb);

$getpmain = mysqli_query($conn, "SELECT a.*, b.passport as ppno FROM `$db1` a LEFT JOIN  `$db2` b ON a.passport=b.passport WHERE b.passport IS NULL $agentcond ") or die(mysqli_error($conn));
include("includes/linkshead.php");
?>
</head>

<body>
    <div class="container">
        <?php include("includes/head_rep.php");
        ?>
        <div class="row" id="printdivcontent">

            <div class="col-lg-12 pad">
                <table class="table table-condensed table-hover table-bordered">
                    <tr class="mySearchTr">
                        <th width="5%">Sr</th>
                        <th width="20%">Name</th>
                        <th width="15%">Passport</th>
                        <th width="20%">Reference / Agent</th>
                        <th width="15%">Courier From </th>
                        <th width="15%">Status</th>
                    </tr>
                    <tr>
                        <!--<button type="button" name="print" onclick="PrintDiv();">PRINT TEST</button>-->
                    </tr>
                    <?php
                    $ctr = 1;
                    while ($pmain = mysqli_fetch_array($getpmain)) {

                        echo "<tr class='bgwhite'>";
                        echo "<td>$ctr</td>";
                        echo "<td>$pmain[paxname]</td>";
                        echo "<td>$pmain[passport]</td>";
                        echo "<td>$pmain[ref]</td>";
                        echo "<td>$pmain[courfrm]</td>";
                        echo "<td>$pmain[status]</td>";
                        echo "</tr>";
                        $ctr++;
                    }
                    ?>
                </table>
            </div>
        </div>
    </div>

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

</html>
<?
?>