fix: Smarty cal php82 warnings (#6316)
[openemr.git] / interface / orders / list_reports.php
blob30358d527db73af4c61c3ab4892347a49c63a54b
1 <?php
3 /**
4 * List procedure orders and reports, and fetch new reports and their results.
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @author Tyler Wrenn <tyler@tylerwrenn.com>
11 * @author Jerry Padgett <sjpadgett@gmail.com>
12 * @copyright Copyright (c) 2013-2016 Rod Roark <rod@sunsetsystems.com>
13 * @copyright Copyright (c) 2017-2019 Brady Miller <brady.g.miller@gmail.com>
14 * @copyright Copyright (c) 2020 Tyler Wrenn <tyler@tylerwrenn.com>
15 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
18 $orphanLog = '';
20 require_once("../globals.php");
21 require_once("$srcdir/patient.inc.php");
22 require_once("$srcdir/options.inc.php");
23 if (file_exists("$include_root/procedure_tools/quest/QuestResultClient.php")) {
24 require_once("$include_root/procedure_tools/quest/QuestResultClient.php");
26 require_once("./receive_hl7_results.inc.php");
27 require_once("./gen_hl7_order.inc.php");
29 use OpenEMR\Common\Acl\AclMain;
30 use OpenEMR\Common\Twig\TwigContainer;
31 use OpenEMR\Core\Header;
33 // Check authorization.
34 $thisauth = AclMain::aclCheckCore('patients', 'med');
35 if (!$thisauth) {
36 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Procedure Orders and Reports")]);
37 exit;
40 $form_patient = !empty($_POST['form_patient']);
41 $processing_lab = $_REQUEST['form_lab_id'] ?? '';
42 $start_form = false;
43 if (!isset($_REQUEST['form_refresh']) && !isset($_REQUEST['form_process_labs']) && !isset($_REQUEST['form_manual'])) {
44 $start_form = true;
47 /**
48 * Get a list item title, translating if required.
50 * @param string $listid List identifier.
51 * @param string $value List item identifier.
52 * @return string The item's title.
54 function getListItem($listid, $value)
56 $lrow = sqlQuery(
57 "SELECT title FROM list_options " .
58 "WHERE list_id = ? AND option_id = ? AND activity = 1",
59 array($listid, $value)
61 $tmp = xl_list_label($lrow['title']);
62 if (empty($tmp)) {
63 $tmp = (($value === '') ? '' : "($value)");
66 return $tmp;
69 /**
70 * Adapt text to be suitable as the contents of a table cell.
72 * @param string $s Input text.
73 * @return string Output text.
75 function myCellText($s)
77 if ($s === '') {
78 return '&nbsp;';
81 return text($s);
84 $errmsg = '';
86 // Send selected unsent orders if requested. This does not support downloading
87 // very well as it will only send the first of those.
88 if (!empty($_POST['form_xmit'])) {
89 foreach ($_POST['form_cb'] as $formid) {
90 $row = sqlQuery("SELECT lab_id FROM procedure_order WHERE procedure_order_id = ?", array($formid));
91 $ppid = (int)$row['lab_id'];
92 $hl7 = '';
93 $errmsg = gen_hl7_order($formid, $hl7);
94 if (empty($errmsg)) {
95 $errmsg = send_hl7_order($ppid, $hl7);
98 if ($errmsg) {
99 break;
102 sqlStatement("UPDATE procedure_order SET date_transmitted = NOW() WHERE procedure_order_id = ?", array($formid));
106 <!DOCTYPE html>
107 <html>
108 <head>
109 <?php Header::setupHeader(['datetime-picker']); ?>
110 <title><?php echo xlt('Procedure Orders and Reports'); ?></title>
112 <style>
114 tr.head {
115 font-size: 13px;
116 background-color: var(--gray);
117 text-align: center;
118 color: var(--white);
121 tr.subhead {
122 font-size: 13px;
123 background-color: var(--gray200);
124 text-align: center;
127 tr.detail {
128 margin: 0;
129 padding: 0;
130 font-size: 13px;
133 a, a:visited, a:hover {
134 color: #0000cc;
137 </style>
138 <script>
139 var dlgtitle = <?php echo xlj("Match Patient") ?>;
141 function openResults(orderid) {
142 top.restoreSession();
143 // Open results in a new window. The options parameter serves to defeat Firefox's
144 // "open windows in a new tab", which is what we want because the doc may want to
145 // see the results concurrently with other stuff like related patient notes.
146 // Opening in the other frame is not good enough because if they then do related
147 // patients notes it will wipe out this script's list. We need 3 viewports.
148 window.open('single_order_results.php?orderid=' + encodeURIComponent(orderid), '_blank', 'toolbar=0,location=0,menubar=0,scrollbars=yes');
150 // To open results in the same frame:
151 // document.location.href = 'single_order_results.php?orderid=' + orderid;
153 // To open results in the "other" frame:
154 // var w = window;
155 // var othername = (w.name == 'RTop') ? 'RBot' : 'RTop';
156 // w.parent.left_nav.forceDual();
157 // w.parent.left_nav.loadFrame('ore1', othername, 'orders/single_order_results.php?orderid=' + orderid);
160 // Invokes the patient matching dialog.
161 // args is a PHP-serialized array of patient attributes.
162 // The dialog script will directly insert the selected pid value, or 0,
163 // into the value of the form field named "[select][$key]".
165 function openPtMatch(args) {
166 top.restoreSession();
167 dlgopen('patient_match_dialog.php?key=' + encodeURIComponent(args), '_blank', 850, 400, '', dlgtitle);
170 function openPatient(pid) {
171 top.restoreSession();
172 document.location.href = "../patient_file/summary/demographics.php?set_pid=" + encodeURIComponent(pid);
175 $(function () {
176 $('.datepicker').datetimepicker({
177 <?php $datetimepicker_timepicker = false; ?>
178 <?php $datetimepicker_showseconds = false; ?>
179 <?php $datetimepicker_formatInput = false; ?>
180 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
181 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
183 $("#wait").addClass('d-none');
186 function doWait(e){
187 $("#wait").removeClass('d-none');
188 return true;
190 </script>
191 </head>
193 <body onsubmit="doWait(event)">
194 <div class="page-header ml-2">
195 <h2><?php echo xlt('Procedure Orders and Reports'); ?></h2>
196 </div>
197 <form class="form-inline" method='post' action='list_reports.php' enctype='multipart/form-data'>
198 <div class="container">
199 <!-- This might be set by the results window: -->
200 <input class="d-none row" type='text' name='form_external_refresh' value='' />
201 <div class="form-row">
202 <div class="col-md">
203 <div class="form-group">
204 <div class="input-group-btn input-group-append">
205 <button class='btn btn-primary' name='form_process_labs'
206 title="Click to process pending results from selected Labs."
207 value="true"><?php echo xlt('Process Results For'); ?><i class="ml-1 btn-transmit"></i>
208 </button>
209 <select name='form_lab_id' id='form_lab_id' class='form-control'>
210 <option value="0"><?php echo xlt('All Labs'); ?></option>
211 <?php
212 $ppres = sqlStatement("SELECT ppid, name, npi FROM procedure_providers ORDER BY name, ppid");
213 while ($pprow = sqlFetchArray($ppres)) {
214 echo "<option value='" . attr($pprow['ppid']) . "'";
215 if ($pprow['ppid'] == $processing_lab) {
216 echo " selected";
218 if (stripos($pprow['npi'], 'QUEST') !== false) {
219 $pprow['name'] = "Quest Diagnostics";
221 echo ">" . text($pprow['name']) . "</option>";
224 </select>
225 </div>
226 <div class="form-group">
227 <div class="input-group-append">
228 <input name='form_max_results' id='form_max_results' class='form-control'
229 style="max-width:75px;margin-left:20px;"
230 type="number" title="<?php echo xla('Max number of results to process at a time per Lab') ?>"
231 step="1" min="0" max="50"
232 value="<?php echo attr($_REQUEST['form_max_results'] ?? 10); ?>" />
233 <span class="input-group-text"><?php echo xlt('Results Per Lab'); ?></span>
234 </div>
235 <div class="form-check form-check-inline ml-2">
236 <input class="form-check-input" type='checkbox' name='form_patient' id="ck_patient" value='1'
237 <?php if ($form_patient) {
238 echo 'checked ';
239 } ?>/>
240 <label class="input-group-text form-check-label" for="ck_patient"><?php echo xlt('Current Patient Only'); ?></label>
241 </div>
242 <span class="d-none" id="wait"><?php echo xlt("Working") . ' .. ';?>
243 <i class="fa fa-cog fa-spin fa-2x"></i>
244 </span>
245 </div>
246 </div>
247 </div>
248 </div>
249 <div class="clearfix"></div>
250 <?php if ($errmsg) { ?>
251 <span class='text-danger'><?php echo text($errmsg); ?></span>
252 <br />
253 <?php } ?>
255 <?php
256 $info = array('select' => array());
257 // We skip match/delete processing if this is just a refresh, because that
258 // might be a nasty surprise.
259 if (empty($_POST['form_external_refresh'])) {
260 // Get patient matching selections from this form if there are any.
261 if (!empty($_POST['select']) && is_array($_POST['select'])) {
262 foreach ($_POST['select'] as $selkey => $selval) {
263 $info['select'][urldecode($selkey)] = $selval;
266 // Get file delete requests from this form if there are any.
267 if (!empty($_POST['delete']) && is_array($_POST['delete'])) {
268 foreach ($_POST['delete'] as $delkey => $dummy) {
269 $info[$delkey] = array('delete' => true);
274 // is this a manual run
275 if (isset($_REQUEST['form_manual'])) {
276 $info['orphaned_order'] = "R";
278 // Attempt to post any incoming results.
279 if (!empty($_REQUEST['form_process_labs']) || (!empty($info['orphaned_order']) && $info['orphaned_order'] == "R")) {
280 $errmsg = poll_hl7_results($info, $processing_lab);
282 // echo "<!--\n"; // debugging
283 // print_r($info); // debugging
284 // echo "-->\n"; // debugging
286 // Display a row for each required patient matching decision or message.
287 $s = '';
288 $matchreqs = false;
289 $errors = false;
290 $orphan_orders = false;
292 // Generate HTML to request patient matching.
293 if (!empty($info['match']) && is_array($info['match'])) {
294 foreach ($info['match'] as $matchkey => $matchval) {
295 $matchreqs = true;
296 $s .= " <tr class='detail'>\n";
297 $s .= " <td>&nbsp;</td>\n";
298 $s .= " <td>&nbsp;</td>\n";
299 $s .= " <td><a href='javascript:openPtMatch(" . attr_js($matchkey) . ")'>";
300 $tmp = unserialize($matchkey, ['allowed_classes' => false]);
301 $s .= xlt('Click to match patient') . ' "' . text($tmp['lname']) . ', ' . text($tmp['fname']) . '"';
302 $s .= "</a>";
303 $s .= "</td>\n";
304 $s .= " <td style='width:1%'><input type='text' name='select[" .
305 attr($matchkey) . "]' size='3' value=0 " .
306 "style='background-color:transparent' readonly /></td>\n";
307 $s .= " </tr>\n";
311 foreach ($info as $infokey => $infoval) {
312 if ($infokey == 'match' || $infokey == 'select') {
313 continue;
316 $count = 0;
317 if (is_array($infoval) && !empty($infoval['mssgs'])) {
318 foreach ($infoval['mssgs'] as $message) {
319 $s .= " <tr class='detail'>\n";
320 if (substr($message, 0, 1) == '*') {
321 $errors = true;
322 // Error message starts with '*'
323 if (!$count++) {
324 $s .= " <td><input type='checkbox' name='delete[" . attr($infokey) . "]' value='1' /></td>\n";
325 $s .= " <td>" . text($infokey) . "</td>\n";
326 } else {
327 $s .= " <td>&nbsp;</td>\n";
328 $s .= " <td>&nbsp;</td>\n";
330 $s .= " <td colspan='2' class='bg-danger'>" . text(substr($message, 1)) . "</td>\n";
331 } else {
332 // Informational message starts with '>'
333 $s .= " <td>&nbsp;</td>\n";
334 $s .= " <td>" . text($infokey) . "</td>\n";
335 $s .= " <td colspan='2' class='bg-success'>" . text(substr($message, 1)) . "</td>\n";
337 $s .= " </tr>\n";
342 if (!empty($s)) {
343 if ($matchreqs || $errors) {
344 $orphan_orders = true;
345 echo "<h4 class='bg-success text-white mb-0'>";
346 echo xlt('Incoming results requiring attention:');
347 echo "</h4>\n";
350 echo "<div class='table-responsive'><table class='table table-sm mb-0'>\n";
351 echo "<thead>\n";
352 echo " <tr class='head'>\n";
353 echo " <th>" . xlt('Delete') . "</th>\n";
354 echo " <th>" . xlt('Processing Lab Name/Internal Lab Id/Results File Name') . "</th>\n";
355 echo " <th>" . xlt('Message') . "</th>\n";
356 echo " <th>" . xlt('Match') . "</th>\n";
357 echo " </tr></thead><tbody id='wait'>\n";
358 echo $s;
359 echo "</tbody></table>\n";
361 if ($matchreqs || $errors) { ?>
362 <div class="" data-toggle="collapse" data-target="#help">
363 <i class="fa fa-plus"></i><span id="wait"> <strong>Help</strong></span>
364 </div>
365 <div class="collapse bg-warning" id="help">
366 <?php if ($matchreqs) { ?>
368 Click the returned patient line item to pull up the patient matching dialog to verify if a match is indicated or select to create a new patient. The match column shows the selected patient ID, or if 0, will create a new patient. Simply clicking Resolve Orphans again without selecting a patient will automatically create a new patient based on the orders patient information. After verifying patients, click Resolve Orphans one last time to complete transactions. A reminder message will be sent to the provider associated with order.
369 </p>
370 <?php } else { ?>
372 Checkboxes indicate if you want to reject and delete the HL7 file. Clicking the Resolve Orphans button will determine if the patient associated with the manual orders exists and will then create a new encounter if one doesn't exist within 30 days of the orphaned orders order date, then will attach the new order to it. If the patient does not exist and there could be a potential match with existing patients then, on return, you will be given an opportunity to match or create a new patient to assign the orphaned order. Otherwise, if there is not any ambiguity that the concerning patient of the order does not currently exist, then the patient will be automatically created and logged to messages and results returned below for review.
373 </p>
374 <?php } ?>
375 </div>
376 <?php }
378 echo "<table><tr>";
379 if ($orphan_orders) {
380 echo "<tr><td><button class='btn btn-add btn-danger' type='submit' name='form_manual'>" . xlt('Resolve Orphans') . "</button></td></tr>";
382 echo "</tr></table>";
385 // If there was a fatal error display that.
386 if ($errmsg) {
387 echo "<span class='text-danger'>" . text($errmsg) . "</span><br />\n";
390 $form_from_date = empty($_POST['form_from_date']) ? '' : trim($_POST['form_from_date']);
391 $form_to_date = empty($_POST['form_to_date']) ? '' : trim($_POST['form_to_date']);
393 $form_reviewed = empty($_POST['form_reviewed']) ? 3 : (int)$_POST['form_reviewed'];
394 $form_patient = !empty($_POST['form_patient']);
395 $form_provider = empty($_POST['form_provider']) ? '' : (int)$_POST['form_provider'];
396 $form_lab_search = empty($_POST['form_lab_search']) ? '' : (int)$_POST['form_lab_search'];
399 <div class="form-row my-2">
400 <div class="col-md input-group">
401 <label class='col-form-label' for="form_from_date"><?php echo xlt('From'); ?>:</label>
402 <input type='text' size='9' name='form_from_date' id='form_from_date' class='form-control datepicker' value='<?php echo attr($form_from_date); ?>' title='<?php echo xla('yyyy-mm-dd'); ?>' placeholder='<?php echo xla('yyyy-mm-dd'); ?>' />
403 </div>
404 <div class="col-md input-group">
405 <label class='col-form-label' for="form_to_date"><?php echo xlt('To{{Range}}'); ?>:</label>
406 <input type='text' size='9' name='form_to_date' id='form_to_date' class='form-control datepicker' value='<?php echo attr($form_to_date); ?>' title='<?php echo xla('yyyy-mm-dd'); ?>' placeholder='<?php echo xla('yyyy-mm-dd'); ?>' />
407 </div>
408 <div class="col-md">
409 <select class="col-md form-control" name='form_reviewed'>
410 <?php
411 foreach (
412 array(
413 '1' => xl('All'),
414 '2' => xl('Reviewed'),
415 '3' => xl('Received, unreviewed'),
416 '4' => xl('Sent, not received'),
417 '5' => xl('Not sent'),
418 ) as $key => $value
420 echo "<option value='" . attr($key) . "'";
421 if ($key == $form_reviewed) {
422 echo " selected";
424 echo ">" . text($value) . "</option>\n";
427 </select>
428 </div>
429 <div class="col-md">
430 <?php
431 generate_form_field(array('data_type' => 10, 'field_id' => 'provider',
432 'empty_title' => '-- All Providers --'), $form_provider);
434 </div>
435 <div class="col-md">
436 <select name='form_lab_search' id='form_lab_search' class='form-control'>
437 <option value="0"><?php echo xlt('All Labs'); ?></option>
438 <?php
439 $ppres = sqlStatement("SELECT ppid, name FROM procedure_providers ORDER BY name, ppid");
440 while ($pprow = sqlFetchArray($ppres)) {
441 echo "<option value='" . attr($pprow['ppid']) . "'";
442 if ($pprow['ppid'] == $form_lab_search) {
443 echo " selected";
445 echo ">" . text($pprow['name']) . "</option>";
448 </select>
449 </div>
450 <div class="col-md">
451 <button type="submit" class="btn btn-outline-primary btn-search float-left" name='form_refresh'><?php echo xlt('Filter'); ?></button>
452 </div>
453 </div>
454 </div>
455 <div class="container-fluid">
456 <table class="table table-bordered table-condensed table-striped table-hover">
457 <thead>
458 <tr class='head'>
459 <th colspan='2'><?php echo xlt('Patient'); ?></th>
460 <th colspan='3'><?php echo xlt('Order'); ?></th>
461 <th colspan='2'><?php echo xlt('Procedure'); ?></th>
462 <th colspan='2'><?php echo xlt('Report'); ?></th>
463 </tr>
464 <tr class='subhead'>
465 <th><?php echo xlt('Name'); ?></th>
466 <th><?php echo xlt('ID'); ?></th>
467 <th><?php echo xlt('Date'); ?></th>
468 <th><?php echo xlt('ID'); ?></th>
469 <th><?php echo xlt('Lab'); ?></th>
470 <th><?php echo xlt('Code'); ?></th>
471 <th><?php echo xlt('Description'); ?></th>
472 <th><?php echo xlt('Date'); ?></th>
473 <th><?php echo xlt('Status'); ?></th>
474 </tr>
475 </thead>
476 <?php
477 if ($start_form !== true) {
478 $selects =
479 "po.patient_id, po.procedure_order_id, po.date_ordered, po.date_transmitted, po.lab_id, pp.npi, " .
480 "pc.procedure_order_seq, pc.procedure_code, pc.procedure_name, pc.do_not_send, " .
481 "pr.procedure_report_id, pr.date_report, pr.date_report_tz, pr.report_status, pr.review_status";
483 $joins =
484 "LEFT JOIN procedure_report AS pr ON pr.procedure_order_id = po.procedure_order_id AND " .
485 "pr.procedure_order_seq = pc.procedure_order_seq";
487 $orderby =
488 "po.date_ordered, po.procedure_order_id, " .
489 "pc.do_not_send, pc.procedure_order_seq, pr.procedure_report_id";
491 $where = "1 = 1";
492 $sqlBindArray = array();
494 if (!empty($form_from_date)) {
495 $where .= " AND po.date_ordered >= ?";
496 $sqlBindArray[] = $form_from_date;
499 if (!empty($form_to_date)) {
500 $where .= " AND po.date_ordered <= ?";
501 $sqlBindArray[] = $form_to_date;
504 if ($form_patient) {
505 $where .= " AND po.patient_id = ?";
506 $sqlBindArray[] = $pid;
509 if ($form_provider) {
510 $where .= " AND po.provider_id = ?";
511 $sqlBindArray[] = $form_provider;
514 if ($form_lab_search > 0) {
515 $where .= " AND po.lab_id = ?";
516 $sqlBindArray[] = $form_lab_search;
519 if ($form_reviewed == 2) {
520 $where .= " AND pr.procedure_report_id IS NOT NULL AND pr.review_status = 'reviewed'";
521 } elseif ($form_reviewed == 3) {
522 $where .= " AND pr.procedure_report_id IS NOT NULL AND pr.review_status != 'reviewed'";
523 } elseif ($form_reviewed == 4) {
524 $where .= " AND po.date_transmitted IS NOT NULL AND pr.procedure_report_id IS NULL";
525 } elseif ($form_reviewed == 5) {
526 $where .= " AND po.date_transmitted IS NULL AND pr.procedure_report_id IS NULL";
529 $query = "SELECT " .
530 "pd.fname, pd.mname, pd.lname, pd.pubpid, $selects " .
531 "FROM procedure_order AS po " .
532 "LEFT JOIN procedure_order_code AS pc ON pc.procedure_order_id = po.procedure_order_id " .
533 "LEFT JOIN procedure_providers AS pp ON po.lab_id = pp.ppid " .
534 "LEFT JOIN patient_data AS pd ON pd.pid = po.patient_id $joins " .
535 "WHERE $where " .
536 "ORDER BY pd.lname, pd.fname, pd.mname, po.patient_id, $orderby";
538 $res = sqlStatement($query, $sqlBindArray);
540 $lastptid = -1;
541 $lastpoid = -1;
542 $lastpcid = -1;
543 $encount = 0;
544 $lino = 0;
545 $extra_html = '';
546 $num_checkboxes = 0;
548 while ($row = sqlFetchArray($res)) {
549 $patient_id = empty($row['patient_id']) ? 0 : ($row['patient_id'] + 0);
550 $order_id = empty($row['procedure_order_id']) ? 0 : ($row['procedure_order_id'] + 0);
551 $order_seq = empty($row['procedure_order_seq']) ? 0 : ($row['procedure_order_seq'] + 0);
552 $date_ordered = empty($row['date_ordered']) ? '' : $row['date_ordered'];
553 $date_transmitted = empty($row['date_transmitted']) ? '' : $row['date_transmitted'];
554 $procedure_code = empty($row['procedure_code']) ? '' : $row['procedure_code'];
555 $procedure_name = empty($row['procedure_name']) ? '' : $row['procedure_name'];
556 $report_id = empty($row['procedure_report_id']) ? 0 : ($row['procedure_report_id'] + 0);
557 $date_report = empty($row['date_report']) ? '' : substr($row['date_report'], 0, 16);
558 $date_report_suf = empty($row['date_report_tz']) ? '' : (' ' . $row['date_report_tz']);
559 $report_status = empty($row['report_status']) ? '' : $row['report_status'];
560 $review_status = empty($row['review_status']) ? '' : $row['review_status'];
561 $report_lab = empty($row['npi']) ? '' : $row['npi'];
563 // Sendable procedures sort first, so this also applies to the order on an order ID change.
564 $sendable = isset($row['procedure_order_seq']) && $row['do_not_send'] == 0;
566 $ptname = $row['lname'];
567 if ($row['fname'] || $row['mname']) {
568 $ptname .= ', ' . $row['fname'] . ' ' . $row['mname'];
571 if ($lastpoid != $order_id || $lastpcid != $order_seq) {
572 ++$encount;
575 //$bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
576 echo " <tr class='detail'>\n";
578 // Generate patient columns.
579 if ($lastptid != $patient_id) {
580 $lastpoid = -1;
581 echo " <td class='text-primary' onclick='openPatient(" . attr_js($patient_id) . ")' style='cursor: pointer;'>";
582 echo text($ptname);
583 echo "</td>\n";
584 echo " <td>" . text($row['pubpid']) . "</td>\n";
585 } else {
586 echo " <td colspan='2'>&nbsp;</td>";
589 // Generate order columns.
590 if ($lastpoid != $order_id) {
591 $lastpcid = -1;
592 echo " <td>";
593 // Checkbox to support sending unsent orders, disabled if sent.
594 echo "<input type='checkbox' name='form_cb[" . attr($order_id) . "]' value='" . attr($order_id) . "' ";
595 if ($date_transmitted || !$sendable) {
596 echo "disabled";
597 } else {
598 echo "checked";
599 ++$num_checkboxes;
602 echo " />&nbsp";
603 // Order date comes with a link to open results in the same frame.
604 echo "<a href='javascript:openResults(" . attr_js($order_id) . ")' ";
605 echo "title='" . xla('Click for results') . "'>";
606 echo text($date_ordered);
607 echo "</a></td>\n";
608 echo " <td>";
609 // Order ID comes with a link to open the manifest in a new window/tab.
610 echo "<a href='" . $GLOBALS['webroot'];
611 echo "/interface/orders/order_manifest.php?orderid=";
612 echo attr_url($order_id);
613 echo "' target='_blank' onclick='top.restoreSession()' ";
614 echo "title='" . xla('Click for order summary') . "'>";
615 echo text($order_id);
616 echo "</a></td>\n";
617 echo " <td>" . text($report_lab) . "</td>\n";
618 } else {
619 echo " <td colspan='3' style='background-color:transparent'>&nbsp;</td>";
622 // Generate procedure columns.
623 if ($order_seq && $lastpcid != $order_seq) {
624 if ($sendable) {
625 echo " <td>" . text($procedure_code) . "</td>\n";
626 echo " <td>" . text($procedure_name) . "</td>\n";
627 } else {
628 echo " <td><s>" . text($procedure_code) . "</s></td>\n";
629 echo " <td><s>" . text($procedure_name) . "</s></td>\n";
631 } else {
632 echo " <td colspan='2' style='background-color:transparent'>&nbsp;</td>";
635 // Generate report columns.
636 if ($report_id) {
637 echo " <td>" . text($date_report . $date_report_suf) . "</td>\n";
638 echo " <td title='" . xla('Check mark indicates reviewed') . "'>";
639 echo myCellText(getListItem('proc_rep_status', $report_status));
640 if ($review_status == 'reviewed') {
641 echo " &#x2713;"; // unicode check mark character
644 echo "</td>\n";
645 } else {
646 echo " <td colspan='2' style='background-color:transparent'>&nbsp;</td>";
649 echo " </tr>\n";
651 $lastptid = $patient_id;
652 $lastpoid = $order_id;
653 $lastpcid = $order_seq;
654 ++$lino;
656 } ?>
657 </table>
658 <?php if (!empty($num_checkboxes)) { ?>
659 <button type="submit" class="btn btn-primary btn-transmit" name='form_xmit'
660 value='<?php echo xla('Transmit Selected Orders'); ?>'><?php echo xlt('Transmit Selected Orders'); ?>
661 </button>
662 <?php } ?>
663 </div>
664 </form>
665 </body>
666 </html>