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

$maindb = "leadenq";
//$trandb = "saletran";
$formname = "Lead Query";
$file = "ldstfreg.php";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
$usertype = $_SESSION["usertype"];
$user = $_SESSION['username_' . $dbname];
mysqli_select_db($conn,$zdb);

if (isset($_POST["view"])) {
    $name = $_POST[name];
    if (!empty($name)) {
        $namecond = " AND `name` like '%$name%' ";
    }


    $getpmain = mysqli_query($conn,"SELECT *,DATE_FORMAT(`vouchdt`, '%d-%m-%Y') as mydt,DATE_FORMAT(`deptdate`, '%d-%m-%Y') as deptdate
                         FROM $maindb where `vouchno` != '' $namecond order by vouchno")or die(mysqli_error($conn));
    include("includes/linkshead.php");
    ?>
    <!--<script src="MyScript/item.js" type="text/javascript"></script>-->    
    </head>
    <body>
        <div class="container" style="width:100%">
            <div class="row">
                <!--                            <div class="col-lg-6">
                                                <label class="label-control marg">Date - </label>
                                                <label class="label-control marg"><?php // Echo Date("d-m-Y");      ?></label>
                                            </div>-->

                <div class="col-lg-5">
                    <label class="label-control marg">Print - </label>
                    <label class="label-control marg"><?php Echo $formname; ?></label>
                </div>

                <div class="col-lg-3" style="float: right; margin-top: 5px;">
                    <a onclick="window.close()" class="btn btn-primary">GO Back</a>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12 pad">
                    <table style="width:100%;background: white" class="table-condensed table-hover table-bordered">
                        <thead>
                            <tr style="height:10px;background-color: #64CCFC;">
                                <th style="width:3%">Sr</th>
                                <th style="width:4%">Book No</th>
                                <th style="width:13%">Enq Date</th>
                                <th style="width:9%">Name</th>
                                <th style="width:9%">Last Name</th>
                                <th style="width:7%">Mobile</th>
                                <th style="width:8%">Email-Id</th>
                                <th style="width:9%">Destination</th>
                                <th style="width:9%">Source</th>
                                <th style="width:13%">Travel Date</th>
                                <th style="width:7%">Status</th>
                                <th style="width:3%">Que to Visa</th>
                                <th style="width:18%">Remarks</th>
                                <!--<th class="numeric">New Remark</th>-->                            
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $ctr = 0;

                            while ($pmain = mysqli_fetch_array($getpmain)) {
                                $ctr++;
                                if ($pmain[quotvisa] == "Y") {
                                    $quotvisa = "YES";
                                } else {
                                    $quotvisa = "No";
                                }
                                Echo "<tr>";

                                Echo "<td style='width:3%'>$ctr</td>";
                                Echo "<td style='width:4%'>$pmain[vouchno]</td>";
                                Echo "<td style='width:13%'>$pmain[mydt]</td>";
                                Echo "<td style='width:9%'>$pmain[name]</td>";
                                Echo "<td style='width:9%'>$pmain[lastname]</td>";
                                Echo "<td style='width:7%'>$pmain[mobile]</td>";
                                Echo "<td style='width:8%'>$pmain[email]</td>";

                                Echo "<td style='width:9%'>$pmain[destination]</td>";
                                Echo "<td style='width:9%'>$pmain[source]</td>";
                                Echo "<td style='width:13%'>$pmain[deptdate]</td>";
                                Echo "<td style='width:7%'>$pmain[status]</td>";
                                Echo "<td style='width:3%'>$quotvisa</td>";
                                Echo "<td style='width:18%'>$pmain[remarks]  $pmain[remarks1]</td>";
//                        Echo "<td style='width:10%'>$pmain[remarks1]</td>";
                                Echo "</tr>";
                            }

//                            
                            ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

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

