<?php include("cn.php");
$page_name = "Electronic Booking Invoice"; ?>
<!DOCTYPE html>

<html>
<?php include("head-tag.php");?>


<body oncontextmenu="return false;" onLoad="javascript:window.print();">
<style type="text/css">

body{

	font:Arial, Helvetica, sans-serif;

	font-family:Arial, Helvetica, sans-serif;

	font-size:14px;

	}
	
	
	@page {

      margin-bottom:0;

	}

td {
    padding-top: .2em;
    padding-bottom: .2em;
    text-align: center;
}
.right {
    text-align: right;
}


</style>


 <style type="text/css" media="print">
 
@page {
    size: auto;   /* auto is the initial value */
    margin-top: 40px;  /* this affects the margin in the printer settings */
}
</style>



<?php
$user="";
$sql = mysqli_query($connect, "SELECT rentedcars.*, cars.car_name AS car_title, cars.car_nameplate AS car_number,
driver.driver_name as driver_name
FROM rentedcars 
INNER JOIN cars ON cars.car_id = rentedcars.car_id
LEFT JOIN driver ON driver.driver_id = rentedcars.driver_id
WHERE `BookingNumber`='".$_GET['id']."'");

$data = mysqli_fetch_assoc($sql);
$user = $data['AppUser'];
    
$sql1 = mysqli_query($connect, "SELECT *FROM app_users 
WHERE `Id`='".$user."'");

$customer = mysqli_fetch_assoc($sql1);

$user = $data['driver_id'];

$sql1= "SELECT * FROM app_users INNER JOIN driver ON driver.driver_id = app_users.DriverId WHERE app_users.DriverId='".$user."'";

$sql1 = mysqli_query($connect, $sql1);

$driver = mysqli_fetch_assoc($sql1);

?>


<div style="margin-top:20px" width="96%">
    </br>
 <table id="datatable" cellspacing="0" width="96%" border="1" name="datatable"  align="center" >
 <tbody>
<tr>
     <td colspan="1" width="20%" rowspan="4"><?php echo $companylogo;?></td>
     
       <td colspan="3" style="text-transform: uppercase; text-align:center; font-size:20px; font-family:Arial; font-weight:bold;" ><?php echo $companyname;?></td>
</tr>
<tr> 
<td colspan="3" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;" >Address: <?php echo $companyaddress;?></td>
</tr>
<tr> 
<td colspan="3" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;" >Phone:<?php echo $companyphone;?> Email:<?php echo $companyemail;?><br><b>TRN :<?php echo $companytrn;?> </b> </tr>
<tr> 
<td colspan="3" style="text-transform: uppercase; text-align:center; font-size:18px; font-family:Arial; font-weight:bold;" ><?php echo $page_name;?></td>
</tr>

<tr>

    <td colspan="4" style=" background:#999; font-size:16px; text-align:left; font-family:Arial; font-weight:bold;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Booking Details</td>
   
</tr>
<tr>

     <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Booking No:</td>
     <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['BookingNumber']?></td>
     <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Booking Date</td>
     <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo date("d-m-Y H:i:s", strtotime($data['booking_date']));?></td>
</tr>
<tr>

    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Car Name:</td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['car_title'];?></td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Number Plate</td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['car_number'];?></td>
</tr>
<tr>

     <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Pick Up Location:</td>
    <td colspan="3" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['pickup'];?></td>

</tr>
<tr>

     <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Drop Off Location:</td>
    <td colspan="3" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['Destination'];?></td>

</tr>
<tr>

    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Trip Started At:</td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo date("d-m-Y H:i:s", strtotime($data['StartTime']));?></td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Trip Ended At:</td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo date("d-m-Y H:i:s", strtotime($data['EndTime']));?></td>
</tr>
<!--<tr>

     <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold; ">Duration</td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['duration'].' '.$data['charge_type'];?></td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Charge Type </td>
    <td colspan="1" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo '@ '.$data['fare'].' / '.$data['charge_type'];?></td>
   
</tr>-->
</tbody>
</table>

<table id="datatable" cellspacing="0" width="96%" border="1" name="datatable"  align="center">
<tbody>

<tr>
<td colspan="4" style="text-align:left; background:#999; font-size:14px; font-family:Arial; font-weight:bold;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Customer Details</td>
</tr>
<tr>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold; ">Customer Name</td>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $customer['Name'];?></td></tr>
<tr>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Customer's Email </td>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $customer['Email'];?></td>
   
</tr>
<tr>
     <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Customer's Phone </td>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $customer['Phone'];?></td>
   
</tr>
<tr>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Hotel/Company</td>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['customer_hotel'];?></td></tr>
<tr>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Room No.</td>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial;"><?php echo $data['customer_room'];?></td>
</tr>
<tr>

     <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Flight:</td>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['customer_flight'];?></td>

</tr> 
<tr>

<td colspan="4" style="text-align:left; background:#999; font-size:14px; font-family:Arial; font-weight:bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Driver Details</td>
</tr>
<tr>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Driver Name</td>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $data['driver_name'];?></td></tr>
<tr>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; font-weight:bold;">Driver's Email</td>
    <td colspan="2" style="text-align:center; font-size:14px; font-family:Arial; "><?php echo $driver['Email'];?></td>
</tr> 
<tr>
	<td colspan="3" class="grand_total right" style="font-size:16px; font-family:Arial; font-weight:bold;">Total Amount Paid:</td>
	<td colspan="1" style="font-size:16px; font-family:Arial; font-weight:bold;"><?php echo $data['total_amount'];?></td>
</tr>
 <tr>
    <td colspan="3" style="height:100px; text-align:left; font-size:14px;padding-left:10px;">
        <strong> </strong>
            <br>
          <strong><h4><?php echo $data['comments'];?></h4> <br><br><br><br><?php echo $companymsgcomputer;?> </strong>
            <br>

    </td>
   <td colspan="1" style="height:100px; text-align:center; font-size:14px;">
     <?php if($data["PaymentStatus"] == "Un-paid" ){
     echo $companyseal2;
     }else{
     echo $companyseal;}?>  
    </td>
       
</tr>
<tr>
    <td colspan="3" style="font-weight:bold; text-align:left; font-size:16px;"><?php echo $companymsgthankyou;?></td>
	<td colspan="1" style="background:#999; text-align:center; font-size:14px">
		Company Seal
	</td>
		
</tr>


</tbody>
</table></br>
</div>

<?php include("scripts.php");?>
    
<div class="sidebar-overlay" id="sidebar_overlay"></div>

</body>



</html>