<?php include('header.php'); ?>
<?php include('session.php'); ?>
<?php $get_id = $_GET['stdev_id']; ?><!-----------------------------------get device location details------------------------------------>
    <body>
		<?php include('navbar.php') ?>
        <div class="container-fluid">
            <div class="row-fluid">
				<?php include('device_location_slidebar.php'); ?>
                <div class="span9" id="content">
                     <div class="row-fluid">
					 <a href="device_location.php" class="btn btn-info"  id="return" data-placement="right" title="Click to return" ><i class="icon-arrow-left icon-large"></i> Back</a>
					  <script type="text/javascript">
		              $(document).ready(function(){
		              $('#return').tooltip('show');
		              $('#return').tooltip('hide');
		              });
		             </script>
					 <!-----------------------------------sc logo for print------------------------------------>
						<h2 id="sc" align="center"><image src="images/sclogo.png" width="45%" height="45%"/></h2>
						
						<?php $location_query = mysql_query("select * from stlocation	                     
	                     where stdev_id = '$get_id'")or die(mysql_error());
	                     $location_row = mysql_fetch_array($location_query);
	                    ?>
						
        <!-------------------------------block ------------------------------>
            <div id="block_bg" class="block">
                  <div class="navbar navbar-inner block-header">							
							  <div class="muted pull-left"><i class="icon-building"></i>  <?php echo $location_row['stdev_location_name']; ?> </div>
							  
                <div id="" class="muted pull-right">
				<?php 
				$my_device = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	WHERE stdevice.stdev_id = '$get_id' ")or die(mysql_error());
				$count_my_device = mysql_num_rows($my_device);?>
				 List: <span class="badge badge-info"><?php echo $count_my_device; ?></span>
				</div>
								
           </div>
							
<!-----------------------------------for Print display visible------------------------------------>							
<h4 id="sc">Location:<?php echo $location_row['stdev_location_name']; ?>   List
<div align="right" id="sc">Date:
<?php
 $date = new DateTime();
 echo $date->format('l, F jS, Y');
 ?></div>
</h4>
							
 <div class="container-fluid">
 <div class="row-fluid">						 
 <br/>
 <!-----------------------------------device categorized by their location details using nav pills------------------------------------>
	<div class="pull-left">
			    <ul class="nav nav-pills">
				<?php	
	           $my_device = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	WHERE stdevice.stdev_id = '$get_id' ")or die(mysql_error());
			    $count = mysql_num_rows($my_device);
			    ?>
				<li class="">
				<a href= 'mydevice.php<?php echo '?stdev_id='.$get_id; ?>')">All&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>
					
				</li>
				
			<?php	
	          $my_desktop = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='Desktop' ")or die(mysql_error());
			  $count = mysql_num_rows($my_desktop);
			  ?>
              					
				<li class="">			
				    <a href= 'mydesktop.php<?php echo '?stdev_id='.$get_id; ?>')">Dekstop&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
				<?php	
	             $my_ultrabook = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='ultra book' 
				")or die(mysql_error());
			    $count = mysql_num_rows($my_ultrabook);
               ?>
				<li class="">			
				    <a href= 'myultrabook.php<?php echo '?stdev_id='.$get_id; ?>')">Ultra Book&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				<?php	
	             $my_laptop = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='Laptop' 
				")or die(mysql_error());
			    $count = mysql_num_rows($my_laptop);
               ?>
				<li class="">			
				    <a href= 'mylaptop.php<?php echo '?stdev_id='.$get_id; ?>')">Laptop&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>				
				
			  <?php	
	             $my_server = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='Server' 
				")or die(mysql_error());
			    $count = mysql_num_rows($my_server);
               ?>
				<li class="">			
				    <a href= 'myserver.php<?php echo '?stdev_id='.$get_id; ?>')">Server&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>				
				<?php	
	             $my_vga = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='Adapter Converter' 
				")or die(mysql_error());
			    $count = mysql_num_rows($my_vga);
               ?>
				<li class="">			
				    <a href= 'myvga.php<?php echo '?stdev_id='.$get_id; ?>')">Adapter Converter&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				<?php	
	             $my_dvd = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='dvd' 
				")or die(mysql_error());
			    $count = mysql_num_rows($my_dvd);
               ?>
				<li class="">			
				    <a href= 'mydvd.php<?php echo '?stdev_id='.$get_id; ?>')">DVD&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>				
				
				<?php	
	            $my_ea= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='ETHERNET ADAPTER'  ")or die(mysql_error());
			    $count = mysql_num_rows($my_ea);
               ?>			
				<li class="">			
				    <a href= 'myea.php<?php echo '?stdev_id='.$get_id; ?>')">Ethernet Adapter&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
					<?php	
	            $my_pointer= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='pointer'  ")or die(mysql_error());
			    $count = mysql_num_rows($my_pointer);
               ?>			
				<li class="">			
				    <a href= 'mypointer.php<?php echo '?stdev_id='.$get_id; ?>')">Pointer&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
					<?php	
	            $my_netgear= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  ='$get_id' AND device_name.dev_name='NETGEAR WIFI ADAPTER'  ")or die(mysql_error());
			    $count = mysql_num_rows($my_netgear);
               ?>			
				<li class="">			
				    <a href= 'mynetgear.php<?php echo '?stdev_id='.$get_id; ?>')">Netgear WIFI Adapter&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
				<?php	
	            $my_spinetix= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='SPINETIX HMP 130'  ")or die(mysql_error());
			    $count = mysql_num_rows($my_spinetix);
               ?>			
				<li class="">			
				    <a href= 'myspinetix.php<?php echo '?stdev_id='.$get_id; ?>')">SPINETIX HMP 130&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				<?php	
	            $my_lcd= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='LCD MOBILE & TV'  ")or die(mysql_error());
			    $count = mysql_num_rows($my_lcd);
               ?>			
				<li class="">			
				    <a href= 'mylcd.php<?php echo '?stdev_id='.$get_id; ?>')">LCD TV&nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
				<?php	
	            $my_led= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='LED MOBILE & TV'  ")or die(mysql_error());
			    $count = mysql_num_rows($my_led);
               ?>			
				<li class="">			
				    <a href= 'myled.php<?php echo '?stdev_id='.$get_id; ?>')">LED TV &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				
				<?php	
	            $my_external= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='External Hardisk'  ")or die(mysql_error());
			    $count = mysql_num_rows($my_external);
               ?>			
				<li class="">			
				    <a href= 'myexternal.php<?php echo '?stdev_id='.$get_id; ?>')">External Hardisk &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				<li class="">			
				    <a href= 'myexternal.php<?php echo '?stdev_id='.$get_id; ?>')">External Hardisk &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
				<?php	
	            $a= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Access Point'")or die(mysql_error());
			    $count = mysql_num_rows($a);
               ?>			
				<li class="">			
				    <a href= 'myaccess_point.php<?php echo '?stdev_id='.$get_id; ?>')">Access Point &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
				<?php	
	            $c= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Core Switch'")or die(mysql_error());
			    $count = mysql_num_rows($c);
               ?>			
				<li class="">			
				    <a href= 'mycore_switch.php<?php echo '?stdev_id='.$get_id; ?>')">Core Switch &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				
				<?php	
	            $e= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Floor Switch'")or die(mysql_error());
			    $count = mysql_num_rows($e);
               ?>			
				<li class="">			
				    <a href= 'myfloor_switch.php<?php echo '?stdev_id='.$get_id; ?>')">Floor Switch &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				<?php	
	            $f= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Poe Switch'")or die(mysql_error());
			    $count = mysql_num_rows($f);
               ?>			
				<li class="">			
				    <a href= 'mypoe_switch.php<?php echo '?stdev_id='.$get_id; ?>')">Poe Switch &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				<?php	
	            $g= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Thumbprint'")or die(mysql_error());
			    $count = mysql_num_rows($g);
               ?>			
				<li class="">			
				    <a href= 'mytumbprint.php<?php echo '?stdev_id='.$get_id; ?>')">Thumbprint &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>	
				<?php	
	            $ig= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Printer'")or die(mysql_error());
			    $count = mysql_num_rows($ig);
               ?>			
				<li class="">			
				    <a href= 'myprinter.php<?php echo '?stdev_id='.$get_id; ?>')">Printer &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
								<?php	
	            $ih= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Cash drawer'")or die(mysql_error());
			    $count = mysql_num_rows($ih);
               ?>			
				<li class="">			
				    <a href= 'mycash.php<?php echo '?stdev_id='.$get_id; ?>')">Cash drawer &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>			
			
				<?php	
	            $ij= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Printer Receipt'")or die(mysql_error());
			    $count = mysql_num_rows($ih);
               ?>			
				<li class="">			
				    <a href= 'myprinterreceipt.php<?php echo '?stdev_id='.$get_id; ?>')">Printer Receipt &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>			
			
				<?php	
	            $ik= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Monitor Display'")or die(mysql_error());
			    $count = mysql_num_rows($ih);
               ?>			
				<li class="">			
				    <a href= 'mymonitordisplay.php<?php echo '?stdev_id='.$get_id; ?>')">Monitor Display &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>			
				
				<?php	
	            $ik= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '1' AND device_name.dev_name='Display Visual Code'")or die(mysql_error());
			    $count = mysql_num_rows($ih);
               ?>			
				<li class="">			
				    <a href= 'mydisplaycode.php<?php echo '?stdev_id='.$get_id; ?>')">Display Visual Code &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>
				<?php	
	            $ik= mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  =  '$get_id' AND device_name.dev_name='Battery Laptop'")or die(mysql_error());
			    $count = mysql_num_rows($ih);
               ?>			
				<li class="">			
				    <a href= 'mybatterylaptop.php<?php echo '?stdev_id='.$get_id; ?>')">Battery Laptop &nbsp;<span class="label label-default"> <?php echo $count;?></span></a>					
				</li>		
				</ul>
	</div>
