<!DOCTYPE html>
<html lang="en">
<link href="../bucket/html/css/style.css" rel="stylesheet" type="text/css">
<?php 
include "dbconfig.php";
include "head.php";

?>

<body>
<style>
.box{
margin-left:60px;
text-align:center;
background:#FFFFFF;
height:150px;
width:250px;
box-shadow: 2px 2px 2px 2px rgba(0,0,0,0.2);
border-radius: 15px;
padding: 15px; 
}
</style>
      
<div class="col-md-2"></div>
      <div class="col-md-8">
<!-- Content Here -->
     <h2> Welcome to CabEzy - Software for Cab Business</h2>
     <p> Please Click on Bookings to Add a New Booking</p>
	 <?php 
include "mot_reminder.php";

?>
    </div>
	
	<div class="col-md-12">
    <div class="col-md-3 box">
	<?php
	$count_sql="SELECT * from bookings";
$count_res=mysqli_query($con,$count_sql);
$total_jobs=mysqli_num_rows($count_res);

echo "<h2>Total Jobs</h2><h1>".$total_jobs."</h1>";
	
	?>
	</div>
	 <div class="col-md-3 box">
	<?php
	$count_sql="SELECT * from employees";
$count_res=mysqli_query($con,$count_sql);
$total_jobs=mysqli_num_rows($count_res);

echo "<h2>Total Drivers</h2><h1>".$total_jobs."</h1>";
	
	?>
	</div>
	<div class="col-md-3 box">
	<?php
	$count_sql="SELECT * from customers";
$count_res=mysqli_query($con,$count_sql);
$total_jobs=mysqli_num_rows($count_res);

echo "<h2>Total Customers</h2><h1>".$total_jobs."</h1>";
	
	?>
	</div>
	
	<div class="col-md-3 box">
	<?php
	$sql="SELECT invoices.invoice_no,invoices.date, invoices.customer_id, customers.name as company,invoices.nett, invoices.vat,invoices.gross, invoices.amount_paid,invoices.status status_id,invoice_status.name as status,invoices.pay_date
FROM invoices
LEFT JOIN invoice_status ON invoices.status = invoice_status.id
LEFT JOIN customers ON invoices.customer_id = customers.id
";

	$invoice_sum=mysqli_query($con,$sql);
$total_invoices=mysqli_num_rows($invoice_sum);
$res=mysqli_query($con,$sql);

//echo $sql;

                
                $nett=0;
				$vat=0;
				$gross=0;
				while($sum=mysqli_fetch_assoc($invoice_sum))
				{
								$nett=$nett+(float)$sum['nett'];
								$vat=$vat+(float)$sum['vat'];
								$gross=$gross+(float)$sum['gross'];
				}

echo "<h2>Total Invoices</h2><h1>".$total_invoices."</h1>";
	
	?>
	</div>
	
	</div>
	
	<div class="col-md-12" style="margin-top:100px;">
	
	<div class="col-md-3 box">
	<?php
	$count_sql="SELECT * from bookings WHERE job_status=1";
$count_res=mysqli_query($con,$count_sql);
$total_jobs=mysqli_num_rows($count_res);

echo "<h2>Total Pending Jobs</h2><h1>".$total_jobs."</h1>";
	
	?>
	</div>
	
	<div class="col-md-3 box">
	<?php
	$count_sql="SELECT * from bookings WHERE job_status=2";
$count_res=mysqli_query($con,$count_sql);
$total_jobs=mysqli_num_rows($count_res);

echo "<h2>Total Confirmed Jobs</h2><h1>".$total_jobs."</h1>";
	
	?>
	</div>
	
	
	<div class="col-md-3 box">
	<?php
	$count_sql="SELECT * from bookings WHERE job_status=3";
$count_res=mysqli_query($con,$count_sql);
$total_jobs=mysqli_num_rows($count_res);

echo "<h2>Total Cancelled Jobs</h2><h1>".$total_jobs."</h1>";
	
	?>
	</div>
	
	<div class="col-md-3 box">
	<?php
	$count_sql="SELECT * from bookings WHERE job_status=4";
$count_res=mysqli_query($con,$count_sql);
$total_jobs=mysqli_num_rows($count_res);

echo "<h2>Total Invoiced Jobs</h2><h1>".$total_jobs."</h1>";
	
	?>
	</div>
	
	<!--div class="col-md-3 box">
	<?php
	$count_sql="SELECT * from bookings WHERE job_status=5";
$count_res=mysqli_query($con,$count_sql);
$total_jobs=mysqli_num_rows($count_res);

echo "<h2>Total On Hold Jobs</h2><h1>".$total_jobs."</h1>";
	
	?>
	</div-->
	
	</div>
	
	
    <div class="col-md-8">
    <!--img src="images/welcome.JPG"-->
	
     </div>
   </body>
</html>
