<?php
session_start();
include("../includes/database.php");
include("../functions/functions.php");
if(!$_SESSION["driver_email"]){
header("location: ../driver_login.php?error=Please-Provide-Your-Login-Details-Thanks.");
}else{
$user_a = @$_SESSION["driver_email"];
$get_user_a = "select * from driver where driver_email = '$user_a' AND account_status = 'enabled'";
$run_user_a = mysqli_query($con, $get_user_a);
$row_a = mysqli_fetch_array($run_user_a);
$drva_id_a = $row_a["driver_id"];
$drva_email_a = $row_a["driver_email"];
$drva_pass_a = $row_a["driver_password"];
$drva_fname_a = $row_a["driver_fullname"];
$drva_img_a = $row_a["driver_picture"];
$drva_phone_a = $row_a["driver_phone"];
$drva_login_a = $row_a["last_login"];
$drva_status_a = $row_a["account_status"];
header("refresh: 300; url=index.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php echo $drva_fname_a; ?>'s Account | <?php echo $comp_title; ?></title>
<?php include("includes/head.php"); ?>
</head>
<body class="cbp-spmenu-push">
<div class="main-content">
<!--left-fixed -navigation-->
<div class=" sidebar" role="navigation">
<div class="navbar-collapse">
<?php include("includes/menu.php"); ?>
</div>
</div>
<!--left-fixed -navigation-->
<!-- header-starts -->
<?php include("includes/header.php"); ?>
<!-- //header-ends -->
<!-- main content start-->
<div id="page-wrapper">
<div class="main-page">
<div class="row-one">
<div class="col-md-3 widget">
<div class="stats-left ">
<h5>Pending</h5>
<h4>Orders</h4>
</div>
<?php
$fst_query = "select * from assign_driver where driver_id = '$drva_id_a' ORDER BY assign_id DESC LIMIT 1";
$run_fst_query = mysqli_query($con, $fst_query);
$row_fst_query = mysqli_fetch_array($run_fst_query);
$fetch_invNo = $row_fst_query["invoice_no"];
$fst_query2 = "select * from customer_orders where invoice_no = '$fetch_invNo' AND order_status = 'Pending'";
$run_fst_query2 = mysqli_query($con, $fst_query2);
$cnt_fst_query = mysqli_num_rows($run_fst_query2);
?>
<div class="stats-right">
<label> <?php echo $cnt_fst_query; ?></label>
</div>
<div class="clearfix"> </div>
</div>
<div class="col-md-3 widget states-mdl">
<div class="stats-left">
<h5>Total</h5>
<h4>Orders</h4>
</div>
<?php
$total_query2 = "select * from customer_orders";
$run_total2 = mysqli_query($con, $total_query2);
$count_total2 = mysqli_num_rows($run_total2);
?>
<div class="stats-right">
<label> <?php echo $count_total2; ?></label>
</div>
<div class="clearfix"> </div>
</div>
<div class="col-md-3 widget states-last">
<div class="stats-left">
<h5>Total</h5>
<h4>Deliveries</h4>
</div>
<?php
$order_query4 = "select * from assign_driver where order_status = 'Delivered'";
$run_order4 = mysqli_query($con, $order_query4);
$count_order4 = mysqli_num_rows($run_order4);
?>
<div class="stats-right">
<label><?php echo $count_order4; ?></label>
</div>
<div class="clearfix"> </div>
</div>
<div class="clearfix"> </div><hr />
</div>
<div class="grid_3 grid_5 widget-shadow">
<h3 class="hdg">Welcome to Your User Control Panel</h3>
<div class="well">
Welcome <?php echo $drva_fname_a; ?> to your personal control panel.
</div>
<div class="well">
There Are (<?php echo $cnt_fst_query; ?>) pending order(s) for Today.
</div>
</div>
<div class="clearfix"> </div><hr />
<?php
include("../includes/database.php");
$init_query = "select * from customer_orders where invoice_no = '$fetch_invNo' AND order_status = 'Pending' ORDER BY 1 DESC";
$run_init_query = mysqli_query($con, $init_query);
while($row_init_query = mysqli_fetch_array($run_init_query)){
$cst_orderID = $row_init_query["order_id"];
$cst_ID = $row_init_query["customer_id"];
$cst_amtToPay = $row_init_query["due_amount"];
$cst_trackID = $row_init_query["invoice_no"];
$cst_ordDate = $row_init_query["order_date"];
$cst_pmt_method = $row_init_query["payment_method"];
if($cst_pmt_method == "paypal"){
$cst_pmt_method = "PayPal";
}else if($cst_pmt_method == "cash_on_delivery"){
$cst_pmt_method = "Cash On Delivery";
}
$init2_query = "select * from customers where customer_id = '$cst_ID'";
$run_init2_query = mysqli_query($con, $init2_query);
$row_init2_query = mysqli_fetch_array($run_init2_query);
$csta_name = $row_init2_query["customer_name"];
$csta_addr = $row_init2_query["customer_address"];
$csta_phone = $row_init2_query["customer_phone"];
$csta_loc = $row_init2_query["customer_location"];
$csta_actLoc = $row_init2_query["actual_location"];
?>
<div class="grid-bottom widget-shadow msgBox">
<h5 style="font-size: 17px;"><span style="color: #6699ff; font-weight: bold;">Customer Name:</span> <?php echo $csta_name; ?> | <a href="delivery_process.php?tracking_id=<?php echo $cst_trackID; ?>"><span class="glow" style="color: #6699ff; font-weight: bold;">Order Tracking No: <?php echo $cst_trackID; ?></span></a> | <span style="color: #6699ff; font-weight: bold;">Order Was Placed:</span> <time class="timeago" datetime="<?php echo $cst_ordDate; ?>"></time> | <span style="color: #6699ff; font-weight: bold;">Payment Method:</span> <?php echo $cst_pmt_method; ?></h5><br>
<table class="table table-bordered table-striped no-margin grd_tble">
<thead>
<tr>
<th style="width: 40%;"><center>Address</center></th>
<th style="width: 20%;"><center>Phone Number</center></th>
<th style="width: 10%;"><center>Destination</center></th>
<th style="width: 10%;"><center>Amount Due</center></th>
</tr>
</thead>
<tbody>
<tr>
<td><center><?php echo $csta_addr; ?></center></td>
<td><center><?php echo $csta_phone; ?></center></td>
<td><center><?php echo $csta_actLoc; ?></center></td>
<td><center><?php echo $currency; ?> <?php echo $cst_amtToPay; ?></center></td>
</tr>
</tbody>
</table>
<div class="row">
<?php
$init3_query = "select * from pending_orders where invoice_no = '$cst_trackID'";
$run_init3_query = mysqli_query($con, $init3_query);
while($row_init3_query = mysqli_fetch_array($run_init3_query)){
$grb_pro_id = $row_init3_query["product_id"];
$grb_pro_qty = $row_init3_query["quantity"];
$init4_query = "select * from product where product_id = '$grb_pro_id'";
$run_init4_query = mysqli_query($con, $init4_query);
$row_init4_query = mysqli_fetch_array($run_init4_query);
$grb_pro_img = $row_init4_query["product_image"];
$grb_pro_name = $row_init4_query["product_name"];
?>
<div class="col-md-2 col-sm-3 col-xs-3">
<img src="../images/product_images/<?php echo $grb_pro_img; ?>" class="img-responsive thumbnail" width="100" height="100" alt="<?php echo $grb_pro_name; ?>" title="<?php echo $grb_pro_name; ?>" />
<label>Qty: <?php echo $grb_pro_qty; ?></label>
</div>
<?php } ?>
</div>
</div><hr />
<?php } ?>
<div class="clearfix"> </div>
</div>
</div>
<!--footer-->
<?php include("includes/footer.php"); ?>
<!--//footer-->
</div>
</body>
</html>
<?php } ?>