<?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>
  <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
  <link rel="icon" type="image/png" href="images/mhb.jpeg">
	<title> PT MULTI HYDRACHROM BALIKPAPAN </title>
						<?php
						include "part/menu2.php";
					?>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta charset="UTF-8">


<style>

</style>
	<?php
		include "part/jss.php";
	?>
	
  </head>
  <body>
	
	<div  style="width:1280px; height:100px" class="container">
	
			<div class="" 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 center>
			
			 
			 <?php
				if (isset($_GET["p"]))
				{
					$p=mysqli_real_escape_string($conn,$_GET["p"]);
					if ($p=="1")
					{
						?>
							<div class="alert alert-primary" role="alert">
							  Testing YES!
							</div>
						<?php
					}
					else if ($p=="2")
					{
						?>
							<div class="alert alert-danger" role="alert">
								Testing NO!
							</div>
						<?php
					}
					else if ($p=="3")
					{
						?>
							<div class="alert alert-danger" role="alert">
								Maaf, Gambar gagal untuk diupload!
							</div>
						<?php
					}
					else if ($p=="4")
					{
						?>
							<div class="alert alert-danger" role="alert">
								Maaf, Ukuran gambar yang diupload tidak boleh lebih dari 1MB!
							</div>
						<?php
					}
					else if ($p=="5")
					{
						?>
							<div class="alert alert-danger" role="alert">
								Maaf, Tipe gambar yang diupload harus JPG / JPEG / PNG!
							</div>
						<?php
					}
				}

				if (isset($_GET['pesan'])) {
					if ($_GET['pesan'] == "berhasilInput") {
						echo "<div class='alert alert-success' role='alert'> Berhasil Input DB. </div>";
					}
					// if ($_GET['pesan'] == "berhasilInput") {
					// 	echo "<div class='alert alert-danger' role='alert'> Berhasil Input DB. </div>";
					// }
				}
				?>
<?php
	if(isset($_POST['enter']))  
				 {  
				   $job = $_POST['job'];
				   $mhb_id = $_POST['mhb_id_assy_parsial'];
				   $mhb_id_single = $_POST['mhb_id_single'];
				   $combo1 = $_POST['combo1'];

				   
				   
				   echo "ini job ".$job."<br>";  
				   echo "id assy ".$mhb_id."<br>";
				   echo "id single ".$mhb_id_single."<br>";
				   echo "id testing ".$combo1."<br>";
				   
				   $update = "UPDATE barang_job SET testing = '$combo1' WHERE no_mhb_id = '$mhb_id'";
				   $resi = mysqli_query($conn,$update);
				 }
				
				if($job == 1)//assy or parsial
				{
				 $q="SELECT * FROM barang_job WHERE no_mhb_id='$mhb_id'";
						$res=mysqli_query($conn,$q);
						$dataUser=mysqli_fetch_assoc($res);
						$status = $dataUser["status"];
						$testing = $dataUser["testing"]; // 1= yes 2=no
						$no_mhb_id = $dataUser["no_mhb_id"];   
                        $nama_customer = $dataUser["nama_customer"];
                        $no_surat_jalan_customer = $dataUser["no_surat_jalan_customer"];
						$nama_komponen = $dataUser["nama_komponen"];
                        $model_komponen = $dataUser["model_komponen"];
                        $part_number = $dataUser["part_number"];	
                        $tanggal_receiving = $dataUser["tanggal_receiving"];
                        $nama_gambar = $dataUser["nama_gambar"];		
?>

<h3 align="left">Quality Control</h3>
				  <label align="left" for="exampleInputPassword1">Report Inspection Inner Diameter (MHB-FR-QC-001-01) </label>
<br><br><br><br>
<div >
<table class="table table-dark table-striped">
 <thead>
 <tr>
 <th>Customer</th>
 <td><?php echo $nama_customer ?></td>
 <th>MHB ID</th>
 <td><?php echo $no_mhb_id ?></td>
 </tr>
 </thead>
 <tbody>
 <tr>
 <th>Cust. Ref.</th>
 <td><?php echo $no_surat_jalan_customer ?></td>
 <th>Income Date</th>
 <td><?php echo $tanggal_receiving ?></td>
 </tr>
 <tr>
 <th>Part Name</th>
 <td><?php echo $nama_komponen ?></td>
 <th>Inspection Date</th>
 <td><?php echo date('d-m-Y');?></td>
 </tr>
 <tr>
 <th>Model</th>
 <td><?php echo $model_komponen ?></td>
 <th></th>
 <td>
     <div class="form-check form-check-inline">			  
		
	 </div>
 </tr>
 <tr>
 <th>Part No</th>
 <td><?php echo $part_number ?></td>
 <th>No. Doc</th>
 <td> MHB-FR-QC-001-01</td>
 </tr>
 </table>
 </div>


<br><br><br><br>
        <table border=0 width="80%" align="center" >
		    <tr>
                <td bgcolor="#2F4F4F" colspan="4" align="center"><font color="white">Assy or Parsial</td>
            </tr>
			<tr>
			    <td colspan="4" align="center" ><?php echo "<img src='Receiving/$nama_gambar' width='300' height='2000' />";?></td>
        
            </tr>
			<tr>
				<td>
					<form align='center' method='POST' action='printInspectionReportAssyParsialSingle.php?mhb_id=<?php echo $mhb_id?>&job=<?php echo $job?>&mhb_id_single=<?php echo $mhb_id_single?>&combo1=<?php echo $combo1?>'>
					<h4><select name="toleransi">
					<option value="0">--ISO Tolerances--</option>
					<option value="1">f6</option>
					<option value="2">f7</option>
					<option value="3">g5</option>
					<option value="4">g6</option>
					<option value="5">g7</option>
					<option value="6">h4</option>
					<option value="7">h5</option>
					<option value="8">h6</option>
					<option value="9">h7</option>
					<option value="10">h8</option>
					<option value="11">F8</option>
					<option value="12">G6</option>
					<option value="13">G7</option>
					<option value="14">G8</option>
					<option value="15">H6</option>
					<option value="16">H7</option>
					<option value="17">H8</option>
					<option value="18">H9</option>
					<option value="19">H10</option>
					<option value="20">H11</option>
					</select>
					<input type="submit" name="submit" class="btn btn-lg btn-success" value="Next"/>
					</h4>
					</form>
					<form method="POST" action="simpanFormMhbFrQc00101.php?mhb_id=<?php echo $mhb_id ?> && job=<?php echo $job?> && mhb_id_single=<?php echo $mhb_id_single?> && combo1=<?php echo $combo1?>" enctype="multipart/form-data">
					
				</td>
			</tr>
			</table>
			<br><br><br><br>
			<center><h5 class="form-signin">Copyright & copy <a href="#" data-toggle="modal" data-target="#contact">SatrioPringgondani</a></h5></center>

			<?php
				}			
			?>
			<?php
