<?php 
include('../config/config.php');
include("../classes/classShift.php");
include("../classes/classDoctor.php");
include("../classes/classVisits.php");
include('../classes/classPatient.php');
include("../classes/classImages.php");
include('../classes/classTransaction.php');
include('../classes/classWardMgmt.php');
include('../classes/classProduct.php');
include('../classes/classIPDPresciption.php');


/*echo '<pre>';
print_r($_SESSION);
echo '</pre>';*/

#################### set temp session  ##############################################
if(isset($_GET['patientid'])&&isset($_GET['allotid']))
{
	$_SESSION['temp']['patient_id'] = base64_decode($_GET['patientid']);
	$_SESSION['temp']['allot_id'] = base64_decode($_GET['allotid']);
}
/*if(isset($_GET['patientid'])&&isset($_GET['visitid']))
{
	$_SESSION['temp']['patient_id'] = base64_decode($_GET['patientid']);
	$_SESSION['temp']['visit_id'] = base64_decode($_GET['visitid']);
	//header("Location:mgmtvisits.php");
}*/
if(isset($_SESSION['temp']['shiftid'])&&$_SESSION['temp']['shiftid']!='')
{
	$shift_id = $_SESSION['temp']['shiftid'];
}
if(isset($_SESSION['temp']['doctorid'])&&$_SESSION['temp']['doctorid']!='')
{
	$doctor_id = $_SESSION['temp']['doctorid'];
}
if(isset($_SESSION['temp']['patient_id'])&&$_SESSION['temp']['patient_id']!='')
{
	$patient_id = $_SESSION['temp']['patient_id'];
}
if(isset($_SESSION['temp']['visit_id'])&&$_SESSION['temp']['visit_id']!='')
{
	$visit_id = $_SESSION['temp']['visit_id'];
}
if(isset($_SESSION['temp']['allot_id'])&&$_SESSION['temp']['allot_id']!='')
{
	$allot_id = $_SESSION['temp']['allot_id'];
}

#################### insert images ##############################################

if(isset($_FILES['image']))
{
	try
	{
		$imageOb = new classImages;
		$imageOb->setImageName($_FILES['image']['name']);
		$imageOb->setImageSize($_FILES['image']['size']);
		$imageOb->setImageType($_FILES['image']['type']);
		$imageOb->setPatientAutoID($patient_id);
		$imageOb->executeForPatient();
		
		$image_id = $imageOb->getImageID();
		
		$path = '../images/patient_images/'.$image_id.'.jpg';
		move_uploaded_file($_FILES['image']['tmp_name'],$path);
	}
	catch (MyException $e)
	{
		$error_message = $e->getUserMsg();
	}
}

#################### Delete images ##############################################

if(isset($_POST['delete_image'])&&$_POST['delete_image']=='Delete')
{
	if(isset($_POST['image_ids'][0]))
	{
		try
		{
			$delImageOb = new classImages;
			for($d=0;$d<count($_POST['image_ids']);$d++)
			{
				$delImageOb->setImageID($_POST['image_ids'][$d]);
				$delImageOb->deleteImageByImageID();
			}
		}
		catch (MyException $e)
		{
			$error_message = $e->getUserMsg();
		}	
	}
}


#################### Compare images ##############################################

if(isset($_POST['compare_image'])&&$_POST['compare_image']=='Compare Images')
{
	if(isset($_POST['image_ids'][0]))
	{
		$images = base64_encode(implode(',',$_POST['image_ids']));
		?>
		 	<script type="text/javascript">
			window.open("printimages.php?images=<?php echo $images;?>","","top=10,left=200,width=850,height=700,status=no,menubar=no,toolbar=no,scrollbars=yes"); 
			</script>   
        <?php
	}
}


#################### delete Presciption data ##############################################

if(isset($_GET['del_prec']))
{
	$del_prec = base64_decode($_GET['del_prec']);
		
	try
	{	
		$delVisitOb = new classVisits;
		$delVisitOb->setPrescriptionItemID($del_prec);
		$delVisitOb->deletePrescription();
		
		header("Location:ipdovw.php");
	}
	catch (MyException $e)
	{
		$error_message = $e->getUserMsg();
	}	
}

#################### insert Presciption data ##############################################
if(isset($_POST['add_presc'])&&$_POST['add_presc']=='Add_presc')
{
	$addPrescOb = new classIPDPresciption;
	$addPrescOb->setPatientID($patient_id);
	$addPrescOb->setIpdBedAllotmentID($allot_id);
	$addPrescOb->setRequestedBy($_SESSION['security']['user_id']);
	$addPrescOb->setLocationID($_SESSION['security']['location_id']);
	$addPrescOb->setPrescriptionType($_POST['presc_type']);
	$addPrescOb->setMedicineIDs(@$_POST['medicine_id']);
	$addPrescOb->setLabTestIDs(@$_POST['labtest_id']);
	$addPrescOb->setProcedureIDs(@$_POST['procedure_id']);
	$addPrescOb->execute();
}
#################### retrieve data ##############################################


