<?php
$section = 'facility';
$title = 'Facility Info';
@$page = $_GET['id'];
include('header.php');
require_once('include_classes.inc');
$tabOBJ = new  Med_functions();  
$p_company_code=1;
$v_table ='MC_FACILITY'; 
$v_apps_code='MCH';
$v_is_actice=1;


?>

<div id="body">
<div class="wrap">

<h2><?=$title?></h2>

<ul id="subnav">
	<li id="subnav-weekly"     <?php if(!isset($page)) {?> class="here" <?php } ?> ><a href="facility.php">Facility</a></li>
	<li id="subnav-special"    <?php if($page=='information') {?> class="here" <?php } ?> ><a href="facility_information.php" >Facility Information</a></li> 
	<li id="subnav-promotions" <?php if($page=='timing') {?> class="here" <?php } ?> ><a href="facility_timing.php">Facility Timing</a></li> 
	  
</ul>

<form method="post" id="frmPricesignsPreview" action="facility.php">
<div style="padding:15px;"  align="center">
<fieldset  style="width: 79em; text-align:left;" >
	
          <div>
			  <div class="row">
			  Facility Nmae: 
			  <select name="s_facility_id">
			  
			  <?php 
			  	$result= $tabOBJ->getFacilityName();
			  	
			  while($colum= $result->fetch_row() ){  ?>
			  <option value="<?php echo $colum[0];?>" ><?php echo $colum[1];?></option>
			  <?php } 
			  $result->close();
			  ?>
			  </select>
			 
			  City:
			  <input name="s_city" id="s_city" class="" value=""/>
			  State:
			  <input name="s_state" id="s_state" class="" value=""/>
			  Phone#:
			  <input name="s_phone" id="s_phone" class="" value=""/>
			  <button type="submit" class="add"> <img  src="public/img/search1.png"  style="= width:32px; height:32px;"/></button>
			  </div>
		  </div>
          
    <div class="buttonrow add">
		
	
	</div>
 <!--
    <div class="buttonrow add">
		<button type="button" class="add"> <img  src="public/img/add.png"  style="= width:128px; height:64px;"/></button>
		<button type="button" class="save"><img  src="public/img/save.png" style="= width:128px; height:64px;"/> </button>
	</div>
	
-->
</fieldset> 
</div> 
</form>

<?php  
$v_id=$_POST['s_facility_id'];
if(!is_null($v_id) || !empty($v_id)){
	$v_facility = $_POST['s_facility_id'];
}else {
	$v_facility=NULL;
}

?>
<div style="padding:0px;"  align="center">

<fieldset  style="width: 79em; text-align:left;" >
	<?php
					//$v_table="mc_facility";
				
					$v_facility_id=$v_facility;
					$v_city='';
					$v_state='';
					$v_phone01='';
					$v_company_code=1;
					$v_language=1;
					$col= array();
					$result  = $tabOBJ->getTableData($v_facility_id,$v_city,$v_state,$v_phone01,$v_company_code,$v_language);
				//	print_r($result->fetch_row());
				
	?>
	<table  align="center"  class="style sort" >
		<thead class="fixedHeader">
			<tr class="alternateRow">
			
			<?php
				 while ($row1 = $result->fetch_field()) {
					 
				?> 
				          <th>
				          <?php echo $row1->name;
						  	$col[]=$row1->orgname;
						  ?>
				          
				          </th>
				<?php } ?>
						 <th colspan="2">SELECT OPTION</th>
				</tr>
		</thead>
			
							
		<tbody class="scrollContent">
			<?php 
				
				  $v_col_count=	$result->field_count;
				  
				   while ($row = $result->fetch_row()) {
				   	
		    ?> 
			<tr <?php (!isset($page))?' class="new"':'';?> >
				<?php for($i=0;$i<$v_col_count;$i++){ ?>
				<td class="center">
					<?php printf("%s", $row[$i]); ?>
				</td>
					<input type="hidden" name="<?php echo $col[$i]; ?>" id="" class="" value="<?php echo $row[$i]; ?>" />
				<?php } ?>
				 <td>
				 	<a href="<?php echo "facility_information.php?id=".$row[0]."&mode=EDIT"; ?>"><img src="public/img/edit-icon.png"/></a>
				</td>
            	<td>
				 	<a href="<?php echo "#delet.php?id=".$row[0]."&mode=DELETE"; ?>" ><img  src="public/img/delete-icon.png" /></a>
				</td>
			</tr>
			
			<?php } ?> 
			<?php $result->close(); ?>
		</tbody>
	</table>
</fieldset> 
</div>


</div><!--/wrap-->
</div><!--/body-->

<?php include('footer.php'); ?>