function do_ticket($theRow, $theWidth, $search = FALSE, $dist = TRUE)
{
    // returns table - 6/26/10
    global $iw_width, $nature, $disposition, $patient, $incident, $incidents;
    // 12/3/10
    $tickno = get_variable('serial_no_ap') == 0 ? "&nbsp;&nbsp;<I>(#" . $theRow['id'] . ")</I>" : "";
    // 1/25/09
    switch ($theRow['severity']) {
        //color tickets by severity
        case $GLOBALS['SEVERITY_MEDIUM']:
            $severityclass = 'severity_medium';
            break;
        case $GLOBALS['SEVERITY_HIGH']:
            $severityclass = 'severity_high';
            break;
        default:
            $severityclass = 'severity_normal';
            break;
    }
    $print = "<TABLE BORDER='0' ID='left' width='" . $theWidth . "'>\n";
    //
    $print .= "<TR CLASS='even'><TD ALIGN='left' CLASS='td_data' COLSPAN=2 ALIGN='center'><B>{$incident}: <I>" . highlight($search, $theRow['scope']) . "</B>" . $tickno . "</TD></TR>\n";
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Addr") . ":</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['tick_street']) . "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("City") . ":</TD>\t\t\t<TD ALIGN='left'>" . highlight($search, $theRow['tick_city']);
    $print .= "&nbsp;&nbsp;" . highlight($search, $theRow['tick_state']) . "</TD></TR>\n";
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Priority") . ":</TD> <TD ALIGN='left' CLASS='" . $severityclass . "'>" . get_severity($theRow['severity']);
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$nature}:&nbsp;&nbsp;" . get_type($theRow['in_types_id']);
    $print .= "</TD></TR>\n";
    $print .= "<TR CLASS='even'  VALIGN='top'><TD ALIGN='left'>" . get_text("Synopsis") . ":</TD>\t<TD ALIGN='left'>" . replace_quotes(highlight($search, nl2br($theRow['tick_descr']))) . "</TD></TR>\n";
    //	8/12/09
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Protocol") . ":</TD> <TD ALIGN='left' CLASS='{$severityclass}'>{$theRow['protocol']}</TD></TR>\n";
    // 7/16/09
    $print .= "<TR CLASS='even'  VALIGN='top'><TD ALIGN='left'>" . get_text("911 Contacted") . ":</TD>\t<TD ALIGN='left'>" . highlight($search, nl2br($theRow['nine_one_one'])) . "</TD></TR>\n";
    //	6/26/10
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>" . get_text("Reported by") . ":</TD>\t<TD ALIGN='left'>" . highlight($search, $theRow['contact']) . "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("Phone") . ":</TD>\t\t\t<TD ALIGN='left'>" . format_phone($theRow['phone']) . "</TD></TR>\n";
    $end_date = intval($theRow['problemend']) > 1 ? $theRow['problemend'] : time() - intval(get_variable('delta_mins')) * 60;
    $elapsed = my_date_diff($theRow['problemstart'], $end_date);
    $elaped_str = intval($theRow['problemend']) > 1 ? "" : "&nbsp;&nbsp;&nbsp;&nbsp;({$elapsed})";
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>" . get_text("Status") . ":</TD>\t\t<TD ALIGN='left'>" . get_status($theRow['status']) . "{$elaped_str}</TD></TR>\n";
    $by_str = $theRow['call_taker'] == 0 ? "" : "&nbsp;&nbsp;by " . get_owner($theRow['call_taker']) . "&nbsp;&nbsp;";
    // 1/7/10
    $print .= "<TR CLASS='even'><TD ALIGN='left'>" . get_text("Written") . ":</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['date']) . $by_str;
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Updated:&nbsp;&nbsp;" . format_date($theRow['updated']) . "</TD></TR>\n";
    $print .= empty($theRow['booked_date']) ? "" : "<TR CLASS='odd'><TD ALIGN='left'>Scheduled date:</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['booked_date']) . "</TD></TR>\n";
    // 10/6/09
    $print .= "<TR CLASS='even' ><TD ALIGN='left' COLSPAN='2'>&nbsp;\t<TD ALIGN='left'></TR>\n";
    // separator
    $print .= empty($theRow['fac_name']) ? "" : "<TR CLASS='odd' ><TD ALIGN='left'>{$incident} at Facility:</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['fac_name']) . "</TD></TR>\n";
    // 8/1/09
    $print .= empty($theRow['rec_fac_name']) ? "" : "<TR CLASS='even' ><TD ALIGN='left'>Receiving Facility:</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['rec_fac_name']) . "</TD></TR>\n";
    // 10/6/09
    $print .= empty($theRow['comments']) ? "" : "<TR CLASS='odd'  VALIGN='top'><TD ALIGN='left'>{$disposition}:</TD>\t<TD ALIGN='left'>" . replace_quotes(highlight($search, nl2br($theRow['comments']))) . "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("Run Start") . ":</TD>\t\t\t\t\t<TD ALIGN='left'>" . format_date($theRow['problemstart']);
    $elaped_str = intval($theRow['problemend']) > 1 ? $elapsed : "";
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End:&nbsp;&nbsp;" . format_date($theRow['problemend']) . "&nbsp;&nbsp;({$elaped_str})</TD></TR>\n";
    $locale = get_variable('locale');
    // 08/03/09
    switch ($locale) {
        case "0":
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;USNG&nbsp;&nbsp;" . LLtoUSNG($theRow['lat'], $theRow['lng']);
            break;
        case "1":
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;OSGB&nbsp;&nbsp;" . LLtoOSGB($theRow['lat'], $theRow['lng']);
            // 8/23/08, 10/15/08, 8/3/09
            break;
        case "2":
            $coords = $theRow['lat'] . "," . $theRow['lng'];
            // 8/12/09
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;UTM&nbsp;&nbsp;" . toUTM($coords);
            // 8/23/08, 10/15/08, 8/3/09
            break;
        default:
            print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />";
    }
    $print .= "<TR CLASS='odd'><TD ALIGN='left' onClick = 'javascript: do_coords(" . $theRow['lat'] . "," . $theRow['lng'] . ")'><U>" . get_text("Position") . "</U>: </TD>\n\t\t<TD ALIGN='left'>" . get_lat($theRow['lat']) . "&nbsp;&nbsp;&nbsp;" . get_lng($theRow['lng']) . $grid_type . "</TD></TR>\n";
    // 9/13/08
    $print .= "<TR><TD colspan=2 ALIGN='left'>";
    $print .= show_log($theRow[0]);
    // log
    $print .= "</TD></TR>";
    $print .= "<TR STYLE = 'display:none;'><TD colspan=2><SPAN ID='oldlat'>" . $theRow['lat'] . "</SPAN><SPAN ID='oldlng'>" . $theRow['lng'] . "</SPAN></TD></TR>";
    $print .= "</TABLE>\n";
    $print .= show_assigns(0, $theRow[0]);
    // 'id' ambiguity - 7/27/09
    $print .= show_actions($theRow[0], "date", FALSE, FALSE);
    return $print;
}
예제 #2
0
			<INPUT TYPE="hidden" NAME="frm_exist_rec_fac" VALUE="<?php 
            print $exist_rec_fac;
            ?>