try
{
	$retrievePrecOb = new classIPDPresciption;
	$retrievePrecOb->setIpdBedAllotmentID($allot_id);
	$prec_array = $retrievePrecOb->retrieveAllIPDPresciptionByAllotID();
	
	///////////// retrieve patient single data ///////////////////////////////
	
	$retrievePatientOb = new classPatient;
	$retrievePatientOb->setPatientAutoID($patient_id);
	$patient_single_detail = $retrievePatientOb->retrievePatientByPatientID();
	$patient_age = $retrievePatientOb->age_from_dob($patient_single_detail[0]['dob']);
	
	$imageOb = new classImages;
	$imageOb->setPatientAutoID($patient_id);
	$image_id = $imageOb->fetchImageOfPatient();
	$images_array = $imageOb->fetchAllImageOfPatient();
	
	$allotmentOb = new classWardMgmt;
	$allotmentOb->setWardBedAllotID($allot_id);
	$allotment_array = $allotmentOb->retrieveBedAllotmentDetailsByAllotID();
	
	
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg();
}

try
{
	$retrieveOb = new classVisits;
	$retrieveOb->setOrganizationID($_SESSION['security']['org_id']);
	$medicine_array = $retrieveOb->retrieveMedicines();
	$labtest_array = $retrieveOb->retrieveLabTests();
	$procedure_array = $retrieveOb->retrieveProcedures();
	$dosage_array = $retrieveOb->retrieveDosage();
	$dressing_array = $retrieveOb->retrieveDressing();
	
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg();
}




/*echo '<pre>';
print_r($prec_array);
echo '</pre>';	*/

?>
<!DOCTYPE html>

<html><!-- InstanceBegin template="/Templates/main.dwt.php" codeOutsideHTMLIsLocked="false" -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<head> 
    <link rel="shortcut icon" href="../images/favicon.png">
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Med2TEC Hospital Management Information System</title>
    <!-- InstanceEndEditable -->
    <!--Core CSS -->
    <link href="../bs3/css/bootstrap.min.css" rel="stylesheet"> 
    <link href="../css/style.css" rel="stylesheet">
    <link href="../css/style-responsive.css" rel="stylesheet"/> 
    <link href="../popUp/popUp.css" rel="stylesheet">
    <link href="../css/bootstrap-fullcalendar.css" rel="stylesheet"/> 
    
    <link href="../css/clndr.css" rel="stylesheet">
    
    <link href="../css/css/font-awesome.css" rel="stylesheet">
    
    <link href="../assets/jquery-ui/jquery-ui-1.10.1.custom.min.css" rel="stylesheet">
    <link href="../assets/jvector-map/jquery-jvectormap-1.2.2.css" rel="stylesheet">    
    <link href="../assets/jquery-multi-select/css/multi-select.css" rel="stylesheet" type="text/css">
    <!--clock css-->
    <link href="../assets/css3clock/css/style.css" rel="stylesheet"> 
    <!--Morris Chart CSS -->
    <link rel="stylesheet" href="../assets/morris-chart/morris.css">
    <!-- Custom styles for this template -->
   
    <link href="../datepicker/jquery-ui.css" rel="stylesheet" >   
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>

<section id="container">
    <!--header start-->
    <header class="header fixed-top clearfix">
        <!--logo start-->
        <div class="brand">

            <a href="home.php" class="logo">
                <img src="../images/logo.png" alt="">
            </a>
            <div class="sidebar-toggle-box">
                <div class="fa fa-bars"></div>  
            </div>
        </div> 
        <!--logo end-->

        <div class="nav notify-row" id="top_menu" style="float: right; margin-top: 16px; margin-left: 0px; margin-right: 10px;">
            <!--  notification start -->
             <img alt="" src="../images/org_logos/<?php echo $_SESSION['security']['org_id']?>.png">
            <!--  notification end -->
        </div>
        <div class="top-nav clearfix">
            <!--search & user info start-->
            <ul class="nav pull-right top-menu">
                <li>
                    <div class="toggle-right-box"><!-- InstanceBeginEditable name="print" -->
                   <a href="javascript:Popup('printopdhistory.php')"><i class="fa fa-print" style="margin-left: 11px; margin-top: 11px;"></i></a>
					<!-- InstanceEndEditable --></div>
                </li>
                <!-- user login dropdown start-->
                <li class="dropdown">
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <img alt="" src="../images/avatar1_small.jpg"> 
                        <span class="username"><?php echo $username;?></span>
                        <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu extended logout">
                        <li><a href="profile.php"><i class=" fa fa-suitcase"></i>Profile</a></li>
                        <li><a href="#update_password-box" class="update_password-window"><i class="fa fa-cog"></i> Change Password</a></li>
                        <li><a href="../logout.php"><i class="fa fa-key"></i> Log Out</a></li>
                    </ul>
                </li>
                <!-- user login dropdown end -->
                <li>
                    <div class="toggle-right-box">
                        <div class="fa fa-bars"></div>
                    </div>
                </li>
            </ul>
            <!--search & user info end-->
        </div>
    </header>
    <!--header end-->
    <!--sidebar start-->
   <aside>
        <div id="sidebar" class="nav-collapse">
            <!-- sidebar menu start-->
            <ul class="sidebar-menu" id="nav-accordion">
					  	<li>
                    	<a class="active" href="db.php" style="background:#0072BC;">
                        <i class="fa fa-dashboard"></i>
                        <span>Dashboard</span>
                    	</a>
                		</li>
					  <?php
					  
				
					  
