<?php 
include "koneksi.php";
//$id=mysqli_real_escape_string($conn,$_GET["id"]);
//$q="SELECT * FROM jenis_cuti WHERE id='$id'";
//$res=mysqli_query($conn,$q);
//$data=mysqli_fetch_assoc($res);
//$ids=mysqli_real_escape_string($conn,$_GET["ids"]);
?>
<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="style.css">
<html>
  <head>
	<title> PT. MULTI HYDRACHROM BALIKPAPAN </title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<?php
		include "part/jss.php";
	?>
  </head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>

</style>
  <body>
  <form method ='POST' action=''>
			<h3>Toleransi</h3>
			
			<h4><select name="toleransi">
			<option value="0">--pilih--</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>
			<form method='POST' action=''>
			<input type="submit" name="submit" value="Submit"/>
			</h4>
			</form>
			
			<?php
if (isset($_POST['submit'])) {
$toleransi = $_POST['toleransi'];
echo "<h4>$toleransi</h4>";
}
?>
			
			
			
			
			
            <h3>Input Size</h3>
			<input type="text" name="size" id="toleransi" value="<?php echo "$toleransi"?>" onkeyup="sum();"/>
  
  
  
  
  
			<h3>Membuat Penjumlahan Otomatis Suckittrees.com</h3>
			<input type="text" id="txt1"  onkeyup="sum();" />
			<input type="text" id="input1"  onkeyup="sum();" />
			<form target="_blank">
			<h3> Uper </h3>
			<input id="uper" class="w3-input w3-padding-16" type="text" placeholder="0" required name="nomor_taging">
			<h3> Lower </h3>
			<input id="lower" class="w3-input w3-padding-16" type="text" placeholder="0" required name="nomor_taging">
			<br><br><br><br><br><br>
			<input id="ini" class="w3-input w3-padding-16" type="text" placeholder="-" required name="nomor_taging">
			<p><input id="ini2" class="w3-input w3-padding-16" type="text" placeholder="-" required name="nomor_taging"></p>
			<p><input id="ini3" class="w3-input w3-padding-16" type="text" placeholder="-" required name="nomor_taging"></p>
			</form>



  
  </body>
 <script>
function sum() 
{
	var toleransi = document.getElementById('toleransi').value;
      var txtFirstNumberValue = document.getElementById('txt1').value;
	  var input1 = document.getElementById('input1').value;

	  if (toleransi == '1')
	  {
		  document.getElementById('ini3').value = 'f6';
		  if (txtFirstNumberValue >= 3 &&  txtFirstNumberValue <=6)
		  {
			 document.getElementById('uper').value = '18';
			document.getElementById('lower').value = '10';
			$uper = 18;
			$lower = 10;
		  }
		  if (txtFirstNumberValue >= 7 &&  txtFirstNumberValue <=10)
		  {
			 document.getElementById('uper').value = '22';
			document.getElementById('lower').value = '13';
		  }
		  if (txtFirstNumberValue >= 11 &&  txtFirstNumberValue <=18)
		  {
			 document.getElementById('uper').value = '27';
			document.getElementById('lower').value = '16';
		  }
		  if (txtFirstNumberValue >= 19 &&  txtFirstNumberValue <=30)
		  {
			 document.getElementById('uper').value = '33';
			document.getElementById('lower').value = '20';
		  }
		  if (txtFirstNumberValue >= 31 &&  txtFirstNumberValue <=40)
		  {
			 document.getElementById('uper').value = '41';
			document.getElementById('lower').value = '25';
		  }
		  if (txtFirstNumberValue >= 41 &&  txtFirstNumberValue <=50)
		  {
			 document.getElementById('uper').value = '41';
			document.getElementById('lower').value = '25';
		  }
		  if (txtFirstNumberValue >= 41 &&  txtFirstNumberValue <=50)
		  {
			 document.getElementById('uper').value = '41';
			document.getElementById('lower').value = '25';
		  }
		  if (txtFirstNumberValue >= 51 &&  txtFirstNumberValue <=65)
		  {
			 document.getElementById('uper').value = '49';
			document.getElementById('lower').value = '30';
		  }
		  if (txtFirstNumberValue <= 2)
		  {
			 document.getElementById('uper').value = '0';
			document.getElementById('lower').value = '0';
		  }
	  }
	  if (input1 >= $lower && input1 <= $uper)
	  {
         document.getElementById('ini').value = 'Accept';
		document.getElementById('ini2').value = '';
	  }
	  else
	  {
		  document.getElementById('ini2').value = 'Reject';
	      document.getElementById('ini').value = '';
	  }
	  if (input1 == '')
	  {
		  document.getElementById('ini').value = '';
		  document.getElementById('ini2').value = '';
	  }
	  
}
</script>
</html>




