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

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

<style>
        @media print {
            @page {
                margin: 0 auto; /* imprtant to logo margin */
                sheet-size: 160mm 500mm; /* imprtant to set paper size */
            }
            html {
               
            }
            html,body{margin:0;padding:0}
            table {
            margin-top: 30px;
            margin-bottom: 25px;
            }
            #printContainer {
                width: 80mm;
                margin: auto;
                /*padding: 10px;*/
                /*border: 2px dotted #000;*/
                text-align: justify;
            }
            tr.bordered {
            border-bottom: 1px solid #000;
            }
           .text-center{text-align: center;}
        }
    </style>

<body oncontextmenu="return false;" onLoad="javascript:window.print();">

<?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'];
$bookings += $data['total_amount'] + $data['addifare'];
$sql1 = mysqli_query($connect, "SELECT *FROM app_users 
WHERE `Id`='".$user."'");

$customer = mysqli_fetch_assoc($sql1);

?>

<div id="printContainer" style="border:groove">
 
<table cellpadding="0" cellspacing="0" align="center">
 
<tr>
       <td colspan="5" style="text-transform: uppercase; text-align:center; font-size:20px; font-family:Arial; font-weight:bold;" ><?php echo $companylogosmall;?><br/><?php echo $companyname;?></td>
</tr>
<tr> 
<td colspan="5" style="text-align:center; font-size:12px; font-family:Arial; font-weight:bold;" ><?php echo $companyaddress;?> </td>
</tr>
<tr> 
<td colspan="5" style="text-align:center; font-size:12px; font-family:Arial; font-weight:bold;" ><?php echo $customer['Phone'];?> , <?php echo $companyemail;?> </td>
</tr>
<tr> 
<td colspan="5" style="text-align:center; font-size:12px; font-family:Arial; font-weight:bold;" >TRN No.:<?php echo $companytrn;?> </td>
</tr>
<tr>
    <td colspan="5" style="font-size:12px; font-family:Arial; font-weight:bold;"><hr style="border-style:dashed; border-width:1px;"></td>
</tr>
<tr> 
<td colspan="5" style="text-transform: uppercase; text-align:center; font-size:18px; font-family:Arial; font-weight:bold;" ><?=$page_name?></td>
</tr>
<tr>
    <td colspan="5" style="font-size:12px; font-family:Arial; font-weight:bold;"><hr style="border-style:dashed; border-width:1px;"></td>
</tr>
<tr>
    <td colspan="3" style="text-align:center; font-size:12px; font-family:Arial; font-weight:bold;">E.Booking# : <?php echo $data['BookingNumber']?></td>
    </tr>
    <tr>
    <td colspan="3" style="text-align:center; font-size:12px; font-family:Arial; font-weight:bold;">Booking Date :  <?php echo date("d-m-Y H:i:s", strtotime($data['booking_date']));?></td>
    </tr>
    <tr>
    <td  colspan="2" style="text-align:center; font-size:12px; font-family:Arial; font-weight:bold;">
    <?php echo $data['car_title'];?>
    <br/><?php echo $data['car_number'];?>
    <br/>Driver: <?php echo $data['driver_name'];?>
    </td>
</tr>

<tr>
    <td colspan="5" style="font-size:12px; font-family:Arial; font-weight:bold; text-align:center;">
        <hr style="border-style:dashed; border-width:1px;">
    Customer: <?php echo $customer['Name'];?>
    <br/>
    <?php echo $customer['Email'];?>
    <br/>
    Phone: <?php echo $customer['Phone'];?>
    </td>
    
</tr>

<tr>
    <td colspan="5" style="font-size:12px; font-family:Arial; font-weight:bold; text-align:center;">
        <hr style="border-style:dashed; border-width:1px;">
    Pickup: <?php echo $data['pickup'];?>
        <br/>
    Drop Off:
        <?php echo $data['Destination'];?>
    </td>
    
</tr>

<tr>
    <td colspan="5" style="font-size:12px; font-family:Arial; font-weight:bold; text-align:center;"><hr style="border-style:dashed; border-width:1px;">
    Started At: <?php echo date("d-m-Y H:i:s", strtotime($data['StartTime']));?>
    <br/>
    
    Ended At: <?php echo date("d-m-Y H:i:s", strtotime($data['EndTime']));?>
    </td>
    
    
</tr>
<tr>
    <td colspan="5" style="font-size:12px; font-family:Arial; font-weight:bold; text-align:center;">
        <hr style="border-style:dashed; border-width:1px;">
    Comments: <?php echo $data['comments'];?>
        <br/>
</tr>

										<tr>
<td colspan="5" style="font-size:12px; font-family:Arial; font-weight:bold;">
    <hr style="border-style:solid; border-width:3px;"></td>
                                    </tr>
								
									
										<tr>
											<td colspan="4" class="grand_total" style="text-transform: uppercase; text-align:left; font-size:12px; font-family:Arial; font-weight:bold;" >
												<strong>Total :</strong>
											</td>
                                            
											<td class="grand_total" style="text-transform: uppercase; text-align:center; font-size:12px; font-family:Arial; font-weight:bold;">
												<strong>
												   <?php echo $bookings;?>
												    </strong>
											</td>
										</tr>
										<tr>
    <td colspan="5" style="font-size:12px; font-family:Arial; font-weight:bold;"><hr style="border-style:solid; border-width:3px;"></td>
</tr>
                                    <tr>
                                        <td colspan="5" style="text-align:center; font-size:10px; font-family:Arial; font-weight:bold;">Thank You....Visit Again</td>
                                    </tr>
                                    
                                        

</table>

</div>

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

</html>