$orgOb = new classUser;
$orgOb->retrieveOrgDataByOrgID($_SESSION['security']['org_id']);
           
		  
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==5||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==10)
				{
					?>
					    <li class="sub-menu">
                    	<a href="dbpatient.php" style="background:#BC1C4A;">
                        <i class="fa fa-user"></i>
                        <span>Patient Registration</span>
                    	</a>
                    	</li>
					  <?php
				}
		  
		  if($orgOb->getOPD())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==4||$_SESSION['security']['userrole_id']==5||$_SESSION['security']['userrole_id']==9)
				{
					?>
						<li class="sub-menu">
						<a href="dbopd.php" style="background:#003366;">
						<i class="fa fa-th"></i>
						<span>Out-Patient (OPD)</span>
						</a>
						</li>
						<?php
				}
		  }
		  if($orgOb->getIPD())
		  {
			  	?>
						<li class="sub-menu">
						<a href="dbipd.php" style="background:#3AC7F9;">
						<i class="fa fa-th"></i>
						<span>In-Patient (IPD)</span>
						</a>
						</li>
						<?php
					
		  }
		  if($orgOb->getOT())
		  {
			   		?>
						<li class="sub-menu">
						<a href="dbot.php" style="background:#D6502A;">
						<i class="fa fa-th"></i>
						<span>Operation Theater</span>
						</a>
						</li>
                        <?php
		  }			
		  if($orgOb->getPharmacy())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==6||$_SESSION['security']['userrole_id']==7||$_SESSION['security']['userrole_id']==8||$_SESSION['security']['userrole_id']==9)
				{
			  		?>
						<li class="sub-menu">
						<a href="dbpharmacy.php" style="background:#00869C;">
						<i class="fa fa-th"></i>
						<span>Pharmacy</span>
						</a>
						</li>
						<?php
				}
		  }
		  if($orgOb->getDiagnostic())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==14||$_SESSION['security']['userrole_id']==9)
				{
			  	?>
						<li>
						<a href="dbdiagnostics.php" style="background:#380E4D;">
						<i class="fa fa-th"></i>
						<span>Diagnostics </span>
						</a>
						</li>
						<?php
				}
		  }
		  if($orgOb->getEmergency())
		  {
					  ?>
						<li class="sub-menu">
						<a href="dbemergency.php" style="background:#8EC63F;">
						<i class="fa fa-tasks"></i>
						<span>Emergency </span>
						</a>
						</li>
						<?php
		  }
          if($orgOb->getAdmin())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==9)
				{
					?>
						<li class="sub-menu">
						<a href="dbadmin.php" style="background:#28282E;">
						<i class="fa fa-laptop"></i>
						<span>Admin Panel</span>
						</a>
						</li>
						<?php
				}
		  }
		  ?>
               
            </ul> 
            <div style="position: absolute; bottom: 2%; padding-left:10%;"><a href="http://www.softusion.com/" target="_blank"><img width="30" height="40" src="../images/SoftusionLOGO.png" alt=""><span style="font-size: 11px; float: right; margin-top: 15%;">Designed by Softusion Inc.</span></a></div><br>
            <!-- sidebar menu end-->
        </div>
    </aside>
    <!--sidebar end-->
    <!--main content start-->
	<!-- InstanceBeginEditable name="center" -->
  <script type="text/javascript">

     function Popup(apri) { 
        window.open(apri,"","top=10,left=200,width=850,height=700,status=no,menubar=no,toolbar=no,scrollbars=yes"); 
     }
	 
  </script>     

  <section id="main-content">
    <section class="wrapper">
    
        <table cellspacing="0" cellpadding="0" width="100%" border="0" style="font-size:11px;">
      <tbody>
        <tr>
          <td width="12%" align="center"><a href="dbipd.php"><img src="../images/icondb.png"></a></td>
          <td width="12%" align="center"><a href="mgmtinpatients.php"><img src="../images/iconipd.png"></a></td>
          <td width="12%" align="center"><a href="mgmtadmissions.php"><img src="../images/iconadm.png"></a></td>
          <td width="12%" align="center"><a href="ipdhistory.php"><img src="../images/iconvisits.png"></a></td>
          <td width="12%" align="center"><a href="#add_medicine-box" class="add_medicine-window" id="add_medicine"><img src="../images/iconnewmed.png" /></a></td>
          <td width="12%" align="center"><a href="#add_labtest-box" class="add_labtest-window" id="add_labtest"><img src="../images/iconlab.png" /></a></td>
          <td width="12%" align="center"><a href="#add_procedure-box" class="add_procedure-window" id="add_procedure"><img src="../images/iconradio.png" /></a></td>
          <td width="12%" align="center"></td>
          <td width="2%" align="center">&nbsp;</td>
        </tr>
        <tr>
          <td align="center"><a href="dbipd.php">In Patient</a></td>
          <td align="center"><a href="mgmtinpatients.php">Beds Register</a></td>
          <td align="center"><a href="mgmtadmissions.php">Admissions & Discharge</a></td>
          <td align="center"><a href="ipdhistory.php">Visit History</a></td>
          <td align="center"><a href="#add_medicine-box" class="add_medicine-window" id="add_medicine">Add Medication</a></td>
          <td align="center"><a href="#add_labtest-box" class="add_labtest-window" id="add_labtest">Request Lab Tests</a></td>
          <td align="center"><a href="#add_procedure-box" class="add_procedure-window" id="add_procedure">Request Procedures</a></td>
          <td align="center"></td>
          <td height="24" align="center">&nbsp;</td>
        </tr>
      </tbody>
    </table>
    
		<br>
 
      	<!-- page start-->
      
      	<header class="panel-heading">
            <img src="../images/titleclinicaloverview.png">
          </header>
          
		<?php
        if(isset($error_message)&&$error_message!='')
        {
			?>
			<span class="message_red"><?php echo $error_message;?></span>
			<?php
        }
        ?>

          <div class="row">
          
            <div class="col-md-8">
                <!--earning graph start-->
                
                <section class="panel">
                
                    <header class="panel-heading"> 
                        <strong>Stats</strong> 
                        <span style="font-size: 8pt; color: #FF6600; line-height:1.4em">Enter Stats</span>
                        <span class="tools pull-right"><a href="javascript:;" class="fa fa-chevron-down"></a> <a href="javascript:;" class="fa fa-cog"></a> <a href="javascript:;" class="fa fa-times"></a> </span>
                    </header>
                    
                    <img src="../images/graph.png" width="100%" height="200">
                    
                </section>
                
                <section class="panel">
                 <header class="panel-heading"> <strong>Medications</strong> <a href="#add_medicine_presc-box" class="add_medicine_presc-window" id="add_medicine_presc"><span style="font-size: 8pt; color: #FF6600; line-height:1.4em">Add Medicine</span></a>
                  <span class="tools pull-right">
                   <a href="javascript:;" class="fa fa-chevron-down"></a> <a href="javascript:;" class="fa fa-cog"></a> <a href="javascript:;" class="fa fa-times"></a> </span>
    
                   </header>
                  
                 <table width="100%" border="0" cellspacing="5" cellpadding="5"  class="display table table-bordered table-striped" id="dynamic-table">  
                      <tr>
                        <th width="40%" align="center" class="display table table-bordered table-striped"> Date</th>
                        <td  align="center">26 Mar 2015</td>
                        <td  align="center">27 Mar 2015</td>
                        <td  align="center">28 Mar 2015</td>
                        <td  align="center">29 Mar 2015</td>
                        <td  align="center">30 Mar 2015</td>
                      </tr>
                      <tr>
                        <th width="40%" align="center" class="display table table-bordered table-striped"> Time</th>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>6 AM</td>
                        <td>12 PM</td>
                        <td>2 PM</td>
                        <td>6 PM</td>
                        <td>9 PM</td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                      </tr>
                      
                        
                      	<?php
						for($prm=0;$prm<count($prec_array);$prm++)
						{
							if($prec_array[$prm]['product_id']!=0)
							{	
								$retreiveMedOb = new classVisits;
								$retreiveMedOb->setMedicineID($prec_array[$prm]['product_id']);
								$med_info = $retreiveMedOb->retrieveMedicineByMedicineID();
								
								?>
                                <tr class="gradeC">
                      
                                    <td width="28%">
                                    	<!--<table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped"><tr><td width="100%">-->
                                        <a href="?del_prec=<?php echo base64_encode($prec_array[$prm]['presc_item_id']);?>"><img border="0" alt="Delete" src="../images/cross.png"></a><?php echo ucwords($med_info[0]['product_name']);?> 
                                       <!-- </td></tr></table>-->
                                    </td>
                                    <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                                      <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                    </table></td>
                                    <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                                      <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                    </table></td>
                                    <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                                      <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                    </table></td>
                                    <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                                      <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                    </table></td>
                                    <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                                      <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                    </table></td>
                                
                                </tr>
                                <?php
							}
						}
						?>  
                        <tr>
                        <td width="40%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        	<td></td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0"  class="display table table-bordered table-striped">
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        </tr>
                        </table></td>
                        </tr>
                        
                      <tr>
                        <th align="left" valign="top" class="display table table-bordered table-striped">RESPIRATION</th>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <th align="left" valign="top" class="display table table-bordered table-striped">BOWELS</th>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <th align="left" valign="top" class="display table table-bordered table-striped">REMARKS</th>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                </table>
                </section>
                
                <!--<section class="panel">
                  <header class="panel-heading"> <strong>Medications</strong>
                  <span class="tools pull-right">
                   <a href="javascript:;" class="fa fa-chevron-down"></a> <a href="javascript:;" class="fa fa-cog"></a> <a href="javascript:;" class="fa fa-times"></a> </span> <br>
    
                   </header>
                  <div class="panel-body">
                    <table  class="display table table-bordered table-striped" id="dynamic-table">
                      <thead>
                        <tr>
                         <th width="15%" align="left">Date</th>
                         <th width="24%" align="center">Medication</th>
                         <th width="8%" align="center">Quantity</th>
                         <th width="6%" align="left">Days</th>
                         <th width="19%" align="left">Pharmacy</th>
                         <th width="19%" align="center">Physician</th>
                         <th width="9%" align="center">Delete</th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr class="gradeX">
                          <td>12-04-2014</td>
                          <td>desprine</td>
                          <td align="center">22</td>
                          <td align="center">25</td>
                          <td align="left">Pharmcy Test</td>
                          <td >Physician Test</td>
                          <td align="right" ><a href="#"><img src="../images/delete.png"></a></td>
                        </tr>
                      </tbody>
                      <tfoot>
                      </tfoot>
                    </table>
                  </div>
                </section>-->
                
                <!--<section class="panel">
                  <header class="panel-heading"> <strong>IPD Visit History</strong><span class="tools pull-right"> <a href="javascript:;" class="fa fa-chevron-down"></a> <a href="javascript:;" class="fa fa-cog"></a> <a href="javascript:;" class="fa fa-times"></a> </span><br>
     </header>
                  <div class="panel-body">
                    <table  class="display table table-bordered table-striped" id="dynamic-table">
                      <thead>
                        <tr>
                         <th width="20%" align="left">Admission Date</th>
                         <th width="30%" align="left">Medical Issue</th>
                         <th width="30%" align="center">Result</th>
                         <th width="20%" align="center">Discharged on</th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr class="gradeX">
                          <td>12 Apr 2014</td>
                          <td>Heart Problem</td>
                          <td >Operated</td>
                          <td >16 Apr 2014</td>
                        </tr>
                      </tbody>
                      <tfoot>
                      </tfoot>
                    </table>
                  </div>
                </section>-->
                
                <!--<section class="panel">
                  <header class="panel-heading"> <strong>OPD Visit History</strong><span class="tools pull-right"> <a href="javascript:;" class="fa fa-chevron-down"></a> <a href="javascript:;" class="fa fa-cog"></a> <a href="javascript:;" class="fa fa-times"></a> </span> <br>
    </header>
                  <div class="panel-body">
                    <table  class="display table table-bordered table-striped" id="dynamic-table">
                      <thead>
                        <tr>
                         <th width="20%" align="left">Visit Date</th>
                         <th width="30%" align="center">Medical Issue</th>
                         <th width="30%" align="left">Doctor visited</th>
                         <th width="20%" align="center">Medicines</th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr class="gradeX">
                          <td>10 Apr 2014</td>
                          <td >Heart Problem</td>
                          <td>Dr. Iftikhar Durrani</td>
                          <td >HCQ</td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                </section>-->
                
                <!--earning graph end-->
              </div>
          
            <div class="col-md-4">
            <div class="profile-nav alt">
            <section class="panel">
                <div class="user-heading alt clock-row terques-bg">
                
                <h1><?php if(isset($patient_single_detail[0]['patient_id'])){echo $patient_single_detail[0]['patient_id'];}?> - <?php if(isset($patient_single_detail[0]['patient_fname'])){echo $patient_single_detail[0]['patient_fname'].' '.$patient_single_detail[0]['patient_lname'];}else{echo 'Outdoor';}?></h1>
                
                <p class="text-left">Age: <?php echo $patient_age?> <span style="float:right; padding-right:10%;">Blood Group: <?php if(isset($patient_single_detail[0]['blood_group'])){echo $patient_single_detail[0]['blood_group'];}?></span></p><br>
                
                <span>Bed No: <?php echo $allotment_array[0]['ipd_bed_no'];?></span><span style="float:right; padding-right:10%;">Adm. No: <?php echo $allotment_array[0]['ipd_bed_allotment_id'];?></span><br> 
                
                <span>Admitted at: <?php echo date('d M Y h:i A',$allotment_array[0]['allot_time']);?></span></p><br>
                
                <p class="text-left"></p>
                
                <span>Phone: <?php if(isset($patient_single_detail[0]['phone'])){echo $patient_single_detail[0]['phone'];}?></span></br>
                
                <span>Address: <?php  if(isset($patient_single_detail[0]['address'])){echo $patient_single_detail[0]['address'];}?></span></p>
                
                </div>
            </section>
            </div>
            </div>
            
            <div class="col-md-3">
            <section class="panel">
                <div class="panel-body">
                    <div class="top-stats-panel">
                    
                        
                    
                        <form action="" method="post" enctype="multipart/form-data">
                        
                        <h4 class="widget-h">Image History <?php
						if(isset($images_array[0]['image_id']))
						{
							?>
                            <input name="compare_image" type="submit" class="btn btn-success btn-sm" style=" background-color:white; border-color:white;color:#ff6600;font-size: 9pt;line-height:1.4em" value="Compare Images"/>
                            <?php
						}
						?></h4>
                        <?php
                        if(isset($images_array[0]['image_id']))
                        {
                            ?>
                            <div style="float:left; width:100%;">
                            <?php
                            for($im=0;$im<count($images_array);$im++)
                            {
                                ?>
                                <div style="float:left;width:20%;">
                                <img src="../images/patient_images/<?php echo $images_array[$im]['image_id'];?>.jpg" height="63" width="60" >
                                <input type="checkbox" name="image_ids[]" value="<?php echo $images_array[$im]['image_id'];?>">
                                </div>
                                <!--<div style=" margin-right:5px;">
                                <img src="../images/cross.png" width="10" height="12">
                                </div>-->
                                <?php
                            }
                            ?>
                            </div>
                            
                            <input name="delete_image" type="submit" class="btn btn-success btn-sm" style=" background-color:white; border-color:white;color:#ff6600; padding:0;" value="Delete"/>
                            
                            
                            <?php
                        
                        }
                        else
                        {
							?>
							<span style="float:left; margin-top:10px; width:100%;">
							<img src="../images/photo.png" width="63" height="60"><br><br>
							</span>
							<?php
                        }
                        ?>
                        </form>
                    
                        
                        <table width="100%" border="0" cellspacing="1" cellpadding="1">
                        <form action="" method="post" enctype="multipart/form-data">
                        <tr>
                            <td width="100%" align="left" valign="top">Select Image:<table width="100%" border="0" cellspacing="1" cellpadding="1">
                            <tr>
                                <td width="30%" style="border: solid 1px #ccc;"><input type="file" name="image" value="" id="image"/></td>
                                <td width="70%"  valign="middle">
                                <input type="submit" name="upload_image" value="Upload" /></td>
                            </tr>
                            </table></td>	
                        </tr>
                        </form>   
                        </table>
                        
                         
                    </div>
                </div>
            </section>
            </div>
            
            <div class="col-md-3">
            <section class="panel">
            
                <header class="panel-heading"> <strong>Lab Test Requests</strong> 
                <a href="#add_labtest_presc-box" class="add_labtest_presc-window" id="add_labtest_presc"><span style="font-size: 8pt; color: #FF6600; line-height:1.4em">Add Request</span></a></header>
                <div class="panel-body">
                <table class="display table table-bordered table-striped" id="dynamic-table">
                <thead>
                <tr>
                    <th width="40%" align="left">Test</th>
                    <th width="40%" align="left">Requested by</th>
                    <th width="20%" align="center">Results</th>
                </tr>
                </thead>
                <tbody>
                <?php
				for($prm=0;$prm<count($prec_array);$prm++)
				{
					if($prec_array[$prm]['labtest_id']!=0)
					{	
						$retreiveMedOb = new classVisits;
						$retreiveMedOb->setLabTestID($prec_array[$prm]['labtest_id']);
						$labtest_info = $retreiveMedOb->retrieveLabTestsByLabTestID();
						
						$userOb = new classUser;
						$userOb->retrieveUserAllDataByUserID($prec_array[$prm]['requested_by']);
						?>
						<tr class="gradeX">
						
						<td>
                        <a href="?del_prec=<?php echo base64_encode($prec_array[$prm]['presc_item_id']);?>"><img border="0" alt="Delete" src="../images/cross.png"></a><?php echo ucwords($labtest_info[0]['labtest_name']);?><br>
						<span class="message_grey"><?php echo @date('d M Y h:i A',$prec_array[$prm]['requested_time']);?></span>
                        </td>
						<td><?php echo ucwords($userOb->getFirstName().' '.$userOb->getLastName());?></td>
						<td><a href=""><img src="../images/iconresults.png"></a></td>
						</tr>
						
						
						<?php
					}
				}
				?>  
                
                </tbody>
                <tfoot>
                </tfoot>
                </table>
                </div>
            
            </section>
            </div>
          
            <div class="col-md-3" style="float:right;">
            <section class="panel">
                <header class="panel-heading"> <strong>Procedure Requests</strong> 
                 <a href="#add_procedure_presc-box" class="add_procedure_presc-window" id="add_procedure_presc"><span style="font-size: 8pt; color: #FF6600; line-height:1.4em">Add Request</span></a></header>
                <div class="panel-body">
                <table  class="display table table-bordered table-striped" id="dynamic-table">
                <thead>
                <tr>
                    <th width="40%" align="left">Procedure</th>
                    <th width="40%" align="left">Requested by</th>
                    <th width="20%" align="center">Results</th>
                </tr>
                </thead>
                <tbody>
                <?php
				for($prm=0;$prm<count($prec_array);$prm++)
				{
					if($prec_array[$prm]['procedure_id']!=0)
					{	
						 $retreiveMedOb = new classVisits;
                         $retreiveMedOb->setProcedureID($prec_array[$prm]['procedure_id']);
                         $procedure_info = $retreiveMedOb->retrieveProcedureByProcedureID();
						
						$userOb = new classUser;
						$userOb->retrieveUserAllDataByUserID($prec_array[$prm]['requested_by']);
						?>
						<tr class="gradeX">
						
						<td>
                        <a href="?del_prec=<?php echo base64_encode($prec_array[$prm]['presc_item_id']);?>"><img border="0" alt="Delete" src="../images/cross.png"></a><?php echo ucwords($procedure_info[0]['procedure_name']);?><br>
						<span class="message_grey"><?php echo @date('d M Y h:i A',$prec_array[$prm]['requested_time']);?></span>
                        </td>
						<td><?php echo ucwords($userOb->getFirstName().' '.$userOb->getLastName());?></td>
						<td><a href=""><img src="../images/iconresults.png"></a></td>
						</tr>
						
						
						<?php
					}
				}
				?>  
                </tbody>
                <tfoot>
                </tfoot>
                </table>
                </div>
            </section>
            </div>

          
          </div>
      
      <!-- page end-->
    </section>
  </section>
  <!-- InstanceEndEditable --><!--main content end-->
