Your IP : 216.73.216.40


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

<h3 align='left'>Prescription</h3>
<center>
<?php

$tbl = 'prescriptions';
$regno = $_REQUEST["regno"];
$presid = $_REQUEST["presid"];
$presfor = $_REQUEST["presfor"];
if (!$presfor) $presfor = 'Medicine';

if ($_POST["submit"] == 'SAVE') {
	
	$medicine = $_POST["medicine"];
	if (!$medicine) $medicine = $_POST["testid"];
	$dose = $_POST["dose"];
	if (!$dose) $dose='';
	$frequency = $_POST["frequency"];
	if (!$frequency) $frequency = 1;
	$coursedays = $_POST["coursedays"];
	if (!$coursedays) $coursedays = 1;
	
	if (mysql_num_rows(mysql_query("select * from $tbl where pres_id=$presid"))) {
		mysql_query("update $tbl set reg_no=$regno,medicine='$medicine',dose='$dose',frequency=$frequency,course_days=$coursedays,
		login_id='$user' where pres_id=$presid");
	} else {
		mysql_query("insert into $tbl(reg_no,medicine,dose,frequency,course_days,login_id) 
		values($regno,'$medicine','$dose',$frequency,$coursedays,'$user')");
	}

}

if ($_GET["del"] == 1) {
//	mysql_query("delete from $tbl where pres_id=$presid");

}

?>

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

<?php  

if ($regno) {
	if (is_registration($regno)) {
        	echo registration_detail($regno);


		echo "<table border='1' width='90%'><tr><th>Sr</th><th>";
        
		foreach ($prescriptions as $pf) {
                	echo "<input type='radio' name='presfor' value='$pf'";
                	if ($presfor == $pf) echo " checked";
                	echo " onclick=\"document.location.href='?pg=$pg&regno=$regno&presfor='+this.value\"> $pf";
        	}
        	echo "</th><th>Dose</th><th>Frequency/Day</th><th>Course Days</th><td align='center'>Action</td></tr>";

        	if (!$presid) {
                	echo "<tr><td>+</td><td nowrap>";
			if ($presfor == 'Test') {
                		echo phtest_list('',0);
                	} else {
                		echo "<input type='text' name='medicine' value='' size='25'>";
			}
			
			echo "</td><td><input type='text' name='dose' value='1' size='10'></td>
                	<td nowrap><input type='text' name='frequency' value='1' size='5'> times</td>
                	<td nowrap><input type='text' name='coursedays' value='1' size='5'> days</td>
			<td align='center'><input type='submit' name='submit' value='SAVE'></td></tr>";
        	} else {
                	echo "<tr><td colspan='6'><a href='?pg=$pg&regno=$regno&presid='>+</a></td></tr>";
        	}

        	$rs = mysql_query("select * from $tbl where reg_no=$regno order by pres_id");
        	while ($o = mysql_fetch_object($rs)) {
                	$i++;
                	echo "<tr><td>$i</td><td nowrap>";
                	if ($presid == $o->pres_id) {
				if ($presfor == 'Test') {
                			echo phtest_list('',$o->medicine);
                		} else {
                        		echo "<input type='text' name='medicine' value='$o->medicine' size='25'>";
				}
                		echo "<input type='hidden' name='presid' value='$o->pres_id'></td>
				<td><input type='text' name='dose' value='$o->dose' size='10'></td>
                        	<td nowrap><input type='text' name='frequency' value='$o->frequency' size='5'> times</td>
                        	<td nowrap><input type='text' name='coursedays' value='$o->course_days' size='5'> days</td>
                        	<td align='center'><input type='submit' name='submit' value='SAVE'> 
				<a href='?pg=$pg&regno=$regno&presid=$presid&del=1'>x</a></td>";
                	} else {
                        	if (is_numeric($o->medicine)) {
					echo "<a href='?pg=$pg&regno=$regno&presfor=Test&presid=$o->pres_id'>".phtest_detail($o->medicine)."</a>";
                        	} else {
					echo "<a href='?pg=$pg&regno=$regno&presid=$o->pres_id'>$o->medicine</a>";
				}
				echo "</td><td>$o->dose</td>
                        	<td>$o->frequency times</td>
                        	<td>$o->course_days days</td>";
                	}
			echo "</tr>";
        	}
        	echo "</table>";
	} else
		echo "No registration";
}

?>
</center>