<?php
	session_start();

    require('connect.php');
				//echo '<script>alert("BEFORE BUTTEN PRESS");</script>';

?>


<!DOCKTYPE html>
<html>
<head>
  <title>Admin</title>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	
<style>
.footer {
    color: white;
    background-color: black;
    margin-left: 0px;
    text-align: center;
    position:fixed;
    bottom: 0;
    height: 50px;
    width: 100%;
    }
    .container {
  	  width:100%;
      padding: 16px;
      margin-top:30px;
      margin-bottom:60px;
      opacity:0.5;
      background-color:#ffffff;
  }
  .container1 {
  	  width:100%;
      padding: 16px;
      margin-top:50px;
      margin-bottom:60px;
      opacity:0.5;
      background-color:#ffffff;
  }
  
    
</style>
<body style="overflow-x:hidden;background-size:100% 100%;background-repeat: no-repeat;bottom: 0;background-attachment: fixed;" background="images/admin.jpg">

<div>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation" style="padding: 0px margin:0px">
<div class="main" >
<div class="col-sm-6" >
<h1 align="left" style="margin-left:10px;" ><font color="white" size="15">   ABHI CAB</font>
  	<img src="images/logo.png" alt="google.com" width="100" height="50" align="left" style="margin-left:10px;">
  	</h1>
  	</div>
  	<div class="col-sm-6" style="margin-top:40px;">
    <ul class="nav navbar-nav navbar-right" style="margin-right:10px;">
    
      <li >
        <a href="index.php"> Home   <span class="glyphicon glyphicon-home"></span></a>
      </li>

        

      <li><a href="main.php">Book Now  <span class="glyphicon glyphicon-shopping-cart"></span></a></li>
      <li ><a href="about_us.html">About Us</a></li>
      <li><a href="contact.html">Contact Us <span class="glyphicon glyphicon-earphone"></span></a></li>
	  <li><a href="logout.php">Log Out <span class="glyphicon glyphicon-earphone"></span></a></li>
	</ul>
	</div>
  </div>
</nav>
</div>

<h2 style="margin-top:150px" align="center"><font size="8" color="BLACK" ><b>ADMIN</b></font></h2>

<div class="col-sm-1"></div>
<div class="col-sm-4">
	<div class="container">
		<h3 align="center"><b>HISTORY</b></h3>
		
		<?php
	
			//echo '<script>alert("BEFORE BUTTEN PRESS");</script>';
			$sql = "SELECT * FROM CUSTDRIV WHERE DATEOFTRAVEL < (SELECT CURDATE())";
	
			if($result = mysqli_query($con, $sql))
			{
				
				if(mysqli_num_rows($result) > 0)
				{
					echo '<table style="width:100%; "><font text-color="white">';
						echo '<tr>';
							echo '<th>Cust ID</th>';
							echo '<th>Cust Name</th>'; 
							echo '<th>Driver ID</th>';
							echo '<th>Driver Name</th>';
							echo '<th>Process ID</th>';
						echo '</tr>';
						
						echo '<tbody>';
                    
					while($row = mysqli_fetch_array($result))
					{
						$cid=$row['CID'];
						$did=$row['DID'];
						$pid=$row['PROCESSID'];


						$sql1 = "SELECT * FROM customer where cid=$cid";

						if($result1 = mysqli_query($con, $sql1))
						{
							if(mysqli_num_rows($result1) > 0)
							{
								$row1 = mysqli_fetch_array($result1);
								$cname=$row1['CNAME'];
							}

							mysqli_free_result($result1);
						}
			
						$sql1 = "SELECT * FROM driver where did=$did";

						if($result1 = mysqli_query($con, $sql1))
						{
							if(mysqli_num_rows($result1) > 0)
							{
								$row1 = mysqli_fetch_array($result1);
								$dname=$row1['DNAME'];
							}

						mysqli_free_result($result1);
						}
						
						
						//<!--Use a while loop to make a table row for every DB row-->
						echo '<tr>';
							//<!--Each table column is echoed in to a td cell-->
							echo '<td>';
								echo $cid; 
							echo '</td>';
							echo '<td>';
								echo $cname;
							echo '</td>';
							echo '<td>';
								echo $did;
							echo '</td>';
							echo '<td>';
								echo $dname;
							echo '</td>';
							echo '<td>';
								echo $pid;
							echo '</td>';
						echo '</tr>';
					}

				}
				echo '</tbody>';
			}
		?>

		
		<table style="width:100%; "><font text-color="white">
			
		</font></table>
	</div>
</div>
<div class="row">
<div class="col-sm-2"></div>

