<?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_request.php');

	//format date 2003-05-06 13:20:59
	$datetimenow = date('Y-m-d')." ".strftime("%H:%M:%S");

	$pid = $_POST['hpid'];
	$lname = $_POST['lname'];
	$fname = $_POST['fname'];
	$mname = strtoupper($_POST['mname']);
	if ($mname == '')
		$mname = '*';
	
	$dept_id = $_POST['department'];
	$room_num = $_POST['room_num'];
	$duties = $_POST['duties'];
	$activatedj = $_POST['activatedj'];
	$data_jack = $_POST['data_jack'];
	$activatevj = $_POST['activatevj'];
	$voice_jack = $_POST['voice_jack'];
	$newphone = $_POST['newphone'];
	$newvoice = $_POST['newvoice'];
	$naviapp = $_POST['naviapp'];
	$acroapp = $_POST['acroapp'];
	$uclidapp = $_POST['uclidapp'];
	$illiadapp = $_POST['illiadapp'];
	$e_furniture = $_POST['e_furniture'];
	$e_workstation = $_POST['e_workstation'];
	$e_keys = $_POST['e_keys'];
	$training = $_POST['training'];
	$newlong = $_POST['newlong'];
	$ucflexhrapp = $_POST['ucflexhrapp'];
	$kronosapp = $_POST['kronosapp'];
	$ucflexfinapp = $_POST['ucflexfinapp'];
	$emailauth = $_POST['emailapp'];
	$cs3app = $_POST['cs3app'];
	$cs3web = $_POST['cs3web'];
	$sec = $_POST['sec'];
	$uclidauth = $_POST['uclidauth'];
	$illiadauth = $_POST['illiadauth'];
	$ableauth = $_POST['ableauth'];
	$webauth = $_POST['webauth'];
	$intraauth = $_POST['intraauth'];
	$ucflexhrauth = $_POST['ucflexhrauth'];
	$ucflexfinauth = $_POST['ucflexfinauth'];
	$startdate = $_POST['telcodate'];
	$type = $_POST['type'];
	$contribapp = $_POST['contribapp'];
	
	
	//Process 1
	echo"
	Your requests for the new staff member $lname, $fname have been submitted.<br /><br />
	Startdate: $startdate<br /><br />
	Details:<br /><br />
	$deptid = Department ID <br />
	$activatedj = Activate Data Jack <br />
	$data_jack = Data jack ID <br />
	$activatevj = Activate Voice Jack <br />
	$voice_jack = Voice jack ID <br />
	$newphone = New Phone <br />
	$newvoice = New Voice Mail <br />
	$naviapp = Navicat App <br />
	$uclidapp = UCLID App <br />
	$illiadapp = ILLiad App <br />
	$e_furniture = Furniture <br />
	$e_workstation = Workstation <br />
	$e_keys = Keys <br />
	$training = Training <br />
	$newlong = Long Distance Code <br />
	$ucflexhrapp = UC Flex Software <br />
	$kronosapp = Kronos Software <br />
	$ucflexfinapp = UCFlex Fin Software <br />
	$emailauth = Email <br />
	$cs3app = CS3 Application <br />
	$cs3web = CS3 Web <br />
	$sec = Access Key <br />
	$uclidauth = UCLID Authorization <br />
	$illiadauth = Illiad Authorization <br />
	$ableauth = Able Authorization <br />
	$webauth = Web Authorization <br />
	$intraauth = Intranet Authroization <br />
	$ucflexhrauth = UCFlex HR Authorization <br />
	$ucflexfinauth = UCFlex Finance Authorization <br />
	$contribapp = Contribute Software <br />
	$room_num = Room<br />
	$duties = Duties<br />
	<br />";
				
	$sqldept = "SELECT dept_id,	dept_name, building, assoc_dean_id,	dept_head_id
				FROM departments
				WHERE dept_id='$dept_id'";
		
	//select database to be used hr database
	$db = mysql_select_db('uclit_db', $uclit_dbConn) or die ("Unable to select uclit_db database.");
	$sqldept_result = mysql_query($sqldept, $uclit_dbConn) or die ("Unable to execute query:<p>$sqldept</p>");

	while ($row = mysql_fetch_array($sqldept_result))
	{
		$building = $row['building'];
		$dept_name = $row['dept_name'];
		$assoc_dean_id = $row['assoc_dean_id'];
		$dept_head_id = $row['dept_head_id'];
	}

	$db5 = mysql_select_db("uclitdb") or die ("Could not select Equipment.");
	$sql_dh = "SELECT personnel.personnel_id,
				 personnel.last_name,
				 personnel.first_name,
				 personnel.e_mail,
				departments.dept_id,
				departments.dept_name,
				departments.building,
				departments.assoc_dean_id
				FROM departments
				INNER JOIN personnel ON (departments.dept_id = personnel.dept_id) WHERE personnel_id='$dept_head_id'";

	$dh_result = mysql_query($sql_dh, $uclit_dbConn) or die ("Unable to exercute query: <p>$sql_dh</p>");
	
	while($row = mysql_fetch_array($dh_result))
	{
		$pid_dh = $row['personnel_id'];
		$lname_dh = $row['last_name'];
		$fname_dh = $row['first_name'];
		$email_dh = $row['e_mail'];
		$mname_dh = $row['middle_name'];
		$dept_id_dh = $row['dept_id'];
		$bldg_dh = $row['building'];
		$dh_id = $row['dept_head_id'];
	}

	$db6 = mysql_select_db("uclitdb") or die ("Could not select Equipment.");
	$sql_assoc = "SELECT personnel.personnel_id,
				 personnel.last_name,
				 personnel.first_name,
				 personnel.e_mail,
				departments.dept_id,
				departments.dept_name,
				departments.building,
				departments.assoc_dean_id
				FROM departments
				INNER JOIN personnel ON (departments.dept_id = personnel.dept_id) WHERE personnel_id='$assoc_dean_id'";

	$assoc_result = mysql_query($sql_assoc, $uclit_dbConn) or die ("Unable to exercute query: <p>$sql_assoc</p>");
	
	while($row = mysql_fetch_array($assoc_result))
	{
		$pid_assoc = $row['personnel_id'];
		$lname_assoc = $row['last_name'];
		$fname_assoc = $row['first_name'];
		$email_assoc = $row['e_mail'];
		$mname_assoc = $row['middle_name'];
		$dept_id_assoc = $row['dept_id'];
		$bldg_assoc = $row['building'];
		$assoc_id = $row['asssoc_dean_id'];
	}

