Assorted minor corrections per code review.
[openemr.git] / interface / forms / procedure_order / report.php
blobea4b3f5dc6dfcb6983c28a9c4a52d040992fd368
1 <?php
2 // Copyright (C) 2010-2013 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 include_once("../../globals.php");
10 include_once($GLOBALS["srcdir"] . "/api.inc");
11 include_once($GLOBALS["srcdir"] . "/options.inc.php");
13 function procedure_order_report($pid, $encounter, $cols, $id) {
14 $data = sqlQuery("SELECT " .
15 "po.procedure_order_id, po.date_ordered, po.diagnoses, " .
16 "po.order_status, po.specimen_type, " .
17 "pp.name AS labname, pr.procedure_report_id, " .
18 "u.lname AS ulname, u.fname AS ufname, u.mname AS umname " .
19 "FROM procedure_order AS po " .
20 "LEFT JOIN procedure_providers AS pp ON pp.ppid = po.lab_id " .
21 "LEFT JOIN users AS u ON u.id = po.provider_id " .
22 "LEFT JOIN procedure_report AS pr ON pr.procedure_order_id = po.procedure_order_id " .
23 "WHERE po.procedure_order_id = ? " .
24 "ORDER BY pr.procedure_report_id LIMIT 1",
25 array($id));
27 if ($data) {
28 echo "<table cellpadding='2' cellspacing='0'>\n";
29 echo " <tr>\n";
30 echo " <td class='bold'>" . xlt('Order ID') . ": </td>\n";
31 echo " <td class='text'>" . text($data['procedure_order_id']) . "</td>\n";
32 echo " </tr>\n";
33 echo " <tr>\n";
34 echo " <td class='bold'>" . xlt('Order Date') . ": </td>\n";
35 echo " <td class='text'>" . text(oeFormatShortDate($data['date_ordered'])) . "</td>\n";
36 echo " </tr>\n";
37 echo " <tr>\n";
38 echo " <td class='bold'>" . xlt('Ordered By') . ": </td>\n";
39 echo " <td class='text'>" . text($data['ulname'] . ', ' . $data['ufname'] . ' ' . $data['umname']) . "</td>\n";
40 echo " </tr>\n";
41 echo " <tr>\n";
42 echo " <td class='bold'>" . xlt('Lab') . ": </td>\n";
43 echo " <td class='text'>" . text($data['labname']) . "</td>\n";
44 echo " </tr>\n";
45 if (!empty($data['procedure_report_id'])) {
46 echo " <tr>\n";
47 echo " <td>&nbsp;</td>\n";
48 echo " <td class='bold'><a href='#' onclick=\"" .
49 "top.restoreSession();" .
50 "window.open('" . $GLOBALS['web_root'] . "/interface/orders/single_order_results.php?orderid=" . text($id) . "');" .
51 "return false;" .
52 "\">[" . xlt('View Results') . "]</a></td>\n";
53 echo " </tr>\n";
55 echo "</table>\n";