<?php
include "koneksi.php";
if (!isset($_SESSION["UserID"])) {
    header("location:login.php?p=3");
}
$idKaryawan = $_GET['id'];
//echo "<br>idkaryawan : . $idKaryawan;</br>";
?>
<!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 HYDRACHROM BALIKPAPAN</h1>
                </center>
            </div>
            <div>
                <center>
                    <h4>PROFESIONAL INFORMATION SYSTEM</h4>
                </center>
            </div>
        </div>

        <?php


        $q = "SELECT * FROM data_purchasing_requisition WHERE id = $idKaryawan";
			
        $res = mysqli_query($conn, $q);
		while ($row = mysqli_fetch_array($res)) 
		{


        ?>
<form method="POST" action="simpanPerubahanQtyPr.php?id=<?php echo $_GET['id'] ?>">

            <div class="alert alert-info" align='center'>
                <h3>DETAIL HISTORI PENGAJUAN PR</h3>
                <table class="table table-hover" align='center'>
                    <tbody>
                        <tr>
                            <td>NIK  PENGAJUAN</td>
                            <td><?php echo $row["user_request"]; ?></td>
                        </tr>
						<tr>
                            <td>NAMA  PENGAJUAN</td>
							
							<?php
					        $d="SELECT * FROM data_karyawan WHERE nik=".$row["user_request"];
						    $resi=mysqli_query($conn,$d);
						    $dataUser1=mysqli_fetch_assoc($resi);				
						    $nama = $dataUser1["nama_karyawan"];
					        ?>
							<td><?php echo $nama;?> </td>
                        </tr>
						<tr>
                            <td>DOCUMENT NO  </td>
                            <td><?php echo $row["document_no"]; ?></td>
                        </tr>
                        <tr>
                            <td>PR NO  </td>
                            <td><?php echo $row["pr_no"]; ?></td>
                        </tr>

                        <tr>
                            <td>PR DATE  </td>
                            <td><?php echo $row["pr_date"]; ?></td>
                        </tr>
						
						<tr>
                            <td>TYPE OF MATERIAL </td>
                            <?php 
							$row["type_of_material"];
                            if ($row["type_of_material"] == 1)
							{
								$material = 'Consumable';
							}
                            else
							{
								$material = 'Non - Consumable';
							}			
                             $material;		
							?>
							<td><?php echo $material; ?></td>	
                        </tr>
						<tr>
                            <td>PURCHASE REQUEST TYPE</td>
                            <?php 
							$row["type_of_material"];
                            if ($row["type_of_material"] == 1)
							{
								$material = 'Normal';
							}
                            else if ($row["type_of_material"] == 2)
							{
								$material = 'Urgent';
							}
                            else
							{
								$material = 'Top Urgent';
							}								
                             $material;		
							?>
							<td><?php echo $material; ?></td>	
                        </tr>
						
		                    <td >
                                <h4 align = "center">DATA BARANG</h4>
                            </td>
                        <tr>
                            <td>MATR MASTER</td>
                            <td><?php echo $row["matr_master"]; ?></td>
                        </tr>
						<tr>
                            <td>DESCRIPTION</td>
                            <td><?php echo $row["description"]; ?></td>
                        </tr>
						<tr>
                            <td>PART NOMOR</td>
                            <td><?php echo $row["part_no"]; ?></td>
                        </tr>
						<tr>
                            <td>QUANTITY</td>
							<td><input type="text" name="quantity" value="<?php echo $row["quantity"] ?>"></td>
                        </tr>
						<tr>
                            <td>UNIT</td>
                            <td><?php echo $row["unit"]; ?></td>
                        </tr>
						<tr>
                            <td>JUSTIFICATION</td>
                            <td><?php echo $row["justification"]; ?></td>
                        </tr>
						<tr>
                            <td>ACC CODE</td>
                            <td><?php echo $row["acc_code"]; ?></td>
                        </tr>
						<tr>
                            <td>NOTE</td>
                            <td><?php echo $row["note"]; ?></td>
                        </tr>
						<tr>
                            <td>STATUS PR</td>
                            <td><?php echo $row["status_pr"]; ?></td>
                        </tr>
						<tr>
                            <td>STATUS SPV</td>
							<td>
							<?php
										$row["status_spv"];
											if ($row["status_spv"] == 0)
										{
										   	echo "Belum disetujui";
										}
										else if ($row["status_spv"] == 2)
										{
											echo "Disetujui". "/ TGL ".$row["tgl_disetujui_spv"];
										}
										else if ($row["status_spv"] == 1)
										{
											echo "Ditolak". "/ TGL ".$row["tgl_ditolak_spv"];
										}
							?>
							</td>
                        </tr>
						<tr>
                            <td>STATUS HC&GA </td>
							<td>
							<?php
										$row["status_hcga"];
											if ($row["status_hcga"] == 0)
										{
										   	echo "Belum disetujui";
										}
										else if ($row["status_hcga"] == 2)
										{
											echo "Disetujui". "/ TGL ".$row["tgl_disetujui_hcga"];
										}
										else if ($row["status_hcga"] == 1)
										{
											echo "Ditolak". "/ TGL ".$row["tgl_ditolak_hcga"];
										}
							?>
							</td>
                        </tr>
						<tr>
                            <td>STATUS DIREKTUR</td>
							<td>
							<?php
										$row["status_direktur"];
											if ($row["status_direktur"] == 0)
										{
										   	echo "Belum disetujui";
										}
										else if ($row["status_direktur"] == 2)
										{
											echo "Disetujui" . "/ TGL ".$row["tgl_disetujui_direktur"];
										}
										else if ($row["status_direktur"] == 1)
										{
											echo "Ditolak". "/ TGL ".$row["tgl_ditolak_direktur"];
										}
							?>
							</td>
                        </tr>
                    </tbody>
                </table>
				<button type="submit" class="btn btn-warning">Simpan</button> 
<?php
 //<a href="prDiprosesPrc.php" class="btn btn-danger">Kembali</a>
?>
               
            </div>
</form>


        <?php
        }
        ?>


</body>

</html>