//Set email body

$assignresdh ="Department Head, <br><br>A new employee has been added to your department by the HR Office.<br><br>Employee Name: $fname $lname<br><br>Start Date: $startdate<br><br>Please click on the following link to assign resources to the new employee (login required)<br><br>http://ul.uc.edu/uclit/protected/depthead/show_new_employee.php?uaction=add&pid=$pid<br><br>";

$appreqit ="IT Coordinator, <br><br>A request for Applications was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname <br><br>Start Date: $startdate <br><br>Help Calls have been created in the Application System and the Department Head and AD will be notified upon completion.";


$appreqhslnavi ="Birsen, <br><br>A request for the NaviCat Application was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$appreqhsluclid ="Birsen, <br><br>A request for the UCLID Telnet and Millenium Application was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$appreqhslilliad ="Birsen, <br><br>A request for the Illiad Application was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$appreqhslkronos ="Birsen, <br><br>A request for the Kronos Web Application (Java JRE) was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$appreqhslucflexhr ="Birsen, <br><br>A request for the UCFLEX HR SAP Application was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$appreqhslucflexfin ="Birsen, <br><br>A request for the UCFLEX FINANCE SAP Application was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$appreqhslcs3 ="Birsen, <br><br>A request for the Adobe CS3 Design Application was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$appreqhslweb ="Birsen, <br><br>A request for the Adobe CS3 Web Application was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$appreqhslcontrib ="Birsen, <br><br>A request for the Contribute Application was made by $fname_dh $lname_dh for the following new employee: <br><br>Employee Name:  $fname $lname <br><br>Start Date:  $startdate <br><br>Please notify Department Head and AD through email when the applications have been installed.";

