<?php
session_start();                      
$username=$_SESSION['username'] ?? '';
$password=$_SESSION['password'] ?? '';
$deprtmnt = "4";
include 'dbcon.php';
$txt = is_file('txiv834.txt') ? trim((string) file_get_contents('txiv834.txt')) : '';
$xnm = '';
$fh = fopen('txiv834b.txt','r');
while ($line = fgets($fh)) {
$parts = explode(',', trim($line));
$x1=$parts[0] ?? '';
$x2=$parts[1] ?? '';
$x3=$parts[2] ?? '';
$x4=$parts[3] ?? '';

		if($username==""){
			$result_usr = mysql_query("SELECT user_id FROM user_log_login where deprtmnt='4' order by log_no desc limit 1");
			$row_usr = mysql_fetch_assoc($result_usr);
			$x1 = $row_usr['user_id'];
		}else{
		}

$sql = mysql_query("INSERT INTO matcher_tag_gen (reslt_dt, ent_by, chn_cycle, grpbypid, process_main_id, p_mark)
VALUES(now(), '$x1', '$x2', '$x3', '$x4', '1')") or die (mysql_error());
}
fclose($fh);
//echo "record added";
?>
<!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;
}
</style>
</head>
<body>
<?php
$result = mysql_query("SELECT * FROM new_case where chn like '%$txt%'");
$login_check1 = mysql_num_rows($result);
//if($login_check1 > 0){
$row = mysql_fetch_assoc($result);
$x_resp_nm1 = $row['resp_dr_nm'] ?? '';
$pt_gend = $row['pat_gend'] ?? '';
$xnm=($row['pat_nm'] ?? '')." ".($row['part_nm'] ?? '')." ".($row['pat_sur'] ?? '');
echo "<br><br>";
echo "<div align='center' style='font-size:20px'><font color=blue>You are going to generate tag for patient</font></div>";
echo "<br><br>";
echo "<div align='center' style='font-size:22px'><font color=red>"."[ Department : IVF Lab ] ".$txt." ".$xnm."</font><br><br></div>";
echo "<br><br>";
echo "<div align='center' style='font-size:18px'><font color=blue>Press yes if want to write tag and then put blank tag on device</font></div>";
echo "<div align='center'><a href='main_wlcm_ivflabn.php' class='btn-two red medium'>click here to go to main scanning page</a></div>";
?>
</body>
</html>
