<?php
session_start();                      
$username=$_SESSION['username'] ?? '';
$password=$_SESSION['password'] ?? '';
$chn = $_POST['chn'] ?? '';
$xcyc = $_POST['cyc_no'] ?? '';
$rec_id = $_POST['actvty_id'] ?? '';
$ip=$_SERVER['REMOTE_ADDR'] ?? '';
include 'dbcon.php';
$password=md5($password);
$sql = mysqli_query($conn,  "SELECT * FROM matcher_usermst WHERE nif_usr='$username' AND nif_pass='$password' AND act_vate='1'");
$login_check = mysqli_num_rows($sql);

if($login_check > 0){
}else {
	session_destroy();
echo ("<SCRIPT LANGUAGE='JavaScript'> window.location.href='invalidlogin.html'; </SCRIPT>");

}
?>
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
	<style type="text/css">
	INPUT { margin-right: 1em }
	</style>
<link href="../style.css" rel="stylesheet" type="text/css" />
<link href="style_btn.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js_button.js"></script>
<link href="../style_btn.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="../js_button.js"></script>
<script>
function getInputValuesame(){
document.getElementById("frzngtrms").value = document.getElementById("regdt").value;
}
function getInputValuesixmon(){
document.getElementById("frzngtrms").value = document.getElementById("sixmon").value;
}
function getInputValue1(){
document.getElementById("frzngtrms").value = document.getElementById("year1").value;
}
function getInputValue2(){
document.getElementById("frzngtrms").value = document.getElementById("year2").value;
}
function getInputValue3(){
document.getElementById("frzngtrms").value = document.getElementById("year3").value;
}
function getInputValue5(){
document.getElementById("frzngtrms").value = document.getElementById("year5").value;
}
</script>
<body>
<form name ="rec_updt" id="rec_updt" method="POST" action="actvcty_updt_oocyt.php">
<?php
				$query  = "SELECT * FROM actvty_trans_frzng_oocyt where log_no='$rec_id'";
				$result = mysqli_query($conn, $query);
				while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
?>
<input type="hidden" name="log_no"  size="25" value="<?php echo $row['log_no'] ?>">
<input type="hidden" name="chn"  size="25" value="<?php echo $chn; ?>">
<table align="center" style="width:50%;" border="0">
  <tr>
    <td colspan="2"><strong>Oocyte / Embryo Freezing Management</strong></td>
  </tr>
  <tr>
    <td colspan="2">Patient : <?php echo $row['pat_id'] ?></td>
  </tr>
  <tr>
    <td>Ext. straw </td>
    <td><select name="exchngstrw" id="exchngstrw">
      <option value="0">0</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
    </select>
  </tr>
  <tr>
    <td>Nos of oocyte </td>
    <td><select name="nosoocyt" id="nosoocyt">
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
    </select>
  </tr>
  <tr>
    <td>Container No. </td>
    <td><select name="contnrno" id="contnrno">
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
      <option value="7">7</option>
      <option value="8">8</option>
    </select>
  </tr>
  <tr>
    <td>Canister No. </td>
    <td><select name="canistrno" id="canistrno">
      <option value="<?php echo $row['canistrno'] ?>"><?php echo $row['canistrno'] ?></option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
      <option value="7">7</option>
      <option value="8">8</option>
      <option value="9">9</option>
      <option value="10">10</option>
      <option value="11">11</option>
      <option value="12">12</option>
    </select>
  </tr>
  <tr>
    <td>Goblet </td>
    <td><select name="goblet" id="goblet">
      <option value="<?php echo $row['goblet'] ?>"><?php echo $row['goblet'] ?></option>
    <option value="1">Orange</option>
    <option value="2">Blue</option>
    <option value="3">White</option>
    <option value="4">Yellow</option>
    <option value="5">Red</option>
    <option value="6">Purple</option>
    <option value="7">Light Blue</option>
	</select><td></tr>
  <tr>
    <td>Viscotube </td>
    <td><select name="viscosity" id="viscosity">
      <option value="<?php echo $row['viscotube'] ?>"><?php echo $row['viscotube'] ?></option>
    <option value="1">Orange</option>
    <option value="2">Blue</option>
    <option value="3">Red</option>
    <option value="4">Yellow</option>
    <option value="5">Black</option>
    <option value="6">Light Blue</option>
    <option value="7">Grey</option>
    <option value="8">Green</option>
    <option value="9">Pink</option>
    <option value="10">Purple</option>
	</select><td></tr>
  <tr>
    <td>Cryotop color </td>
    <td><select name="cryocolor" id="cryocolor">
      <option value="<?php echo $row['cryocolor'] ?>"><?php echo $row['cryocolor'] ?></option>
    <option value="1">Green</option>
    <option value="2">Blue</option>
    <option value="3">White</option>
    <option value="4">Red</option>
    <option value="5">Yellow</option>
	</select>
  </tr>
  <tr>
    <td> Register freezing</td>
    <td><input type="text" name="regdt" id="regdt" value="<?php echo $row['due_date_act'] ?>" size="15"></td></tr>
  <tr>
    <td valign="middle">Freezing terms</td>
    <td valign="middle"><input type="text" name="frzngtrms" id="frzngtrms" size="15" value="<?php echo $row['term_date'] ?>" readonly></td>
  </tr>
  <tr>
    <td valign="middle"></td>
    <td valign="middle"><input type="button" name="clickme1" id="clickme1" value="Same year" onClick="getInputValuesame()">
	<input type="button" name="sixmonths" id="sixmonths" value="Six months" onClick="getInputValuesixmon()">
	<input type="button" name="clickme1" id="clickme1" value="1 Year" onClick="getInputValue1()">
	<input type="button" name="clickme2" id="clickme2" value="2 Year" onClick="getInputValue2()">
	<input type="button" name="clickme3" id="clickme3" value="3 Year" onClick="getInputValue3()">
	<input type="button" name="clickme5" id="clickme5" value="5 Year" onClick="getInputValue5()">
	<input type="hidden" name="sixmon" id="sixmon" value="<?php echo date('Y-m-d', strtotime($row['due_date_act']. '+ 6 months'));?>">
	<input type="hidden" name="year1" id="year1" value="<?php echo date('Y-m-d', strtotime($row['due_date_act']. '+ 1 year'));?>">
	<input type="hidden" name="year2" id="year2" value="<?php echo date('Y-m-d', strtotime($row['due_date_act']. '+ 2 year'));?>">
	<input type="hidden" name="year3" id="year3" value="<?php echo date('Y-m-d', strtotime($row['due_date_act']. '+ 3 year'));?>">
	<input type="hidden" name="year5" id="year5" value="<?php echo date('Y-m-d', strtotime($row['due_date_act']. '+ 5 year'));?>">
	</td>
  </tr>
  <tr>
    <td>Remark if any</td>
    <td><input type="text" name="act_rem" value="<?php echo $row['remarks'] ?>" size="25" style='width:160px;height:28px;'>
    </td>
  </tr>
  <tr>
    <td><input type="submit" name="Submit" value="Submit" class="btn-two red small" onClick="this.disabled=true;this.form.submit();"/></td>
    <td><a href="frzmodls.php?chn=<?php echo $chn;?>&cyc_no=<?php echo $xcyc;?>" class="btn-two blue small">&nbsp;Back to freezing dashboard&nbsp;</a></td>
    </tr>
  </table>
<?php }
?>
</form>
</body>
</html>
