<?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');
	
	//	format date 2003-05-06 13:20:59
	$datetimenow = date('Y-m-d')." ".strftime("%H:%M:%S");
		
	$displayblock = "<table width='90%' border='1' cellspacing='1' cellpadding='3'>";
	$edid = $_GET['edid'];
	$uaction = $_GET['uaction'];
	
	if ($uaction == 'display')
	{
		$sql_detail = "SELECT personnel_id AS pid, computer_serial AS pcserial, monitor_serial AS mserial,
					 	printer_serial AS pserial, jacks_id AS jid, voice_id AS vid FROM equipment_detail WHERE ((detail_id = '$edid'))";

		$db = mysql_select_db('equipment', $equipConn) or die("Couldn't select database equipment");
		$sql_detail_result = mysql_query($sql_detail, $equipConn) or die ("Unable to query detail $edid<br />$sql_detail");;
		//get the id keys of employee/equiptment from detail table
		while($row = mysql_fetch_array($sql_detail_result))
		{
			$pid = $row['pid'];
			$pcserial = $row['pcserial'];
			$mserial = $row['mserial'];
			$pserial = $row['pserial'];
			$jid = $row['jid'];
			$vid = $row['vid'];
		}
		//sql select statement
		$sql_select_emp = "SELECT * FROM  personnel WHERE pid='$pid' ";	
		$sql_select_puter = "SELECT * FROM  computers WHERE computer_serial='$pcserial' ";	
		$sql_select_mon = "SELECT * FROM  monitors WHERE monitor_serial='$mserial' ";	
		$sql_select_printer = "SELECT * FROM  printers WHERE printer_serial='$pserial' ";	
		$sql_select_vdj = "SELECT * FROM  data_jacks WHERE jack_id='$jid' ";	
		$sql_select_voicej = "SELECT * FROM  voice_jacks WHERE jack_id='$vid' ";	

		//query sql statement
		$db = @mysql_select_db('uclit_db', $uclit_dbConn) or die("Couldn't select database uclit_db");
		$sql_select_emp_result = @mysql_query($sql_select_emp, $uclit_dbConn);
		
		$db = mysql_select_db('equipment', $equipConn) or die("Couldn't select database equipment");
		$sql_select_puter_result = mysql_query($sql_select_puter, $equipConn);
		$sql_select_mon_result = mysql_query($sql_select_mon, $equipConn);
		$sql_select_printer_result = mysql_query($sql_select_printer, $equipConn);
		$sql_select_vdj_result = mysql_query($sql_select_vdj, $equipConn);
		$sql_select_voice_result = mysql_query($sql_select_voicej, $equipConn);

		while($rowEmp = @mysql_fetch_array($sql_select_emp_result))
		{
			$eid = $rowEmp['pid'];
			$lname = $rowEmp['lname'];
			$fname = $rowEmp['fname'];
			$mname = $rowEmp['mname'];
			$did = $rowEmp['dept_id'];
					
			//display demartment name instead of dept id
			$sql_dept = "SELECT dept_name FROM departments WHERE (dept_id='$did')";
			$db = mysql_select_db("uclit_db", $uclit_dbConn) or die("Couldn't select database uclit_db");
			$sql_dept_result = mysql_query($sql_dept, $uclit_dbConn);
			while($rowD = mysql_fetch_array($sql_dept_result))
			{
				$deptname = $rowD['dept_name'];
			}
			$mloc = $rowEmp['mail_location'];
			$email = $rowEmp['email'];
			$phone = $rowEmp['phone'];
			$fax = $rowEmp['fax'];
			$web_role = $rowEmp['web_role'];
			
			$displayblock .=
			"
			<tr bordercolor='#000088'>
			  <td bordercolor='#000088'>
				<a href='http://ul.uc.edu/uclit/protected/itstaff/show_addemployee.php?pid=$eid&uaction=edit'><img src='../../images/employee.gif' border='0' alt='employee' /></a><br />
			
				<strong>Person responsible:</strong> $lname, $fname $mname&nbsp; &nbsp; &nbsp;<strong>E-mail:</strong> $email<br />
				<strong>Phone:</strong> $phone&nbsp; &nbsp; <strong>Fax:</strong> $fax&nbsp; &nbsp; <strong>Web Role:</strong> $web_role<br />
				<strong>Department ID:</strong> $deptname&nbsp; &nbsp; <strong>Mail Location:</strong> $mloc
				<br />
			  </td>
			</tr>
			";
		}
		
		//computer
		while($row = mysql_fetch_array($sql_select_puter_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];
				
			$displayblock .= 
			"
			<tr bordercolor='#000088'>
			  <td bordercolor='#000088'>
				<a href='http://ul.uc.edu/uclit/protected/itstaff/show_addcomputer.php?computer_serial=$computer_serial&uaction=edit'><img src='../../images/computer.gif' border='0' alt='computer' /></a><br />
			
				<strong>Workstation ID:</strong> $workstation_id &nbsp;
				<strong>PC Serial:</strong>$computer_serial&nbsp; &nbsp;<br />
			
				<strong>UC Property Tag:</strong>&nbsp;$computer_uc_property_num<br />
				<strong>SAP Asset:</strong>&nbsp;$sapasset<br />
				
				<strong>Make/Model:</strong> $computer_type&nbsp; &nbsp;
				<strong>CPU Type/Speed:</strong> $cpu_type_speed&nbsp; &nbsp;<br />
			
				<strong>Memory:</strong> $ram<br />
			
				<strong>HDD Size:</strong> $hd_capacity&nbsp; &nbsp;
				<strong>Removeable Storage:</strong> $removeable_storage<br />
			
				<strong>Video Card:</strong> $video_card&nbsp; &nbsp;
				<strong>Sound Card:</strong> $sound_card<br />
				
				<strong>CD-RW:</strong> $cd_rw&nbsp; &nbsp;
				<strong>DVD:</strong> $dvd&nbsp; &nbsp;
				<strong>SCSI Adapter:</strong> $scsi_adapter&nbsp; &nbsp;
				<strong>Wand Gun:</strong> $wand_gun&nbsp;&nbsp; &nbsp;
				<strong>Card Reader:</strong> $card_reader<br />
			
				<strong>Additional Peripherals:</strong> $additional_peripherals<br />
			
				<strong>Installed Date:</strong> $installed_date&nbsp; &nbsp;
				<strong>Cascade Date:</strong> $cascade_date<br />
			
				<strong>Cascade From Location:</strong> $cascade_from_location&nbsp; &nbsp;
					
				<strong>NIC:</strong> $nic_make $nic_model&nbsp; &nbsp;
						
				<strong>IP:</strong> $ip_address&nbsp; &nbsp;
				<strong>MAC Address:</strong> $mac_address&nbsp; &nbsp;
				<strong>Primary Server:</strong> $primary_server<br />
			
				<strong>OS:</strong> $operating_system&nbsp; &nbsp;
				<strong>Office Suite:</strong> $office_suite<br />
				<strong>Browser Application:</strong> $browser_app&nbsp; &nbsp;
				<strong>E-Mail Application:</strong> $email_app<br />
			
				<strong>Graphic Application:</strong> $graphic_app<br />
			
				<strong>Specialized Application:</strong> $specialized_appz<br />
				<strong>Catagory:</strong> $catagory
				<br />
			  </td>
			</tr>
			";
		}
		
		//monitor
		while ($row = mysql_fetch_array($sql_select_mon_result))
		{
			$monitor_make = $row['monitor_make'];
			$monitor_model = $row['monitor_model'];
			$monitor_serial = $row['monitor_serial'];
			$monitor_uc = $row['monitor_uc_property_num'];
			$monitor_lock_key = $row['monitor_lock_key'];
			$monitor_size = $row['monitor_size'];
			$monitor_type = $row['monitor_type'];
						
			$displayblock .=
			"
			<tr bordercolor='#000088'>
			  <td bordercolor='#000088'>
			   <a href='http://ul.uc.edu/uclit/protected/itstaff/show_addmonitor.php?monitor_serial=$monitor_serial&uaction=edit'><img src='../../images/monitor.gif' border='0' alt='monitor' /></a><br />
			
			   <strong>Size:</strong> $monitor_size &nbsp; &nbsp;
			   <strong>Make/Model:</strong> $monitor_make &nbsp;$monitor_model<br />
			   <strong>Monitor Type:</strong> $monitor_type<br />
			   <strong>Serial:</strong> $monitor_serial&nbsp; &nbsp;
			   <strong>UC Property Tag#:</strong> $monitor_uc&nbsp; &nbsp;
			   <strong>LockKey:</strong> $monitor_lock_key</td>
			   <br />
			 </td>
		   </tr>";
		    		
		}
		
		//printer
		while ($row = mysql_fetch_array($sql_select_printer_result))
		{
			$printer_serial = $row['printer_serial'];
			$printer_name = $row['printer_name'];
			$printer_server = $row['printer_server'];
			$printer_make = $row['printer_make'];
			$printer_model = $row['printer_model'];
			$printer_uc = $row['printer_uc_property_num'];
			
			$displayblock .=
			"
			<tr bordercolor='#000088'>
			  <td bordercolor='#000088'>
				<a href='http://ul.uc.edu/uclit/protected/itstaff/show_addprinter.php?printer_serial=$printer_serial&uaction=edit'><img src='../../images/printer.gif' border='0' alt='printer' /></a><br />
				<strong>Make/Model</strong> $printer_make &nbsp;$printer_model &nbsp; &nbsp;
				<strong>Serial:</strong> $printer_serial &nbsp; &nbsp;
				<strong>Phone:</strong> $printer_uc
				<br />
				<strong>Name:</strong> $printer_name &nbsp; &nbsp;
				<strong>Print Server:</strong> $printer_server
				<br />
			  </td>
			</tr>";
			
		}
				
		//(voice/phone)/data jack
		while ($row = mysql_fetch_array($sql_select_vdj_result))
		{
			$jack_id = $row['jack_id'];
			$department = $row['department'];
			$data_jack = $row['data_jack'];
			$room_jack = $row['room_jack'];    		
			
			$displayblock .=
			"<tr bordercolor='#000088'>
			   <td bordercolor='#000088'>
				 <a href='http://ul.uc.edu/uclit/protected/itstaff/show_addpdjack.php?jack_id=$jack_id&uaction=edit'><img src='../../images/jacks.gif' border='0' alt='jacks' /> Data Jack</a><br />
				 <strong>Department ID:</strong> $department &nbsp; &nbsp;
				 <strong>Room#:</strong> $room_jack<br />    
				 <strong>Data Jack:</strong> $data_jack
				 <br />
			  </td>
			</tr>";
		}
		
		//voice/phone jack
		while ($row = mysql_fetch_array($sql_select_voice_result))
		{
			$jack_id = $row['jack_id'];
			$department = $row['department'];
			$voice_jack = $row['voice_jack'];
			$room_jack = $row['room_jack']; 
			$phone_num = $row['phone_num'];   		
			
				$displayblock .=
				"<tr bordercolor='#000088'>
				   <td bordercolor='#000088'>
					 <a href='http://ul.uc.edu/uclit/protected/itstaff/show_addvjack.php?jack_id=$jack_id&uaction=edit'><img src='../../images/jacks.gif' border='0' alt='jacks' /> Voice Jack</a><br />
				
					 <strong>Department ID:</strong> $department &nbsp; &nbsp;
					 <strong>Room#:</strong> $room_jack<br />    
					 <strong>Voice/Phone Jack:</strong> $voice_jack &nbsp; &nbsp;
					 <br />
					 <strong>Phone Number:</strong> $phone_num &nbsp; &nbsp;
					 <strong>Phone Type:</strong> ATE4 &nbsp; &nbsp;
 					 <br />


				  </td>
				</tr>";
		}
	}//end if for edit
		
	else
	{
		header ("location: http://libitdb.lang.uc.edu/uclit/default.php");
		exit();
	}
		
	echo "
		<h2>Full Detail View</h2>
		$displayblock
		</table>";
include('/var/www/html/uclit/protected/common/css_login/css_foot2.php'); ?>