Further modification of address book:
[openemr.git] / interface / orders / orders_results.php
blob546a40e42eb0bc6ff5c77248288b27978b8ab2e1
1 <?php
2 // Copyright (C) 2010 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once("../globals.php");
10 require_once("$srcdir/acl.inc");
11 require_once("$srcdir/formdata.inc.php");
12 require_once("$srcdir/options.inc.php");
13 require_once("$srcdir/formatting.inc.php");
15 // Indicates if we are entering in batch mode.
16 $form_batch = empty($_GET['batch']) ? 0 : 1;
18 // Indicates if we are entering in review mode.
19 $form_review = empty($_GET['review']) ? 0 : 1;
21 // Check authorization.
22 $thisauth = acl_check('patients', 'med');
23 if (!$thisauth) die(xl('Not authorized'));
25 // Check authorization for panding review.
26 $reviewauth = acl_check('patients', 'sign');
27 if ($form_review and !$reviewauth and !$thisauth) die(xl('Not authorized'));
29 // Set pid for panding review.
30 if ($_GET['set_pid'] && $form_review) {
31 require_once("$srcdir/pid.inc");
32 require_once("$srcdir/patient.inc");
33 setpid($_GET['set_pid']);
35 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
37 <script language='JavaScript'>
38 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']) . "'"; ?>);
39 parent.left_nav.setRadio(window.name, 'orp');
40 </script>
44 if (!$form_batch && !$pid && !$form_review) die(xl('There is no current patient'));
46 function oresData($name, $index) {
47 $s = isset($_POST[$name][$index]) ? $_POST[$name][$index] : '';
48 return formDataCore($s, true);
51 function QuotedOrNull($fld) {
52 if (empty($fld)) return "NULL";
53 return "'$fld'";
56 $current_report_id = 0;
58 if ($_POST['form_submit']) {
59 foreach ($_POST['form_line'] as $lino => $line_value) {
60 list($order_id, $restyp_id, $report_id, $result_id) = explode(':', $line_value);
62 // Not using xl() here because these errors are for debugging only.
63 if (empty($order_id)) die("Order ID is missing from line $lino.");
64 if (empty($restyp_id)) die("Result type ID is missing from line $lino.");
66 // If report data exists for this line, save it.
67 $date_report = oresData("form_date_report", $lino);
69 if (!empty($date_report)) {
70 $sets =
71 "procedure_order_id = '$order_id', " .
72 "date_report = '$date_report', " .
73 "date_collected = " . QuotedOrNull(oresData("form_date_collected", $lino)) . ", " .
74 "specimen_num = '" . oresData("form_specimen_num", $lino) . "', " .
75 "report_status = '" . oresData("form_report_status", $lino) . "'";
77 // Set the review status to reviewed.
78 if ($form_review)
79 $sets .= ", review_status = 'reviewed'";
81 if ($report_id) { // Report already exists.
82 sqlStatement("UPDATE procedure_report SET $sets " .
83 "WHERE procedure_report_id = '$report_id'");
85 else { // Add new report.
86 $report_id = sqlInsert("INSERT INTO procedure_report SET $sets");
90 // If this line had report data entry fields, filled or not, set the
91 // "current report ID" which the following result data will link to.
92 if (isset($_POST["form_date_report"][$lino])) $current_report_id = $report_id;
94 // If there's a report, save corresponding results.
95 if ($current_report_id) {
96 $sets =
97 "procedure_report_id = '$current_report_id', " .
98 "procedure_type_id = '$restyp_id', " .
99 "abnormal = '" . oresData("form_result_abnormal", $lino) . "', " .
100 "result = '" . oresData("form_result_result", $lino) . "', " .
101 "`range` = '" . oresData("form_result_range", $lino) . "', " .
102 "facility = '" . oresData("form_facility", $lino) . "', " .
103 "comments = '" . oresData("form_comments", $lino) . "', " .
104 "result_status = '" . oresData("form_result_status", $lino) . "'";
105 if ($result_id) { // result already exists
106 sqlStatement("UPDATE procedure_result SET $sets " .
107 "WHERE procedure_result_id = '$result_id'");
109 else { // Add new result.
110 $result_id = sqlInsert("INSERT INTO procedure_result SET $sets");
114 } // end foreach
117 <html>
119 <head>
120 <?php html_header_show();?>
122 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
123 <title><?php xl('Procedure Results','e'); ?></title>
125 <style>
127 tr.head { font-size:10pt; background-color:#cccccc; text-align:center; }
128 tr.detail { font-size:10pt; }
129 a, a:visited, a:hover { color:#0000cc; }
131 .celltext {
132 font-size:10pt;
133 font-weight:normal;
134 border-style:solid;
135 border-top-width:0px;
136 border-bottom-width:0px;
137 border-left-width:0px;
138 border-right-width:0px;
139 border-color: #aaaaaa;
140 background-color:transparent;
141 width:100%;
142 color:#0000cc;
145 .celltextfw {
146 font-size:10pt;
147 font-weight:normal;
148 border-style:solid;
149 border-top-width:0px;
150 border-bottom-width:0px;
151 border-left-width:0px;
152 border-right-width:0px;
153 border-color: #aaaaaa;
154 background-color:transparent;
155 color:#0000cc;
158 .cellselect {
159 font-size:10pt;
160 background-color:transparent;
161 color:#0000cc;
164 .reccolor {
165 color:#008800;
168 </style>
170 <style type="text/css">@import url(<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.css);</style>
171 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script>
172 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
173 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script>
175 <script type="text/javascript" src="../../library/dialog.js"></script>
176 <script type="text/javascript" src="../../library/textformat.js"></script>
178 <script language="JavaScript">
180 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
182 // This invokes the find-procedure-type popup.
183 var ptvarname;
184 function sel_proc_type(varname) {
185 var f = document.forms[0];
186 if (typeof varname == 'undefined') varname = 'form_proc_type';
187 ptvarname = varname;
188 dlgopen('types.php?popup=1&order=' + f[ptvarname].value, '_blank', 800, 500);
191 // This is for callback by the find-procedure-type popup.
192 // Sets both the selected type ID and its descriptive name.
193 function set_proc_type(typeid, typename) {
194 var f = document.forms[0];
195 f[ptvarname].value = typeid;
196 f[ptvarname + '_desc'].value = typename;
199 // Helper functions.
200 function extGetX(elem) {
201 var x = 0;
202 while(elem != null) {
203 x += elem.offsetLeft;
204 elem = elem.offsetParent;
206 return x;
208 function extGetY(elem) {
209 var y = 0;
210 while(elem != null) {
211 y += elem.offsetTop;
212 elem = elem.offsetParent;
214 return y;
217 // Show or hide the "extras" div for a result.
218 var extdiv = null;
219 function extShow(lino, show) {
220 var thisdiv = document.getElementById("ext_" + lino);
221 if (extdiv) {
222 extdiv.style.visibility = 'hidden';
223 extdiv.style.left = '-1000px';
224 extdiv.style.top = '0px';
226 if (show && thisdiv != extdiv) {
227 extdiv = thisdiv;
228 var dw = window.innerWidth ? window.innerWidth - 20 : document.body.clientWidth;
229 x = dw - extdiv.offsetWidth;
230 if (x < 0) x = 0;
231 var y = extGetY(show) + show.offsetHeight;
232 extdiv.style.left = x;
233 extdiv.style.top = y;
234 extdiv.style.visibility = 'visible';
236 else {
237 extdiv = null;
241 // Helper function for validate.
242 function prDateRequired(rlino) {
243 var f = document.forms[0];
244 if (f['form_date_report['+rlino+']'].value.length < 10) {
245 alert('<?php xl('Missing report date','e') ?>');
246 if (f['form_date_report['+rlino+']'].focus)
247 f['form_date_report['+rlino+']'].focus();
248 return false;
250 return true;
253 // Validation at submit time.
254 function validate(f) {
255 var rlino = 0;
256 for (var lino = 0; f['form_line['+lino+']']; ++lino) {
257 if (f['form_date_report['+lino+']']) {
258 rlino = lino;
259 if (f['form_report_status['+rlino+']'].selectedIndex > 0) {
260 if (!prDateRequired(rlino)) return false;
263 var abnstat = f['form_result_abnormal['+lino+']'].selectedIndex > 0;
264 if (abnstat && !prDateRequired(rlino)) return false;
265 /*******************************************************************
266 var resstat = f['form_result_status['+lino+']'].selectedIndex > 0;
267 if (resstat != abnstat) {
268 alert('<?php xl('Result status or abnormality is missing','e') ?>');
269 if (f['form_result_abnormal['+lino+']'].focus)
270 f['form_result_abnormal['+lino+']'].focus();
271 return false;
273 *******************************************************************/
275 top.restoreSession();
276 return true;
279 </script>
281 </head>
283 <body class="body_top">
284 <form method='post' action='orders_results.php?batch=<?php echo $form_batch; ?>&review=<?php echo $form_review; ?>'
285 onsubmit='return validate(this)'>
287 <table>
288 <tr>
289 <td class='text'>
290 <?php
291 if ($form_batch) {
292 $form_from_date = formData('form_from_date','P',true);
293 $form_to_date = formData('form_to_date','P',true);
294 if (empty($form_to_date)) $form_to_date = $form_from_date;
295 $form_proc_type = formData('form_proc_type') + 0;
296 if (!$form_proc_type) $form_proc_type = -1;
297 $form_proc_type_desc = '';
298 if ($form_proc_type > 0) {
299 $ptrow = sqlQuery("SELECT name FROM procedure_type WHERE " .
300 "procedure_type_id = '$form_proc_type'");
301 $form_proc_type_desc = $ptrow['name'];
304 <?php xl('Procedure','e'); ?>:
305 <input type='text' size='30' name='form_proc_type_desc'
306 value='<?php echo addslashes($form_proc_type_desc) ?>'
307 onclick='sel_proc_type()' onfocus='this.blur()'
308 title='<?php xl('Click to select the desired procedure','e'); ?>'
309 style='cursor:pointer;cursor:hand' readonly />
310 <input type='hidden' name='form_proc_type' value='<?php echo $form_proc_type ?>' />
312 &nbsp;<?php xl('From','e'); ?>:
313 <input type='text' size='10' name='form_from_date' id='form_from_date'
314 value='<?php echo $form_from_date ?>'
315 title='<?php xl('yyyy-mm-dd','e'); ?>'
316 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
317 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
318 id='img_from_date' border='0' alt='[?]' style='cursor:pointer'
319 title='<?php xl('Click here to choose a date','e'); ?>' />
321 &nbsp;<?php xl('To','e'); ?>:
322 <input type='text' size='10' name='form_to_date' id='form_to_date'
323 value='<?php echo $form_to_date ?>'
324 title='<?php xl('yyyy-mm-dd','e'); ?>'
325 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
326 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
327 id='img_to_date' border='0' alt='[?]' style='cursor:pointer'
328 title='<?php xl('Click here to choose a date','e'); ?>' />
330 &nbsp;
331 <?php
332 } // end header for batch option
334 <input type='checkbox' name='form_all' value='1'<?php if ($_POST['form_all']) echo " checked"; ?>><?php xl('Include Completed','e') ?>
335 &nbsp;
336 <input type='submit' name='form_refresh' value=<?php xl('Refresh','e'); ?>>
337 </td>
338 </tr>
339 </table>
341 <?php if (!$form_batch || ($form_proc_type > 0 && $form_from_date)) { ?>
343 <table width='100%' cellpadding='1' cellspacing='2'>
345 <tr class='head'>
346 <td colspan='2'><?php echo $form_batch ? xl('Patient') : xl('Order'); ?></td>
347 <td colspan='4'><?php xl('Report','e'); ?></td>
348 <td colspan='5'><?php xl('Results and','e'); ?> <span class='reccolor''>
349 <?php xl('Recommendations','e'); ?></span></td>
350 </tr>
352 <tr class='head'>
353 <td><?php echo $form_batch ? xl('Name') : xl('Date'); ?></td>
354 <td><?php echo $form_batch ? xl('ID') : xl('Name'); ?></td>
355 <td><?php xl('Reported','e'); ?></td>
356 <td><?php xl('Ext Time Collected','e'); ?></td>
357 <td><?php xl('Specimen','e'); ?></td>
358 <td><?php xl('Status','e'); ?></td>
359 <td><?php xl('Group','e'); ?></td>
360 <td><?php xl('Name (click for more)','e'); ?></td>
361 <td><?php xl('Abn','e'); ?></td>
362 <td><?php xl('Value','e'); ?></td>
363 <td><?php xl('Range','e'); ?></td>
364 </tr>
366 <?php
367 $selects =
368 "po.procedure_order_id, po.date_ordered, " .
369 "po.procedure_type_id AS order_type_id, pt1.name AS procedure_name, " .
370 "ptrc.name AS result_category_name, " .
371 "pt2.procedure_type AS result_type, " .
372 "pt2.procedure_type_id AS result_type_id, pt2.name AS result_name, " .
373 "pt2.units AS result_def_units, pt2.range AS result_def_range, " .
374 "pt2.description AS result_description, lo.title AS units_name, " .
375 "pr.procedure_report_id, pr.date_report, pr.date_collected, pr.specimen_num, pr.report_status, pr.review_status, " .
376 "ps.procedure_result_id, ps.abnormal, ps.result, ps.range, ps.result_status, " .
377 "ps.facility, ps.comments";
379 // This join syntax means that results must all be at the same "level".
380 // Either there is one result the same as the order, or all results are
381 // direct children of the order, or all results are grandchildren of the
382 // order. No other arrangements are allowed.
384 $joins =
385 "LEFT JOIN procedure_type AS pt1 ON pt1.procedure_type_id = po.procedure_type_id " .
386 // ptrc is an optional result category just under the order type
387 "LEFT JOIN procedure_type AS ptrc ON ptrc.parent = po.procedure_type_id " .
388 "AND ptrc.procedure_type LIKE 'grp%' " .
389 // pt2 is a result or recommendation type the same as or just under the order type
390 "LEFT JOIN procedure_type AS pt2 ON " .
391 "( ( ptrc.procedure_type_id IS NULL AND ( pt2.parent = po.procedure_type_id " .
392 "OR pt2.procedure_type_id = po.procedure_type_id ) ) OR " .
393 "( ptrc.procedure_type_id IS NOT NULL AND pt2.parent = ptrc.procedure_type_id ) " .
394 ") AND ( pt2.procedure_type LIKE 'res%' OR pt2.procedure_type LIKE 'rec%' ) " .
396 "LEFT JOIN list_options AS lo ON list_id = 'proc_unit' AND option_id = pt2.units " .
397 "LEFT JOIN procedure_report AS pr ON pr.procedure_order_id = po.procedure_order_id " .
398 "LEFT JOIN procedure_result AS ps ON ps.procedure_report_id = pr.procedure_report_id " .
399 "AND ps.procedure_type_id = pt2.procedure_type_id";
401 $orderby =
402 "po.date_ordered, po.procedure_order_id, pr.procedure_report_id, " .
403 "ptrc.seq, ptrc.name, ptrc.procedure_type_id, " .
404 "pt2.seq, pt2.name, pt2.procedure_type_id";
406 $where = empty($_POST['form_all']) ?
407 "( pr.report_status IS NULL OR pr.report_status = '' OR pr.report_status = 'prelim' )" :
408 "1 = 1";
410 if ($form_batch) {
411 $res = sqlStatement("SELECT po.patient_id, " .
412 "pd.fname, pd.mname, pd.lname, pd.pubpid, $selects " .
413 "FROM procedure_order AS po " .
414 "LEFT JOIN patient_data AS pd ON pd.pid = po.patient_id $joins " .
415 "WHERE po.procedure_type_id = '$form_proc_type' AND " .
416 "po.date_ordered >= '$form_from_date' AND po.date_ordered <= '$form_to_date' " .
417 "AND $where " .
418 "ORDER BY pd.lname, pd.fname, pd.mname, po.patient_id, $orderby");
420 else {
421 $res = sqlStatement("SELECT $selects " .
422 "FROM procedure_order AS po $joins " .
423 "WHERE po.patient_id = '$pid' AND $where " .
424 "ORDER BY $orderby");
427 $lastpoid = -1;
428 $lastprid = -1;
429 $encount = 0;
430 $lino = 0;
431 $extra_html = '';
432 $lastrcn = '';
434 while ($row = sqlFetchArray($res)) {
435 $order_id = empty($row['procedure_order_id' ]) ? 0 : ($row['procedure_order_id' ] + 0);
436 $restyp_id = empty($row['result_type_id']) ? 0 : ($row['result_type_id' ] + 0);
437 $report_id = empty($row['procedure_report_id']) ? 0 : ($row['procedure_report_id'] + 0);
438 $result_id = empty($row['procedure_result_id']) ? 0 : ($row['procedure_result_id'] + 0);
440 /*******************************************************************
441 $result_name = '';
442 if (!empty($row['result_category_name'])) $result_name = $row['result_category_name'] . ' / ';
443 if (!empty($row['result_name'])) $result_name .= $row['result_name'];
444 *******************************************************************/
445 $result_category_name = empty($row['result_category_name']) ? '--' : $row['result_category_name'];
446 $result_name = empty($row['result_name' ]) ? '' : $row['result_name'];
448 $date_report = empty($row['date_report' ]) ? '' : $row['date_report'];
449 $date_collected = empty($row['date_collected' ]) ? '' : substr($row['date_collected'], 0, 16);
450 $specimen_num = empty($row['specimen_num' ]) ? '' : $row['specimen_num'];
451 $report_status = empty($row['report_status' ]) ? '' : $row['report_status'];
452 $result_abnormal = empty($row['abnormal' ]) ? '' : $row['abnormal'];
453 $result_result = empty($row['result' ]) ? '' : $row['result'];
454 $facility = empty($row['facility' ]) ? '' : $row['facility'];
455 $comments = empty($row['comments' ]) ? '' : $row['comments'];
456 $result_range = empty($row['range' ]) ? $row['result_def_range'] : $row['range'];
457 $result_status = empty($row['result_status' ]) ? '' : $row['result_status'];
458 $result_def_units = empty($row['result_def_units']) ? '' : $row['result_def_units'];
459 $units_name = empty($row['units_name' ]) ? xl('Units not defined') : $row['units_name'];
461 $review_status = empty($row['review_status' ]) ? 'received' : $row['review_status'];
463 // skip report_status = receive to make sure do not show the report before it reviewed and sign off by Physicians
464 if ($form_review) {
465 if ($review_status == "reviewed") continue;
467 else {
468 if ($review_status == "received") continue;
471 if ($lastpoid != $order_id) {
472 ++$encount;
473 $lastrcn = '';
475 $bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
477 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
479 // If this starts a new order, display its date and procedure name,
480 // otherwise empty space.
482 if ($lastpoid != $order_id) {
483 if ($form_batch) {
484 $tmp = $row['lname'];
485 if ($row['fname'] || $row['mname'])
486 $tmp .= ', ' . $row['fname'] . ' ' . $row['mname'];
487 echo " <td>" . htmlentities($tmp) . "</td>\n";
488 echo " <td>" . htmlentities($row['pubpid']) . "</td>\n";
490 else {
491 echo " <td>" . $row['date_ordered'] . "</td>\n";
492 echo " <td>" . htmlentities($row['procedure_name']) . "</td>\n";
494 $lastprid = -1; // force report fields on first line of each order
495 } else {
496 echo " <td colspan='2' style='background-color:#94d6e7'>&nbsp;";
498 // Include a hidden form field containing all IDs for this line.
499 echo "<input type='hidden' name='form_line[$lino]' value='$order_id:$restyp_id:$report_id:$result_id' />";
500 echo "</td>\n";
502 // If this starts a new report or a new order, generate the report form
503 // fields. In the case of a new order with no report yet, the fields will
504 // have their blank/default values, and form_line (above) will indicate a
505 // report ID of 0.
507 // TBD: Also generate default report fields and another set of results if
508 // the previous report is marked "Preliminary".
510 if ($report_id != $lastprid) {
511 echo " <td nowrap>";
512 echo "<input type='text' size='8' name='form_date_report[$lino]'" .
513 " id='form_date_report[$lino]' class='celltextfw' value='$date_report' " .
514 " title='" . xl('Date of this report') . "'" .
515 " onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'" .
516 " />";
517 echo "<span class='bold' id='q_date_report[$lino]' style='cursor:pointer' " .
518 "title='" . xl('Click here to choose a date') . "' />?</span>";
519 echo "</td>\n";
521 echo " <td nowrap>";
522 echo "<input type='text' size='13' name='form_date_collected[$lino]'" .
523 " id='form_date_collected[$lino]'" .
524 " class='celltextfw' value='$date_collected' " .
525 " title='" . xl('Date and time of sample collection') . "'" .
526 " onkeyup='datekeyup(this,mypcc,true)' onblur='dateblur(this,mypcc,true)'" .
527 " />";
528 echo "<span class='bold' id='q_date_collected[$lino]' style='cursor:pointer' " .
529 "title='" . xl('Click here to choose a date and time') . "' />?</span>";
530 echo "</td>\n";
532 echo " <td>";
533 echo "<input type='text' size='8' name='form_specimen_num[$lino]'" .
534 " class='celltext' value='$specimen_num' " .
535 " title='" . xl('Specimen number/identifier') . "'" .
536 " />";
537 echo "</td>\n";
539 echo " <td>";
540 echo generate_select_list("form_report_status[$lino]", 'proc_rep_status',
541 $report_status, xl('Report Status'), ' ', 'cellselect');
542 echo "</td>\n";
544 else {
545 echo " <td colspan='4' style='background-color:#94d6e7'>&nbsp;</td>\n";
548 if ($result_category_name != $lastrcn) {
549 echo " <td>";
550 echo htmlentities($result_category_name);
551 echo "</td>\n";
552 $lastrcn = $result_category_name;
554 else {
555 echo " <td style='background-color:#94d6e7'>&nbsp;</td>\n";
558 echo " <td title='" . addslashes($row['result_description']) . "'";
559 if ($row['result_type'] == 'rec') echo " class='reccolor'";
560 echo " style='cursor:pointer' onclick='extShow($lino, this)'>" .
561 htmlentities($result_name) . "</td>\n";
563 echo " <td>";
564 echo generate_select_list("form_result_abnormal[$lino]", 'proc_res_abnormal',
565 $result_abnormal, xl('Indicates abnormality'), ' ', 'cellselect');
566 echo "</td>\n";
568 echo " <td>";
569 if ($result_def_units == 'bool') {
570 // echo generate_select_list("form_result_result[$lino]", 'proc_res_bool',
571 // $result_result, $units_name, ' ', 'cellselect');
572 echo "&nbsp;--";
574 else {
575 echo "<input type='text' size='4' name='form_result_result[$lino]'" .
576 " class='celltext' value='$result_result' " .
577 " title='" . addslashes($units_name) . "'" .
578 " />";
580 echo "</td>\n";
582 echo " <td>";
583 echo "<input type='text' size='8' name='form_result_range[$lino]'" .
584 " class='celltext' value='$result_range' " .
585 " title='" . xl('Reference range of results') . "'" .
586 " />";
587 echo "</td>\n";
589 echo " </tr>\n";
591 // Create a floating div for additional attributes of this result.
592 $extra_html .= "<div id='ext_$lino' " .
593 "style='position:absolute;width:500px;border:1px solid black;" .
594 "padding:2px;background-color:#cccccc;visibility:hidden;" .
595 "z-index:1000;left:-1000px;top:0px;font-size:9pt;'>\n" .
596 "<table width='100%'>\n" .
597 "<tr><td class='bold' align='center' colspan='2' style='padding:4pt 0 4pt 0'>" .
598 // xl('Additional Attributes') .
599 htmlspecialchars($result_name) .
600 "</td></tr>\n" .
601 "<tr><td class='bold' width='1%' nowrap>" . xl('Status') . ": </td>" .
602 "<td>" . generate_select_list("form_result_status[$lino]", 'proc_res_status',
603 $result_status, xl('Result Status'), '') . "</td></tr>\n" .
604 "<tr><td class='bold' nowrap>" . xl('Facility') . ": </td>" .
605 "<td><input type='text' size='15' name='form_facility[$lino]'" .
606 " value='$facility' " .
607 " title='" . xl('Supplier facility name') . "'" .
608 " style='width:100%' /></td></tr>\n" .
609 "<tr><td class='bold' nowrap>" . xl('Comments') . ": </td>" .
610 "<td><textarea rows='3' cols='15' name='form_comments[$lino]'" .
611 " title='" . xl('Comments for this result or recommendation') . "'" .
612 " style='width:100%' />" . htmlspecialchars($comments) .
613 "</textarea></td></tr>\n" .
614 "</table>\n" .
615 "<p><center><input type='button' value='" . xl('Close') . "' " .
616 "onclick='extShow($lino, false)' /></center></p>\n" .
617 "</div>\n";
619 $lastpoid = $order_id;
620 $lastprid = $report_id;
621 ++$lino;
624 </table>
626 <?php
627 if ($form_review) {
628 // if user authorised for panding review.
629 if ($reviewauth) {
631 <center><p>
632 <input type='submit' name='form_submit' value='<?php xl('Sign Results','e'); ?>' />
633 </p></center>
634 <?php
636 else {
638 <center><p>
639 <input type='button' name='form_submit' value='<?php xl('Sign Results','e'); ?>' onclick="alert('<?php xl('Not authorized','e') ?>');" />
640 </p></center>
641 <?php
644 else {
646 <center><p>
647 <input type='submit' name='form_submit' value='<?php xl('Save','e'); ?>' />
648 </p></center>
649 <?php
653 <?php } ?>
655 <?php echo $extra_html; ?>
657 <script language='JavaScript'>
659 <?php if ($form_batch) { ?>
660 // Initialize calendar widgets for "from" and "to" dates.
661 Calendar.setup({inputField:'form_from_date', ifFormat:'%Y-%m-%d',
662 button:'img_from_date'});
663 Calendar.setup({inputField:'form_to_date', ifFormat:'%Y-%m-%d',
664 button:'img_to_date'});
665 <?php } ?>
667 // Initialize calendar widgets for report dates and collection dates.
668 var f = document.forms[0];
669 for (var lino = 0; f['form_line['+lino+']']; ++lino) {
670 if (f['form_date_report['+lino+']']) {
671 Calendar.setup({inputField:'form_date_report['+lino+']', ifFormat:'%Y-%m-%d',
672 button:'q_date_report['+lino+']'});
673 Calendar.setup({inputField:'form_date_collected['+lino+']', ifFormat:'%Y-%m-%d %H:%M',
674 button:'q_date_collected['+lino+']', showsTime:true});
678 </script>
680 </form>
681 </body>
682 </html>