bug fixes in patient_files summary directory (#1964)
[openemr.git] / interface / patient_file / summary / labdata_fragment.php
blob36be16aec7f699dd749cbc0b2560c15ddaf81980
1 <?php
2 /**
3 * labdata_fragment.php
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Joe Slam <joe@produnis.de>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2014 Joe Slam <joe@produnis.de>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../../globals.php");
17 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
18 csrfNotVerified();
22 <div id='labdata' style='margin-top: 3px; margin-left: 10px; margin-right: 10px'><!--outer div-->
23 <br>
24 <?php
25 //retrieve most recent set of labdata.
26 $spell = "SELECT procedure_report.date_collected AS thedate, " .
27 "procedure_order_code.procedure_name AS theprocedure, " .
28 "procedure_order.encounter_id AS theencounter " .
29 "FROM procedure_report " .
30 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
31 "JOIN procedure_order_code ON procedure_order.procedure_order_id = procedure_order_code.procedure_order_id " .
32 "WHERE procedure_order.patient_id = ? " .
33 "ORDER BY procedure_report.date_collected DESC ";
34 $result=sqlQuery($spell, array($pid));
36 if (!$result) { //If there are no lab data recorded
38 <span class='text'> <?php echo xlt("No lab data documented.");
40 </span>
41 <?php
42 } else {
44 <span class='text'><b>
45 <?php echo xlt('Most recent lab data:'); ?>
46 </b>
47 <br />
48 <?php
49 echo xlt('Procedure') . ": " . text($result['theprocedure']) . " (" . text($result['thedate']) . ")<br>";
50 echo xlt('Encounter') . ": <a href='../../patient_file/encounter/encounter_top.php?set_encounter=" . attr_url($result['theencounter']) . "' target='RBot'>" . text($result['theencounter']) . "</a>";
52 <br />
53 </span><span class='text'>
54 <br />
55 <a href='../summary/labdata.php' onclick='top.restoreSession()'><?php echo xlt('Click here to view and graph all labdata.');?></a>
56 </span><?php
57 } ?>
58 <br />
59 <br />
60 </div>