Highway to PSR2
[openemr.git] / interface / patient_file / summary / labdata_fragment.php
blob307c25472af7a1bb37ea908590d7b93506b8cab1
1 <?php
2 /*******************************************************************************\
3 * Copyright (C) 2014 Joe Slam (joe@produnis.de) *
4 * *
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. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, *
17 * see <http://opensource.org/licenses/gpl-license.php> *
18 ********************************************************************************
19 * @package OpenEMR
20 * @author Joe Slam <joe@produnis.de>
21 * @link http://www.open-emr.org
22 * */
26 require_once("../../globals.php");
29 <div id='labdata' style='margin-top: 3px; margin-left: 10px; margin-right: 10px'><!--outer div-->
30 <br>
31 <?php
32 //retrieve most recent set of labdata.
33 $spell = "SELECT procedure_report.date_collected AS thedate, " .
34 "procedure_order_code.procedure_name AS theprocedure, " .
35 "procedure_order.encounter_id AS theencounter " .
36 "FROM procedure_report " .
37 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
38 "JOIN procedure_order_code ON procedure_order.procedure_order_id = procedure_order_code.procedure_order_id " .
39 "WHERE procedure_order.patient_id = ? " .
40 "ORDER BY procedure_report.date_collected DESC ";
41 $result=sqlQuery($spell, array($pid));
43 if (!$result) { //If there are no lab data recorded
45 <span class='text'> <?php echo htmlspecialchars(xl("No lab data documented."), ENT_NOQUOTES);
47 </span>
48 <?php
49 } else {
50 ?>
51 <span class='text'><b>
52 <?php echo htmlspecialchars(xl('Most recent lab data:'), ENT_NOQUOTES); ?>
53 </b>
54 <br />
55 <?php
56 echo xlt('Procedure') . ": " . text($result['theprocedure']) . " (" . text($result['thedate']) . ")<br>";
57 echo xlt('Encounter') . ": <a href='../../patient_file/encounter/encounter_top.php?set_encounter=" . attr($result['theencounter']) . "' target='RBot'>" . text($result['theencounter']) . "</a>";
59 <br />
60 </span><span class='text'>
61 <br />
62 <a href='../summary/labdata.php' onclick='top.restoreSession()'><?php echo htmlspecialchars(xl('Click here to view and graph all labdata.'), ENT_NOQUOTES);?></a>
63 </span><?php
64 } ?>
65 <br />
66 <br />
67 </div>