<!--right sidebar start-->
 
<!--right sidebar end-->
</section>
<!-- Placed js at the end of the document so the pages load faster -->
<!--Core js-->
<!--<script src="../js/jquery-1.10.2.min.js"></script>-->
  
 
<script src="../assets/jquery-ui/jquery-ui-1.10.1.custom.min.js"></script>
<script src="../bs3/js/bootstrap.min.js"></script>



<script src="../js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../popUp/popUp.js"></script>
<script src="../js/ajax.js"></script>

<script src="../js/lib/jquery.js"></script>
<script src="../assets/fullcalendar/fullcalendar/fullcalendar.min.js"></script>
<script src="../js/calendar/external-dragging-calendar.js"></script>
<script src="../js/accordion-menu/jquery.dcjqaccordion.2.7.js"></script>
<script src="../js/scrollTo/jquery.scrollTo.min.js"></script>
<script src="../js/nicescroll/jquery.nicescroll.js" type="text/javascript"></script>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/flot-chart/excanvas.min.js"></script><![endif]-->
<script src="../assets/jQuery-slimScroll-1.3.0/jquery.slimscroll.js"></script>
<script src="../assets/skycons/skycons.js"></script>
<script src="../assets/jquery.scrollTo/jquery.scrollTo.js"></script>
<script src="../js/jquery.easing.min.js"></script>
<script src="../assets/calendar/clndr.js"></script>
<script src="../js/underscore-min.js"></script>
<script src="../assets/calendar/moment-2.2.1.js"></script>
<script src="../js/calendar/evnt.calendar.init.js"></script>
<script src="../assets/jvector-map/jquery-jvectormap-1.2.2.min.js"></script>
<script src="../assets/jvector-map/jquery-jvectormap-us-lcc-en.js"></script>
<script src="../assets/gauge/gauge.js"></script>



