<title>Help Desk Past Calls</title><body text="#000000" link="#0000FF" vlink="#0000FF">
<p><img src="../images/it%20graphics/2banner.jpg" width="612" height="199" border="0" usemap="#Map"> 
  <map name="Map">
    <area shape="rect" coords="163,3,248,15" href="DataAccess.php">
    <area shape="rect" coords="543,151,611,195" href="DataAccess.php">
    <area shape="rect" coords="479,145,541,197" 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,147,182,197" href="DataAccessSearch.php">
    <area shape="rect" coords="75,147,121,196" href="helpDeskAccessAllCalls.php">
    <area shape="rect" coords="2,146,74,198" href="reportproblem.htm">
  </map>
  <br>
  <a href="searchpastopen.php">View my past calls which are still <em><strong>open</strong></em><br>
  </a> 
  <?php 

//Created by Chad Edwards
//01-29-03
//Requires M.S. Access 2000 with DNS configured to helpdesk pass=''
//Revision 1
//Juim Help Desk


function HTML_Head() { 
    echo " 
    <HTML><HEAD> 
    <TITLE>Processing Form</TITLE> 
    </HEAD> 
    <BODY BGCOLOR=\"#FFFFFF\">"; 
	

} 

function HTML_Foot() { 
    echo "</body></html>"; 
} 

function Database_Entries($msg) { 
    echo $msg; 
} 

function Output_Entries() { 
    /* 
        Make the connection to the database. The syntax is 
        odbc_connect( 'SYSTEM_DSN' , 'USER', 'PASSWORD' ); 
        $cnx will hold the 
        pconnect is used to establish a persistent database 
        connection to the Database until the procedure is completed. 
    */ 

	$userName = $_COOKIE["usr"]; //Recommended
			
    $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,User,Pass,FirstName,LastName FROM accounts WHERE User ='$userName'" ); 
    if (!$cur) { 
        Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); 
    } 

    $nbrow=0;   //Local variable to count number of rows 

    // fetch the succesive result rows 
    while( odbc_fetch_row( $cur ) ) 
		{ 
        $nbrow++; 
        $FirstName= odbc_result( $cur, 4 ); // get the field "FirstName" 
        $LastName= odbc_result( $cur, 5 ); // get the field "LastName" 
		}
		
		$fullName = "$FirstName $LastName";
		print "This report shows $fullName past help desk calls";

		$cur= odbc_exec( $cnx, "SELECT ID,FirstName, LastName,PCatagory,describe,Status,Resolution,staff,mainDate FROM data WHERE Staff ='$fullName'" );  

 		$nbrow=0;   //Local variable to count number of rows 
   
   			 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"; 
   
    		while( odbc_fetch_row( $cur ) ) 
			{ 
       	    $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, 9 ); // get the field "Status" 
			$nbrow++; 
		
			$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>\n"; 
			}
    		echo "<tr><td colspan=2>$nbrow entries </td></tr></table>"; 
	
    // close the connection. important if persistent connection are "On" 
    odbc_close( $cnx); 
} 

function Error_Handler( $msg, $cnx ) { 
    echo "$msg \n"; 
    odbc_close( $cnx); 
    exit(); 
} 

$strOldEntries = ""; 
$strNewEntries = "Updated version of databse (after entries)"; 



HTML_Head(); 
Database_Entries($strOldEntries); 
Output_Entries(); 
HTML_Foot(); 

?>
</p>
<p>&nbsp;</p>
<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>