$equipregfurn ="Holly, <br><br>A request for furniture was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname <br><br>Start Date: $startdate <br><br>Location: $room $building<br><br>Please notify Department Head and AD by email when request is complete.";

$equipregwork ="IT Coordinator, <br><br>A request for a workstation was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:$startdate<br><br>Location: $room $building<br><br>A help call was assigned in the application system and the department head and ad will be notified upon completion.";

$equipreqkeys ="Jim, <br><br>A request for keys was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name:  $fname $lname<br><br>Start Date: $startdate<br><br>Location: $room $building<br><br>Please notify department head and AD by email when request is complete.";

$equipreqid ="Jim, <br><br>A request for ID Access was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date: $startdate<br><br>Location: $room $building<br><br>Please notify department head and AD by email when request is complete.";

$equipreqhslfurn ="Birsen, <br><br>A request for furniture was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname <br><br>Start Date: $startdate <br><br>Location: $room $building<br><br>Please notify Department Head and AD by email when request is complete.";

$equipreqhslwork ="Birsen, <br><br>A request for a workstation was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname <br><br>Start Date: $startdate <br><br>Location: $room $building<br><br>Please notify Department Head and AD by email when request is complete.";

$equipreqhslkeys ="Birsen, <br><br>A request for keys was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname <br><br>Start Date: $startdate <br><br>Location: $room $building<br><br>Please notify Department Head and AD by email when request is complete.";

$equipreqhslid ="Birsen, <br><br>A request for ID Access was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname <br><br>Start Date: $startdate <br><br>Location: $room $building<br><br>Please notify Department Head and AD by email when request is complete.";

$reqauthuclid ="IT Coordinator, <br><br>A request for UCLID authorization was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:  $startdate<br><br>Location: $room $building<br><br>A help call has been created in the application system.  The department head and AD will be notified upon completion.";

$reqauthilliad ="Lorna, <br><br>A request for Illiad authorization was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:  $startdate<br><br>Location: $room $building<br><br>Please notify departmnet head and AD by email when request is complete.";

$reqauthable ="Holly, <br><br>A request for ABLE authorization was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:  $startdate<br><br>Location: $room $building<br><br>Please notify department head and AD by email when request is complete.";

$reqauthweb ="IT Coordinator, <br><br>A request for a Web Server authorization was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:  $startdate<br><br>Location: $room $building<br><br>A help call has been created in the application system.  The department head and AD will be notified upon completion.";

$reqauthintra ="IT Coordinator, <br><br>A request for a Intranet Server authorization was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:  $startdate<br><br>Location: $room $building<br><br>A help call has been created in the application system.  The department head and AD will be notified upon completion.";

$reqauthflexhr ="Karen, <br><br>A request for UCFLEX HR authorization was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:  $startdate<br><br>Location: $room $building<br><br>Please notify department head and AD by email when request is complete.";

$reqauthflexfin ="Becky, <br><br>A request for UCFLEX FINANCE authorization was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:  $startdate<br><br>Location: $room $building<br><br>Please notify department head and AD by email when request is complete.";

$reqtrain ="Karen, <br><br>A request for Training was made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date:  $startdate<br><br>Location: $room $building<br><br>Training: $training<br><br>Please notify department head and AD by email when request is complete.";

$reqtelcostaff = "IT Coordinator, <br><br>A request for Telco needs were made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date: $startdate<br><br>Telco Needs:<br><br>Activate Data Jack: $data_jack<br><br>Activate Phone Jack: $voice_jack<br><br>Phone:$newphone<br><br>Voice Mail: $newvoice<br><br>Help Calls have been created in the Application System and department head will be notified upon completion.";