<!--clock init-->
<script src="../assets/css3clock/js/script.js"></script>
<!--Easy Pie Chart-->
<script src="../assets/easypiechart/jquery.easypiechart.js"></script>
<!--Sparkline Chart-->
<!--Morris Chart-->
<script src="../assets/morris-chart/morris.js"></script>
<script src="../assets/morris-chart/raphael-min.js"></script>
<!--jQuery Flot Chart-->
<script src="../assets/flot-chart/jquery.flot.animator.min.js"></script>
<script src="../assets/flot-chart/jquery.flot.growraf.js"></script>
<script src="../js/dashboard.js"></script>
<script src="../js/custom-select/jquery.customSelect.min.js" ></script>
<!--common script init for all pages-->
<script src="../js/scripts.js"></script>
<!--dynamic table initialization -->
<script src="../js/dynamic_table/dynamic_table_init.js"></script>



<!--dynamic table initialization -->
<script src="../js/dynamic_table/dynamic_table_init.js"></script>
<!--<start===================>-->
<script src="../js/lib/jquery.js"></script>


<script src="../bs3/js/bootstrap.min.js"></script>



<script class="include" type="text/javascript" src="../js/accordion-menu/jquery.dcjqaccordion.2.7.js"></script>

<script src="../js/scrollTo/jquery.scrollTo.min.js"></script>
<script src="../js/nicescroll/jquery.nicescroll.js" type="text/javascript"></script>
<!--Easy Pie Chart-->
<script src="../assets/easypiechart/jquery.easypiechart.js"></script>
<!--Sparkline Chart-->
<script src="../assets/sparkline/jquery.sparkline.js"></script>
<!--jQuery Flot Chart-->
<script src="../assets/flot-chart/jquery.flot.js"></script>
<script src="../assets/flot-chart/jquery.flot.tooltip.min.js"></script>
<script src="../assets/flot-chart/jquery.flot.resize.js"></script>
<script src="../assets/flot-chart/jquery.flot.pie.resize.js"></script>
<script type="text/javascript" src="../assets/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="../assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>