">
			<INPUT TYPE="hidden" NAME="frm_exist_groups" VALUE="<?php 
            print isset($alloc_groups) ? $alloc_groups : 1;
            ?>
">			
			<INPUT TYPE="hidden" NAME="frm_fac_chng" VALUE="0">		<!-- 3/25/10 -->
<?php 
            print "<TR CLASS='even'>\n\t\t\t\t<TD COLSPAN='10' ALIGN='center'><BR /><B><U><A HREF='#' TITLE='List of all actions and patients atached to this Incident'>Actions and Patients</A></U></B><BR /></TD></TR>";
            //8/7/09
            print "<TR CLASS='odd'><TD COLSPAN='10' ALIGN='center'>";
            //8/7/09
            //			$temp = (!((is_user()) && (intval(get_variable('oper_can_edit')) != 1)));					// 4/1/11
            print show_actions($row[0], "date", !$disallow, TRUE);
            //8/7/09
            print "<BR /><BR /></TD></TR>";
            //8/7/09
            print "</TABLE>";
            // end data 8/7/09
            //8/7/09
            if ($gmaps) {
                // 1/1/11, 6/10/11
                print "</TD><TD>";
                print "<TABLE ID='mymap' border = 0><TR><TD ALIGN='center'><DIV ID='map' STYLE='WIDTH: " . get_variable('map_width') . "PX; HEIGHT:" . get_variable('map_height') . "PX'></DIV>\n\t\t\t\t\t<BR /><SPAN ID='do_grid' onClick='toglGrid()'><U>Grid</U></SPAN>&nbsp;&nbsp;&nbsp;&nbsp;\n\t\t\t\t\t<SPAN ID='do_sv' onClick = 'sv_win(document.edit)'><U>Street view</U></SPAN>";
                print $zoom_tight ? "<SPAN  onClick= 'zoom_in({$lat}, {$lng}, {$zoom_tight});' STYLE = 'margin-left:20px'><U>Zoom</U></SPAN>\n" : "";
                // 3/27/10
                print "</TD></TR></TABLE ID='mymap'>\n";
            }
            print "</TD></TR>";
