Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/icure/admin/
Upload File :
Current File : /var/www/html/mmishra/icure/admin/phresult.inc

<h3 align='left'>Pathology Result</h3>
<center>
<?php

$tbl 	= 'phresults';
$regno 	= $_REQUEST["regno"];

if ($_POST["submit"] == 'SAVE') {
	$testids 		= $_POST["testid"];
    $testresults 	= $_POST["testresult"];
	$i = 0;

	foreach ($testresults as $testresult) {
		if (mysql_num_rows(mysql_query("select * from $tbl where reg_no=$regno and test_id=".$testids[$i]))) {
			mysql_query("update $tbl set test_result='$testresult',login_id='$user' 
			where reg_no=$regno and test_id=".$testids[$i]);
		} else if ($testresult) {
			mysql_query("insert into $tbl(reg_no,test_id,test_result,test_date,test_time,login_id) 
			values($regno,".$testids[$i].",'$testresult',current_date(),current_time(),'$user')");
		}
		$i++;
	}

	//delete null results
	mysql_query("delete from $tbl where test_result=''");
}

?>

Registration No. <input type='text' name='regno' value='<?php echo $regno; ?>' size='10'>
<input type='submit' name='submit' value='FIND'>
<br>

<?php

$j = 0;

if ($regno) {
	if (is_registration($regno)) {
		echo registration_detail($regno);
	
		//if (is_prescription($regno)) {
			//	echo prescription_detail($regno);

			echo "<table border='1' width='100%'>
			<tr><th>Haematology</th><th>Biochemical</th><th>Urine Examination</th></tr>
			<tr valign='top'><td><table border='0' width='100%'>
			<tr><th>Sr.</th><th>Test Name</th><th>Normal Range</th><th>Result</th></tr>";

			$rs = mysql_query("select * from phtests where test_group='Haemetology' order by test_id");
			while ($o = mysql_fetch_object($rs)) {
				$j++;
				echo "<tr><td align='center'>$j</td>
				<td><input type='hidden' name='testid[]' value='$o->test_id'>$o->test_name</td>
				<td>$o->test_range</td>";
		
				$sr = mysql_query("select * from $tbl where reg_no=$regno and test_id=$o->test_id");
				if (mysql_num_rows($sr)) {
					$q = mysql_fetch_object($sr);
					$testresult = $q->test_result;
				} else {
					$testresult = '';
				}

				echo "<td><input type='text' name='testresult[]' value='$testresult' size='15'></td></tr>";
			}
			echo "</table></td><td><table border='0' width='100%'>
			<tr><th>Sr.</th><th>Test Name</th><th>Normal Range</th><th>Result</th></tr>";

			$j = 0;
			$rs = mysql_query("select * from phtests where test_group='Biochemical' order by test_id");
			while ($o = mysql_fetch_object($rs)) {
				$j++;
				echo "<tr><td align='center'>$j</td>
				<td><input type='hidden' name='testid[]' value='$o->test_id'>";
				if (strpos($o->test_name,'Exam') && !$z) {
					echo "<b>URINE EXAMINATION</b><br>";
					$z++;
				}
				echo str_replace("Urine Examination",'&nbsp;&nbsp;&nbsp;&nbsp;',$o->test_name);
				echo "</td><td>$o->test_range</td>";

				$sr = mysql_query("select * from $tbl where reg_no=$regno and test_id=$o->test_id");
				if (mysql_num_rows($sr)) {
					$q = mysql_fetch_object($sr);
					$testresult = $q->test_result;
				} else {
					$testresult = '';
				}

				echo "<td><input type='text' name='testresult[]' value='$testresult' size='15'></td></tr>";
			}
			echo "</table></td><td><table border='0' width='100%'>
			<tr><th>Sr.</th><th>Test Name</th><th>Normal Range</th><th>Result</th></tr>";

			$rs = mysql_query("select * from phtests where test_group='Urine Examination' order by test_name");
			while ($o = mysql_fetch_object($rs)) {
				$k++;
				echo "<tr><td align='center'>$k</td>
				<td><input type='hidden' name='testid[]' value='$o->test_id'>$o->test_name</td>
				<td>$o->test_range</td>";
		
				$sr = mysql_query("select * from $tbl where reg_no=$regno and test_id=$o->test_id");
				if (mysql_num_rows($sr)) {
					$q = mysql_fetch_object($sr);
					$testresult = $q->test_result;
				} else {
					$testresult = '';
				}

				echo "<td><input type='text' name='testresult[]' value='$testresult' size='15'></td></tr>";
			}
			echo "</table></td></tr>
			<tr><th colspan='3'><input type='submit' name='submit' value='SAVE'></th></tr>     
			</table>
			<a href='?pg=phreport&print=1&regno=$regno' target='new'>PRINT REPORT</a>";
		//} else
		//	echo "No prescription";
	} else
		echo "No registration";
}

?>
</center>