</div>
</div>

<div class="block-content collapse in">
<div class="span12">
	<form action="" method="post"><!-----------------------------------table form------------------------------------>
  	<table cellpadding="0" cellspacing="0" border="0" class="table" id="example">
		<thead>		
		        <tr>			        
					<th class="empty"></th>
					<th>Staff Name</th>
					<th>Device Description </th>
					<th>Inventory Code</th>
			        <th>Device Brand  </th>
					<th>Device Model  </th>
					<th>Date Assign   </th>	
					<th>Device Status </th> 				
                    <th>Devices</th>
					<th class="empty">Manage Device</th>
		    </tr>
		</thead>
<tbody>
<!-----------------------------------Content------------------------------------>									
 <?php
$my_device = mysql_query("select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id  = '$get_id' AND device_name.dev_name='DVD' ")or die(mysql_error());
while($row = mysql_fetch_array($my_device)){
$id = $row['id'];
		                                               
?>
<tr>
		<td><?php
			   $device_query2 = mysql_query("select * from stdevice ")or die(mysql_error());
		       $dev=mysql_fetch_assoc($device_query2);
		       if($row['dev_status']=='New')
		       {
			   echo '<i class="icon-check"></i><div id="hide"><strong>'.$row['dev_status'].'</strong></div>';
		       }
		       else if($row['dev_status']=='In-use')
			   {
			   echo '<i class="icon-ok"></i><div id="hide"><strong>'.$row['dev_status'].'</strong></div>';
		       }
			   else if($row['dev_status']=='In-stock')
			   {
			   echo '<i class="icon-plus"></i><div id="hide"><strong>'.$row['dev_status'].'</strong></div>';
		       }
		       else
			   {
			   echo '<i class="icon-remove-sign"></i><div id="hide"><strong>'.$row['dev_status'].'</strong></div>';
		       };
			  ?>
		</td>
			<td><?php echo $row['staff_name']; ?></td>
			<td><?php echo $row['dev_desc']; ?></td>
			<td><?php echo $row['dev_serial']; ?></td>
			<td><?php echo $row['dev_brand']; ?></td>
			<td><?php echo $row['dev_model']; ?></td>
			<td><?php echo $row['dev_install_date']; ?></td>
			<td><?php
			   $my_device1 = mysql_query("select * from stdevice ")or die(mysql_error());
		       $dev=mysql_fetch_assoc($my_device1);
		       if($row['dev_status']=='New')
		       {
			   echo '<div class="alert alert-success"><i class="icon-check"></i><strong>'.$row['dev_status'].'</strong></div>';
		       }
		       else if($row['dev_status']=='In-use')
			   {
			   echo '<div class="alert alert-warning"><i class="icon-ok"></i><strong>'.$row['dev_status'].'</strong></div>';
		       }
			    else if($row['dev_status']=='In-stock')
			   {
			   echo '<div class="alert alert-warning"><i class="icon-plus"></i><strong>'.$row['dev_status'].'</strong></div>';
		       }
		       else
			   {
			   echo '<div class="alert alert-danger"><i class="icon-remove-sign"></i><strong>'.$row['dev_status'].'</strong></div>';
		       };
			  ?></td>
			<td><?php echo $row['dev_name']; ?></td>
												
			<?php include('toolttip_edit_delete.php'); ?>
			<td width="185" class="empty"><a rel="tooltip"  title="Edit Device" id="e<?php echo $id; ?>" href="device_edit.php<?php echo '?id='.$id; ?>" class="btn btn-success"><i class="icon-pencil"> Edit</i></a><a rel="tooltip"  title="Transfer Device" id="e<?php echo $id; ?>" href="transfer.php<?php echo '?id='.$id; ?>&<?php echo 'stdev_id='.$get_id; ?>" class="btn btn-warning"><i class="icon-move"></i> Transfer </a>
			<a rel="tooltip"  title="Update Status" id="t<?php echo $id; ?>" href="devlmtr_update_status.php<?php echo '?id='.$id; ?>&<?php echo 'stdev_id='.$get_id; ?>" class="btn btn-success"><i class="icon-upload-alt"></i> Status</a></td>
		</tr>
											
	<?php } ?>   
</tbody>
</table>
</form>	
 <!---------------------------------------------------- /block --------------------------------------------->
            </div>
         </div>
       </div>
     </div>
  </div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>