|
Computer Service Request
$sn = isset($_GET['sn']) ? $_GET['sn'] : "";
include(dirname(__FILE__)."/llc/includes/dbconfig.php");
$connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable to connect!");
$query = "SELECT *, DATE_FORMAT(ReportTime, '%m/%d/%Y %H:%i') d1, DATE_FORMAT(ProblemDate, '%m/%d/%Y') d2, DATE_FORMAT(ReqCompDate, '%m/%d/%Y') d3 from request WHERE SerialNo = '$sn'";
mysql_select_db($db_name);
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_array($result);
if ($row["Status"]==0){$status = 'Open';}
else if ($row["Status"]==8){$status = 'Closed';}
else if ($row["Status"]==3){$status = 'Solved';}
else {$status = 'Unknown';}
$ReportTime = $row["d1"];
$ReportPerson = $row["ReportPerson"];
$Extension = $row["Extension"];
$Location = $row["Location"];
$ProblemDate = $row["d2"];
$StationNo = $row["StationNo"];
$Type = $row["Type"];
$ReqCompDate = $row["d3"];
$Description = str_replace("\n"," ",$row["Description"]);
$StepsTaken = str_replace("\n"," ",$row["StepsTaken"]);
$Comments = str_replace("\n"," ",$row["Comments"]);
$Procedures = $row["Procedures"];
$Prio = $row["Priority"];
$AssignTo = $row["AssignTo"];
$Training = $row["Training"];
if ($Training == '1'){$need = " checked";}else {$need = "";}
for ($i=0; $i<3; $i++)
{
$P[$i]='';
}
if ($Prio == '1')
{
$Priority = "Medium";
$P[1] = "selected";
}
else if ($Prio == '2')
{
$Priority = " High";
$P[2] = "selected";
}
else if ($Prio == '0')
{
$Priority = " Low";
$P[0] = "selected";
}
print <<
Request #: $sn |
Status: $status |
Report Time: $ReportTime |
Priority: $Priority |
Assigned to:
END;
$query = "SELECT FirstName, LastName from userlist WHERE UserName='$AssignTo'";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_array($result);
$Aname = $row[0];
if (session_is_registered("SUPER") || session_is_registered("CFS"))
{
print <<
END;
$query = "SELECT UserName, FirstName from userlist";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
if (mysql_num_rows($result) >= 1)
{
while ($row = mysql_fetch_row($result))
{
if ($row[0] == $AssignTo)
{print "";}
else
{print "";}
}
}
print " ";
}
else
{
echo "$Aname";
}
print << |
Person
Reporting Problem: |
$ReportPerson
|
Ext.: |
$Extension
|
|
Location: |
$Location
|
Station: |
$StationNo |
Problem Started: |
$ProblemDate
|
|
Type: |
$Type
|
Request
Completion By: |
$ReqCompDate
|
|
|
|
|
END;
if ($Procedures != '')
{
$p = str_replace("\n"," ",$Procedures);
print << Recommended Trouble Shooting Procedures:
$p
END;
}
$query = "SELECT * from followup WHERE SerialNo = '$sn'";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
while ($row = mysql_fetch_array($result))
{
if ($row['Type'] == '1'){$head = ' Comments from ';}
else if ($row['Type'] == '3'){$head = ' Solved by ';}
else if ($row['Type'] == '5'){continue; $head = 'Further Training changed by ';}
else if ($row['Type'] == '6'){$head = ' Assigned person changed by ';}
else if ($row['Type'] == '7'){$head = ' Priority changed by ';}
else if ($row['Type'] == '8'){$head = ' Closed by ';}
else if ($row['Type'] == '9'){$head = ' Reopened by ';}
$name = $row['Person'];
$recordtime = $row['RecordTime'];
$comments = str_replace("\n"," ",$row['Description']);
print <<$head$name on $recordtime
$comments
END;
}
if ($status != 'Closed')
{print <<
END;
}
else if (session_is_registered("SUPER") || session_is_registered("CFS"))
{print <<
END;
}
if (session_is_registered("SUPER") || session_is_registered("CFS"))
{print <<
END;
}
?>
|
|
|
| |