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

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

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

$vouch = $_GET['vouchno'];
$imglogo = $_GET["image"];

$cond = '';
$lcond = '';
$formname = "Voucher";

$maindb = 'pax';
$accdb = 'actran';
$fooddb = 'foodent';
$launddb = 'laundent';
$visadb = 'visaent';
$tiktdb = 'tiktent';
$transdb = 'transent';
$tranpurchdb = 'tranpurch';

$getqry = mysqli_query($conn, "SELECT *, DATE_FORMAT(`date`, '%d-%m-%Y')as mydt   FROM `$maindb` WHERE vouchno='$vouch' ORDER BY `vouchno`") or die(mysqli_error($conn));

$getdata = mysqli_fetch_array($getqry);

$getagent = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE accode='$getdata[agent]'") or die(mysqli_error($conn));
$fetagent = mysqli_fetch_array($getagent);
$agentname = $fetagent['name'];
$fullname = $getdata['surname'] . " " . $getdata['name'] . " " . $getdata['midname'];
if ($agentname != "") {
    $paxname = $agentname;
} else {
    $paxname = $fullname;
}

$getcomp2 = mysqli_query($conn, "SELECT * FROM $zroot.`company`") or die(mysqli_error($conn));
$comp2 = mysqli_fetch_array($getcomp2);

$compname = $comp2['compname'];
$headerimg = $comp2['reportheadimg'];
$footerimg = $comp2['footerimg'];

$title = "VOUCHER_$vouch FOR $fullname";

include("includes/print_linkshead.php");
?>

<!DOCTYPE HTML>
<html lang="en-US">
<style>
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        /*background-color: #FAFAFA;*/
        font: 12pt "Arial";
    }

    @media print {
        .noprint {
            display: none;
        }
    }

    * {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
    }

    .page {
        width: 210mm;
        min-height: 297mm;
        padding: 4mm;
        margin: 10mm auto;
        border: 1px #D3D3D3 solid;
        border-radius: 5px;
        /*background: white;*/

    }

    .subpage {
        padding: 0cm;
        /*        border: 1px solid;*/
        height: 288mm;
        outline: 2cm #ffffff solid;
    }

    @page {
        size: A4;
        margin: 0;
    }

    @media print {
        .noPrint {
            display: none;
        }

        html,
        body {
            width: 210mm;
            height: 297mm;
        }

        .page {
            margin: 0;
            border: initial;
            border-radius: initial;
            width: initial;
            min-height: initial;
            box-shadow: initial;
            background: initial;
            page-break-after: always;
        }
    }

    .numeric {
        text-align: right;
    }

    .rnone {
        border-right: none;
    }

    .lnone {
        border-left: none;
    }

    .outer {
        width: 100%;
        border-collapse: collapse;
        border: 1px solid black;
    }

    .center {
        text-align: center;
    }

    .B {
        padding-left: 15px;
    }


    .d {
        border-collapse: inherit;
    }


    .w {
        width: 40%;
    }

    hr.sk1 {
        border: 2px solid black;
    }

    .skdiv {
        width: 50%;
        margin: auto;
        margin-top: -20px;
        margin-bottom: -20px;
    }

    .table1>tbody>tr>td {
        padding: 2px;
        line-height: 1.42857143;
        /* vertical-align: top; */
        /* border-top: 1px solid #ddd; */
    }
</style>
</head>

