<?php
include "koneksi.php";
if (!isset($_SESSION["UserID"])) {
	header("location:login.php?p=3");
}


?>
<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="style.css">
<html>

<head>
	<title> PT. MULTI HIDRACHROME BALIKPAPAN </title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<?php
	include "part/jss.php";
	?>

</head>

<body>

	<div style="width:1280px; height:220px" class="container" >

		
			<div class="alert alert-info" style='background-color:#F8F8FF' href="#">
            <div style="display: block; margin-left: auto; margin-right: auto; width: 1000px;  height:100px;"><img style="width: 1000px;  height:180px;" src="images/hd.jpg"></div>
            <div>
                <center>
                    <h1>PT. MULTI HIDRACHROM BALIKPAPAN</h1>
					
                </center>
            </div>
            <div>
                <center>
                    <h4 >PROFESIONAL INFORMATION SYSTEM</h4>
                </center>
            </div>
        </div>

			<?php
			include "part/menu.php";
			?>


			<div class="alert alert-info" align='center' >
				<h3>Daftar Izin Karyawan</h3>
				<?php
				echo date('yy-m-d');
				?>
				<?php
				if (isset($_GET["p"])) {
					$p = $_GET["p"];
					if ($p == "1") {
				?>
						<div class="alert alert-primary">
							Data Karyawan berhasil ditambah!
						</div>
					<?php
					} else if ($p == "2") {
					?>
						<div class="alert alert-primary">
							Data Karyawan berhasil diupdate!
						</div>
					<?php
					} else if ($p == "3") {
					?>
						<div class="alert alert-primary">
							Data Karyawan berhasil dipecat!
						</div>
				<?php
					}
				}
				?>
				<table class="table table-bordered">
					<thead>
						<tr>
						    <th>
								NO 
							</th>
							<th>
								NIK 
							</th>
							<th>
								NAMA  
							</th>
							<th>
								DEPARTEMEN
							</th>
							<th>
								TANGAL / JAM  
							</th>
							<th>
								ALASAN IZIN
							</th>
						
						</tr>
					</thead>
					<tbody>
						<?php
						//$q = "SELECT * 
						
						//FROM absensi.att_log
						//INNER JOIN data_karyawan_mhb.data_karyawan ON
						//absensi.att_log.pin =
						//data_karyawan_mhb.data_karyawan.nik
						//";
						
						//$q = "SELECT * FROM data_karyawan";
						
						//$tanggalhariini = date('2020-08-28');
						//echo "aaaa".$tanggalhariini;
						
						//$q = "SELECT * FROM att_log WHERE DATE(scan_date) = '$tanggalhariini'";
						// $d = "SELECT TIME(scan_date) AS jam_masuk, pin FROM att_log";
						//$q = "SELECT pin, TIME(scan_date) AS jam_masuk FROM att_log WHERE DATE(scan_date) = '$tanggalhariini'";
						//echo "aaaa".$q;
						
						$q = "SELECT dk.nik AS niks, dk.nama_karyawan AS nama, dk.departement AS dpt, dt.scan_date AS tanggal, dt.alasan_izin AS alasan FROM data_izin dt INNER JOIN data_karyawan dk
						      ON dt.nik = dk.nik";
						$res = mysqli_query($conn, $q);
						$z=1;
						
						

						
						
						while ($row = mysqli_fetch_assoc($res)) 
						{
							
							// $jammasuk=$row["jam_masuk"];
							// if($jammasuk<='13:40:00')
							// {
							// 	$insertTerlambat = "INSERT INTO data_terlambat (id_data_karyawan, id_att_log, terlambat) VALUES (" . $row['pin'];  "," . $row['id']; ", Tidak Terlambat)";
							// 	echo $insertTerlambat;
							// 	echo "jam masujk :" . $jammasuk . "</br>";
							// 	echo "belum terlambat";
							// }
							// else
							// {
								
							// 	echo "jam masujk :" . $jammasuk . "</br>";
							// 	echo "terlambat";
							// }
							//while ($row2 = mysqli_fetch_assoc($res2))
							//{
								?>
							<tr>
							    <td>
									<?php
									echo $z;
									$z = $z + 1;
									?>
								</td>
								<td>
									<?php
									echo $row["niks"];
									?>
								</td>
								<td>
									
									<?php
									
									echo $row["nama"];
									?>
								</td>
								<td>
									<?php
							 
									echo $row["dpt"];
									?>
									
								</td>
								<td>
									
									<?php
								
                                    
									echo $row["tanggal"];
									?>
									
								</td>
								<td>
									<?php
					
									echo $row["alasan"];
									?>
								</td>
							


								
							</tr>
						
						<?php
						}
						?>
					</tbody>
				</table>

			</div>

    <script>
    $(document).ready(function()
	{
		 $('.table-bordered').DataTable();
	});
    </script>
	<center><h5 class="form-signin">Copyright &copy; <a href="#" data-toggle="modal" data-target="#contact">SatrioPringgondani</a></h5></center>  
</body>

</html>