<?php 
require("../connection.php");
include("../user.php");
$user_id=$_SESSION['user'];
$username=$_SESSION['user_name'];
//$row=mysqli_query($con,"select * from log_entry order by id  DESC");		
?>
<html>
<head>
  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php echo TITLE;?></title>
    <meta name="description" content="Ela Admin - HTML5 Admin Template">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="apple-touch-icon" href="../images/bluebase.png">
    <link rel="shortcut icon" href="../images/bluebase.png">

    <link rel="stylesheet" href="../css/normalize.min.css">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/themify-icons.css">
    <link rel="stylesheet" href="../css/pe-icon-7-stroke.min.css">
    <link rel="stylesheet" href="../css/flag-icon.min.css">
    <link rel="stylesheet" href="../assets/css/cs-skin-elastic.css">
    <link rel="stylesheet" href="../assets/css/style.css">
    <link href="../css/chartist.min.css" rel="stylesheet">
    <link href="../css/jqvmap.min.css" rel="stylesheet">

    <link href="../css/weather-icons.css" rel="stylesheet" />
    <link href="../css/fullcalendar.min.css" rel="stylesheet" />

<script src="../js/jquery-1.12.4.min.js"></script>
<script src="../js/jquery-3.3.1.js"></script>
<script src="../js/jquery.dataTables.min.js"></script>


    <script src="../js/popper.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/jquery.matchHeight.min.js"></script>
    <script src="../assets/js/main.js"></script>
    <script src="../js/jquery-3.3.1.min.js"></script>
   <style>
    #weatherWidget .currentDesc 
	{
        color: #ffffff!important;
    }
        .traffic-chart {
            min-height: 335px;
        }
        #flotPie1  {
            height: 150px;
        }
        #flotPie1 td {
            padding:3px;
        }
        #flotPie1 table {
            top: 20px!important;
            right: -10px!important;
        }
        .chart-container {
            display: table;
            min-width: 270px ;
            text-align: left;
            padding-top: 10px;
            padding-bottom: 10px;
        }
        #flotLine5  {
             height: 105px;
        }

        #flotBarChart {
            height: 150px;
        }
        #cellPaiChart{
            height: 160px;
        }
th{
	text-transform:uppercase;
}
td{
	text-transform:uppercase;
}
    </style>

<link rel="stylesheet" href="/project_temp/datatable/css/jquery.dataTables.min.css">
<script src="/project_temp/datatable/js/jquery.datatables.min.js"></script>
<!-- button --><link rel="stylesheet" type="text/css" href="/project_temp/button/css/buttons.css" /><!-- button -->

<script>
$(document).ready(function() {
		$('#example').DataTable();
		} );
</script>
</head>
<body>
 <?php require('../sidemenu.php');?>
  <!-- /#left-panel -->
    <!-- Right Panel -->
    <div id="right-panel" class="right-panel">
        <!-- Header-->
        <?php require('../header.php');?>
		<div class="content">
            <!-- Animated -->
            <div class="animated fadeIn">
			<div style="background-color:white;margin-bottom:10px;">
	<strong style="color:blue"><center>TEMPORARY EXPIRY REPORT</center></strong>
	</div>
<table id="example" class="table table-striped table-bordered" >
        <thead>
            <tr>
                <th>S.No</th>
                <th>Employee Name</th>
                <th>Employee Code</th>
                <th>Department</th>
                <th>Item Code</th>
                <th>Message</th>
                <th>Action</th>
            </tr>
        </thead>
		
        <tbody>
		<?php 
		$sno=1;
		$expire_query=mysqli_query($con,"SELECT em.employee_name,im.emp_code,im.emp_dept,imt.id,imt.item_code,case when imt.expire_date=CURDATE() THEN 'TODAY EXPIRED' when imt.expire_date>CURDATE() THEN 'PROCESSING' else 'EXPIRED' end as ex_date   FROM `issue_master` im left join employee_master em on im.emp_name=em.emp_no left join issue_master_table imt on imt.issue_master_id=im.id  where imt.expire_date is not null and imt.status=0");
		
		while($get_detail=mysqli_fetch_array($expire_query))
		{
		?>
	<tr>
		<td><?php echo $sno++ ?></td>
		<td><?php echo $get_detail['employee_name']; ?></td>
		<td><?php echo $get_detail['emp_code']; ?></td>
		<td><?php echo $get_detail['emp_dept']; ?></td>
		<td><?php echo $get_detail['item_code']; ?></td>
		<?php if($get_detail['ex_date']=='TODAY EXPIRED') { ?>
		<td style="color:Green;font-weight:900;"><?php echo $get_detail['ex_date']; ?></td>
		<?php } elseif($get_detail['ex_date']=='PROCESSING') { ?>
		<td style="color:Orange;font-weight:900;"><?php echo $get_detail['ex_date']; ?></td>
		<?php } else { ?>
		<td  style="color:Red;font-weight:900;"><?php echo $get_detail['ex_date']; ?></td>
		<?php } ?>
		
		<td>
		<?php if($get_detail['ex_date']=='EXPIRED') { ?>
		<a><button class="btn btn-primary" onclick="return_item(this.id)" id="<?php echo $get_detail['item_code']; ?>">RETURN</button></a> 
		<a><button class="btn btn-success" onclick="extend_item(this.id)" id="<?php echo $get_detail['id']; ?>">Extend Date</button></a>
		<?php } else { ?><a><button class="btn btn-primary" onclick="return_item(this.id)" id="<?php echo $get_detail['item_code']; ?>">RETURN</button></a>  
		<?php } ?></td>
	</tr>
		<?php } ?>
		</tbody>
    </table>
	</div>
	</div>
	<div class="clearfix"></div>
	</div>
	</body>
	</html>
	

<?php require("../mainjavascript.js"); ?>
