Your IP : 216.73.216.40


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

<h3 align='left'>Patient Status</h3>
<center>
<?php

$tbl = 'registrations';

$pgno = $_REQUEST["pgno"];
if (!$pgno) $pgno = 0;

$pgsz = 30;

$dated = $_REQUEST["dated"];
$regno = $_REQUEST["regno"];
$patid = $_REQUEST["patid"];

$sql = "select pat_id,count(reg_no) as no from $tbl group by pat_id order by no desc limit $pgno,$pgsz";
$rs = mysql_query($sql);

echo "<table border='1' width='90%'>
<tr valign='top'><td width='30%'>";

while ($o = mysql_fetch_object($rs)) { //data
	$patid1 = strtoupper($o->pat_id);
	if ($patid == $patid1) {
        	echo "<font color='red' size=+1>- $patid ($o->no)</font>";
		$sr = mysql_query("select reg_no,reg_date from $tbl where pat_id='$patid' order by reg_no desc");
		echo "<dir>";
		while ($q = mysql_fetch_object($sr)) { //data
			if ($regno == $q->reg_no)
				echo "<font color='red' size=+1>- $q->reg_no ($q->reg_date)</font>";
			else
				echo "+ <a href='?pg=$pg&regno=$q->reg_no&patid=$patid&pgno=$pgno'>$q->reg_no</a> ($q->reg_date)";
			echo "<br>";
		}
		echo "</dir>";
        } else {
        	echo "+ <a href='?pg=$pg&patid=$patid1&pgno=$pgno'>$patid1</a> ($o->no)";
	}
	echo "<br>";
}
echo "<div align='right'>";
if ($pgno) {
       	$pgno = $pgno - $pgsz;
       	echo "[ <a href='?pg=$pg&pgno=$pgno'>Previous</a> ] ";
       	$pgno = $pgno + $pgsz;
}
if ($j % $pgsz == 0) {
       	$pgno = $pgno + $pgsz;
       	echo " [ <a href='?pg=$pg&pgno=$pgno'>Next</a> ]";
}
echo "</div></td><td>";

if ($regno) {
	$heads = array('Registration','Medication');
        echo "<h3 align='center'>Treatment Record of Registration No.- $regno</h3>";

        $sqls = array("select reg_no,concat(reg_date,' ',reg_time) as dated,concat(dr_name,' (',specialization,')') as doctor,a.login_id as staff from registrations a, doctors b where a.dr_id=b.dr_id and reg_no=$regno",
        "select med_name,qty,a.login_id as staff from medications as a, medicines as b where a.med_id=b.med_id and reg_no=$regno");

 	echo patient_name($regno);
 	//echo registration_detail($regno);
        $no = 0;
        foreach ($sqls as $sql) {
                echo "<p align='left'><b>".$heads[$no]."</b></p>";
                $no++;

                echo list_tabledata($sql);
        }
} else {
	echo "Enter Patient ID: <input type='text' name='patid' size='20' value='$patid'>
	<input type='submit' name='submit' value='GET REGISTRATIONS'>";
}

if ($patid) {
	echo "<h3>Registratons of $patid</h3>";
        $rs = mysql_query("select reg_no from registrations where pat_id='$patid' order by reg_no desc");
	while ($o = mysql_fetch_object($rs)) {
        	echo registration_detail($o->reg_no);
        }
}
echo "</td></tr></table>";

?>
</center>