<!--dynamic table-->
<!--common script init for all pages-->
<script src="../js/scripts.js"></script>

<!--dynamic table initialization -->
<script src="../js/dynamic_table/dynamic_table_init.js"></script>

<script type="text/javascript" src="../datepicker/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../datepicker/jquery-ui.js"></script>

<!--<script type="text/javascript" src="../popUp/jquery-1.9.0.js"></script>-->
<script type="text/javascript">

 function Popup(apri) { 
	window.open(apri,"","top=10,left=200,width=800,height=700,status=no,menubar=no,toolbar=no,scrollbars=yes"); 
 }
</script> 

<div id="update_password-box" class="update_password-popup">
    
    <div class="pop_header">
        <span>Change Password</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
      <tr>
        <td>
          <div id="result_update_password_form"></div>
          
          <form action="" method="post" id="update_password_form" class="cmxform form-horizontal" onSubmit="return false;">
          	
            <br>
            
         	<div class="form-group">
            <label class="control-label col-lg-3" for="lastname">New Password:</label>
                <div class="col-lg-6">
                    <input type="password" name="password" class="form-control" value="" id="exampleInputPassword1">
                </div>
            </div>
           
            <p align="right">
            	<input type="hidden" name="user_id" value="<?php if(isset($user_id)&&$user_id!=''){echo $user_id;}else{ echo 
				$_SESSION['security']['user_id'];}?>">
                <input type="hidden" name="updateUserPwd" value="yes">
                <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Update"/>
            </p>
            
          </form>
          </td>
          
      </tr>
    </table>
