3 * Copyright (C) 2010-2013 Rod Roark <rod@sunsetsystems.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
11 require_once("../globals.php");
12 require_once("$srcdir/acl.inc");
13 require_once("$srcdir/formdata.inc.php");
14 require_once("$srcdir/options.inc.php");
15 require_once("$srcdir/formatting.inc.php");
16 require_once("../orders/lab_exchange_tools.php");
18 // Indicates if we are entering in batch mode.
19 $form_batch = empty($_GET['batch']) ?
0 : 1;
21 // Indicates if we are entering in review mode.
22 $form_review = empty($_GET['review']) ?
0 : 1;
24 // Check authorization.
25 $thisauth = acl_check('patients', 'med');
26 if (!$thisauth) die(xl('Not authorized'));
28 // Check authorization for pending review.
29 $reviewauth = acl_check('patients', 'sign');
30 if ($form_review and !$reviewauth and !$thisauth) die(xl('Not authorized'));
32 // Set pid for pending review.
33 if ($_GET['set_pid'] && $form_review) {
34 require_once("$srcdir/pid.inc");
35 require_once("$srcdir/patient.inc");
36 setpid($_GET['set_pid']);
38 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
40 <script language
='JavaScript'>
41 parent
.left_nav
.setPatient(<?php
echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "',$pid,'" . addslashes($result['pubpid']) . "','', ' " . xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($result['DOB_YMD']) . "'"; ?
>);
42 parent
.left_nav
.setRadio(window
.name
, 'orp');
47 if (!$form_batch && !$pid && !$form_review) die(xl('There is no current patient'));
49 function oresRawData($name, $index) {
50 $s = isset($_POST[$name][$index]) ?
$_POST[$name][$index] : '';
51 return trim(strip_escape_custom($s));
54 function oresData($name, $index) {
55 $s = isset($_POST[$name][$index]) ?
$_POST[$name][$index] : '';
56 return formDataCore($s, true);
59 function QuotedOrNull($fld) {
60 if (empty($fld)) return "NULL";
64 $current_report_id = 0;
66 if ($_POST['form_submit'] && !empty($_POST['form_line'])) {
67 foreach ($_POST['form_line'] as $lino => $line_value) {
68 list($order_id, $order_seq, $report_id, $result_id) = explode(':', $line_value);
70 // Not using xl() here because this is for debugging only.
71 if (empty($order_id)) die("Order ID is missing from line $lino.");
73 // If report data exists for this line, save it.
74 $date_report = oresData("form_date_report", $lino);
76 if (!empty($date_report)) {
78 "procedure_order_id = '$order_id', " .
79 "procedure_order_seq = '$order_seq', " .
80 "date_report = '$date_report', " .
81 "date_collected = " . QuotedOrNull(oresData("form_date_collected", $lino)) . ", " .
82 "specimen_num = '" . oresData("form_specimen_num", $lino) . "', " .
83 "report_status = '" . oresData("form_report_status", $lino) . "'";
85 // Set the review status to reviewed.
87 $sets .= ", review_status = 'reviewed'";
89 if ($report_id) { // Report already exists.
90 sqlStatement("UPDATE procedure_report SET $sets " .
91 "WHERE procedure_report_id = '$report_id'");
93 else { // Add new report.
94 $report_id = sqlInsert("INSERT INTO procedure_report SET $sets");
98 // If this line had report data entry fields, filled or not, set the
99 // "current report ID" which the following result data will link to.
100 if (isset($_POST["form_date_report"][$lino])) $current_report_id = $report_id;
102 // If there's a report, save corresponding results.
103 if ($current_report_id) {
104 // Comments and notes will be combined into one comments field.
105 $form_comments = oresRawData("form_comments", $lino);
106 $form_comments = str_replace("\n" ,'~' , $form_comments);
107 $form_comments = str_replace("\r" ,'' , $form_comments);
108 $form_notes = oresRawData("form_notes", $lino);
109 if ($form_notes !== '') {
110 $form_comments .= "\n" . $form_notes;
113 "procedure_report_id = '$current_report_id', " .
114 "result_code = '" . oresData("form_result_code", $lino) . "', " .
115 "result_text = '" . oresData("form_result_text", $lino) . "', " .
116 "abnormal = '" . oresData("form_result_abnormal", $lino) . "', " .
117 "result = '" . oresData("form_result_result", $lino) . "', " .
118 "`range` = '" . oresData("form_result_range", $lino) . "', " .
119 "units = '" . oresData("form_result_units", $lino) . "', " .
120 "facility = '" . oresData("form_facility", $lino) . "', " .
121 "comments = '" . add_escape_custom($form_comments) . "', " .
122 "result_status = '" . oresData("form_result_status", $lino) . "'";
123 if ($result_id) { // result already exists
124 sqlStatement("UPDATE procedure_result SET $sets " .
125 "WHERE procedure_result_id = '$result_id'");
127 else { // Add new result.
128 $result_id = sqlInsert("INSERT INTO procedure_result SET $sets");
137 <?php
html_header_show();?
>
139 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
140 <title
><?php
xl('Procedure Results','e'); ?
></title
>
144 tr
.head
{ font
-size
:10pt
; background
-color
:#cccccc; text-align:center; }
145 tr
.detail
{ font
-size
:10pt
; }
146 a
, a
:visited
, a
:hover
{ color
:#0000cc; }
152 border
-top
-width
:0px
;
153 border
-bottom
-width
:0px
;
154 border
-left
-width
:0px
;
155 border
-right
-width
:0px
;
156 border
-color
: #aaaaaa;
157 background
-color
:transparent
;
166 border
-top
-width
:0px
;
167 border
-bottom
-width
:0px
;
168 border
-left
-width
:0px
;
169 border
-right
-width
:0px
;
170 border
-color
: #aaaaaa;
171 background
-color
:transparent
;
177 background
-color
:transparent
;
187 <style type
="text/css">@import
url(<?php
echo $GLOBALS['webroot'] ?
>/library
/dynarch_calendar
.css
);</style
>
188 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script
>
189 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
190 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script
>
192 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
193 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
195 <script language
="JavaScript">
197 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
199 // This invokes the find-procedure-type popup.
201 function sel_proc_type(varname
) {
202 var f
= document
.forms
[0];
203 if (typeof varname
== 'undefined') varname
= 'form_proc_type';
205 dlgopen('types.php?popup=1&order=' + f
[ptvarname
].value
, '_blank', 800, 500);
208 // This is for callback by the find-procedure-type popup.
209 // Sets both the selected type ID and its descriptive name.
210 function set_proc_type(typeid
, typename
) {
211 var f
= document
.forms
[0];
212 f
[ptvarname
].value
= typeid
;
213 f
[ptvarname +
'_desc'].value
= typename
;
217 function extGetX(elem
) {
219 while(elem
!= null) {
220 x +
= elem
.offsetLeft
;
221 elem
= elem
.offsetParent
;
225 function extGetY(elem
) {
227 while(elem
!= null) {
229 elem
= elem
.offsetParent
;
234 // Show or hide the "extras" div for a result.
236 function extShow(lino
, show
) {
237 var thisdiv
= document
.getElementById("ext_" + lino
);
239 extdiv
.style
.visibility
= 'hidden';
240 extdiv
.style
.left
= '-1000px';
241 extdiv
.style
.top
= '0px';
243 if (show
&& thisdiv
!= extdiv
) {
245 var dw
= window
.innerWidth ? window
.innerWidth
- 20 : document
.body
.clientWidth
;
246 x
= dw
- extdiv
.offsetWidth
;
248 var y
= extGetY(show
) + show
.offsetHeight
;
249 extdiv
.style
.left
= x
;
250 extdiv
.style
.top
= y
;
251 extdiv
.style
.visibility
= 'visible';
258 // Helper function for validate.
259 function prDateRequired(rlino
) {
260 var f
= document
.forms
[0];
261 if (f
['form_date_report['+rlino+
']'].value
.length
< 10) {
262 alert('<?php xl('Missing report date
','e
') ?>');
263 if (f
['form_date_report['+rlino+
']'].focus
)
264 f
['form_date_report['+rlino+
']'].focus();
270 // Validation at submit time.
271 function validate(f
) {
273 for (var lino
= 0; f
['form_line['+lino+
']']; ++lino
) {
274 if (f
['form_date_report['+lino+
']']) {
276 if (f
['form_report_status['+rlino+
']'].selectedIndex
> 0) {
277 if (!prDateRequired(rlino
)) return false;
280 var abnstat
= f
['form_result_abnormal['+lino+
']'].selectedIndex
> 0;
281 if (abnstat
&& !prDateRequired(rlino
)) return false;
283 top
.restoreSession();
291 <body
class="body_top">
292 <form method
='post' action
='orders_results.php?batch=<?php echo $form_batch; ?>&review=<?php echo $form_review; ?>'
293 onsubmit
='return validate(this)'>
300 $form_from_date = formData('form_from_date','P',true);
301 $form_to_date = formData('form_to_date','P',true);
302 if (empty($form_to_date)) $form_to_date = $form_from_date;
303 $form_proc_type = formData('form_proc_type') +
0;
304 if (!$form_proc_type) $form_proc_type = -1;
305 $form_proc_type_desc = '';
306 if ($form_proc_type > 0) {
307 $ptrow = sqlQuery("SELECT name FROM procedure_type WHERE " .
308 "procedure_type_id = '$form_proc_type'");
309 $form_proc_type_desc = $ptrow['name'];
312 <?php
xl('Procedure','e'); ?
>:
313 <input type
='text' size
='30' name
='form_proc_type_desc'
314 value
='<?php echo addslashes($form_proc_type_desc) ?>'
315 onclick
='sel_proc_type()' onfocus
='this.blur()'
316 title
='<?php xl('Click to select the desired procedure
','e
'); ?>'
317 style
='cursor:pointer;cursor:hand' readonly
/>
318 <input type
='hidden' name
='form_proc_type' value
='<?php echo $form_proc_type ?>' />
320  
;<?php
xl('From','e'); ?
>:
321 <input type
='text' size
='10' name
='form_from_date' id
='form_from_date'
322 value
='<?php echo $form_from_date ?>'
323 title
='<?php xl('yyyy
-mm
-dd
','e
'); ?>'
324 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' />
325 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
326 id
='img_from_date' border
='0' alt
='[?]' style
='cursor:pointer'
327 title
='<?php xl('Click here to choose a date
','e
'); ?>' />
329  
;<?php
xl('To','e'); ?
>:
330 <input type
='text' size
='10' name
='form_to_date' id
='form_to_date'
331 value
='<?php echo $form_to_date ?>'
332 title
='<?php xl('yyyy
-mm
-dd
','e
'); ?>'
333 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' />
334 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
335 id
='img_to_date' border
='0' alt
='[?]' style
='cursor:pointer'
336 title
='<?php xl('Click here to choose a date
','e
'); ?>' />
340 } // end header for batch option
342 <!-- removed by jcw
-- check
/submit sequece too tedious
. This is a quick fix
-->
343 <!-- <input type
='checkbox' name
='form_all' value
='1' <?php
if ($_POST['form_all']) echo " checked"; ?
>><?php
xl('Include Completed','e') ?
>
345 <input type
='submit' name
='form_refresh' value
=<?php
xl('Refresh','e'); ?
>>
350 <?php
if (!$form_batch ||
($form_proc_type > 0 && $form_from_date)) { ?
>
352 <table width
='100%' cellpadding
='1' cellspacing
='2'>
355 <td colspan
='2'><?php
echo $form_batch ?
xl('Patient') : xl('Order'); ?
></td
>
356 <td colspan
='4'><?php
xl('Report','e'); ?
></td
>
357 <td colspan
='7'><?php
xl('Results and','e'); ?
> <span
class='reccolor''>
358 <?php xl('Recommendations
','e
'); ?></span></td>
362 <td><?php echo $form_batch ? xl('Name
') : xl('Date
'); ?></td>
363 <td><?php echo $form_batch ? xl('ID
') : xl('Procedure Name
'); ?></td>
364 <td><?php xl('Reported
','e
'); ?></td>
365 <td><?php xl('Ext Time Collected
','e
'); ?></td>
366 <td><?php xl('Specimen
','e
'); ?></td>
367 <td><?php xl('Status
','e
'); ?></td>
368 <td><?php xl('Code
','e
'); ?></td>
369 <td><?php xl('Name
','e
'); ?></td>
370 <td><?php xl('Abn
','e
'); ?></td>
371 <td><?php xl('Value
','e
'); ?></td>
372 <td><?php xl('Units
', 'e
'); ?></td>
373 <td><?php xl('Range
','e
'); ?></td>
374 <td><?php xl('?
','e
'); ?></td>
379 "po.procedure_order_id, po.date_ordered, pc.procedure_order_seq, " .
380 "pt1.procedure_type_id AS order_type_id, pc.procedure_name, " .
381 "pr.procedure_report_id, pr.date_report, pr.date_collected, pr.specimen_num, " .
382 "pr.report_status, pr.review_status";
385 "JOIN procedure_order_code AS pc ON pc.procedure_order_id = po.procedure_order_id " .
386 "LEFT JOIN procedure_type AS pt1 ON pt1.lab_id = po.lab_id AND pt1.procedure_code = pc.procedure_code " .
387 "LEFT JOIN procedure_report AS pr ON pr.procedure_order_id = po.procedure_order_id AND " .
388 "pr.procedure_order_seq = pc.procedure_order_seq";
391 "po.date_ordered, po.procedure_order_id, " .
392 "pc.procedure_order_seq, pr.procedure_report_id";
394 // removed by jcw -- check/submit sequece too tedious. This is a quick fix
395 //$where = empty($_POST['form_all
']) ?
396 // "( pr.report_status IS NULL OR pr.report_status = '' OR pr.report_status = 'prelim
' )" :
402 $query = "SELECT po.patient_id, " .
403 "pd.fname, pd.mname, pd.lname, pd.pubpid, $selects " .
404 "FROM procedure_order AS po " .
405 "LEFT JOIN patient_data AS pd ON pd.pid = po.patient_id $joins " .
406 "WHERE pt.procedure_type_id = '$form_proc_type' AND " .
407 "po.date_ordered >= '$form_from_date' AND po.date_ordered <= '$form_to_date' " .
409 "ORDER BY pd.lname, pd.fname, pd.mname, po.patient_id, $orderby";
412 $query = "SELECT $selects " .
413 "FROM procedure_order AS po " .
415 "WHERE po.patient_id = '$pid' AND $where " .
419 $res = sqlStatement($query);
428 $facilities = array();
430 while ($row = sqlFetchArray($res)) {
431 $order_type_id = empty($row['order_type_id
' ]) ? 0 : ($row['order_type_id
' ] + 0);
432 $order_id = empty($row['procedure_order_id
' ]) ? 0 : ($row['procedure_order_id
' ] + 0);
433 $order_seq = empty($row['procedure_order_seq
']) ? 0 : ($row['procedure_order_seq
'] + 0);
434 $report_id = empty($row['procedure_report_id
']) ? 0 : ($row['procedure_report_id
'] + 0);
435 $date_report = empty($row['date_report
' ]) ? '' : $row['date_report
'];
436 $date_collected = empty($row['date_collected
' ]) ? '' : substr($row['date_collected
'], 0, 16);
437 $specimen_num = empty($row['specimen_num
' ]) ? '' : $row['specimen_num
'];
438 $report_status = empty($row['report_status
' ]) ? '' : $row['report_status
'];
439 $review_status = empty($row['review_status
' ]) ? 'received
' : $row['review_status
'];
441 // skip report_status = receive to make sure do not show the report before it reviewed and sign off by Physicians
443 if ($review_status == "reviewed") continue;
446 if ($review_status == "received") continue;
449 $selects = "pt2.procedure_type, pt2.procedure_code, pt2.units AS pt2_units, " .
450 "pt2.range AS pt2_range, pt2.procedure_type_id AS procedure_type_id, " .
451 "pt2.name AS name, pt2.description, pt2.seq AS seq, " .
452 "ps.procedure_result_id, ps.result_code AS result_code, ps.result_text, ps.abnormal, ps.result, " .
453 "ps.range, ps.result_status, ps.facility, ps.comments, ps.units, ps.comments";
455 // procedure_type_id for order:
456 $pt2cond = "pt2.parent = $order_type_id AND " .
457 "(pt2.procedure_type LIKE 'res%
' OR pt2.procedure_type LIKE 'rec%
')";
459 // pr.procedure_report_id or 0 if none:
460 $pscond = "ps.procedure_report_id = $report_id";
462 $joincond = "ps.result_code = pt2.procedure_code";
464 // This union emulates a full outer join. The idea is to pick up all
465 // result types defined for this order type, as well as any actual
466 // results that do not have a matching result type.
467 $query = "(SELECT $selects FROM procedure_type AS pt2 " .
468 "LEFT JOIN procedure_result AS ps ON $pscond AND $joincond " .
471 "SELECT $selects FROM procedure_result AS ps " .
472 "LEFT JOIN procedure_type AS pt2 ON $pt2cond AND $joincond " .
474 "ORDER BY seq, name, procedure_type_id, result_code";
476 $rres = sqlStatement($query);
477 while ($rrow = sqlFetchArray($rres)) {
478 $restyp_code = empty($rrow['procedure_code
' ]) ? '' : $rrow['procedure_code
'];
479 $restyp_type = empty($rrow['procedure_type
' ]) ? '' : $rrow['procedure_type
'];
480 $restyp_name = empty($rrow['name
' ]) ? '' : $rrow['name
'];
481 $restyp_units = empty($rrow['pt2_units
' ]) ? '' : $rrow['pt2_units
'];
482 $restyp_range = empty($rrow['pt2_range
' ]) ? '' : $rrow['pt2_range
'];
484 $result_id = empty($rrow['procedure_result_id
']) ? 0 : ($rrow['procedure_result_id
'] + 0);
485 $result_code = empty($rrow['result_code
' ]) ? $restyp_code : $rrow['result_code
'];
486 $result_text = empty($rrow['result_text
' ]) ? $restyp_name : $rrow['result_text
'];
487 $result_abnormal = empty($rrow['abnormal
' ]) ? '' : $rrow['abnormal
'];
488 $result_result = empty($rrow['result
' ]) ? '' : $rrow['result
'];
489 $result_units = empty($rrow['units
' ]) ? $restyp_units : $rrow['units
'];
490 $result_facility = empty($rrow['facility
' ]) ? '' : $rrow['facility
'];
491 $result_comments = empty($rrow['comments
' ]) ? '' : $rrow['comments
'];
492 $result_range = empty($rrow['range
' ]) ? $restyp_range : $rrow['range
'];
493 $result_status = empty($rrow['result_status
' ]) ? '' : $rrow['result_status
'];
495 // If there is more than one line of comments, everything after that is "notes".
497 $i = strpos($result_comments, "\n");
499 $result_notes = trim(substr($result_comments, $i + 1));
500 $result_comments = substr($result_comments, 0, $i);
502 $result_comments = trim($result_comments);
504 if($result_facility <> "" && !in_array($result_facility, $facilities)) {
505 $facilities[] = $result_facility;
508 if ($lastpoid != $order_id || $lastpcid != $order_seq) {
512 $bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
514 echo " <tr class='detail
' bgcolor='$bgcolor'>\n";
516 // Generate first 2 columns.
517 if ($lastpoid != $order_id || $lastpcid != $order_seq) {
518 $lastprid = -1; // force report fields on first line of each procedure
520 if ($lastpoid != $order_id) {
521 $tmp = $row['lname
'];
522 if ($row['fname
'] || $row['mname
'])
523 $tmp .= ', ' . $row['fname
'] . ' ' . $row['mname
'];
524 echo " <td>" . text($tmp) . "</td>\n";
525 echo " <td>" . text($row['pubpid
']) . "</td>\n";
528 echo " <td colspan='2' style='background
-color
:transparent
'> </td>";
532 if ($lastpoid != $order_id) {
533 echo " <td>" . $row['date_ordered
'] . "</td>\n";
536 echo " <td style='background
-color
:transparent
'> </td>";
538 echo " <td>" . text($row['procedure_name
']) . "</td>\n";
542 echo " <td colspan='2' style='background
-color
:transparent
'> </td>";
545 // If this starts a new report or a new order, generate the report form
546 // fields. In the case of a new order with no report yet, the fields will
547 // have their blank/default values, and form_line (above) will indicate a
550 // TBD: Also generate default report fields and another set of results if
551 // the previous report is marked "Preliminary".
553 if ($report_id != $lastprid) {
555 echo "<input type='text
' size='8' name='form_date_report
[$lino]'" .
556 " id='form_date_report
[$lino]' class='celltextfw
' value='" . attr($date_report) . "' " .
557 " title='" . xl('Date of this report') . "'" .
558 " onkeyup='datekeyup(this
,mypcc
)' onblur='dateblur(this
,mypcc
)'" .
560 echo "<span class='bold
' id='q_date_report
[$lino]' style='cursor
:pointer
' " .
561 "title='" . xl('Click here to choose a date') . "' />?</span>";
565 echo "<input type='text
' size='13' name='form_date_collected
[$lino]'" .
566 " id='form_date_collected
[$lino]'" .
567 " class='celltextfw
' value='" . attr($date_collected) . "' " .
568 " title='" . xl('Date and time of sample collection') . "'" .
569 " onkeyup='datekeyup(this
,mypcc
,true)' onblur='dateblur(this
,mypcc
,true)'" .
571 echo "<span class='bold
' id='q_date_collected
[$lino]' style='cursor
:pointer
' " .
572 "title='" . xl('Click here to choose a date and time') . "' />?</span>";
576 echo "<input type='text
' size='8' name='form_specimen_num
[$lino]'" .
577 " class='celltext
' value='" . attr($specimen_num) . "' " .
578 " title='" . xl('Specimen number/identifier') . "'" .
583 echo generate_select_list("form_report_status[$lino]", 'proc_rep_status
',
584 $report_status, xl('Report Status
'), ' ', 'cellselect
');
588 echo " <td colspan='4' style='background
-color
:transparent
'> </td>\n";
592 echo "<input type='text
' size='6' name='form_result_code
[$lino]'" .
593 " class='celltext
' value='" . attr($result_code) . "' />" .
597 "<input type='text
' size='16' name='form_result_text
[$lino]'" .
598 " class='celltext
' value='" . attr($result_text) . "' />";
602 echo generate_select_list("form_result_abnormal[$lino]", 'proc_res_abnormal
',
603 $result_abnormal, xl('Indicates abnormality
'), ' ', 'cellselect
');
607 if ($result_units == 'bool') {
611 echo "<input type='text
' size='7' name='form_result_result
[$lino]'" .
612 " class='celltext
' value='" . attr($result_result) . "' " .
618 echo "<input type='text
' size='4' name='form_result_units
[$lino]'" .
619 " class='celltext
' value='" . attr($result_units) . "' " .
620 " title='" . xl('Units applicable to the result value') . "'" .
625 echo "<input type='text
' size='8' name='form_result_range
[$lino]'" .
626 " class='celltext
' value='" . attr($result_range) . "' " .
627 " title='" . xl('Reference range of results') . "'" .
629 // Include a hidden form field containing all IDs for this line.
630 echo "<input type='hidden
' name='form_line
[$lino]' " .
631 "value='$order_id:$order_seq:$report_id:$result_id' />";
634 echo " <td class='bold
' style='cursor
:pointer
' " .
635 "onclick='extShow($lino, this
)' align='center
' " .
636 "title='" . xl('Click here to view/edit more details') . "'>";
637 echo " ? ";
642 // Create a floating div for additional attributes of this result.
643 $extra_html .= "<div id='ext_
$lino' " .
644 "style='position
:absolute
;width
:750px
;border
:1px solid black
;" .
645 "padding
:2px
;background
-color
:#cccccc;visibility:hidden;" .
646 "z-index:1000;left:-1000px;top:0px;font-size:9pt;'>\n" .
647 "<table width='100%'>\n" .
648 "<tr><td class='bold' align='center' colspan='2' style='padding:4pt 0 4pt 0'>" .
649 htmlspecialchars($result_text) .
651 "<tr><td class='bold' width='1%' nowrap>" . xlt('Status') . ": </td>" .
652 "<td>" . generate_select_list("form_result_status[$lino]", 'proc_res_status',
653 $result_status, xl('Result Status'), '') . "</td></tr>\n" .
654 "<tr><td class='bold' nowrap>" . xlt('Facility') . ": </td>" .
655 "<td><input type='text' size='15' name='form_facility[$lino]'" .
656 " value='$result_facility' " .
657 " title='" . xla('Supplier facility name') . "'" .
658 " style='width:100%' /></td></tr>\n" .
659 "<tr><td class='bold' nowrap>" . xlt('Comments') . ": </td>" .
660 "<td><textarea rows='3' cols='15' name='form_comments[$lino]'" .
661 " title='" . xla('Comments for this result or recommendation') . "'" .
662 " style='width:100%' />" . htmlspecialchars($result_comments) .
663 "</textarea></td></tr>\n" .
664 "<tr><td class='bold' nowrap>" . xlt('Notes') . ": </td>" .
665 "<td><textarea rows='4' cols='15' name='form_notes[$lino]'" .
666 " title='" . xla('Additional notes for this result or recommendation') . "'" .
667 " style='width:100%' />" . htmlspecialchars($result_notes) .
668 "</textarea></td></tr>\n" .
670 "<p><center><input type='button' value='" . xla('Close') . "' " .
671 "onclick='extShow($lino, false)' /></center></p>\n".
674 $lastpoid = $order_id;
675 $lastpcid = $order_seq;
676 $lastprid = $report_id;
681 if (!empty($facilities)) {
682 // display facility information
683 $extra_html .= "<table>";
684 $extra_html .= "<tr><th>". xl('Performing Laboratory Facility') . "</th></tr>";
685 foreach($facilities as $facilityID) {
686 foreach(explode(":", $facilityID) as $lab_facility) {
687 $facility_array = getFacilityInfo($lab_facility);
688 if($facility_array) {
690 "<tr><td><hr></td></tr>" .
691 "<tr><td>". htmlspecialchars($facility_array['fname']) . " " . htmlspecialchars($facility_array['lname']) . ", " . htmlspecialchars($facility_array['title']). "</td></tr>" .
692 "<tr><td>". htmlspecialchars($facility_array['organization']) . "</td></tr>" .
693 "<tr><td>". htmlspecialchars($facility_array['street']) . " " .htmlspecialchars($facility_array['city']) . " " . htmlspecialchars($facility_array['state']) . "</td></tr>" .
694 "<tr><td>". htmlspecialchars(formatPhone($facility_array['phone'])) . "</td></tr>";
698 $extra_html .= "</table>\n";
706 // if user authorized for pending review.
710 <input type
='submit' name
='form_submit' value
='<?php xl('Sign Results
','e
'); ?>' />
717 <input type
='button' name
='form_submit' value
='<?php xl('Sign Results
','e
'); ?>' onclick
="alert('<?php xl('Not authorized','e') ?>');" />
725 <input type
='submit' name
='form_submit' value
='<?php xl('Save
','e
'); ?>' />
733 <?php
echo $extra_html; ?
>
735 <script language
='JavaScript'>
737 <?php
if ($form_batch) { ?
>
738 // Initialize calendar widgets for "from" and "to" dates.
739 Calendar
.setup({inputField
:'form_from_date', ifFormat
:'%Y-%m-%d',
740 button
:'img_from_date'});
741 Calendar
.setup({inputField
:'form_to_date', ifFormat
:'%Y-%m-%d',
742 button
:'img_to_date'});
745 // Initialize calendar widgets for report dates and collection dates.
746 var f
= document
.forms
[0];
747 for (var lino
= 0; f
['form_line['+lino+
']']; ++lino
) {
748 if (f
['form_date_report['+lino+
']']) {
749 Calendar
.setup({inputField
:'form_date_report['+lino+
']', ifFormat
:'%Y-%m-%d',
750 button
:'q_date_report['+lino+
']'});
751 Calendar
.setup({inputField
:'form_date_collected['+lino+
']', ifFormat
:'%Y-%m-%d %H:%M',
752 button
:'q_date_collected['+lino+
']', showsTime
:true});