<?session_start();?>
<link rel="stylesheet" href="style.css" type="text/css" />
<?

include("opendb.php");
if($type1=='O.P')
$result=mysqli_query($db,"select * from opitem where grpcode='$opgrp' order by itemname");
else if($type1=='I.P')
$result=mysqli_query($db,"select * from ipitem where grpcode='$opgrp' order by itemname");
else if($type1=='lab')
$result=mysqli_query($db,"select * from labitem where grpcode='$opgrp' order by itemname");
else if($type1=='xray')
$result=mysqli_query($db,"select * from xrayitem where grpcode='$opgrp' order by itemname");
else if($type1=='Theatre')
$result=mysqli_query($db,"select * from theatreitem where grpcode='$opgrp' order by itemname");

$sq="select admdate from ipreg where regno='$regno'";

$datere=mysqli_query($db,"select admdate from ipreg where regno='$regno'") or die(mysqli_error());
$dtrow=mysqli_fetch_row($datere);
$sq="select to_days(now())-to_days('$dtrow[0]') from ipreg";

$dt_result=mysqli_query($db,$sq) or die(mysqli_error());
$dt=mysqli_fetch_row($dt_result);
$ndays=$dt[0];
if($ndays<=0)
$ndays=1;

?>
<center>
<base target=bottom>
<form action='ipmainbill.php' method='post'>
<input type=hidden name='ndays' value='<?print $ndays?>'>
<table border=1 bgcolor=D1D0AF width=50%>
<th><?print $type1?>  Items
<tr><td align=center>
<select name=items multiple=true size=5 style={width:320}>
<?
while($row=mysqli_fetch_row($result))
{
 print"\n<option>$row[2] - $row[3]</option>";
}
?>
</select>
</td></tr>
<tr><td align=center>Qty <input type=text name='qty' size=4 value='<?print $ndays?>'> <input type=submit name='submit' value='Add'> </td></tr>
</table>
</form>