</div> 
 
</body>  
<!-- InstanceEnd --></html>


<div id="add_medicine-box" class="add_medicine-popup">
    
    <div class="pop_header">
        <span>Add Medicine</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
      <tr>
        <td>
          <div id="result_insert_medicine_form"></div>
          
          <form action="" method="post" id="insert_medicine_form" class="cmxform form-horizontal" onsubmit="return false;">
          
          	<div class="form-group">
            <label class="control-label col-lg-3" for="firstname">Medicine:</label>
            	<div class="col-lg-6">
                     <input type="text" name="medicine_name" id="medicine_name" value="" class="form-control">
                </div>
            </div>
            
            
            <p align="right">
                <input type="hidden" name="add_medicine" value="Add_medicine">
               <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Add"/>
            </p>
            
          </form>
          </td>
          
      </tr>
    </table>
</div>

<div id="add_labtest-box" class="add_labtest-popup">
    
    <div class="pop_header">
        <span>Add Lab Test</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
      <tr>
        <td>
          <div id="result_insert_labtest_form"></div>
          
          <form action="" method="post" id="insert_labtest_form" class="cmxform form-horizontal" onsubmit="return false;">
          
          	<div class="form-group">
            <label class="control-label col-lg-3" for="firstname">Lab Test:</label>
            	<div class="col-lg-6">
                     <input type="text" name="labtest_name" id="labtest_name" value="" class="form-control">
                </div>
            </div>
            
            
            <p align="right">
                <input type="hidden" name="add_labtest" value="Add_labtest">
               <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Add"/>
            </p>
            
          </form>
          </td>
          
      </tr>
      
      <tr>
      	<td><a href="mgmtpresctests.php">Manage Lab Tests</a></td>
      </tr>
      
    </table>