<body id="main_container">
    <div class="book tablerep">

        <button onclick="window.print();
                return false;" class="btn btn-primary noPrint"
            style="width: 150px;height:35px;background-color: #A0B1BA;color:white;">Print</button>
        &nbsp;&nbsp;&nbsp;
        <button class="btn btn-primary goBack noPrint" onclick="window.close()"
            style="width: 150px;height:35px;background-color: white;color:#A0B1BA;padding-left: 1%">Go Back</button>
        <div class="page">
            <div class="">

                <?php if ($imglogo == "Yes") { ?>
                    <div class="skdiv">
                        <img style="height:auto;width:100%" src="<?php echo $headerimg; ?>">
                    </div>
                <?php } ?>

                <br>

                <div class="row" style="text-align:center;background-color:<?= $vheadcolor; ?> !important;height:35px">
                    <p style="font-size: 20px;color:white !important;margin-top:5px">
                        <?php echo $formname ?>
                    </p>
                </div>

                <table class=" table1 table-borderless" style="width:100%">

                    <tbody>

                        <tr width="100%">
                            <td><b style="font-size:17px;color:<?= $vheadcolor; ?> ">#
                                    <?php echo $getdata['vouchno']; ?>
                                </b></td>
                        </tr>
                        <tr width="100%">
                            <td><span style="padding-right:48px"> Date </span> : <b>
                                    <?php echo $getdata['mydt']; ?>
                                </b></td>
                        </tr>
                        <?php if ($agentname != "") { ?>
                            <tr width="100%">

                                <td><span style="padding-right:60px"> To </span> : <b>
                                        <?php echo $paxname; ?>
                                    </b></td>
                                <td style="width: 40%;text-align:right"></td>
                            </tr>
                        <?php } ?>
                        <tr width="100%">
                            <?php $fullname = $getdata['surname'] . " " . $getdata['name'] . " " . $getdata['midname']; ?>
                            <td><span style="padding-right:5px"> Guest Name </span> : <b>
                                    <?php echo $fullname; ?>
                                </b></td>
                            <td style="width: 40%;text-align:left"><span style="padding-right:5px"> Staff</span> : <b>
                                    <?php
                                    if ($getdata["edituser"] != '') {
                                        $user = strtoupper($getdata["edituser"]);
                                    } else {
                                        $user = strtoupper($getdata["adduser"]);
                                    }

                                    echo $user;
                                    ?>
                                </b></td>
                        </tr>
                        <tr width="100%">
                            <td><span style="padding-right:16px"> Nationality </span> : <b>
                                    <?php echo $getdata['nationality']; ?> </b></td>
                        </tr>
                    </tbody>
                </table>

                <br>

                <?php if ($_GET['paxdtl'] == "Yes") { ?>
                    <div>
                        <div>Pax Details</div>
                        <table style="width:100%" class="table table-bordered">
                            <tr class="mySearchTr" style="font-size: 13px;">
                                <th style="width: 4%;">Suffix</th>
                                <th style="width: 7%;">Surname</th>
                                <th style="width: 10%;">Name</th>
                                <th style="width: 10%;">Middle Name</th>
                                <th style='width: 10%;'>Gender</th>
                                <th style='width: 10%;'>Passport</th>
                                <th style='width: 10%;'>Aadhaar No.</th>
                                <th style='width: 10%;'>PAN No.</th>
                            </tr>

                            <?php
                            echo "<tr style='font-size: 11px;'>";
                            echo "<td style=''>$getdata[suffix]</td>";
                            echo "<td>$getdata[surname]</td>";
                            echo "<td>$getdata[name]</td>";
                            echo "<td>$getdata[midname]</td>";
                            echo "<td style=''>$getdata[gender]</td>";
                            echo "<td style=''>$getdata[paxpassport]</td>";
                            echo "<td style=''>$getdata[aadhaarno]</td>";
                            echo "<td style=''>$getdata[panno]</td>";
                            echo "</tr>";

                            $ctr = 0;
                            $ctab = 0;
                            $totqty = 0;
                            $getpaxdtl = mysqli_query($conn, "SELECT * FROM `paxdtfit` WHERE vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));

                            while ($fetpaxdtl = mysqli_fetch_array($getpaxdtl)) {

                                echo "<tr style='font-size: 11px;'>";
                                echo "<td style=''>$fetpaxdtl[tsuffix]</td>";
                                echo "<td>$fetpaxdtl[tsurname]</td>";
                                echo "<td>$fetpaxdtl[tname]</td>";
                                echo "<td>$fetpaxdtl[tmidname]</td>";
                                echo "<td style=''>$fetpaxdtl[tgender]</td>";
                                echo "<td style=''>$fetpaxdtl[tpaxpassport]</td>";
                                echo "<td style=''>$fetpaxdtl[taadhaarno]</td>";
                                echo "<td style=''>$fetpaxdtl[tpanno]</td>";
                                echo "</tr>";
                            }
                            ?>


                        </table>
                    </div>
                <?php } ?>

                <?php
                $gettiktdtl = mysqli_query($conn, "SELECT *,DATE_FORMAT(`travdate`,'%d-%m-%Y')as travdate from `$tiktdb` where vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));
                if (mysqli_num_rows($gettiktdtl) > 0) {
                    ?>
                    <div>
                        <h4>Ticket & Airline Voucher</h4>
                        <table style="width:100%" class="table table-bordered">
                            <tr class="mySearchTr" style="font-size: 13px; ">
                                <th style="width: 7%">From</th>
                                <th style="width: 7%;">To</th>
                                <th style="width: 10%;">Airline</th>
                                <th style="width: 8%;">Ticket No.</th>
                                <th style='width: 7%'>Flight No.</th>
                                <th style='width: 10%'>PNR</th>
                                <th style='width: 10%'>Date</th>
                                <th style='width: 5%' class="text-right">No. Pax</th>
                            </tr>

                            <?php
                            $ctr = 0;
                            $ctab = 0;
                            $totqty = 0;

                            while ($fettikt = mysqli_fetch_array($gettiktdtl)) {
                                $getho = mysqli_query($conn, "SELECT `code`,`name` FROM `airline` where code='$fettikt[airline]'") or die(mysqli_error($conn));
                                $fetho = mysqli_fetch_array($getho);

                                $paxfetfit = $fettikt["nopax"] + $fettikt["nochild"];
                                echo "<tr style='font-size: 11px;'>";
                                echo "<td style=''>$fettikt[fromdes]</td>";
                                echo "<td>$fettikt[todes]</td>";
                                echo "<td>$fetho[name]</td>";
                                echo "<td>$fettikt[ticketno]</td>";
                                echo "<td style=''>$fettikt[flightno]</td>";
                                echo "<td style=''>$fettikt[pnrno]</td>";
                                echo "<td style='font-size:11px'>$fettikt[travdate]</td>";
                                echo "<td style='text-align:right'>$paxfetfit</td>";
                                echo "</tr>";

                                $ctab = $ctab + 1;
                            }
                            if ($ctab < 2) {
                                for ($i = $ctab; $i < 2; $i++) {
                                    ?>
                                    <tr style="height: 30px;">
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <?php
                                }
                            }
                            ?>
                        </table>
                    </div>
                    <?php
                }

                $gettran = mysqli_query($conn, "SELECT *,DATE_FORMAT(`checkin`,'%d-%m-%Y')as checkin,
                                                              DATE_FORMAT(`checkout`,'%d-%m-%Y')as checkout FROM `$tranpurchdb` 
                                                              WHERE `vouchno`='$getdata[vouchno]' ORDER BY `srno`") or die(mysqli_error($conn));
                if (mysqli_num_rows($gettran) > 0) {
                    ?>
                    <br>

                    <div>
                        <h4>Hotel Voucher</h4>

                        <table style="width:100%" class="table table-bordered">
                            <tr class="mySearchTr" style="font-size: 12px;">
                                <th width="7%">CNF No.</th>
                                <th width="7%">City</th>
                                <th width="10%">Hotel Name</th>
                                <th width="7%">Check In</th>
                                <th width="7%">Check Out</th>
                                <th width="6%" class="text-center">No.<br>Nights</th>
                                <th width="12%">Room<br>Category</th>
                                <th width="8%">Room<br>View</th>
                                <th width="8%">Meal<br>Type</th>
                                <th width="7%">Room<br>Type</th>
                                <th width="5%" class='text-right'>Qty.</th>
                            </tr>

                            <?php
                            $ctr = 0;
                            $ctab = 0;
                            $totqty = 0;
                            while ($tran = mysqli_fetch_array($gettran)) {

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

                                $mroomview = mysqli_query($conn, "SELECT code,name FROM roomview WHERE code='$tran[roomview]'") or die(mysqli_error($conn));
                                $troomview = mysqli_fetch_array($mroomview);

                                $mrtype = mysqli_query($conn, "SELECT code,name FROM roomtype where code='$tran[roomtype]'") or die(mysqli_error($conn));
                                $trtype = mysqli_fetch_array($mrtype);

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

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

                                $mmeal = mysqli_query($conn, "SELECT code,name FROM $zroot.mealtype WHERE code ='$tran[mealtype]'") or die(mysqli_error($conn));
                                $tmeal = mysqli_fetch_array($mmeal);

                                if ($trtype['name'] == "Quad" && $tran['hotelpax'] < 4) {
                                    $roomtype = "Quad Sharing";
                                } else {
                                    $roomtype = $trtype['name'];
                                }

                                echo "<tr style='font-size: 11px;'>";
                                echo "<td style='font-size: 11px;'>$tran[cnfno]</td>";
                                echo "<td style='font-size: 11px;'>$thotcity[name]</td>";
                                echo "<td style='font-size: 11px;'>$thotel[hotelnm]</td>";
                                echo "<td style='font-size:11px'>$tran[checkin]</td>";
                                echo "<td style='font-size:11px'>$tran[checkout]</td>";
                                echo "<td style='font-size: 11px;'>$tran[nonights]</td>";
                                echo "<td style='font-size: 11px;'>$thotcatg[name]</td>";
                                echo "<td style='font-size: 11px;'>$troomview[name]</td>";
                                echo "<td style='font-size: 11px;'>$tmeal[name]</td>";
                                echo "<td style='font-size:11px'>$roomtype</td>";
                                echo "<td style='text-align:right;font-size: 11px;'>$tran[qty]</td>";
                                echo "</tr>";
                                $ctab = $ctab + 1;
                            }
                            if ($ctab < 2) {
                                for ($i = $ctab; $i < 2; $i++) {
                                    ?>
                                    <tr style="height: 30px;">
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <?php
                                }
                            }
                            ?>

                        </table>
                    </div>
                    <?php
                }
                $getfooddtl = mysqli_query($conn, "Select *,DATE_FORMAT(`checkin`, '%d-%m-%Y')as checkin,DATE_FORMAT(`checkout`, '%d-%m-%Y')as checkout from `$fooddb` where vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));
                if (mysqli_num_rows($getfooddtl) > 0) {
                    ?>
                    <br>
                    <h4>Food Voucher</h4>

                    <div>
                        <table style="width:100%" class="table table-bordered">
                            <tr class="mySearchTr" style="font-size: 13px;">
                                <th style="width:10%">Check In</th>
                                <th style="width:10%">Check Out</th>
                                <th style="width:30%">Hotel</th>
                                <th style="width:15%">Meal Type</th>
                                <th style="width:10%" class='text-right'>No. Nights</th>
                                <th style="width:10%" class='text-right'>No. Pax</th>

                            </tr>

                            <?php
                            $ctr = 0;
                            $ctab = 0;
                            $totqty = 0;
                            while ($fetfood = mysqli_fetch_array($getfooddtl)) {
                                $getho = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` where code='$fetfood[hotel]'") or die(mysqli_error($conn));
                                $fetho = mysqli_fetch_array($getho);

                                $getmeal = mysqli_query($conn, "SELECT `code`,`name` FROM $zroot.`mealtype` where code='$fetfood[meal]'") or die(mysqli_error($conn));
                                $fetmeal = mysqli_fetch_array($getmeal);

                                echo "<tr style='font-size: 11px;'>";
                                echo "<td style=''>$fetfood[checkin]</td>";
                                echo "<td>$fetfood[checkout]</td>";
                                echo "<td>$fetho[hotelnm]</td>";
                                echo "<td>$fetmeal[name]</td>";
                                echo "<td style='text-align: right;'>$fetfood[nonights]</td>";
                                echo "<td style='text-align: right;'>$fetfood[nopax]</td>";
                                echo "</tr>";
                                $ctab = $ctab + 1;
                            }
                            if ($ctab < 2) {
                                for ($i = $ctab; $i < 2; $i++) {
                                    ?>
                                    <tr style="height:30px;">
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <?php
                                }
                            }
                            ?>
                        </table>
                    </div>
                    <?php
                }
                $getlaunddtl = mysqli_query($conn, "SELECT *,DATE_FORMAT(`checkin`, '%d-%m-%Y')as checkin,DATE_FORMAT(`checkout`, '%d-%m-%Y')as checkout FROM `$launddb` where vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));
                if (mysqli_num_rows($getlaunddtl) > 0) {
                    ?>
                    <br>
                    <h4>Laundry Voucher</h4>

                    <div>
                        <table style="width:100%" class="table table-bordered">
                            <tr class="mySearchTr" style="font-size: 13px;">
                                <th style="width:10%">Check In</th>
                                <th style="width:10%">Check Out</th>
                                <th style="width:30%">Hotel</th>
                                <th style="width:10%" class='text-right'>No. Nights</th>
                                <th style="width:10%" class='text-right'>No. Pax</th>
                            </tr>

                            <?php
                            $ctr = 0;
                            $ctab = 0;
                            $totqty = 0;
                            while ($fetlaund = mysqli_fetch_array($getlaunddtl)) {
                                $getho2 = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` where code='$fetlaund[hotel]'") or die(mysqli_error($conn));
                                $fetho2 = mysqli_fetch_array($getho2);

                                echo "<tr style='font-size: 11px;'>";
                                echo "<td style=''>$fetlaund[checkin]</td>";
                                echo "<td>$fetlaund[checkout]</td>";
                                echo "<td>$fetho2[hotelnm]</td>";
                                echo "<td style='text-align: right;'>$fetlaund[nonights]</td>";
                                echo "<td style='text-align: right;'>$fetlaund[nopax]</td>";
                                echo "</tr>";
                                $ctab = $ctab + 1;
                            }
                            if ($ctab < 2) {
                                for ($i = $ctab; $i < 2; $i++) {
                                    ?>
                                    <tr style="height:30px;">
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <?php
                                }
                            }
                            ?>
                        </table>
                    </div>
                    <?php
                }
                $gettransdtl = mysqli_query($conn, "SELECT * from `$transdb` where vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));
                if (mysqli_num_rows($gettransdtl) > 0) {
                    ?>
                    <br>
                    <h4>Transportation Voucher</h4>

                    <div>
                        <table style="width:100%" class="table table-bordered">
                            <tr class="mySearchTr" style="font-size: 13px; ">
                                <th style="width:7%">Type</th>
                                <th style="width:7%">CNF No.</th>
                                <th style="width:13%">From</th>
                                <th style="width:13%">To</th>
                                <th style="width:15%">Pick Up Time</th>
                                <th style="width:10%">Vehicle</th>
                                <th style="width:5%" class='text-right'>No. Pax</th>
                                <th style="width:7%" class='text-right'>No. Vehicle</th>
                                <th style="width:15%">Description</th>
                            </tr>

                            <?php
                            $ctr = 0;
                            $ctab = 0;
                            $totqty = 0;
                            while ($fettrans = mysqli_fetch_array($gettransdtl)) {

                                if ($fettrans['picktype'] == "D") {
                                    $flttypen = "Departure";
                                } elseif ($fettrans['picktype'] == "A") {
                                    $flttypen = "Arrival";
                                } elseif ($fettrans['picktype'] == "I") {
                                    $flttypen = "Internal";
                                } else {
                                    $flttypen = "";
                                }


                                $getveh = mysqli_query($conn, "SELECT `code`,`vehtype` FROM `vehicle` where code='$fettrans[vehicle]'") or die(mysqli_error($conn));
                                $fetveh = mysqli_fetch_array($getveh);

                                $new_date = date('d-m-Y  H:i A', strtotime($fettrans['pickuptime']));

                                echo "<tr style='font-size: 11px;'>";
                                echo "<td style=''>$flttypen</td>";
                                echo "<td style=''>$fettrans[cnfno]</td>";
                                echo "<td style=''>$fettrans[fromplace]</td>";
                                echo "<td style='text-align: left;'>$fettrans[toplace]</td>";
                                echo "<td style='text-align: left;'>$new_date</td>";
                                echo "<td style='text-align: left;'>$fetveh[vehtype]</td>";
                                echo "<td style='text-align: right;'>$fettrans[nopax]</td>";
                                echo "<td style='text-align: right;'>$fettrans[noveh]</td>";
                                echo "<td style='text-align: left;'>$fettrans[descrip]</td>";
                                echo "</tr>";

                                $ctab = $ctab + 1;
                            }
                            if ($ctab < 2) {
                                for ($i = $ctab; $i < 2; $i++) {
                                    ?>
                                    <tr style="height: 30px;">
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <?php
                                }
                            }
                            ?>

                        </table>
                        <?php
                }
                $transfltdet = 'transfltdet';

                $gettiktdtl = mysqli_query($conn, "SELECT * from `$transfltdet` where vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));
                if (mysqli_num_rows($gettiktdtl) > 0) {
                    ?>
                        <h4><u>Flight Details</u></h4>
                        <table style="width:60%" class="table table-bordered">
                            <tr class="mySearchTr" style="font-size: 13px; ">
                                <th style="width: 7%">#</th>
                                <th style="width: 7%;">Type</th>
                                <th style="width: 10%;">Flight<br>Arrival/Departure</th>
                                <th style='width: 7%'>Flight Sector</th>
                                <th style='width: 10%'>Flight No.</th>
                            </tr>

                            <?php
                            $ctr = 0;
                            $ctab = 0;
                            $totqty = 0;

                            while ($fettikt = mysqli_fetch_array($gettiktdtl)) {

                                if ($fettikt['flttype'] == "D") {
                                    $flttype = "Departure";
                                } elseif ($fettikt['flttype'] == "A") {
                                    $flttype = "Arrival";
                                } else {
                                    $flttype = "";
                                }
                                $new_date = date('d-m-Y  H:i A', strtotime($fettikt['flttime']));

                                echo "<tr style='font-size: 11px;'>";
                                echo "<td style=''>$fettikt[cnfno]</td>";
                                echo "<td>$flttype</td>";
                                echo "<td>$new_date</td>";
                                echo "<td style=''>$fettikt[sector]</td>";
                                echo "<td style=''>$fettikt[fltno]</td>";
                                echo "</tr>";

                                $ctab = $ctab + 1;
                            }
                            ?>


                        </table>
                    </div>
                    <?php
                }
                $getvisadtl = mysqli_query($conn, "SELECT * FROM `$visadb` where vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));
                if (mysqli_num_rows($getvisadtl) > 0) {
                    ?>

                    <div>
                        <h4>Visa Voucher</h4>

                        <table style="width:100%" class="table table-bordered">
                            <tr class="mySearchTr" style="font-size: 13px;">
                                <th style="width:30%">Country</th>
                                <th style="width:10%" class='text-right'>No. Pax</th>
                                <th style="width:10%">Visa Type</th>
                                <th style="width:10%">Validity</th>
                                <th style="width:10%">Group Code</th>
                                <th style="width:10%">Travel Date</th>
                            </tr>

                            <?php
                            $ctr = 0;
                            $ctab = 0;
                            $totqty = 0;
                            while ($fetvisa = mysqli_fetch_array($getvisadtl)) {

                                $getho3 = mysqli_query($conn, "SELECT `code`,`country` FROM `visamain` where code='$fetvisa[country]'") or die(mysqli_error($conn));
                                $fetho3 = mysqli_fetch_array($getho3);

                                echo "<tr style='font-size: 11px;'>";
                                echo "<td style=''>$fetho3[country]</td>";
                                echo "<td style='text-align: right;'>$fetvisa[nopax]</td>";
                                echo "<td>$fetvisa[type]</td>";
                                echo "<td>$fetvisa[validity]</td>";
                                echo "<td>$fetvisa[groupcode]</td>";
                                echo "<td>" . format_date($fetvisa['vtraveldt']) . "</td>";
                                echo "</tr>";

                                $ctab = $ctab + 1;
                            }
                            if ($ctab < 2) {
                                for ($i = $ctab; $i < 2; $i++) {
                                    ?>
                                    <tr style="height:30px;">
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <?php
                                }
                            }
                            ?>

                        </table>
                    </div>

                </div>
            <?php } ?>
            <div style="border:1px solid black">

                <table>
                    <tr>
                        <td style="text-align: left;"><b>NOTES</b></td>
                    </tr>
                    <?php
                    echo "<tr><td style='text-align: left;'>$comp2[vchnote1]</td></tr>";
                    echo "<tr><td style='text-align: left;'>$comp2[vchnote2]</td></tr>";
                    echo "<tr><td style='text-align: left;'>$comp2[vchnote3]</td></tr>";
                    echo "<tr><td style='text-align: left;'>$comp2[vchnote4]  $comp2[vchnote5] </td></tr>";
                    // echo "<tr><td style='text-align: left;'>$comp2[vchnote5]</td></tr>";
                    echo "<tr><td style='text-align: left;'>$comp2[vchnote6]</td></tr>";
                    if ($comp2['vchnote7'] != "") {
                        echo "<tr><td style='text-align: left;'>$comp2[vchnote7]</td></tr>";
                    }
                    ?>
                </table>

            </div>
            <tr>
                <td style="text-align: left;">&nbsp;</td>
            </tr>
            <?php
            require("includes/dbconnect.php");
            ?>
            <div>
                <table style="width:100%">
                    <tr style="width:100%">
                        <td style="width:50%;text-align: left;font-size:14px;">Helpline Makkah : <b>
                                <?= "$comp2[helpmak]"; ?>
                            </b></td>
                        <td style="width:50%;text-align: right;font-size:14px;">Helpline Medina : <b>
                                <?= "$comp2[helpmed]"; ?>
                            </b></td>
                    </tr>
                </table>
            </div>
            <!--        <div class="row" style="background-color:<?= $vheadcolor; ?>  !important;height:35px">
                <table class="border" style="height:35px;width:100%">
                    <tr>
                        <td width="35%" class="padd">&nbsp;&nbsp;</td>
                        <td width="30%" class="padd" style="text-align: center;"></td>
                        <td width="35%" class="right padd" style="text-align: center;"></td>
                    </tr>
                </table>
            </div>
        <br>-->

            <?php if ($imglogo == "Yes") { ?>
                <br>
                <div class="row" style="text-align:center;background-color:lightgrey !important;">

                    <?php
                    $ztel = $comp2['htel'];
                    $zadd = $comp2["hoadd1"] . " " . $comp2["hoadd2"] . " " . $comp2["hoadd3"] . " " . $comp2["hocity"] . " " . $comp2["hopin"];
                    ?>
                    <b> Regd. Ofc. </b><span style="font-family: verdana;font-size: 14px"><?= $zadd ?></span>
                    <b>Tel.:<?= $ztel ?></b>
                </div>


                <div class="row" style="background-color:<?= $vheadcolor; ?>  !important;height:35px">
                    <table class="border" style="height:35px;width:100%">
                        <tr>
                            <td width="35%" class="padd">&nbsp;&nbsp;<b
                                    style="font-size: 14px;color:white !important"><?php echo $comp2['compname']; ?></b>
                            </td>
                            <td width="30%" class="padd" style="text-align: center;"><b
                                    style="font-size: 12px;color:white !important">Email :
                                    <?php echo $comp2['email']; ?></b></td>
                            <td width="35%" class="right padd" style="text-align: center;"><b
                                    style="font-size: 12px;color:white !important">Website
                                    :&nbsp;<?php echo $comp2['website']; ?></b></td>
                        </tr>
                    </table>
                </div>
            <?php } ?>

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

</body>

</html>