$reqtelcohsl = "Birsen, <br><br>A request for Telco needs were made by $fname_dh $lname_dh for the following new employee:<br><br>Employee Name: $fname $lname<br><br>Start Date: $startdate<br><br>Telco Needs:<br><br>Activate Data Jack: $data_jack<br><br>Activate Phone Jack: $voice_jack<br><br>Phone:$newphone<br><br>Voice Mail: $newvoice<br><br>Please contact department head and AD by email upon completion.";

$reqtelcotemp = "$fname_ad, <br><br>A telco request has been made by $fname_dh $lname_dh for the following TEMP employee:<br><br>Employee Name: $fname $lname<br><br>Start Date: $startdate<br><br>Telco Needs:<br><br>Activate Data Jack: $data_jack<br><br>Activate Phone Jack: $voice_jack<br><br>Phone:$newphone<br><br>Voice Mail: $newvoice<br><br>Email:  $emailauth<br><br>Please access the application system and APPROVE or DENY the request.  IF APPROVED, Help Calls will be created for the IT Department immediately.  If Denied, then an email will be sent to the department head stating the reason for denial.<br><br>http://ul.uc.edu/uclit/protected/assosdean/request/form.php";


	$sqldatajack = "SELECT jack_id,	data_jack
					FROM data_jacks
					WHERE jack_id='$data_jack'";
	
	$db = mysql_select_db('equipment', $equipConn) or die ("Unable to select equipment database.");		
	$sqldatajack_result = mysql_query($sqldatajack, $equipConn) or die ("Unable to execute query:<p>$sqldatajack</p>");

	while ($row = mysql_fetch_array($sqldatajack_result))
	{
		$data_jack_name = $row['data_jack'];
	}
	
	$sqlvoicejack = "SELECT jack_id, voice_jack
			FROM voice_jacks
			WHERE jack_id='$voice_jack'";

	$sqlvoicejack_result = mysql_query($sqlvoicejack, $equipConn) or die ("Unable to execute query:<p>$sqldatajack</p>");

	while ($row = mysql_fetch_array($sqlvoicejack_result))
	{
		$voice_jack_name = $row['voice_jack'];
	}
		
	//process 2
	$sql_viewed = "VIEWED    personnel_id='$pid',  lname='$lname',  fname='$fname',  mname='$mname',  room='$room_num', duties='$duties'; web_role='$web_role'";

	//update sql statement
	$sql = "UPDATE personnel SET room='$room_num', duties='$duties', dept_id='$dept_id' WHERE personnel_id='$pid' ";
		
	//exercute sql statement
	$db = mysql_select_db('uclit_db', $uclit_dbConn) or die ("Unable to select uclit_db database.");
	$sql_result = mysql_query($sql, $uclit_dbConn) or die ("Couldn't exercute query<p>$sql</p>");
		
	if(!mysql_errno())
	{
		$db = mysql_select_db('equipment', $equipConn) or die ("Unable to select equipment database.");		
		
		//log user access
		$sql_useraccess = "INSERT INTO EquipmentUserAccessLog VALUES ('', '$suser', '$sql_viewed', '$datetimenow')";
		mysql_query($sql_useraccess, $equipConn);
		$sql_useraccess = "INSERT INTO EquipmentUserAccessLog VALUES ('', '$suser', '$sql', '$datetimenow')";
		mysql_query($sql_useraccess, $equipConn);
		
		$h2 = "Personnel ID[ '$pid' ] has been successfully updated.";
	}
	
	//process 3
	if($activatedj != "" and $type =="4")
	{	
		echo"Datajack $data_jack_name activation has been requested.<br />";
		$datetimenow = date('Y-m-d')." ".strftime("%H:%M:%S");
		$date = date('Y-m-d');

		$request1 = "Department: $dept_name - $username has requested that $data_jack_name be activated in $room_num $building for the New Temp Employee: $lname, $fname.";				

		$sqlrequest1 = "INSERT INTO RequestLog 
							(id, usernamerequest, request, datetimestamprequest, requesttype, dept_id, personnel_id)
						VALUES 
							('', '','$request1','$datetimenow','Activate Data Jack','$dept_id','$pid')";

		$result1 = mysql_query($sqlrequest1, $equipConn) or die("Couldn't execute query.");
	}
	
	//process 4
	if($activatevj != "" and $type =="4")
	{	
		echo"Voicejack $voice_jack_name activation has been requested.<br />";
						
		$request2 = "Department: $dept_name - $username has requested that $voice_jack_name be activated in $room_num $building for the New Temp Employee: $lname, $fname.   The initial cost will be $50.00 and a monthly cost of $22";				

		$sqlrequest2 = "INSERT INTO RequestLog 
							(id, usernamerequest, request, datetimestamprequest, requesttype, dept_id, personnel_id)
						VALUES 
							('', '','$request2','$datetimenow','Activate Voice Jack','$dept_id','$pid')";

		$result2 = mysql_query($sqlrequest2, $equipConn)
			or die("Couldn't execute query. $sqlrequest2");
	}
	
	//process 5
	if($newphone != "" and $type =="4")
	{	
		echo"A new $phonebutton phone has been requested.<br />";
						
		$request3 = "Department: $dept_name - $username has requested that a New Phone be activated in $room_num $building for the New Temp Employee: $lname, $fname .   The initial cost will be $75.00 and a monthly cost of $234.25";				

		$sqlrequest3 = "INSERT INTO RequestLog 
							(id, usernamerequest, request, datetimestamprequest, requesttype, dept_id, personnel_id)
						VALUES 
							('', '','$request3','$datetimenow','New Phone','$dept_id','$pid')";

		$result2 = mysql_query($sqlrequest3, $equipConn) or die("Couldn't execute query. $sqlrequest3");
	}
	
	//process 6
	if($newvoice != "" and $type =="4")
	{	
		echo"A new $voicebutton voice mail has been requested.<br />";
							
		$request3 = "Department: $dept_name - $username has requested that a New $voicebutton Voice Mail be activated in $room_num $building for the New Staff Member: $lname, $fname .   The Monthly cost will be $voicemailcost";				

		$sqlrequest3 = "INSERT INTO RequestLog 
							(id, usernamerequest, request, datetimestamprequest, requesttype, dept_id, personnel_id)
						VALUES 
							('', '','$request3','$datetimenow','New Voice Mail','$dept_id','$pid')";

		$result2 = mysql_query($sqlrequest3, $equipConn) or die("Couldn't execute query. $sqlrequest3");
	}
	
	//process 7
	$fullname = $fname." ".$lname;
	$emailname = $fname.".".$lname;
	$date = date('Y-m-d');
	$db = mysql_select_db("helpcalls", $helpConn) or die ("Unable to select helpcalls database.");		
		
	$sql_sa_uclid = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Michael Mahoney','$date','Needs UCLID telnet program installed.','$emailname') ";
	
	$sql_sa_illiad = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Michael Mahoney','$date','Needs Illiad client installed.','$emailname') ";
	
	$sql_sa_kronos = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Michael Mahoney','$date','Needs Kronos (Java) installed.', '$emailname') ";
	
	$sql_sa_ucflexhr = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Michael Mahoney','$date','Install SAP Client for UCFlex HR','$emailname') ";
	
	$sql_sa_ucflexfin = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Michael Mahoney','$date','Needs SAP Client for UCFlex Finance.', '$emailname') ";
	
	$sql_sa_navicat = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Michael Mahoney','$date','Needs Navicat installed.','$emailname') ";
	
	$sql_sa_acrobat = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Erma Fritsche','$date','Needs Adobe Acrobat installed.', '$emailname') ";
	
	$sql_sa_cs3 = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Erma Fritsche','$date','Needs Adobe CS3 Creative Suite installed.','$emailname') ";
	
	$sql_sa_web = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Erma Fritsche','$date','Needs Adobe CS3 Web Suite installed.', '$emailname') ";
		
	$sql_sa_contrib = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('User Services', '$fullname','$dept_name','NA','Erma Fritsche','$date','Needs Contribute installed.', '$emailname') ";
						
	if ($uclidapp == true) 
	{
		$result_sa_uclid = mysql_query($sql_sa_uclid, $helpConn) or die("Couldn't execute query:<p>$sql_sa_uclid</p>");
		echo"A helpcall for the UCLID software has been submitted.<br />";
	}
	
	if ($illiadapp == true) 
	{
		$result_sa_illiad = mysql_query($sql_sa_illiad, $helpConn) or die("Couldn't execute query:<p>$sql_sa_illiad</p>");
		echo"A helpcall for the Illiad software has been submitted.<br />";
	}
	
	if ($kronosapp == true) 
	{
		$result_sa_kronos = mysql_query($sql_sa_kronos, $helpConn) or die("Couldn't executequery:<p>$sql_sa_kronos</p>");
		echo"A helpcall for the Kronos software has been submitted.<br />";
	}
	
	if ($ucflexhrapp == true) 
	{
		$result_sa_ucflexhr = mysql_query($sql_sa_ucflexhr, $helpConn) or die("Couldn't executequery:<p>$sql_sa_ucflexhr</p>");
		echo"A helpcall for the SAP UC Flex HR software has been submitted.<br />";
	}
	
	if ($ucflexfinapp == true) 
	{
		$result_sa_ucflexfin = mysql_query($sql_sa_ucflexfin, $helpConn) or die("Couldn't executequery:<p>$sql_sa_ucflexfin</p>");
		echo"A helpcall for the SAP UC Flex Finance software has been submitted.<br />";
	}
	
	if ($naviapp == true) 
	{
		$result_sa_navicat = mysql_query($sql_sa_navicat, $helpConn) or die("Couldn't executequery:<p>$sql_sa_navicat</p>");
		echo"A helpcall for the Navicat software has been submitted.<br />";
	}
	
	if ($acroapp == true) 
	{
		$result_sa_acroapp = mysql_query($sql_sa_acrobat, $helpConn) or die("Couldn't executequery:<p>$sql_sa_acrobat</p>");
		echo"A helpcall for the Adobe Acrobat software has been submitted.<br />";
	}
	
	if ($cs3app == true) 
	{
		$result_sa_cs3 = mysql_query($sql_sa_cs3, $helpConn) or die("Couldn't executequery:<p>$sql_sa_cs3</p>");
		echo"A helpcall for the Adobe CS3 Design software has been submitted.<br />";
	}
	
	if ($cs3web == true) 
	{
		$result_sa_cs3 = mysql_query($sql_sa_web, $helpConn) or die("Couldn't executequery:<p>$sql_sa_web</p>");
		echo"A helpcall for the Adobe CS3 Web software has been submitted.<br />";
	}
	
	if ($contribapp == true) 
	{
		$result_sa_contrib = mysql_query($sql_sa_contrib, $helpConn) or die("Couldn't executequery:<p>$sql_sa_contrib</p>");
		echo"A helpcall for the Contribute software has been submitted.<br />";
	}
	//Process 8
	$sql_uclidauth = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('System Services', '$fullname','$dept_name','NA','James Campbell','$date','Needs UCLID Account created.', '$emailname') ";
	
	$sql_illiadauth = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('System Services', '$fullname','$dept_name','NA','Dennis Gavin','$date','Needs Illiad Account created.', '$emailname') ";
	
	$sql_webauth = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('Web Services', '$fullname','$dept_name','NA','Lisa Pons','$date','Needs Account created on Web Server.', '$emailname') ";
	
	$sql_intraauth = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('System Services', '$fullname','$dept_name','NA','Dennis Gavin','$date','Needs Account created on Intranet Server.', '$emailname') ";
						
	if ($uclidauth == true) 
	{
		$result_uclidauth = mysql_query($sql_uclidauth, $helpConn) or die("Couldn't execute query:<p>$sql_uclidauth</p>");
		echo"A helpcall to create a UCLID Account has been submitted.<br />";
	}
	
	if ($illiadauth == true) 
	{
		$result_illiadauth = mysql_query($sql_illiadauth, $helpConn) or die("Couldn't execute query:<p>$sql_illiadauth</p>");
		echo"A helpcall to create a Illiad Account has been submitted.<br />";
	}
	
	if ($webauth == true) 
	{
		$result_webauth = mysql_query($sql_webauth, $helpConn) or die("Couldn't execute query:<p>$sql_webauth</p>");
		echo"A helpcall to create a Web Account has been submitted.<br />";
	}
	
	if ($intraauth == true) 
	{
		$result_intraauth = mysql_query($sql_intraauth, $helpConn) or die("Couldn't execute query:<p>$sql_intraauth</p>");
		echo"A helpcall to create an Intranet Account has been submitted.<br />";
	}
	
	//Process 9
	
	
	//Process 10
	$sql_supervisor = "SELECT personnel.personnel_id,
				 personnel.last_name,
				 personnel.first_name,
				 personnel.e_mail,
				departments.dept_id,
				departments.dept_name,
				departments.building,
				departments.dept_head_id
				FROM departments
				INNER JOIN personnel ON (departments.dept_id = personnel.dept_id) WHERE personnel_id='$dept_head_id'";
	
	$db = mysql_select_db("uclit_db", $uclit_dbConn) or die ("Could not select uclit_db database.");
	$supervisor_result = mysql_query($sql_supervisor, $uclit_dbConn) or die ("Unable to exercute query: <p>$sql_supervisor</p>");
	
	while($row = mysql_fetch_array($supervisor_result))
	{
		$pid_sup = $row['personnel_id'];
		$lname_sup = $row['last_name'];
		$fname_sup = $row['first_name'];
		$email_sup = $row['e_mail'];
		$mname_sup = $row['middle_name'];
		$dept_id_sup = $row['dept_id'];
		$bldg_sup = $row['building'];
		$dept_head_id = $row['dept_head_id'];
	}
	
	$db = mysql_select_db("helpcalls", $helpConn) or die ("Unable to select helpcalls database.");		
	
	$sql_e_workstation = "INSERT INTO log 
						(Help_Catagory, Help_User, Help_Dept, Help_Phone, Help_Tech, Date_Arrived, Help_Desc, Email)
					VALUES 
						('Equipment Services', '$fullname','$dept_name','NA','Paul Dozier','$date','Needs workstation installed.', '$emailname') ";
	
	
	if ($e_workstation == true) 
	{
		$result_e_workstation = mysql_query($sql_e_workstation,$helpConn) or die("Couldn't execute query:<p>$sql_e_workstation</p>");
		echo"A helpcall for a workstation has been submitted.<br />";
	}
		
	//Process 12: Email
	$db5 = mysql_select_db("equipment") or die ("Could not select Equipment.");
	$sql_assoc = "SELECT personnel.personnel_id,
				 personnel.last_name,
				 personnel.first_name,
				 personnel.e_mail,
				departments.dept_id,
				departments.dept_name,
				departments.building,
				departments.assoc_dean_id
				FROM departments
				INNER JOIN personnel ON (departments.dept_id = personnel.dept_id) WHERE personnel_id='$assoc_dean_id'";

	$assoc_result = mysql_query($sql_assoc, $uclit_dbConn) or die ("Unable to exercute query: <p>$sql_assoc</p>");
	
	while($row = mysql_fetch_array($assoc_result))
	{
		$pid_assoc = $row['personnel_id'];
		$lname_assoc = $row['last_name'];
		$fname_assoc = $row['first_name'];
		$email_assoc = $row['e_mail'];
		$mname_assoc = $row['middle_name'];
		$dept_id_assoc = $row['dept_id'];
		$bldg_assoc = $row['building'];
		$assoc_dean_id = $row['asssoc_dean_id'];
	}
	
	//mail($email_assoc,"New Staff Member Request","Please check request system 
		//(http://ul.uc.edu/uclit/protected/assoc_dean/checkrequest.php).  A new request has 
		//been made by $suser for $fullname concerning a new staff member.","From: Library Technology Services");

	include('/var/www/html/uclit/protected/common/css_login/css_foot2.php'); 
?>