
<?php 

  if (!isset($_SESSION['username'])) {
    $_SESSION['msg'] = "To access this page, Login is required";
    header('location: login.php');
  }
  if (isset($_GET['logout'])) {
    session_destroy();
    unset($_SESSION['username']);
    header("location: login.php");
  }
?>


<!DOCTYPE>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.top-top {float: left; font-size: x-small; color: ; display: none;}

.body {float: left; width: 100%; background: white;}
.col-body {  float: left;  width: 33.33%;  padding: 15px;}

.col-body-a {  width: 100%; float: left; background: white; padding: 20px ;  font-size: small; border-right: 2px solid whitesmoke; text-align: right;   }

.col-body-a a { color: #007AA5; font-weight: bold; text-decoration: none; }
.col-body-a p { color: ; font-weight: bold; font-size: large; margin-top: -1%; }

.bicon{ float: left; font-size: 30px; margin-top: -10%; text-align: left;   color: whitesmoke; opacity: .5;  }


/* Clear floats after the col-bodys */
.row:after {
  content: "";
  display: table;
  clear: both;
}

@media screen and (max-width:600px) {

  .bicon{ float: left; font-size: 50px; margin-top: -10%; text-align: left;   color: whitesmoke; opacity: .5;  }

 .col-body, .col-body-a {  width: 100%;   }

.body {float: left; width: 100%; background: whitesmoke; }

.col-body {  float: left;    padding:20px;   margin-bottom: 3%;}

.col-body-a p { color: ; font-weight: bold; font-size: large; margin-top: 0%; }

    }

</style>
</head>
<body>


<div class="row">

<nav class="top-top"> <p><i style="color: ;" class="fa fa-home"></i> Home</p></nav>

  <nav class="body">
  
<div class="col-body">
<nav class="col-body-a">
    <p> <?php $sql = "SELECT * FROM products ";     
$result = mysqli_query($conn,$sql); $rowcount=mysqli_num_rows($result);
  printf(" %d \n ",$rowcount);?></p>
    <i style="float: left;" class="fa fa-shopping-cart bicon"></i>
  <h5>Available Items</h5>
<a  href="index.php?link=001release"> <i class="fa fa-minus-circle"></i> Release </a>
</nav>
</div>

<div class="col-body">
<nav class="col-body-a" >
    <p>49</p>
    <i style="float: left;" class="fa fa-exchange bicon"></i>
  <h5>Web order</h5>
 <a> <i class="fa fa-eye"></i> View </a>
</nav>
</div>

<div class="col-body">
<nav class="col-body-a" style="border-right: 0px solid whitesmoke;">
  <p><?php  $sql = "select SUM(mpesa) as mpesa from earnings where time >= CURDATE() AND YEAR(time) = YEAR(CURRENT_DATE)";  

 $sql_1 = "select SUM(cash) as cash from earnings where time >= CURDATE() AND YEAR(time) = YEAR(CURRENT_DATE)"; 

 $result = $db->query($sql);   $result_1 = $db->query($sql_1);

 $row = $result->fetch_array();{  $sum_a = $row['mpesa'];}
 $row_1 = $result_1->fetch_array();{  $sum_b = $row_1['cash'];}
 
 $sum = $sum_a + $sum_b ;  echo $sum;?></p>
  <i style="float: left;" class="fa fa-money bicon"></i>
  <h5>Income </h5>
<a  href="index.php?link=001report"> <i class="fa fa-download"></i> Report </a>
</nav>
</div>

 </nav> 
</div>

</body>
</html>
