<?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"];
$zcomp = $_SESSION["comp_" . $dbname];

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

$vouch = $_GET['vouchno'];

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

$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);

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

$title = "INVOICE NO. $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: 290mm;
        padding: 4mm;
        margin: 5mm auto;
        border: 1px #D3D3D3 solid;
        border-radius: 2px;
        /*background: white;*/

    }

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

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

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

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

        .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;
    }

    .f13 {
        font-size: 13px;
    }

    .f14 {
        font-size: 14px;
    }

    .skdiv {
        width: 50%;
        margin: auto;
        margin-top: -20px;
        margin-bottom: -20px;
    }
</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="">
                <div>
                    <table class="table table-borderless" style="width:100%">
                        <tr>
                            <?php if ($comp2['iatano'] != "") { ?>
                                <td style="width:60%;">
                                    <img style="height:auto;width:100%; " src="<?php echo $headerimg; ?>">
                                </td>
                                <td style="width:40%;text-align: right;">
                                    <img style="height:auto;width:40%;" src="images/iata_logo.png">
                                </td>
                            <?php } else { ?>

                                <div class="skdiv">
                                    <img style="height:auto;width:100%;" src="<?php echo $headerimg; ?>">
                                </div>

                            <?php } ?>
                        </tr>
                        <?php if ($comp2['iatano'] != "") { ?>
                            <tr>
                                <td style="width:60%;">
                                </td>
                                <td style="width:40%;text-align: right;" class="f14"><b> IATA NO. : <?= $comp2['iatano']; ?></b></td>
                            </tr>
                        <?php } ?>
                    </table>


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

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

                        <tbody>

                            <tr width="100%">
                                <td class="f14"><span style="padding-right:5px"> Invoice No. </span> : <b> <?= $getdata['invno']; ?></b></td>
                                <td class="f14"><span style="padding-right:30px"> Date </span> : <b> <?= $getdata['mydt']; ?></b></td>
                            </tr>

                            <?php if ($agentname != "") { ?>
                                <tr width="100%">
                                    <td class="f14"><span style="padding-right:60px"> To </span> : <b> <?= $paxname; ?></b></td>
                                </tr>
                            <?php } ?>
                            <tr width="100%">
                                <?php $fullname = $getdata['surname'] . " " . $getdata['name'] . " " . $getdata['midname']; ?>
                                <td class=""><span style="padding-right:18px"> LEAD PAX </span> : <b>
                                        <?= $fullname; ?>
                                    </b></td>
                                <?php if ($getdata['gstno'] != "") { ?>
                                    <td class="f14"><span style="padding-right:5px"> GST No. </span> : <b> <?= $getdata['gstno']; ?></b></td>
                                <?php } ?>

                            </tr>
                        </tbody>
                    </table>
                    <?php
                    if ($getdata['tiktaprov'] == 1) {
                    ?>

                        <div>
                            <br>
                            <div>Ticket & Airline Details</div>
                            <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>
                                    <th style='width: 7%;' class="text-right">Adult</th>
                                    <th style='width: 7%;' class="text-right">Child</th>
                                    <th style='width: 7%;' class="text-right">Infant</th>
                                    <th style='width: 7%;' class="text-right">Total</th>
                                </tr>

                                <?php
                                $ctr = 0;
                                $ctab = 0;
                                $totqty = 0;
                                $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));

                                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);

                                    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:10px'>$fettikt[travdate]</td>";
                                    echo "<td style='text-align:right'>$fettikt[nopax]</td>";
                                    echo "<td style='text-align:right'>$fettikt[adult]</td>";
                                    echo "<td style='text-align:right'>$fettikt[child]</td>";
                                    echo "<td style='text-align:right'>$fettikt[infant]</td>";
                                    echo "<td style='text-align:right'>$fettikt[amount]</td>";
                                    echo "</tr>";
                                }
                                ?>


                            </table>
                        </div>
                        <br>
                    <?php
                    }
                    if ($getdata['hotelaprov'] == 1) {
                    ?>
                        <div>
                            <div>Hotel</div>

                            <table style="width:100%" class="table table-bordered">
                                <tr class="mySearchTr" style="font-size: 13px;">
                                    <th width="8%">City</th>
                                    <th width="10%">Hotel Name</th>
                                    <th width="10%">Check In</th>
                                    <th width="10%">Check Out</th>
                                    <th width="7%" class="text-center">No. Nights</th>
                                    <th width="15%">Room Category</th>
                                    <th width="7%">Type</th>
                                    <th width="5%" class='text-right'>Qty.</th>
                                    <th width="5%" class='text-right'>Rate</th>
                                    <th width="5%" class='text-right'>Amount(FE)</th>
                                </tr>

                                <?php
                                $ctr = 0;
                                $ctab = 0;
                                $totqty = 0;
                                $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));
                                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);

                                    $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);

                                    echo "<tr style='font-size: 11px;'>";
                                    echo "<td style=''>$thotcity[name]</td>";
                                    echo "<td>$thotel[hotelnm]</td>";
                                    echo "<td style='font-size:10px'>$tran[checkin]</td>";
                                    echo "<td style='font-size:10px'>$tran[checkout]</td>";
                                    echo "<td style=''>$tran[nonights]</td>";
                                    echo "<td style=''>$thotcatg[name]</td>";
                                    echo "<td style='font-size:10px'>$trtype[name]</td>";
                                    echo "<td style='text-align:right'>$tran[qty]</td>";
                                    echo "<td style='text-align:right'>$tran[rate]</td>";
                                    echo "<td style='text-align:right'>$tran[amount]</td>";
                                    echo "</tr>";
                                }
                                ?>

                            </table>
                        </div>
                    <?php
                    }
                    if ($getdata['foodaprov'] == 1) {
                    ?>

                        <br>
                        <div>
                            <div>Food</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>
                                    <th style="width:10%;" class='text-right'>Rate</th>
                                    <th style="width:10%;" class='text-right'>Amount(FE)</th>
                                </tr>

                                <?php
                                $ctr = 0;
                                $ctab = 0;
                                $totqty = 0;
                                $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));
                                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);

                                    echo "<tr style='font-size: 11px;'>";
                                    echo "<td style=''>$fetfood[checkin]</td>";
                                    echo "<td>$fetfood[checkout]</td>";
                                    echo "<td>$fetho[hotelnm]</td>";
                                    echo "<td style='text-align: right;'>$fetfood[nonights]</td>";
                                    echo "<td style='text-align: right;'>$fetfood[nopax]</td>";
                                    echo "<td style='text-align: right;'>$fetfood[rate]</td>";
                                    echo "<td style='font-size:10px;text-align:right'>$fetfood[amount]</td>";
                                    echo "</tr>";
                                }
                                ?>
                            </table>
                        </div>
                    <?php
                    }
                    if ($getdata['laundaprov'] == 1) {
                    ?>

                        <br>
                        <div>
                            <div>Laundry</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>
                                    <th style="width:10%;" class='text-right'>Rate</th>
                                    <th style="width:10%;" class='text-right'>Amount(FE)</th>
                                </tr>

                                <?php
                                $ctr = 0;
                                $ctab = 0;
                                $totqty = 0;
                                $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));
                                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 "<td style='text-align: right;'>$fetlaund[rate]</td>";
                                    echo "<td style='font-size:10px;text-align:right'>$fetlaund[amount]</td>";
                                    echo "</tr>";
                                }
                                ?>
                            </table>
                        </div>
                    <?php
                    }
                    if ($getdata['visaaprov'] == 1) {
                    ?>

                        <br>
                        <div>
                            <div>Visa</div>
                            <table style="width:100%" class="table table-bordered">
                                <tr class="mySearchTr" style="font-size: 13px;">
                                    <th style="width:10%;">Country</th>
                                    <th style="width:10%;" class='text-right'>No. Pax</th>
                                    <th style="width:10%;" class='text-right'>Rate</th>
                                    <th style="width:10%;" class='text-right'>Amount</th>
                                </tr>

                                <?php
                                $ctr = 0;
                                $ctab = 0;
                                $totqty = 0;
                                $getvisadtl = mysqli_query($conn, "SELECT * FROM `$visadb` where vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));
                                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 style='text-align: right;'>$fetvisa[rate]</td>";
                                    echo "<td style='text-align: right;'>$fetvisa[amount]</td>";
                                    echo "</tr>";
                                }
                                ?>
                            </table>
                        </div>
                    <?php
                    }
                    if ($getdata['transaprov'] == 1) {
                    ?>

                        <br>
                        <div>
                            <div>Transportation</div>
                            <table style="width:100%" class="table table-bordered">
                                <tr class="mySearchTr" style="font-size: 13px;">
                                    <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:6%; " class='text-right'>Rate</th>
                                    <th style="width:8%; " class='text-right'>Amount(FE)</th>
                                    <th style="width:15%;">Description</th>
                                </tr>

                                <?php
                                $ctr = 0;
                                $ctab = 0;
                                $totqty = 0;
                                $gettransdtl = mysqli_query($conn, "Select * from `$transdb` where vouchno ='$getdata[vouchno]' order by srno") or die(mysqli_error($conn));
                                while ($fettrans = mysqli_fetch_array($gettransdtl)) {

                                    $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=''>$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: right;'>$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: right;'>$fettrans[rate]</td>";
                                    echo "<td style='text-align: right;'>$fettrans[amount]</td>";
                                    echo "<td style='text-align: left;'>$fettrans[descrip]</td>";
                                    echo "</tr>";
                                }
                                ?>

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

                    <table class="table table-bordered">
                        <tr class="">
                            <td style="width:50%">
                                <table style="width:100"></table>
                            </td>
                            <td style="width:50%">
                                <table style="width:100%" class="tecle table-bordered">
                                    <?php if ($getdata['tiktaprov'] == 1) {
                                        $gst = $_REQUEST['gst'];
                                        $tiktsubtot = $getdata['tiktsubtot'];
                                        $tikthandchg = $getdata['tikthandchg'];
                                        $tiktgstamt = $getdata['tiktgstamt'];

                                        if ($getdata['pstatecode'] == $hostatecode) {
                                            $tiktcgstamt = $tiktgstamt / 2;
                                            $tiktsgstamt = $tiktgstamt / 2;
                                        }

                                    ?>
                                        <tr>
                                            <td style="width:50%" class="text-right" colspan="2">
                                                <b style="font-size:14px">Ticket Subtotal</b>
                                            </td>

                                            <td style="width:50%" class="text-right">
                                                <b style="font-size:18px"><?= number_format($tiktsubtot, 2); ?></b>
                                            </td>
                                        </tr>

                                        <?php if ($tikthandchg > 0) { ?>
                                            <tr>
                                                <td style="width:50%" class="text-right" colspan="2">
                                                    <b style="font-size:13px">Handling Charges</b>
                                                </td>
                                                <td style="width:50%" class="text-right">
                                                    <b style="font-size:18px"><?= number_format($tikthandchg, 2); ?></b>
                                                </td>
                                            </tr>
                                        <?php } ?>

                                        <?php if ($gst == "Yes") {

                                            if ($getdata['pstatecode'] == $hostatecode) {  ?>

                                                <tr>
                                                    <td style="width:50%" class="text-right" colspan="2">
                                                        <b style="font-size:13px">CGST</b>
                                                    </td>
                                                    <td style="width:50%" class="text-right">
                                                        <b style="font-size:18px"><?= number_format($tiktcgstamt, 2); ?></b>
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td style="width:50%" class="text-right" colspan="2">
                                                        <b style="font-size:13px">SGST</b>
                                                    </td>
                                                    <td style="width:50%" class="text-right">
                                                        <b style="font-size:18px"><?= number_format($tiktsgstamt, 2); ?></b>
                                                    </td>
                                                </tr>
                                            <?php } else { ?>

                                                <tr>
                                                    <td style="width:50%" class="text-right" colspan="2">
                                                        <b style="font-size:13px">IGST</b>
                                                    </td>
                                                    <td style="width:50%" class="text-right">
                                                        <b style="font-size:18px"><?= number_format($tiktgstamt, 2); ?></b>
                                                    </td>
                                                </tr>

                                            <?php } ?>
                                            <tr>
                                                <td style="width:50%" class="text-right" colspan="2">
                                                    <b style="font-size:16px">Ticket Final</b>
                                                </td>
                                                <td style="width:50%" class="text-right">
                                                    <b style="font-size:18px"><?= number_format($getdata['tiktamt'], 2); ?></b>
                                                </td>
                                            </tr>
                                    <?php
                                        }

                                        $tiktamt = $getdata['tiktamt'];
                                    }
                                    ?>


                                    <?php if ($getdata['hotelaprov'] == 1) { ?>
                                        <tr>

                                            <td style="width:30%">
                                                <b style="font-size:14px">FE - <?= rajnumformat($getdata['hotelamt']) ?></b>
                                            </td>
                                            <td style="width:20%">
                                                <b style="font-size:16px">Hotel</b>
                                            </td>
                                            <td style="width:50%" class="text-right">

                                                <b style="font-size:18px"><?= rajnumformat($getdata['hotelinramt']) ?></b>
                                            </td>
                                        </tr>
                                    <?php
                                        $hotelamt = $getdata['hotelinramt'];
                                    }
                                    ?>
                                    <?php if ($getdata['foodaprov'] == 1) { ?>
                                        <tr>
                                            <td style="width:30%">
                                                <b style="font-size:14px">FE - <?= rajnumformat($getdata['foodamt']) ?></b>
                                            </td>
                                            <td style="width:20%">
                                                <b style="font-size:16px">Food</b>
                                            </td>
                                            <td style="width:50%" class="text-right">

                                                <b style="font-size:18px"><?= rajnumformat($getdata['foodinramt']) ?></b>
                                            </td>
                                        </tr>
                                    <?php
                                        $foodamt = $getdata['foodinramt'];
                                    }
                                    ?>
                                    <?php if ($getdata['laundaprov'] == 1) { ?>
                                        <tr>
                                            <td style="width:30%">
                                                <b style="font-size:14px">FE - <?= rajnumformat($getdata['laundamt']) ?></b>
                                            </td>
                                            <td style="width:20%">
                                                <b style="font-size:16px">Laundry</b>
                                            </td>
                                            <td style="width:50%" class="text-right">

                                                <b style="font-size:18px"><?= rajnumformat($getdata['laundinramt']) ?></b>
                                            </td>
                                        </tr>
                                    <?php
                                        $laundamt = $getdata['laundinramt'];
                                    }
                                    ?>
                                    <?php if ($getdata['visaaprov'] == 1) { ?>
                                        <tr>
                                            <td style="width:30%">
                                                <b style="font-size:14px"></b>
                                            </td>
                                            <td style="width:20%">
                                                <b style="font-size:16px">Visa</b>
                                            </td>
                                            <td style="width:50%" class="text-right">

                                                <b style="font-size:18px"><?= rajnumformat($getdata['visaamt']) ?></b>
                                            </td>
                                        </tr>
                                    <?php
                                        $visaamt = $getdata['visaamt'];
                                    }
                                    ?>
                                    <?php if ($getdata['transaprov'] == 1) { ?>
                                        <tr>
                                            <td style="width:30%">
                                                <b style="font-size:14px">FE - <?= rajnumformat($getdata['transamt']) ?></b>
                                            </td>
                                            <td style="width:20%">
                                                <b style="font-size:16px">Transportation</b>
                                            </td>
                                            <td style="width:50%" class="text-right">

                                                <b style="font-size:18px"><?= rajnumformat($getdata['transinramt']) ?></b>
                                            </td>
                                        </tr>
                                    <?php
                                        $transamt = $getdata['transinramt'];
                                    }

                                    $netamt = $foodamt + $hotelamt + $transamt + $visaamt + $laundamt + $tiktamt;
                                    ?>

                                    <tr>
                                        <td style="width:25%">

                                        </td>
                                        <td style="width:25%">
                                            <b style="font-size:18px;color:green !important">Total INR</b>
                                        </td>
                                        <td style="width:50%" class="text-right">
                                            <b style="font-size:18px;color:green !important"><?= rajnumformat($netamt) ?></b>
                                        </td>
                                    </tr>

                                </table>
                            </td>
                        </tr>
                    </table>
                    <p>Amount in Words : <?php echo rsword($netamt) ?></p>
                    <p style="font-weight:bold">All Rates are mentioned in SAR. ( ROE : <?= $getdata['roe'] ?> )</p>

                </div>

                <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[invnote1]</td></tr>";
                        echo "<tr><td style='text-align: left;'>$comp2[invnote2]</td></tr>";
                        echo "<tr><td style='text-align: left;'>$comp2[invnote3]</td></tr>";
                        echo "<tr><td style='text-align: left;'>$comp2[invnote4]  $comp2[invnote5] </td></tr>";
                        // echo "<tr><td style='text-align: left;'>$comp2[invnote5]</td></tr>";
                        echo "<tr><td style='text-align: left;'>$comp2[invnote6]</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>
                <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>
                <?php if ($comp2['gstno'] != "") { ?>
                    <div class="row" style="text-align:center;background-color:lightgrey !important; ">
                        <b> <span style="font-family: verdana;font-size: 14px"> GST No.<?= $comp2["gstno"]; ?></span></b>
                    </div>
                <?php } ?>

                <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>
            </div>
        </div>
        <?php
        include("includes/linksfoot.php");
        ?>

</body>

</html>