function do_inc_log_report($the_ticket_id)
{
    // 3/18/10
    global $types;
    global $w_tiny, $w_small, $w_medium, $w_large;
    // 4/14/11
    global $nature, $disposition, $patient, $incident, $incidents;
    // 4/21/11
    $tickets = $actions = $patients = $unit_names = $un_status = $unit_types = $users = $facilities = $fac_status = $fac_types = array();
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}ticket`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    //		$str_lgth_max = 10;
    //		$tick_str = ((strlen($tickets[$row['id']])) > $str_lgth_max) ? substr($row['street'], 0, $str_lgth_max). " ..." : $tickets[$row['id']] ;
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $tickets[$row['id']] = substr($row['scope'], 0, 10) . "/" . substr($row['street'], 0, 10);
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}action`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $actions[$row['id']] = substr($row['description'], 0, 20);
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}patient`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $patients[$row['id']] = substr($row['description'], 0, 20);
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}responder`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $unit_names[$row['id']] = $row['name'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}un_status`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $un_status[$row['id']] = $row['status_val'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}unit_types`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $unit_types[$row['id']] = $row['name'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}user`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $users[$row['id']] = $row['user'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}facilities`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $facilities[$row['id']] = $row['name'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}fac_status`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $fac_status[$row['id']] = $row['status_val'];
    }
    $query = "SELECT *FROM `{$GLOBALS['mysql_prefix']}fac_types`";
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        $fac_types[$row['id']] = $row['name'];
    }
    // ______________________________________________________________________________
    $query = "SELECT *,\n\t\t\tUNIX_TIMESTAMP(problemstart) AS problemstart,\n\t\t\tUNIX_TIMESTAMP(problemend) AS problemend,\n\t\t\tUNIX_TIMESTAMP(booked_date) AS booked_date,\t\t\n\t\t\tUNIX_TIMESTAMP(date) AS date,\n\t\t\tUNIX_TIMESTAMP(`{$GLOBALS['mysql_prefix']}ticket`.`updated`) AS updated,\n\t\t\t `{$GLOBALS['mysql_prefix']}ticket`.`description` AS `tick_descr`,\n\t\t\t `{$GLOBALS['mysql_prefix']}ticket`.`lat` AS `lat`,\n\t\t\t `{$GLOBALS['mysql_prefix']}ticket`.`lng` AS `lng`,\n\t\t\t `{$GLOBALS['mysql_prefix']}ticket`.`_by` AS `call_taker`,\n\t\t\t `{$GLOBALS['mysql_prefix']}facilities`.`name` AS `fac_name`,\n\t\t\t `rf`.`name` AS `rec_fac_name`,\n\t\t\t `rf`.`lat` AS `rf_lat`,\n\t\t\t `rf`.`lng` AS `rf_lng`,\n\t\t\t `{$GLOBALS['mysql_prefix']}facilities`.`lat` AS `fac_lat`,\n\t\t\t `{$GLOBALS['mysql_prefix']}facilities`.`lng` AS `fac_lng` FROM `{$GLOBALS['mysql_prefix']}ticket`  \n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}in_types` `ty` ON (`{$GLOBALS['mysql_prefix']}ticket`.`in_types_id` = `ty`.`id`)\t\t\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}facilities` ON (`{$GLOBALS['mysql_prefix']}facilities`.`id` = `{$GLOBALS['mysql_prefix']}ticket`.`facility`)\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}facilities` `rf` ON (`rf`.`id` = `{$GLOBALS['mysql_prefix']}ticket`.`rec_facility`) \n\t\t\tWHERE `{$GLOBALS['mysql_prefix']}ticket`.`id`= '{$the_ticket_id}' LIMIT 1";
    // 7/24/09 10/16/08 Incident location 10/06/09 Multi point routing
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    $theRow = stripslashes_deep(mysql_fetch_array($result));
    $tickno = get_variable('serial_no_ap') == 0 ? "&nbsp;&nbsp;<I>(#" . $theRow['id'] . ")</I>" : "";
    // 1/25/09
    switch ($theRow['severity']) {
        //color tickets by severity
        case $GLOBALS['SEVERITY_MEDIUM']:
            $severityclass = 'severity_medium';
            break;
        case $GLOBALS['SEVERITY_HIGH']:
            $severityclass = 'severity_high';
            break;
        default:
            $severityclass = 'severity_normal';
            break;
    }
    $print = "<TABLE BORDER='0' STYLE = 'width:800px'>\n";
    //
    $print .= "<TR CLASS='even'><TD ALIGN='left' CLASS='td_data' COLSPAN=2 ALIGN='center'><B>{$incident}: <I>{$theRow['scope']}</B>{$tickno}</TD></TR>\n";
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>Priority:</TD> <TD ALIGN='left' CLASS='" . $severityclass . "'>" . get_severity($theRow['severity']);
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$nature}:&nbsp;&nbsp;" . get_type($theRow['in_types_id']);
    $print .= "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>Protocol:</TD> <TD ALIGN='left' CLASS='{$severityclass}'>{$theRow['protocol']}</TD></TR>\n";
    // 7/16/09
    $print .= "<TR CLASS='odd' ><TD ALIGN='left'>Address:</TD>\t\t<TD ALIGN='left'>{$theRow['street']}";
    $print .= "&nbsp;&nbsp;{$theRow['city']}&nbsp;&nbsp;{$theRow['state']}</TD></TR>\n";
    $print .= "<TR CLASS='even'  VALIGN='top'><TD ALIGN='left'>Description:</TD>\t<TD ALIGN='left'>" . nl2br($theRow['tick_descr']) . "</TD></TR>\n";
    //	8/12/09
    $end_date = intval($theRow['problemend']) > 1 ? $theRow['problemend'] : time() - get_variable('delta_mins') * 60;
    $elapsed = my_date_diff($theRow['problemstart'], $end_date);
    // 5/13/10
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>Status:</TD>\t\t<TD ALIGN='left'>" . get_status($theRow['status']) . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;({$elapsed})</TD></TR>\n";
    $print .= "<TR CLASS='even'><TD ALIGN='left'>Reported by:</TD>\t<TD ALIGN='left'>{$theRow['contact']}";
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;Phone:&nbsp;&nbsp;" . format_phone($theRow['phone']) . "</TD></TR>\n";
    $by_str = $theRow['call_taker'] == 0 ? "" : "&nbsp;&nbsp;by " . get_owner($theRow['call_taker']) . "&nbsp;&nbsp;";
    // 1/7/10
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>Written:</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['date']) . $by_str;
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Updated:&nbsp;&nbsp;" . format_date($theRow['updated']) . "</TD></TR>\n";
    $print .= empty($theRow['booked_date']) ? "" : "<TR CLASS='odd'><TD ALIGN='left'>Scheduled date:</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['booked_date']) . "</TD></TR>\n";
    // 10/6/09
    $print .= !is_int($theRow['facility']) ? "" : "<TR CLASS='odd' ><TD ALIGN='left'>{$incident} at Facility:</TD>\t\t<TD ALIGN='left'>{$theRow['fac_name']}</TD></TR>\n";
    // 8/1/09
    $print .= !is_int($theRow['rec_facility']) ? "" : "<TR CLASS='even' ><TD ALIGN='left'>Receiving Facility:</TD>\t\t<TD ALIGN='left'>{$theRow['rec_fac_name']}</TD></TR>\n";
    // 10/6/09
    $print .= empty($theRow['comments']) ? "" : "<TR CLASS='odd'  VALIGN='top'><TD ALIGN='left'>{$disposition}:</TD>\t<TD ALIGN='left'>" . nl2br($theRow['comments']) . "</TD></TR>\n";
    $print .= "<TR CLASS='even' ><TD ALIGN='left'>Run Start:</TD><TD ALIGN='left'>" . format_date($theRow['problemstart']);
    $print .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End:&nbsp;&nbsp;" . format_date($theRow['problemend']) . "&nbsp;&nbsp;&nbsp;&nbsp;Elapsed:&nbsp;&nbsp;{$elapsed}\n\t\t\t</TD></TR>\n";
    $locale = get_variable('locale');
    // 08/03/09
    switch ($locale) {
        case "0":
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;USNG&nbsp;&nbsp;" . LLtoUSNG($theRow['lat'], $theRow['lng']);
            break;
        case "1":
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;OSGB&nbsp;&nbsp;" . LLtoOSGB($theRow['lat'], $theRow['lng']);
            // 8/23/08, 10/15/08, 8/3/09
            break;
        case "2":
            $coords = $theRow['lat'] . "," . $theRow['lng'];
            // 8/12/09
            $grid_type = "&nbsp;&nbsp;&nbsp;&nbsp;UTM&nbsp;&nbsp;" . toUTM($coords);
            // 8/23/08, 10/15/08, 8/3/09
            break;
        default:
            print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />";
    }
    $print .= "<TR CLASS='odd'><TD ALIGN='left'>Position: </TD><TD ALIGN='left'>" . get_lat($theRow['lat']) . "&nbsp;&nbsp;&nbsp;" . get_lng($theRow['lng']) . $grid_type . "</TD></TR>\n";
    // 9/13/08
    $print .= "<TR><TD>&nbsp;</TD></TR></TABLE>\n";
    print $print;
    print show_actions($the_ticket_id, "date", FALSE, TRUE);
    // ($the_id, $theSort="date", $links, $display)
    $query = "\n\t\t\tSELECT *, `u`.`user` AS `thename` , \n\t\t\t\t`l`.`info` AS `log_info` , \n\t\t\t\t`l`.`id` AS `log_id` , \n\t\t\t\t`l`.`responder_id` AS `the_unit_id`,\n\t\t\t\tUNIX_TIMESTAMP( `l`.`when` ) AS `when`\n\t\t\tFROM `{$GLOBALS['mysql_prefix']}log` `l`\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` t ON ( `t`.`id` = `l`.`ticket_id` )\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}user` u ON ( `l`.`who` = `u`.`id` )\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}assigns` a ON ( `a`.`ticket_id` = `t`.`id` )\n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}responder` `r` ON ( `r`.`id` = `a`.`responder_id` )\n\t\t\tWHERE `code` >= '{$GLOBALS['LOG_INCIDENT_OPEN']}'\n\t\t\tAND `l`.`ticket_id` ={$the_ticket_id}\n\t\t\tORDER BY `log_id` ASC";
    //		dump($query);
    $result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
    $evenodd = array("even", "odd");
    $i = 0;
    echo "<TABLE ALIGN='left' CELLSPACING = 1 border=0  STYLE = 'width:800px'>";
    $do_hdr = TRUE;
    $day_part = "";
    $last_id = "";
    while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
        if ($row['log_id'] != $last_id) {
            $last_id = $row['log_id'];
            // dupe preventer
            if ($do_hdr) {
                echo "<TR CLASS='odd'><TD>&nbsp;</TD></TR>";
                echo "<TR CLASS='even'><TH COLSPAN=99> {$incident} Log</TH></TR>";
                echo "<TR CLASS='odd'>\n\t\t\t\t\t\t<TD></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;Time</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;Log code</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;" . get_text("Unit") . "/Fac'y</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;Data</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;By</b></TD>\n\t\t\t\t\t\t<TD ALIGN='left'><b>&nbsp;From</b></TD>\n\t\t\t\t\t\t</TR>";
                $do_hdr = FALSE;
            }
            $temp = explode(" ", format_date($row['when']));
            $show_day = $temp[0] == $day_part ? "" : $temp[0];
            $day_part = $temp[0];
            echo "<TR CLASS = '{$evenodd[$i % 2]}'>\n\t\t\t\t<TD ALIGN='left'>{$show_day}</TD>\n\t\t\t\t<TD ALIGN='left'>&nbsp;{$temp[1]}&nbsp;</TD>\n\t\t\t\t<TD><b>&nbsp;{$types[$row['code']]}&nbsp;</b></TD>";
            switch ($row['code']) {
                case $GLOBALS['LOG_INCIDENT_OPEN']:
                case $GLOBALS['LOG_INCIDENT_CLOSE']:
                case $GLOBALS['LOG_INCIDENT_CHANGE']:
                case $GLOBALS['LOG_INCIDENT_DELETE']:
                    print "<TD></TD><TD></TD>";
                    break;
                case $GLOBALS['LOG_ACTION_ADD']:
                case $GLOBALS['LOG_ACTION_DELETE']:
                    $act_str = array_key_exists($row['log_info'], $actions) ? $actions[$row['log_info']] : "[{$row['log_info']}]";
                    print "<TD></TD><TD>&nbsp;{$act_str}&nbsp;</TD>";
                    break;
                case $GLOBALS['LOG_PATIENT_ADD']:
                case $GLOBALS['LOG_PATIENT_DELETE']:
                    $pat_str = array_key_exists($row['log_info'], $patients) ? $patients[$row['log_info']] : "[{$row['log_info']}]";
                    print "<TD></TD><TD>&nbsp;{$pat_str}&nbsp;</TD>";
                    break;
                case $GLOBALS['LOG_UNIT_STATUS']:
                case $GLOBALS['LOG_UNIT_COMPLETE']:
                case $GLOBALS['LOG_UNIT_CHANGE']:
                    $the_unit = array_key_exists($row['the_unit_id'], $unit_names) ? $unit_names[$row['the_unit_id']] : "?? {$row['the_unit_id']}";
                    $the_status = array_key_exists($row['log_info'], $un_status) ? $un_status[$row['log_info']] : "?? {$row['the_unit_id']}";
                    print "<TD>&nbsp;{$the_unit}&nbsp;</TD><TD>{$the_status}</TD>";
                    break;
                case $GLOBALS['LOG_CALL_DISP']:
                case $GLOBALS['LOG_CALL_RESP']:
                case $GLOBALS['LOG_CALL_ONSCN']:
                case $GLOBALS['LOG_CALL_CLR']:
                case $GLOBALS['LOG_CALL_RESET']:
                    //						dump($row);
                    $the_unit = array_key_exists($row['the_unit_id'], $unit_names) ? $unit_names[$row['the_unit_id']] : "?? {$row['the_unit_id']}";
                    print "<TD>&nbsp;{$the_unit}&nbsp;</TD><TD></TD>";
                    break;
                case $GLOBALS['LOG_CALL_REC_FAC_SET']:
                case $GLOBALS['LOG_CALL_REC_FAC_CHANGE']:
                case $GLOBALS['LOG_CALL_REC_FAC_UNSET']:
                case $GLOBALS['LOG_CALL_REC_FAC_CLEAR']:
                case $GLOBALS['LOG_FACILITY_INCIDENT_OPEN']:
                case $GLOBALS['LOG_FACILITY_INCIDENT_CLOSE']:
                case $GLOBALS['LOG_FACILITY_INCIDENT_CHANGE']:
                case $GLOBALS['LOG_FACILITY_DISP']:
                case $GLOBALS['LOG_FACILITY_RESP']:
                case $GLOBALS['LOG_FACILITY_ONSCN']:
                case $GLOBALS['LOG_FACILITY_CLR']:
                case $GLOBALS['LOG_FACILITY_RESET']:
                    $the_facy = array_key_exists($row['facility'], $facilities) ? $facilities[$row['facility']] : "?? {$row['facility']}";
                    print "<TD>{$the_facy}</TD><TD></TD>";
                    break;
                default:
                    print "<TD>ERROR {$row['code']} : {$row['log_id']} </TD";
            }
            // end switch()
            echo "\n\t\t\t\t\t<TD>&nbsp;{$row['thename']}&nbsp;</TD>\n\t\t\t\t\t<TD>&nbsp;{$row['from']}&nbsp;</TD>";
            echo "</TR>\n";
            $i++;
        }
    }
    // end while()
    echo "<TR><TD COLSPAN=99 ALIGN='center'><HR STYLE = 'color: blue; size: 1; width: 50%'></TD></TR>";
    echo "</TABLE>";
}
" />
			<INPUT TYPE="hidden" NAME="frm_exist_rec_fac" VALUE="<?php 
            print $exist_rec_fac;
            ?>
" />
			<INPUT TYPE="hidden" NAME="frm_fac_chng" VALUE="0" />		<!-- 3/25/10 -->
			<INPUT TYPE="hidden" NAME="mode" VALUE="<?php 
            print $mode;
            ?>
" />	<!-- 9/8/10 -->
<?php 
            print "<TR CLASS='even'><TD COLSPAN='10' ALIGN='center'><BR /><B><U><A HREF=\"#\" TITLE=\"List of all actions and patients atached to this Incident\">Actions and Patients</A></U></B><BR /></TD></TR>";
            //8/7/09
            print "<TR CLASS='odd'><TD COLSPAN='10' ALIGN='center'>";
            //8/7/09
            print show_actions($row[0], "date", TRUE, TRUE, $mode);
            // 9/8/10
            print "</TD></TR>";
            //8/7/09
            print "</TABLE>";
            // end data 8/7/09
            print "</TD></TR>";
            //8/7/09
            print "<TR><TD CLASS='print_TD' COLSPAN='2'>";
            print "</FORM>";
            print "</TD></TR></TABLE>";
            // bottom of outer
            ?>
	<SCRIPT type="text/javascript">
	
<?php