<?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($_POST['computer_serial']))
	{
		$cserial = $_POST['computer_serial'];
		$room = $_POST['stock_room'];
							
		$sql = "SELECT * FROM computers WHERE computer_serial='$cserial'";
		$sql_result = mysql_query($sql, $equipConn) or die ("Unable to exercute query.<p>$sql</p>");
	
		while($row = mysql_fetch_array($sql_result))
		{
						$sapasset = $row[0];
			$workstation_id = $row[1];
			$computer_serial = $row[2];
			$computer_uc_property_num = $row[3];
			$computer_type = $row[4];
			$cpu_type_speed = $row[5];
			$ram = $row[6];
			$hd_capacity = $row[7];
			$video_card = $row[8];
			$sound_card = $row[9];
			$removeable_storage = $row[10];
			$cd_rw = $row[11];
			$dvd = $row[12];
			$scsi_adapter = $row[13];
			$wand_gun = $row[14];
			$card_reader = $row[15];
			$additional_peripherals = $row[16];
			$installed_date = $row[17];
			$cascade_date = $row[18];
			$cascade_from_location = $row[19];
			$nic_make = $row[20];
			$nic_model = $row[21];
			$ip_address = $row[22];
			$mac_address = $row[23];
			$primary_server = $row[24];
			$operating_system = $row[25];
			$office_suite = $row[26];
			$browser_app = $row[27];
			$email_app = $row[28];
			$graphic_app = $row[29];
			$specialized_appz = $row[30];
			$catagory = $row[31];
			
			
			
			
			
			
				$display_block = " <H2>The following Workstation was moved to Stock Room: $room>/H2>
				<table>
					   <tr><td><strong>Workstation ID:</strong>&nbsp;<i>$workstation_id</i><td></tr>
					   <tr><td><strong>PC Serial:</strong>&nbsp;<i>$computer_serial</i>&nbsp;&nbsp;</td></tr>
					   <tr><td><strong>UC Property Tag:</strong>&nbsp;<i>$computer_uc_property_num</i></td></tr>
					   <tr>
					     <td>
					       <strong>PC Make-Model:</strong>&nbsp;<i>$computer_type</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>CPU Type/Speed:</strong>&nbsp;<i>$cpu_type_speed</i>
					     </td>
					   </tr>		
					   <tr>
					     <td>
					       <strong>Memory:</strong>&nbsp;<i>$ram</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>HDD Size:</strong>&nbsp;<i>$hd_capacity</i>
					     </td>
					   </tr>
					   <tr>
					     <td>
					       <strong>Video Card:</strong>&nbsp;<i>$video_card</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Sound Card:</strong>&nbsp;<i>$sound_card</i>
					    </td>
					   </tr>
					   <tr><td><strong>Removeable Storage:</strong>&nbsp;<i>$removeable_storage</i></td></tr>
					   <tr>
					     <td>
					       <strong>CD-RW:</strong>&nbsp;<i>$cd_rw</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>DVD:</strong>&nbsp;<i>$dvd</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>SCSI Adapter:</strong>&nbsp;<i>$scsi_adapter</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Wand Gun:</strong>&nbsp;<i>$wand_gun</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Card Reader:</strong>&nbsp;<i>$card_reader</i>
					     </td>
					   </tr>
					   <tr><td><strong>Additional Peripherals:</strong>&nbsp;<i>$additional_peripherals</i></td></tr>
					   <tr><td><strong>Installed Date:</strong>&nbsp;<i>$installed_date</i></td></tr>
					   <tr><td><strong>Cascade Date:</strong>&nbsp;<i>$cascade_date</i></td></tr>
					   <tr>
					     <td>
					       <strong>Cascade From Location:</strong>&nbsp;<i>$cascade_from_location</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Surplus Date:</strong>&nbsp;<i>$surplus_date</i>
					     </td>
					   </tr>
					   <tr>
					     <td>
					       <strong>NIC:</strong>&nbsp;<i>$nic_make&nbsp;$nic_model</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Network Access Speed:</strong>&nbsp;<i>$network_access_speed</i>
					    </td>
					   </tr>
					   <tr>
					     <td>
					       <strong>IP:</strong>&nbsp;<i>$ip_address</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Gateway:</strong>&nbsp;<i>$ip_gateway</i>
					     </td>
					   </tr>
					   <tr>
					     <td>
					       <strong>MAC Address:</strong>&nbsp;<i>$mac_address</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Primary Server:</strong>&nbsp;<i>$primary_server</i>
					     </td>
					   </tr>
					   <tr>
					     <td>
					       <strong>OS:</strong>&nbsp;<i>$operating_system</i>&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>Office Suite:</strong>&nbsp;<i>$office_suite</i>
					     </td>
					   </tr>
					   <tr>
					     <td>
					       <strong>Browser Application:</strong>&nbsp;<i>$browser_app</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					       <strong>E-Mail Application:</strong>&nbsp;<i>$email_app</i>
					     </td>
					   </tr>
					   <tr><td><strong>Graphic Application:</strong>&nbsp;<i>$graphic_app</i></td></tr>
					   <tr><td><strong>Specialized Application:</strong>&nbsp;<i>$specialized_appz</i></td></tr>
					   <tr><td><strong>Catagory:</strong>&nbsp;<i>$catagory</i></td></tr>
					   <tr><td><strong>Stock Room:</strong>&nbsp;<i>$room</i></td></tr>
				</table>";
		}
		
		$today = date("Y-m-d");  
		$sqlupdate = "UPDATE computers SET room='$room' WHERE computer_serial='$cserial'";
		$sql_result = mysql_query($sqlupdate, $equipConn) or die ("Unable to exercute query.<p>$sqlupdate</p>");		//echo"Change Date 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>Computer '$computer_serial ' has been sent to Stock Room: $room</h2>
			  $display_block
			  <br /> <a href='http://ul.uc.edu/uclit/protected/itstaff/show_pcsearch.php'>Search for another workstation</a>";
		}	
	else  
	{
		header("Location: ./uclit/protected/itstaff/show_pcsearch.php");
		exit;				
	}
		
	include('/var/www/html/uclit/protected/common/css_login/css_foot2.php'); 
?>