if($job == 2)//single
{
				 $q="SELECT * FROM barang_job WHERE no_mhb_id='$mhb_id_single'";
						$res=mysqli_query($conn,$q);
						$dataUser=mysqli_fetch_assoc($res);
						$status = $dataUser["status"];
						$testing = $dataUser["testing"]; // 1= yes 2=no
						$no_mhb_id = $dataUser["no_mhb_id"];   
                        $nama_customer = $dataUser["nama_customer"];
                        $no_surat_jalan_customer = $dataUser["no_surat_jalan_customer"];
						$nama_komponen = $dataUser["nama_komponen"];
                        $model_komponen = $dataUser["model_komponen"];
                        $part_number = $dataUser["part_number"];	
                        $tanggal_receiving = $dataUser["tanggal_receiving"];
                        $nama_gambar = $dataUser["nama_gambar"];		
?>

<h3 align="left">Quality Control</h3>
				  <label align="left" for="exampleInputPassword1">Report Inspection Inner Diameter (MHB-FR-QC-001-01) </label>
<br><br><br><br>
<div >
<table class="table table-dark table-striped">
 <thead>
 <tr>
 <th>Customer</th>
 <td><?php echo $nama_customer ?></td>
 <th>MHB ID</th>
 <td><?php echo $no_mhb_id ?></td>
 </tr>
 </thead>
 <tbody>
 <tr>
 <th>Cust. Ref.</th>
 <td><?php echo $no_surat_jalan_customer ?></td>
 <th>Income Date</th>
 <td><?php echo $tanggal_receiving ?></td>
 </tr>
 <tr>
 <th>Part Name</th>
 <td><?php echo $nama_komponen ?></td>
 <th>Inspection Date</th>
 <td><?php echo date('d-m-Y');?></td>
 </tr>
 <tr>
 <th>Model</th>
 <td><?php echo $model_komponen ?></td>
 <th></th>
 <td>
     <div class="form-check form-check-inline">			  
		
	 </div>
 </tr>
 <tr>
 <th>Part No</th>
 <td><?php echo $part_number ?></td>
 <th>No. Doc</th>
 <td> MHB-FR-QC-001-01</td>
 </tr>
 </table>
 </div>


<br><br><br><br>
        <table border=0 width="80%" align="center" >
		    <tr>
                <td bgcolor="#2F4F4F" colspan="4" align="center"><font color="white">
			<tr>
			<tr>
			</tr>
			    <td colspan="4" align="center" ><?php echo "<img src='Receiving/$nama_gambar' width='300' height='2000' />";?></td>
        
            </tr>
			<tr>
				<td>
					<form align='center' method='POST' action='printInspectionReportAssyParsialSingle.php?mhb_id=<?php echo $mhb_id?>&job=<?php echo $job?>&mhb_id_single=<?php echo $mhb_id_single?>&combo1=<?php echo $combo1?>'>
					<h4><select name="toleransi">
					<option value="0">--ISO Tolerances--</option>
					<option value="1">f6</option>
					<option value="2">f7</option>
					<option value="3">g5</option>
					<option value="4">g6</option>
					<option value="5">g7</option>
					<option value="6">h4</option>
					<option value="7">h5</option>
					<option value="8">h6</option>
					<option value="9">h7</option>
					<option value="10">h8</option>
					<option value="11">F8</option>
					<option value="12">G6</option>
					<option value="13">G7</option>
					<option value="14">G8</option>
					<option value="15">H6</option>
					<option value="16">H7</option>
					<option value="17">H8</option>
					<option value="18">H9</option>
					<option value="19">H10</option>
					<option value="20">H11</option>
					</select>
					<input type="submit" name="submit" class="btn btn-lg btn-success" value="Next"/>
					</h4>
					</form>
					<form method="POST" action="simpanFormMhbFrQc00101.php?mhb_id=<?php echo $mhb_id ?> && job=<?php echo $job?> && mhb_id_single=<?php echo $mhb_id_single?> && combo1=<?php echo $combo1?>" enctype="multipart/form-data">
					
				</td>
			</tr>
			</table>
			<center><h5 class="form-signin">Copyright & copy <a href="#" data-toggle="modal" data-target="#contact">SatrioPringgondani</a></h5></center>

			<?php
				}			
			?>
			  

			
		
