<?php
session_start();
require'Database.php';
$database = new Database;
if(!$_SESSION['username']){
	header('Location: ../index.php');
	die();
}else{
$database->query('SELECT * FROM `shipment`');
$rows = $database->resultset();
    
?>	
<!DOCTYPE html>
<html lang="en">
	<head>
	    	<script
	src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script
	src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script
	src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
</head>
	<title>INVOICE FOR Airsuit Logistics Company</title>
		<style type="text/css">
		body {		
			font-family: Verdana;
		}
		
		div.invoice {
		border:1px solid #ccc;
		padding:100px;
		height:740pt;
		width:570pt;
		align-items:center;
		justify-content:center;
		background-color: #f2f2f2;
		
		}

		div.company-address {
			border:0px solid #ccc;
			float:left;
			width:200pt;
		}
		
		div.invoice-details {
			border:1px solid #ccc;
			float:right;
			width:200pt;
		}
		
		div.customer-address {
			border:1px solid #ccc;
			float:right;
			margin-bottom:50px;
			margin-top:100px;
			width:200pt;
		}
		
		div.clear-fix {
			clear:both;
			float:none;
		}
		
		table {
			width:100%;
		}
		
		th {
			text-align: left;
		}
		
		td {
		}
		
		.text-left {
			text-align:left;
		}
		
		.text-center {
			text-align:center;
		}
		
		.text-right {
			text-align:right;
		}
		
		</style>
	</head>

	<body>
	<div class="invoice">
		<div class="company-address">
			Airsuit Logistics Company
			<br />
			Support@Airsuitlogcompanydelivery.com
			<br />
			London, AF3Z 7BP
			<br />
			<img src="logo.png" alt="logo" width="300" height="250">
		</div>
	
		<div class="invoice-details">
			Invoice N°: 564
			<br />
			<?php echo $_POST["del_date"];?>
		</div>
		
		<div class="customer-address">
			To:
			<br />
			<?php echo $_POST["sender"];?>
			<br />
			<?php echo $_POST["receiver_add"];?>
			
			<br />
			<?php echo $_POST["receiver_phone"];?>
			<br />
			
			<?php echo $_POST["track"];?>
			<br />
		</div>
		
		<div class="clear-fix"></div>
			<table border='1' cellspacing='0'>
				<tr>
					<th width=250>Description</th>
					<th width=80>Parcel</th>
					<th width=100>Weight</th>
					<th width=100>Status</th>
				</tr>
				
				 <tr>
                        <td><?php echo $_POST["package"];?></td>
                        <td><?php echo $_POST["package_name"];?></td>
                        <td><?php echo $_POST["weight"];?></td>
                         <td><?php echo $_POST["status"];?></td>
                </tr>
                <tr>
					<th width=250>Expected Delivery Date</th>
					<th width=80>Location</th>
					<th width=100>Shipper Reference</th>
					<th width=100>Tracking Number</th>
				</tr>
				
				 <tr>
                        <td><?php echo $_POST["delivered"];?></td>
                        <td><?php echo $_POST["Location"];?></td>
                        <td><?php echo $_POST["shipper_ref"];?></td>
                         <td><?php echo $_POST["track"];?></td>
                </tr>

		
			</table><br><br>
			
				<img src="back.png" alt="baccorde" width="200" height="150">
				
			
				
	
<div id="content">
    <h1>  
        Thank you for choosing Airsuit Logistics Company . 
    </h1><br><br>
    </div>
		</div>
		<form method="post"class="form">
		 <input type="submit" name="submit" value="Submit" class="form-control"><br>
		 </form>
		 <?php
    include "../connect.php";
if(isset($_POST["submit"])){
    $track = $_POST['track'];
    $sender = $_POST['sender'];
    $receiver = $_POST['receiver'];
    $receiver_add = $_POST['receiver_add'];
    $del_date = $_POST['del_date'];
    $package = $_POST['package'];
    $shipper_ref = $_POST['shipper_ref'];
    $service = $_POST['service'];
    $num_shipment = $_POST['num_shipment'];
    $status = $_POST['status'];
    $package_name = $_POST['package_name'];
    $weight = $_POST['weight'];
    $receiver_phone = $_POST['receiver_phone'];
    $delivered = $_POST['delivered'];
    $location = $_POST['location'];
    $local = $_POST['local'];
    $loc_country = $_POST['loc_country'];
    $email = $_POST['email'];
    

        $adduser = $conn->query("INSERT INTO shipment(track_no,sender,receiver,receiver_add,receiver_phone,actual_date,package,shipper_ref,service,number_of_shipment,status,package_name,weight,expected_date,location,local_time,location_country,email) VALUES('$track','$sender','$receiver','$receiver_add','$receiver_phone','$del_date','$package','$shipper_ref','$service','$num_shipment','$status','$package_name','$weight','$delivered','$location','$local','$loc_country','$email')");
   


if($adduser){
			//Send Email
			$from = "support@Airsuitlogcompany.com";
			$to = "$email";
			$subject = " DELIVERY DETAILS";
	   
			$headers = "From:" .$from . "\r\n";
			$headers .= "MIME-Version: 1.0" . "\r\n";
			$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
			$headers .= "<center><img src='https://Airsuitlogcompany.com/en/logo.png'/></center>" . "\r\n";
			$headers .= "<center><h3 style='color:#fffff;'>PACKAGE RECIEVED, $sender</h3></center>" . "\r\n";
			$headers .= "<center><h5 style='color:#8B0815;'>Your delivery has been Recieved Successfully!</h5></center>" . "\r\n";
			$headers .= "<center><h4 style='color:#fffff;'>Your Tracking Number is: $track</h4></center>" . "\r\n";
			
			$headers .= "<center><h5 style='color:#8B0815;'>kindly visit our website to track your delivery, for more information please contact our support team!</h5></center>" . "\r\n";
			
			$headers .= "<center><h5 style='color:#fffff;'>Thank you for choosing us The Best delivery platform</h5></center>" . "\r\n";
  
  
			$headers .= "<center></center>" . "\r\n";
			
			
		  
			mail($to,$subject,$message,$headers);               
		}
		  echo "<font color='green'><b>Your Registration was successful<b></font>";
}
		
		
		
?>
	</body>






</html>
<?php
}
?>
 