<div class="col-sm-4">
	<div class="container">
		<h3 align="center"><b>FUTURE</b></h3>
		
		<?php
	
			//echo '<script>alert("BEFORE BUTTEN PRESS");</script>';
			$sql = "SELECT * FROM CUSTDRIV WHERE DATEOFTRAVEL > (SELECT CURDATE())";
	
			if($result = mysqli_query($con, $sql))
			{
				
				if(mysqli_num_rows($result) > 0)
				{
					echo '<table style="width:100%; "><font text-color="white">';
						echo '<tr>';
							echo '<th>Cust ID</th>';
							echo '<th>Cust Name</th>'; 
							echo '<th>Driver ID</th>';
							echo '<th>Driver Name</th>';
							echo '<th>Process ID</th>';
						echo '</tr>';
						
						echo '<tbody>';
                    
					while($row = mysqli_fetch_array($result))
					{
						$cid=$row['CID'];
						$did=$row['DID'];
						$pid=$row['PROCESSID'];


						$sql1 = "SELECT * FROM customer where cid=$cid";

						if($result1 = mysqli_query($con, $sql1))
						{
							if(mysqli_num_rows($result1) > 0)
							{
								$row1 = mysqli_fetch_array($result1);
								$cname=$row1['CNAME'];
							}

							mysqli_free_result($result1);
						}
			
						$sql1 = "SELECT * FROM driver where did=$did";

						if($result1 = mysqli_query($con, $sql1))
						{
							if(mysqli_num_rows($result1) > 0)
							{
								$row1 = mysqli_fetch_array($result1);
								$dname=$row1['DNAME'];
							}

						mysqli_free_result($result1);
						}
						
						
						//<!--Use a while loop to make a table row for every DB row-->
						echo '<tr>';
							//<!--Each table column is echoed in to a td cell-->
							echo '<td>';
								echo $cid; 
							echo '</td>';
							echo '<td>';
								echo $cname;
							echo '</td>';
							echo '<td>';
								echo $did;
							echo '</td>';
							echo '<td>';
								echo $dname;
							echo '</td>';
							echo '<td>';
								echo $pid;
							echo '</td>';
						echo '</tr>';
					}

				}
				echo '</tbody>';
			}
		?>
		
		<table style="width:100%; "><font text-color="white">
			
		</font></table>
	</div>
</div>

<div class="col-sm-1"></div>
</div>

<div class="col-sm-4"></div>

<div class="col-sm-4">
	<div class="container1">		
		<h3 align="center"><b>ON GOING</b></h3>
		
		<?php
	
			//echo '<script>alert("BEFORE BUTTEN PRESS");</script>';
			$sql = "SELECT * FROM CUSTDRIV WHERE DATEOFTRAVEL = (SELECT CURDATE())";
	
			if($result = mysqli_query($con, $sql))
			{
				
				if(mysqli_num_rows($result) > 0)
				{
					echo '<table style="width:100%; "><font text-color="white">';
						echo '<tr>';
							echo '<th>Cust ID</th>';
							echo '<th>Cust Name</th>'; 
							echo '<th>Driver ID</th>';
							echo '<th>Driver Name</th>';
							echo '<th>Process ID</th>';
						echo '</tr>';
						
						echo '<tbody>';
                    
					while($row = mysqli_fetch_array($result))
					{
						$cid=$row['CID'];
						$did=$row['DID'];
						$pid=$row['PROCESSID'];


						$sql1 = "SELECT * FROM customer where cid=$cid";

						if($result1 = mysqli_query($con, $sql1))
						{
							if(mysqli_num_rows($result1) > 0)
							{
								$row1 = mysqli_fetch_array($result1);
								$cname=$row1['CNAME'];
							}

							mysqli_free_result($result1);
						}
			
						$sql1 = "SELECT * FROM driver where did=$did";

						if($result1 = mysqli_query($con, $sql1))
						{
							if(mysqli_num_rows($result1) > 0)
							{
								$row1 = mysqli_fetch_array($result1);
								$dname=$row1['DNAME'];
							}

						mysqli_free_result($result1);
						}
						
						
						//<!--Use a while loop to make a table row for every DB row-->
						echo '<tr>';
							//<!--Each table column is echoed in to a td cell-->
							echo '<td>';
								echo $cid; 
							echo '</td>';
							echo '<td>';
								echo $cname;
							echo '</td>';
							echo '<td>';
								echo $did;
							echo '</td>';
							echo '<td>';
								echo $dname;
							echo '</td>';
							echo '<td>';
								echo $pid;
							echo '</td>';
						echo '</tr>';
					}

				}
				echo '</tbody>';
			}
		?>
		
		
		<table style="width:100%; "><font text-color="white">
			
		</font></table>
	</div>
</div>

<div class="col-sm-4"></div>


<!-- Footer -->
  <footer class="footer">
    <h5>Copyright &copy; 2018 AbhiCab.com</h5>
  </footer>



</div>
</body>
</html>