<script type="text/javascript">
function readURL(input) {
  if (input.files && input.files[0]) {
    var reader = new FileReader();
    
    reader.onload = function(e) {
      $('#gambar').attr('src', e.target.result);
    }
    
    reader.readAsDataURL(input.files[0]); // convert to base64 string
  }
}

$("#file").change(function() {
	$('#gambar').show();
   readURL(this);
});

function sum() 
{
	var toleransi = document.getElementById('toleransi').value;
      var txtFirstNumberValue = document.getElementById('txt1').value;
	  

	  if (toleransi == '1')
	  {
		  document.getElementById('ini3').value = 'f6';
		  if (txtFirstNumberValue >= 3 &&  txtFirstNumberValue <=6)
		  {
			 document.getElementById('uper').value = '-0,018';
			document.getElementById('lower').value = '-0,010';
		  }
		  if (txtFirstNumberValue >= 7 &&  txtFirstNumberValue <=10)
		  {
			 document.getElementById('uper').value = '-0,022';
			document.getElementById('lower').value = '-0,013';
		  }
		  if (txtFirstNumberValue >= 11 &&  txtFirstNumberValue <=18)
		  {
			 document.getElementById('uper').value = '-0,027';
			document.getElementById('lower').value = '-0,016';
		  }
		  if (txtFirstNumberValue >= 19 &&  txtFirstNumberValue <=30)
		  {
			 document.getElementById('uper').value = '-0,033';
			document.getElementById('lower').value = '-0,020';
		  }
		  if (txtFirstNumberValue >= 31 &&  txtFirstNumberValue <=40)
		  {
			 document.getElementById('uper').value = '-0,041';
			document.getElementById('lower').value = '-0,025';
		  }
		  if (txtFirstNumberValue >= 41 &&  txtFirstNumberValue <=50)
		  {
			 document.getElementById('uper').value = '-0,041';
			document.getElementById('lower').value = '-0,025';
		  }
		  if (txtFirstNumberValue >= 41 &&  txtFirstNumberValue <=50)
		  {
			 document.getElementById('uper').value = '-0,041';
			document.getElementById('lower').value = '-0,025';
		  }
		  if (txtFirstNumberValue >= 51 &&  txtFirstNumberValue <=65)
		  {
			 document.getElementById('uper').value = '-0,049';
			document.getElementById('lower').value = '-0,030';
		  }
		  if (txtFirstNumberValue <= 2)
		  {
			 document.getElementById('uper').value = '0';
			document.getElementById('lower').value = '0';
		  }
	  }
	  if (txtFirstNumberValue >= 10 &&  txtFirstNumberValue <=15)
	  {
         document.getElementById('ini').value = 'Accept';
		document.getElementById('ini2').value = '';
	  }
	  else
	  {
		  document.getElementById('ini2').value = 'Reject';
	      document.getElementById('ini').value = '';
	  }
	  if (txtFirstNumberValue <=1)
	  {
		  document.getElementById('ini').value = '';
		  document.getElementById('ini2').value = '';
	  }
	  
}
</script>		
	</div>	  
  </body>
</html>