</div>

<div id="add_procedure-box" class="add_procedure-popup">
    
    <div class="pop_header">
        <span>Add Procedure</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
      <tr>
        <td>
          <div id="result_insert_procedure_form"></div>
          
          <form action="" method="post" id="insert_procedure_form" class="cmxform form-horizontal" onsubmit="return false;">
          
          	<div class="form-group">
            <label class="control-label col-lg-3" for="firstname">Procedure:</label>
            	<div class="col-lg-6">
                     <input type="text" name="procedure_name" id="procedure_name" value="" class="form-control">
                </div>
            </div>
            
            
            <p align="right">
                <input type="hidden" name="add_procedure" value="Add_procedure">
               <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Add"/>
            </p>
            
          </form>
          </td>
          
      </tr>
      
       <tr>
      	<td><a href="mgmtprescprocedures.php">Manage Procedures</a></td>
      </tr>
      
    </table>
</div>

<div id="add_medicine_presc-box" class="add_medicine_presc-popup">
    
    <div class="pop_header">
        <span>Add Medicine</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
    <br>
      <tr>
        <td>
          <div id="result_insert_medicine_presc_form"></div>
          
          <form action="" method="post" id="insert_medicine_presc_form" class="cmxform form-horizontal">
          
          
            <div class="form-group">
            <label class="control-label col-lg-3" for="firstname">Select Medicine:</label>
            <div class="col-lg-6">
            <select name="medicine_id[]"  class="form-control" aria-controls="dynamic-table" style=" width: 320px; height: 110px;" multiple>
           	<?php
            if(isset($medicine_array[0]['product_id']))
            {
				for($m=0;$m<count($medicine_array);$m++)
				{
					$singleProdOb = new classProduct;
					$prod_loc_array = $singleProdOb->retrieveProductLocationRelationship($medicine_array[$m]['product_id'],$_SESSION['security']['location_id']);
					?>
					<option value="<?php echo $medicine_array[$m]['product_id'];?>"><?php echo ucwords($medicine_array[$m]['product_name']).' - '.$medicine_array[$m]['medicine_type'].' - Qty : '.$prod_loc_array[0]['unit_qtyinstock'];?></option>
					<?php
				}
            }
            ?>
            </select>
            </div>
            </div>
            
            
            <p align="right">
            	<input type="hidden" name="presc_type" value="medicine">
               <input type="hidden" name="add_presc" value="Add_presc">
               <input name="ajax_submit" type="submit" class="btn btn-info" value="Add"/>
            </p>
            
          </form>
          </td>
          
      </tr>
    </table>
</div>

<div id="add_labtest_presc-box" class="add_labtest-popup">
    
    <div class="pop_header">
        <span>Add Lab Test</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
    <br>
      <tr>
        <td>
          <div id="result_insert_labtest_form"></div>
          
          <form action="" method="post" id="insert_labtest_form" class="cmxform form-horizontal">
          
          	<div class="form-group">
            <label class="control-label col-lg-3" for="firstname">Select Lab Test:</label>
            	<div class="col-lg-6">
                     <select name="labtest_id[]"  class="form-control" aria-controls="dynamic-table" style=" width: 320px; height: 90px;" multiple>
                                <!--<option value="0">Select Lab Tests</option>-->
                                 <?php
                                if(isset($labtest_array[0]['labtest_id']))
                                {
                                    for($l=0;$l<count($labtest_array);$l++)
                                    {
                                        ?>
                                        <option value="<?php echo $labtest_array[$l]['labtest_id'];?>"><?php echo ucwords($labtest_array[$l]['labtest_name']);?></option>
                                        <?php
                                    }
                                }
                                ?>
                            </select>
                </div>
            </div>
            
            <p align="right">
            <input type="hidden" name="presc_type" value="labtest">
                <input type="hidden" name="add_presc" value="Add_presc">
               <input name="ajax_submit" type="submit" class="btn btn-info" value="Add"/>
            </p>
            
          </form>
          </td>
          
      </tr>
      
      
      
    </table>
</div>

<div id="add_procedure_presc-box" class="add_procedure-popup">
    
    <div class="pop_header">
        <span>Add Procedure</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
    <br>
      <tr>
        <td>
          <div id="result_insert_procedure_form"></div>
          
          <form action="" method="post" id="insert_procedure_form" class="cmxform form-horizontal">
          
          	<div class="form-group">
            <label class="control-label col-lg-3" for="firstname">Procedure:</label>
            	<div class="col-lg-6">
                      <select name="procedure_id[]"  class="form-control" aria-controls="dynamic-table" style=" width: 320px; height: 90px;" multiple>
                                <!--<option value="0">Select Procedures</option>-->
                                <?php
                                if(isset($procedure_array[0]['procedure_id']))
                                {
                                    for($p=0;$p<count($procedure_array);$p++)
                                    {
                                        ?>
                                        <option value="<?php echo $procedure_array[$p]['procedure_id'];?>"><?php echo ucwords($procedure_array[$p]['procedure_name']);?></option>
                                        <?php
                                    }
                                }
                                ?>
                            </select>
                </div>
            </div>
            
            
            <p align="right">
            	<input type="hidden" name="presc_type" value="procedure">
                <input type="hidden" name="add_presc" value="Add_presc">
               <input name="ajax_submit" type="submit" class="btn btn-info" value="Add"/>
            </p>
            
          </form>
          </td>
          
      </tr>
      
      
      
    </table>
</div>