Fixes for encounter date display when showing historical LBF data.
[openemr.git] / interface / patient_file / summary / lbf_fragment.php
blob040a3d98857239d837d9830aef7a7ae6c456c088
1 <?php
2 /*******************************************************************************\
3 * Copyright 2010 Brady Miller <brady@sparmy.com> *
4 * Copyright 2011 Rod Roark <rod@sunsetsystems.com> *
5 * *
6 * This program is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU General Public License *
8 * as published by the Free Software Foundation; either version 2 *
9 * of the License, or (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ********************************************************************************/
21 //SANITIZE ALL ESCAPES
22 $sanitize_all_escapes = true;
24 //STOP FAKE REGISTER GLOBALS
25 $fake_register_globals = false;
27 require_once("../../globals.php");
28 require_once("$srcdir/formatting.inc.php");
30 $lbf_form_id = $_GET['formname'];
32 <div id='<?php echo $lbf_form_id; ?>' style='margin-top: 3px; margin-left: 10px; margin-right: 10px'>
33 <br />
34 <?php
35 // Retrieve most recent instance of this form for this patient.
36 $result = sqlQuery("SELECT f.form_id, f.form_name, fe.date " .
37 "FROM forms AS f, form_encounter AS fe WHERE " .
38 "f.pid = ? AND f.formdir = ? AND " .
39 "f.deleted = 0 AND " .
40 "fe.pid = f.pid AND fe.encounter = f.encounter " .
41 "ORDER BY fe.date DESC, f.encounter DESC, f.date DESC " .
42 "LIMIT 1",
43 array($pid, $lbf_form_id));
45 if (!$result) { //If there are none
47 <span class='text'> <?php echo htmlspecialchars(xl("None have been documented"), ENT_NOQUOTES); ?>
48 </span>
49 <?php } else { ?>
50 <span class='text'><b>
51 <?php
52 echo htmlspecialchars(xl('Most recent from') . ": " .
53 oeFormatShortDate(substr($result['date'], 0, 10)), ENT_NOQUOTES);
55 </b></span>
56 <br />
57 <br />
58 <?php
59 include_once($GLOBALS['incdir'] . "/forms/LBF/report.php");
60 call_user_func("lbf_report", '', '', 2, $result['form_id'], $lbf_form_id);
62 <span class='text'>
63 <br />
64 <a href='../encounter/trend_form.php?formname=<?php echo $lbf_form_id; ?>'
65 onclick='top.restoreSession()'>
66 <?php echo htmlspecialchars(xl('Click here to view and graph'),ENT_NOQUOTES);?>
67 </a>
68 </span>
69 <?php } ?>
70 <br />
71 <br />
72 </div>