Mini Kabibi Habibi
<?php
@include '../database.php';
session_start();
//Checking User Logged or Not
if(!isset($_SESSION['username'])){
header('location:../index.php');
}
include('header.php');
include('script.php');
include('conn.php');
?>
<link rel="icon" href="../images/logo.ico">
<section class="content">
<div class="container-fluid">
<!-- Exportable Table -->
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="card">
<div id="print">
<div class = "scroll">
<div class="body">
<table id = "example" class = "table table-bordered" cellspacing = "0" >
<thead>
<tr>
<th style="white-space: nowrap;" class="hidden">ID</th>
<th style="white-space: nowrap;">TRACKING NUMBER</th>
<th style="white-space: nowrap;">TITLE</th>
<th style="white-space: nowrap;">DATE RECEIVED</th>
<th style="white-space: nowrap;">CURRENT LOCATION</th>
<th style="white-space: nowrap;">EXPIRATION DATE</th>
<th style="white-space: nowrap;">DAYS REMAINING</th>
<th style="white-space: nowrap;">STATUS</th>
<th style="white-space: nowrap;">ACTION</th>
</tr>
</thead>
<tbody>
<?php
include('../database.php');
$sql = "SELECT * from documents_recieved order by date_recieved";
$data = mysqli_query($conn,$sql);
while ($rows= mysqli_fetch_array($data))
{
?>
<tr>
<td class="hidden"><?php echo $row['id']; ?></td>
<td style="white-space: nowrap;"><?php echo $rows['tracking_no']; ?></td>
<td style="white-space: nowrap;"><?php echo $rows['title']; ?></td>
<td style="white-space: nowrap;"><?php echo $rows['date_recieved']; ?></td>
<td style="white-space: nowrap;"><?php echo $rows['current_location']; ?></td>
<td style="white-space: nowrap;"><?php echo $rows['expiration_date']; ?></td>
<td id="CellColor" style="white-space: nowrap;"><?php echo $rows['days_remaining']; ?></td>
<td id="colorcell" style="white-space: nowrap;"><?php
if ($rows['days_remaining']=="3"){
echo "<span style='background-color:red;' class='badge badge-danger'>SOON TO EXPIRE</span>";
}elseif ($rows['days_remaining']=="2"){
echo "<span style='background-color:red;' class='badge badge-danger'>SOON TO EXPIRE</span>";
}elseif ($rows['days_remaining']=="1"){
echo "<span style='background-color:red;' class='badge badge-danger'>SOON TO EXPIRE</span>";
}elseif ($rows['days_remaining']=="0"){
echo "<span style='background-color:red;' class='badge badge-danger'>EXPIRED</span>";
}elseif ($rows['days_remaining']=="" && $rows['stats'] == "RETURN"){
echo "<span style='background-color:yellow;' class='badge badge-danger'>RETURN</span>";
}elseif ($rows['days_remaining']=="" && $rows['stats'] == "DONE"){
echo "<span style='background-color:green;' class='badge badge-danger'>DONE</span>";
}else{
echo "<span style='background-color:blue;' class='badge badge-success'>ACTIVE</span>";
}
?>
</td>
<td >
<a class="btn btn-success btn-sm" href="document_history.php?tracking_no=<?php echo $rows['tracking_no']?>">
<span class = "glyphicon glyphicon-open-file" aria-hidden = "true">VIEW</span>
</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
<script>
function printDiv() {
//Get the HTML of div
var divElements = document.getElementById("print").innerHTML;
//Get the HTML of whole page
var oldPage = document.body.innerHTML;
//Reset the page's HTML with div's HTML only
document.body.innerHTML = "<table></table>" + divElements;
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = oldPage;
}
</script>
<script src="plugins/js/jquery-1.js"></script>
<script src="plugins/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
<?php
include("script.php");
?>e