Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/irp/icure/doctor/
Upload File :
Current File : /var/www/html/mmishra/irp/icure/doctor/registrations.inc.bak

<h3 align='left'>Registrations</h3>

<?php

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

$tbl = 'registrations';

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

$pgsz = 10;

$sql = "select pat_id as patient_ID,concat(count(reg_no),' registrations') as no 
from $tbl group by pat_id order by no desc limit $pgno,$pgsz";

$rs = mysql_query($sql);
if (mysql_num_rows($rs)) {
        $colHeads = mysql_num_fields($rs);

        echo "<table border='1' width='50%'><tr><th>Sr</th>";
        for ($i=0; $i < $colHeads; $i++) { // Header
                echo '<th>'.ucwords(str_replace("_"," ",mysql_field_name($rs, $i))).'</th>';
        }
        echo "</tr>";
       
	$j = $pgno; 
	while ($row = mysql_fetch_row($rs)) { //data
                $j++;
                echo "<tr><td><a href='doctor/?pg=$pg&patid=".$row[0]."'>$j</a></td><td>".implode($row,'</td><td>')."</td></tr>";
        }
        echo "</table>";

        if ($pgno) {
                $pgno = $pgno - $pgsz;
                echo "[ <a href='doctor/?pg=$pg&pgno=$pgno'>Previous</a> ] ";
                $pgno = $pgno + $pgsz;
        }
        if ($j % $pgsz == 0) {
                $pgno = $pgno + $pgsz;
                echo " [ <a href='doctor/?pg=$pg&pgno=$pgno'>Next</a> ]";
        }
} else {
        echo "---";
}


if ($patid) {
	echo "<br><br><b>Registrations of Patient ID: $patid</b>";

	$sql = "select reg_no,reg_date,reg_time,concat(pat_group,'-',pat_id,' (',dependent,')') as patient,dr_id as doctor,login_id as staff 
	from registrations where pat_id='$patid' order by reg_no desc";

        echo "<table border='1' width='90%'>
	<tr><th>Sr</th><th>Reg No.</th><th>Patient</th><th>Doctor</th><th>Staff</th></tr>";
	$rs = mysql_query($sql);
	while ($o = mysql_fetch_object($rs)) {
                $k++;
                echo "<tr><td>$k</td><td><a href='doctor/?pg=$pg&patid=$patid&regno=$o->reg_no'>$o->reg_no</a></td><td>$o->reg_date $o->reg_time</td><td>$o->patient</td>
		<td>".doctor_detail($o->doctor)."</td></tr>";
        }
        echo "</table>";
}

if ($regno) {
	echo "<br><br><b>Records of Registration No.: $regno</b>";

	$sqls = array("select reg_no,reg_date,reg_time,concat(pat_group,'-',pat_id,' (',dependent,')') as patient,dr_id as doctor,login_id as staff from registrations where reg_no=$regno",
        "select concat(medicine,'- ',dose,', ',frequency,' times, ',course_days,' days') as prescription,login_id as staff from prescriptions where reg_no=$regno order by pres_id",
	"select adm_datetime as ADT,diagnosis,referral,dis_datetime as DDT,login_id as staff from admissions where reg_no=$regno",
	"select dis_datetime as date_time,med_name as medicine,qty,a.login_id as staff from medications as a, medicines as b where a.med_id=b.med_id and reg_no=$regno");

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

		echo list_tabledata($sql);
	}
}

?>