<?php
	include('/var/www/html/uclit/protected/common/login/check.php');
	include('/var/www/html/uclit/protected/common/css_login/css_head2.php');
	include('/var/www/html/uclit/protected/connections/db_equip.php');

	$db = mysql_select_db('equipment', $equipConn) or die ("Unable to select equipment database.");
	
	if (isset($_GET['monitor_serial']))
	{
		$mserial = $_GET['monitor_serial'];
							
		$dbtablemon = 'monitors';
		$sql = "SELECT * FROM monitors WHERE monitor_serial='$mserial'";
			
		$vdj_result = mysql_query($sql, $equipConn) or die ("Unable to exercute query: <p>$sql</p>");
		
		while($row = mysql_fetch_array($vdj_result))
		{
			$monitor_make = strtoupper($row['monitor_make']);
			$monitor_model = $row['monitor_model'];
			$monitor_serial = strtoupper($row['monitor_serial']);
			$monitor_uc = strtoupper($row['monitor_uc_property_num']);
			$monitor_lock_key = strtoupper($row['monitor_lock_key']);
			$monitor_size = $row['monitor_size'];
			$monitor_type = $row['monitor_type'];
			$monitor_room = $row['room'];
		}
			
			
			
			
			
			
				$display_block = "<table>
					   <tr><td><strong>Monitor Make:</strong>&nbsp;<i>$monitor_make</i><td></tr>
					   <tr><td><strong>Monitor Model:</strong>&nbsp;<i>$monitor_model</i>&nbsp;&nbsp;</td></tr>
					   <tr><td><strong>Monitor Serial:</strong>&nbsp;<i>$monitor_serial</i></td></tr>
					   <tr>
					     <td>
					       <strong>Monitor UC Property:</strong>&nbsp;<i>$monitor_uc</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Monitor Lock Key:</strong>&nbsp;<i>$monitor_lock_key</i>
					     </td>
					   </tr>		
					   <tr>
					     <td>
					       <strong>Monitor Size:</strong>&nbsp;<i>$monitor_size</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Monitor Type:</strong>&nbsp;<i>$monitor_type</i>
					     </td>
					   </tr>
					   <tr>
					    	<td>
							<strong>Stock Room:</strong>&nbsp;<i>$monitor_room</i>&nbsp;&nbsp;&nbsp;&nbsp;
							</td>
							</tr>
							
					   
				</table>";
		
		
		$sqlinsert = "INSERT INTO surplus_mon SELECT * FROM monitors WHERE monitor_serial='$mserial'";
		$sql_result = mysql_query($sqlinsert, $equipConn) or die ("Unable to exercute query.<p>$sqlinsert</p>");		//echo"Insert INTO Successfull.";
			
		//$today = date("Y-m-d");  
		//$sqlupdate = "UPDATE surplus_cpu SET surplus_date='$today' WHERE computer_serial='$cserial'";
		//$sql_result = mysql_query($sqlupdate, $equipConn) or die ("Unable to exercute query.<p>$sqlupdate</p>");		//echo"Change Date Successfull.";
		$sqldel = "DELETE from monitors WHERE monitor_serial='$mserial'";
		$sql_result = mysql_query($sqldel, $equipConn) or die ("Unable to exercute query.<p>$sqldel</p>");
		//echo"Delete Computer Successfull.";
		//$sqlprod = "DELETE from equipment_detail WHERE computer_serial='$cserial'";
		//$sql_result = mysql_query($sqlprod, $equipConn) or die ("Unable to exercute query.<p>$sqlprod</p>");
		//echo"Delete Production Successfull.";
		
		//end while

		echo "<h2>Monitor '$mserial ' has been sent to Surplus</h2>
			  $display_block
			  <br /> <a href='http://ul.uc.edu/uclit/protected/itstaff/show_move.php'>Search for another monitor to Move</a>";
		}	
	else  
	{
		header("Location: ./uclit/protected/itstaff/show_pcsearch.php");
		exit;				
	}
		
	include('/var/www/html/uclit/protected/common/css_login/css_foot2.php'); 
?>