Location: PHPKode > projects > ampCAD > print_calldetail.php
<?php

// *******************************
// print_calldetail.php
//
// Call detail report
// *******************************

include_once 'functions.php';
include_once 'accesscontrol.php';
include_once 'dbaccess.inc.php';
include_once 'error_process.inc.php';
include_once 'f_callList.inc.php';

if (!isset($_GET['id'])) $id = "";
else $id = $_GET['id'];

$sql = "select * from tblCall join tblChannel on (tblCall.callChannel = tblChannel.channelID) ";
$sql .= "join tblIncident on (tblCall.callIncident = tblIncident.incidentID) ";
$sql .= "join tblLocation on (tblCall.callLocation = tblLocation.locationID) ";
$sql .= "where callID=$id";
$result = mysql_query( $sql, $db );
if( !$result ) error_process( $db );
?>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo $googleMapKey; ?>" type="text/javascript"></script>
<script type="text/javascript">

//<![CDATA[
var map;

function load() {
  map = new GMap2(document.getElementById("map"));
<?php

$data = mysql_fetch_object( $result );

?>
  point = new GLatLng(<?php echo $data->locationLat; ?>, <?php echo $data->locationLong; ?>);
  marker = new GMarker( point );
  map.setCenter( point , 15 );
  map.addOverlay( marker );
}

//]]>
</script>
<body onload="load()" onunload="GUnload()">
<?php

echo "<table align=center width=75% bgcolor=\"#f9f1b1\">\n";
echo "	<tr>\n";
echo "		<td valign=top>\n";
echo "			<table>\n";
echo "				<tr>\n";
echo "					<td align=right>Call ID :</td>\n";
echo "					<td>$data->callID</td>\n";
echo "				</tr>\n";
echo "				<tr>\n";
echo "					<td align=right>Entered :</td>\n";
echo "					<td>$data->callDate $data->callTime</td>\n";
echo "				</tr>\n";
echo "				<tr>\n";
echo "					<td align=right>Location :</td>\n";
echo "					<td><a href=\"http://maps.google.com/maps?f=q&hl=en&geocode=&q=$data->locationAddress $global_default_state\" target=\"_new\">$data->locationAddress</a></td>\n";
echo "				</tr>\n";
echo "				<tr>\n";
echo "					<td align=right>Incident Type :</td>\n";
echo "					<td>$data->incidentDescription</td>\n";
echo "				</tr>\n";
echo "				<tr>\n";
echo "					<td align=right>Primary Channel :</td>\n";
echo "					<td>$data->channelDescription</td>\n";
echo "				</tr>\n";
echo "				<tr>\n";
echo "					<td align=right valign=top>Notes :</td>\n";
echo "					<td width=60%>$data->callNotes</td>\n";
echo "				</tr>\n";
echo "				<tr>\n";
echo "					<td align=right valign=top>Units Assigned :</td>\n";
echo "					<td>\n";

$sql = "select * from tblCallUnits join tblUnit on (tblCallUnits.callUnitsAssigned = tblUnit.unitID) where callUnitsCall = $id";
$result_unit = mysql_query( $sql, $db );
if( !$result_unit ) error_process( $db );

for( $x = 0; $x < mysql_num_rows( $result_unit ); $x++ ) {
	$data_unit = mysql_fetch_object( $result_unit );
	echo "$data_unit->unitCallSign<br>\n";
}
echo "					</td>\n";
echo "				</tr>\n";
echo "			</table>\n";
echo "		</td>\n";

echo "		<td valign=top>\n";
echo "			<div id=\"map\" style=\"width: 250px; height: 250px\"></div>\n";
echo "		</td>\n";
echo "	</tr>\n";
echo "</table>\n";
echo "<hr>\n";

$sql = "select * from tblCallLog where logCall = $id order by logDate asc, logTime asc";
$result_log = mysql_query( $sql, $db );
if( !$result_log ) error_process( $db );
?>
<table align=center cellspacing=0 cellpadding=0 borders=0>
<tr bgcolor=<?php echo $global_tblHeader; ?>>
	<td align=center><b><u>Date</u></b></td>
	<td>&nbsp;&nbsp;&nbsp</td>
	<td align=center><b><u>Time</u></b></td>
	<td>&nbsp;&nbsp;&nbsp</td>
	<td align=center><b><u>Duration</u></b></td>
	<td>&nbsp;&nbsp;&nbsp</td>
	<td align=center><b><u>User</u></b></td>
	<td>&nbsp;&nbsp;&nbsp</td>
	<td align=center><b><u>Message</u></b></td>
</tr>
<?php

for( $x = 0; $x < mysql_num_rows( $result_log ); $x++ ) {
	$data_log = mysql_fetch_object( $result_log );
	$duration = elapsed_time( $data->callTime, $data_log->logTime );
	echo "  <tr bgcolor=";
	if( $x % 2 ) echo "$global_tblColor1>\n";
	else echo "$global_tblColor2>\n";
	echo "		<td>$data_log->logDate</td>\n";
	echo "		<td>&nbsp;&nbsp;&nbsp</td>\n";
	echo "		<td>$data_log->logTime</td>\n";
	echo "		<td>&nbsp;&nbsp;&nbsp</td>\n";
	echo "		<td>$duration</td>\n";
	echo "		<td>&nbsp;&nbsp;&nbsp</td>\n";
	echo "          <td>$data_log->logUser</td>\n";
	echo "          <td>&nbsp;&nbsp;&nbsp</td>\n";
	echo "		<td>$data_log->logMessage</td>\n";
	echo "	</tr>\n";
}

echo "</table>\n";

mysql_close();

?>
Return current item: ampCAD