<?PHP
ob_start();
session_start();
include 'connect.php';
if(isset($_SESSION['adminemail']))
{
$user=$_SESSION['adminemail'];

$gtp=mysql_query("select * from admin where username='$user'");
$gtp1=mysql_fetch_array($gtp);

include 'top.php';
?>



			<div class="main-content">
				<div class="main-content-inner">
					<div class="breadcrumbs ace-save-state" id="breadcrumbs">
						<ul class="breadcrumb">
							<li>
								<i class="ace-icon fa fa-home home-icon"></i>
								<a href="#">Home</a>
							</li>
							<li class="active">Delivery</li>
						</ul><!-- /.breadcrumb -->
					</div>

					<div class="page-content">
			

						<div class="page-header">
                        
<?php

$aca=mysql_query("select * from financial where user='$user' order by ID desc");
$aca1=mysql_fetch_array($aca);

$financial=$aca1['financial'];

?>
                        
                        <table style="width:100%;">
                        
                        <tr><td style="width:50%;">
                        
							<h1>
								Delivery
							</h1>
                            
                            </td>
                            
                            <td style="width:50%; text-align:right; padding-right:15px; font-size:15px;">
                            
                            <i class="fa fa-calendar"></i>&nbsp; <?php echo $financial; ?>
                            
                            </td></tr></table>
                            
						</div><!-- /.page-header -->

						<div class="row">
							<div class="col-xs-12">
                            
								<!-- PAGE CONTENT BEGINS -->


<script src="assets/js/jquery.js"></script>


<?php

if($_GET['id'])
{
	
	$id=$_GET['id'];
	
	$sel=mysql_query("select * from delivery where ID='$id'");
	$sel1=mysql_fetch_array($sel);
	
	$inn=mysql_query("select * from invoice where invoiceno='$sel1[invoiceno]'");
	$inn1=mysql_fetch_array($inn);
	
	$cus=mysql_query("select * from customer where ID='$inn1[customer]'");
	$cus1=mysql_fetch_array($cus);
	
	$vil=mysql_query("select * from villages where ID='$cus1[village]'");
	$vil1=mysql_fetch_array($vil);
	
	echo"<br /><center><a href='printdelivery.php?id=".$id."' target='_blank'><button type='submit' class='btn btn-white btn-primary'>Print</button></a></center>
	
	<table style='margin:auto; line-height:31px;'>
	
	<tr><td>Date</td><td style='padding:0 7px;'>:</td><td>".$sel1['date']."</td></tr>
	
	<tr><td>Delivery Officer</td><td style='padding:0 7px;'>:</td><td>".$sel1['deliveryofficer']."</td></tr>
	
	<tr><td>Driver</td><td style='padding:0 7px;'>:</td><td>".$sel1['driver']."</td></tr>
	
	<tr><td>Vehicle No.</td><td style='padding:0 7px;'>:</td><td>".$sel1['vehicleno']."</td></tr>
	
	<tr><td>Starting KM</td><td style='padding:0 7px;'>:</td><td>".$sel1['startkm']."</td></tr>
	
	<tr><td>Closing KM</td><td style='padding:0 7px;'>:</td><td>".$sel1['endkm']."</td></tr>
	
	<tr><td>Starting Date</td><td style='padding:0 7px;'>:</td><td>".$sel1['departuredate']."</td></tr>
	
	<tr><td>Closing Date</td><td style='padding:0 7px;'>:</td><td>".$sel1['arrivaldate']."</td></tr>
	
	</table><br />";
	
	echo"<table class='table table-bordered table-condensed'>
	
	<thead><tr><th>Name</th><th>Place</th><th>Mobile No.</th><th>T.Bags</th><th>Kg</th><th>Rs</th><th>Amount</th></tr></thead>
	
	<tr><td>".$cus1['name']."</td><td>".$vil1['village']."</td><td>".$cus1['mobile1']."</td><td></td><td>".$inn1['qty']."</td><td>".$inn1['rate']."</td>
	<td>".$inn1['total']."</td></tr>
	
	</table><br />
	
	<center><a href='viewdelivery.php'>Back</a></center>";
	
	
	
}

?>




										<!-- PAGE CONTENT ENDS -->
									</div><!-- /.col -->
								</div><!-- /.row -->
							</div><!-- /.page-content -->
						</div>
					</div><!-- /.main-content -->


<?php

include 'bottom.php';
}
else
{

 header("location:login.php");
}
ob_flush();


?>