<?php
include "koneksi.php";
if (!isset($_SESSION["UserID"])) {
	header("location:login.php?p=3");
}
$q="SELECT * FROM user WHERE id='". $_SESSION["UserID"] ."'";
						$res=mysqli_query($conn,$q);
						$dataUser=mysqli_fetch_assoc($res);
					
						$nik = $dataUser["nik_data_karyawan"];
						$level_spv = $dataUser["level_spv"];
						$status = $dataUser["status"];

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

	<head>
		<title> PT. MULTI HIDRACHROME BALIKPAPAN </title>
								<?php
						include "part/menu2.php";
					?>
		<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>
				<div class="alert alert-info" align='center' >
					<h3>DAILY REPORT</h3>
					<h5>check daily karyawan QC sesuai tanggal dipilih</h5>
									  <?php
				   //echo date('d - m - Y');
				   
				  ?>
				   <br><br><br><br>
				<div class="w3-bar">
				  <a href="#" class="w3-button">&laquo;</a>
				  <a href="dailyReportCheck.php" class="w3-button">hari ini All</a>
				  <a href="dailyReportCheckQc.php" class="w3-button">qc</a>
				  <a href="dailyReportCheckPpic.php" class="w3-button">ppic</a>
				  <a href="dailyReportCheckProduksi.php" class="w3-button">produksi</a>
				  <a href="#" class="w3-button">&raquo;</a>
				</div>
				<br><br>
					<?php
					if (isset($_GET["p"])) 
					{
						$p = $_GET["p"];
						if ($p == "1") 
						{
						?>
						<div class="alert alert-primary">
							PR DISETUJUI!
						</div>
						<?php
						} 
						else if ($p == "2") 
						{
						?>
							<div class="alert alert-danger">
								PR DITOLAK!
							</div>
						<?php
						}
						else if ($p == "3") 
						{
						?>
							<div class="alert alert-danger">
							    KESALAHAN TEKNIS!
							</div>
						<?php
						}
					}
					?>
					<?php
					$z = 1;
					?>
					<table class="table table-bordered">
						<thead>
							<tr>
							    <th>
									NO 
								</th>
								<th>
									DEPARTEMENT 
								</th>
								<th>
									JOB TITLE 
								</th>
								<th>
									NAMA 
								</th>
								<th>
									TANGGAL 
								</th>
								<th>
									JOB ACTIVITY 
								</th>
								<th>
									PROGRESS 
								</th>
								<th>
									MHB ID 
								</th>
								<th>
								</th>
							</tr>
						</thead>
						<tbody>

							<?php
							$status = '0';
							$tanggalHistory=$_POST["tanggalHistory"];
							echo date('Y-m-d', strtotime($tanggalHistory));
							$tanggal = date('Y-m-d', strtotime($tanggalHistory));
							$q = "SELECT * FROM daily_report WHERE tanggal_upload='$tanggal' and departement='QC'";
							$res = mysqli_query($conn, $q);
							while ($row = mysqli_fetch_assoc($res)) {
							?>
								<tr>
									<td>
									     <?php
									         echo $z;
									         $z = $z + 1;
											 //echo $row["id"];
									     ?>
								    </td>
									<td>
										<?php
										$b = $row["nik"];
										$c="SELECT * FROM data_karyawan WHERE nik=".$b;
										$resb=mysqli_query($conn,$c);
										$datb=mysqli_fetch_assoc($resb);
										$departement = $datb["departement"];
								        echo $departement;
										?>
									</td>
									<td>
										<?php
										$a = $row["nik"];
										$d="SELECT * FROM data_karyawan WHERE nik=".$a;
										$resi=mysqli_query($conn,$d);
										$data=mysqli_fetch_assoc($resi);
										$jabatan = $data["jabatan"];
								        echo $jabatan;
										?>
									</td>
									<td>
										<?php
										$a = $row["nik"];
										$d="SELECT * FROM data_karyawan WHERE nik=".$a;
										$resi=mysqli_query($conn,$d);
										$data=mysqli_fetch_assoc($resi);
										$nama = $data["nama_karyawan"];
								        echo $nama;
										?>
									</td>
									<td>
										<?php
										echo $row["tanggal_upload"];
										?>
									</td>
									<td>
										<?php
										echo "<br>".substr($row["isi"],0,100);
										echo "<br>".substr($row["isi"],100,100);
										echo "<br>".substr($row["isi"],200,100);
										echo "<br>".substr($row["isi"],300,100);
										echo "<br>".substr($row["isi"],400,100);
										echo "<br>".substr($row["isi"],500,100);
										echo "<br>".substr($row["isi"],600,100);
										echo "<br>".substr($row["isi"],700,100);
										echo "<br>".substr($row["isi"],800,100);
										echo "<br>".substr($row["isi"],900,100);
										echo "<br>".substr($row["isi"],1000,100);
										?>
									</td>
									<td>
										<?php
										echo $row["progres"];
										?>
									</td>
									<td>
										<?php
										echo $row["mhb_id"];
										?>
									</td>
									<td>	
									  	 <a  href="detailFotoDailyReport.php?id=<?php echo $row["id"]; ?>"    type="button" class="fa fa-camera w3-margin-right"   ></a>
									</td>
								</tr>
							<?php
							}
							?>
						</tbody>
					</table>
					
					<form method="POST" action="dailyReportCheckTanggal.php">
					<label for="exampleInputPassword1">cek daily karyawan history</label>
					<input style="resize:none;width:350px;height:40px;" type="date" class="form-control" name="tanggalHistory" placeholder="Due date">
		            <button type="submit" class="btn btn-primary">Send</button> 



				</div>

		<center><h5 class="form-signin">Copyright &copy; <a href="#" data-toggle="modal" data-target="#contact">SatrioPringgondani</a></h5></center>  
	</body>
</html>

<script>
$(document).ready(function()
{
	 $('.table-bordered').DataTable();
});
</script>