<?php
session_start();                      
$username=$_SESSION['username'] ?? null;
$password=$_SESSION['password'] ?? null;
$chn=$_GET['chn'] ?? null;
$cyc_no=$_GET['cyc_no'] ?? null;
$ip=$_SERVER['REMOTE_ADDR'] ?? null;
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){
	$row = mysqli_fetch_assoc($sql);
	$xadmnchk=$row['dept_x'];
	$result = mysqli_query($conn, "SELECT * FROM cycle_lst where pat_mrn like '%$chn%'");
	$row = mysqli_fetch_assoc($result);
	$xnm=$row['pat_name']." ".$row['part_name'];
	$cycle_typ=$row['cycle_type'];
	$cycle_numbr=$row['x1flag'];

}else {
	session_destroy();
echo "Invalid login";
}
?>
<!DOCTYPE HTML>
<html>
<head>
<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>
<style>
#Image {
    margin: 5px;
    border:2px solid #FF3399;
    border-radius: 5px;
    background-size: 210px;
    background-position:center;
}
#Imagex {
    margin: 5px;
    border:2px solid #FF3399;
	width:200px;
	height:200px;
    border-radius: 10px;
    background-size: 210px;
    background-position:center;
}
#foo {
    position: fixed;
    top: -1000000px;
  }
</style>
<script type='text/javascript'>
function fun()
{
    if(document.getElementById("reasonclsng").value!="")
        document.getElementById("button").disabled=false;
    else
    document.getElementById("button").disabled=true;

}
</script>
</head>
<body onLoad="lctfrst()">
<div id="foo"><input name="ptcard" id="ptcard" type="text"></div>
<br><br><br><br><br><br><br><div align="center"><img src="strtupmain.jpg"/></div><br><br>
<div style="color:#006699;font-size:20px;text-align:center">Welcome to NOVA IVF Electronic Witnessing System - EMBRYOLOGY DEPARTMENT</div><br><br><br>
<form action="cycl_clsng_fnl.php" method="post">
<input name="chn" id="chn" type="hidden" value="<?php echo $chn;?>">
<input name="cycno" id="cycno" type="hidden" value="<?php echo $cycle_numbr;?>">
<div style="color:#FF6600;font-weight:700;font-size:16px;text-align:center">Select appropriate reason to close the cycle witness and press "close witness" button<br><br>
<select name="reasonclsng" id="reasonclsng" onChange="fun()">
<option value=""></option>
<option value="1">Close cycle</option>
<option value="2">No oocytes retrieved</option>
<option value="3">No mature oocytes</option>
<option value="4">Fertilization failure, cleavage arrest</option>
<option value="5">Oocytes freezing</option>
<option value="9">Absence of viable embryos</option>
<option value="6">Power or network issues</option>
<option value="7">Patient card not generated on-time</option>
<option value="8">Improper witness</option>
<option value="10">Cycle cancelled</option>
<option value="11">No tags available in stock</option>
</select><br><br>
<input value="Close witness" type="submit" class="btn-two red large" id="button" disabled="true">
</form></div>
</body>
</html>