<table width="137%" border="0">
  <tr bgcolor="#CCCCCC"> 
    <td height="59" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><img src="../images/it%20graphics/4banner.jpg" width="612" height="199" border="0" usemap="#Map"> 
      <map name="Map">
        <area shape="rect" coords="543,151,611,195" href="DataAccess.php">
        <area shape="rect" coords="480,146,542,198" href="search.php">
        <area shape="rect" coords="366,146,474,197" href="http://10.202.160.143/search/search.php?index">
        <area shape="rect" coords="280,146,362,194" href="actmgt.php">
        <area shape="rect" coords="189,146,277,196" href="ocm-first.htm">
        <area shape="rect" coords="127,148,182,198" href="DataAccessSearch.php">
        <area shape="rect" coords="76,147,122,196" href="helpDeskAccessAllCalls.php">
        <area shape="rect" coords="163,2,248,14" href="DataAccess.php">
        <area shape="rect" coords="2,148,74,200" href="reportproblem.htm">
      </map>
      <div align="left"></div></td>
  </tr>
</table>

<?     
function HTML_Head() 
	{ 

    echo " 
    <HTML><HEAD> 
    <TITLE>Helpdesk call log details.</TITLE> 
    </HEAD> 
    <BODY BGCOLOR=\"#FFFFFF\">"; 
	} 

function HTML_Foot() 
	{ 
    echo "</body></html>"; 
	} 
	  
$searchQ = $_POST["search"];
$records = $_POST["checkbox"]; 
$LastName = $_POST["lastName"];
$idNum = $_POST["idNum"];
$compName = $_POST["compName"];   
	                                             //The following code will not be seen

function Output_Entries() {

$searchQ = $_POST["search"];
$records = $_POST["checkbox"]; 

If ($records == 1)
		{
    	$cnx = odbc_connect( 'HelpDesk' , '', '' ); 
    	if (!$cnx) 
		{ 
        Error_handler( "Error in odbc_connect" , $cnx ); 
    	} 

    	// send a simple odbc query . returns an odbc cursor 
    	$cur= odbc_exec( $cnx, "select ID,FirstName,LastName,PCatagory,describe, Status, mainDate from Data WHERE FirstName ='$searchQ'" ); 
    		if (!$cur) 
			{ 
        	Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); 
    		} 
   	   	echo "<table border=1><tr><th>ID</th><th>Time & Date</th><th>First Name</th>". 
        "<th>Last Name</th><th>Help Request Status</th><th>Type of Problem</th></tr>\n"; 
    	$nbrow=0;   //Local variable to count number of rows 
    	// fetch the succesive result rows 
    			while( odbc_fetch_row( $cur ) ) 
					{ 
        			$nbrow++; 
        			$ID= odbc_result( $cur, 1 ); // get the field "Index" 
        			$FirstName= odbc_result( $cur, 2 ); // get the field "FirstName" 
        			$LastName= odbc_result( $cur, 3 ); // get the field "LastName" 
        			$PCatagory= odbc_result( $cur, 4 ); // get the field "PCatagory" 
					$value= odbc_result( $cur, 5 ); // get the field "describe" <br><br>
					$Status= odbc_result( $cur, 6 ); // get the field "Status" 
					$sysDate= odbc_result( $cur, 7 ); // get the field "Status" 
					$url = 'viewDetails.php?record=';
					$url2 = "$ID";
					$url3 = "$url$url2"; 
		 			echo "<tr><td><a href=\"$url3\">$ID</a>\n</td><td>$sysDate</td><td>$FirstName</td>". 
         			"<td>$LastName</td><td>$Status</td><td>$PCatagory</td></tr>"; 
		 			} 
					odbc_close( $cnx); 

				}//end if
				
function inverse() {
 $compName = $_POST["compName"];

 // send a simple odbc query . returns an odbc cursor 
        	$cnx = odbc_connect( 'HelpDesk' , '', '' ); 
    			if (!$cnx) 
				{ 
        		Error_handler( "Error in odbc_connect" , $cnx ); 
    			}   
			//error checking	
			if($compName !=="")
				{ 
				$cur= odbc_exec( $cnx, "select FirstName,LastName from inventory WHERE CompName ='$compName'" );
				while( odbc_fetch_row( $cur ) ) 
						{ 
        				$nbrow++; 
        				$FirstName= odbc_result( $cur, 1 ); // get the field "FirstName" 
						$LastName= odbc_result( $cur, 2 ); // get the field "FirstName" 
						}
						$compName = $_POST["compName"];
						echo "<br>The Computer Name is $compName for $FirstName $LastName <br>";
						echo "<br>Note there maybe more then one computer name if the database has been not updated properly.";
				
				}
		
					
    // close the connection. important if persistent connection are "On" 
    odbc_close( $cnx); 
}}


		 function OutputA() {
		 $searchQ = $_POST["search"];
		 $LastName = $_POST["lastName"];
		$records = $_POST["checkbox"];

		   // send a simple odbc query . returns an odbc cursor 
        	$cnx = odbc_connect( 'HelpDesk' , '', '' ); 
    			if (!$cnx) 
				{ 
        		Error_handler( "Error in odbc_connect" , $cnx ); 
    			}   
			//error checking	
			if($LastName =="")
				{ 
				$cur= odbc_exec( $cnx, "select FirstName,CompName from inventory WHERE FirstName ='$searchQ'" );
				}
			if($LastName !=="")
			{	
			$cur= odbc_exec( $cnx, "select FirstName,CompName from inventory WHERE FirstName ='$searchQ' AND LastName ='$LastName'" );
    		}	
			
			if($searchQ =="")
			{	
			$cur= odbc_exec( $cnx, "select FirstName,CompName from inventory WHERE LastName ='$LastName' AND LastName ='$LastName'" );
    		}
			//end error checking	
			if (!$cur) 
				{ 
        		Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); 
				}
					while( odbc_fetch_row( $cur ) ) 
						{ 
        				$nbrow++; 
        				$CompName= odbc_result( $cur, 2 ); // get the field "FirstName" 
						echo "This report is for $searchQ $LastName <br>";
						echo "The Computer Name is: $CompName <br>";
						}
						echo "Note there maybe more then one computer name if the database has been not updated properly.";
    // close the connection. important if persistent connection are "On" 
    odbc_close( $cnx); 

}//end output

		function OutputCheck() {
		echo "$idNum";
		$idNum = $_POST["idNum"];		
		If ($idNum > 0)
			{
			echo "<br>";
			$url = 'http://10.202.160.143/helpdesk/viewDetails.php?record=';
			$url2 = "$url$idNum";
			echo "<a href=\"$url2\">Click her to view your search results for record: $idNum</a>\n";
			echo "<br>";
			}//end if
	}//end OutputCheck

HTML_Head(); 
Output_Entries();
inverse();
OutputA();
OutputCheck(); 
HTML_Foot(); 
?>
<br>
<br>
<p align="center"><a href="http://www.quickintranet.com"><img src="http://www.quickintranet.com/infosec/quickintranet-com.jpg" border="0"></a><br>
  CopyRight 2004<br>
  QuickIntranet.com<br>
  <a href="http://www.quickintranet.com">http://www.QuickIntranet.com </a></p>
<p align="center"><font size="5" face="Arial, Helvetica, sans-serif"></font></p>
