2 // Copyright (C) 2009-2017 Rod Roark <rod@sunsetsystems.com>
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(dirname(__FILE__
).'/../../globals.php');
10 include_once($GLOBALS["srcdir"] . "/api.inc");
12 // This function is invoked from printPatientForms in report.inc
13 // when viewing a "comprehensive patient report". Also from
14 // interface/patient_file/encounter/forms.php.
16 function lbf_report($pid, $encounter, $cols, $id, $formname, $no_wrap = false)
19 require_once($GLOBALS["srcdir"] . "/options.inc.php");
22 getLayoutProperties($formname, $grparr, '*');
23 // Check access control.
24 if (!empty($grparr['']['grp_aco_spec'])) {
25 $LBF_ACO = explode('|', $grparr['']['grp_aco_spec']);
27 if (!acl_check('admin', 'super') && !empty($LBF_ACO)) {
28 if (!acl_check($LBF_ACO[0], $LBF_ACO[1])) {
29 die(xlt('Access denied'));
34 $shrow = getHistoryData($pid);
35 $fres = sqlStatement("SELECT * FROM layout_options " .
36 "WHERE form_id = ? AND uor > 0 " .
37 "ORDER BY group_id, seq", array($formname));
38 while ($frow = sqlFetchArray($fres)) {
39 $field_id = $frow['field_id'];
41 if (strpos($frow['edit_options'], 'H') !== false) {
42 if (isset($shrow[$field_id])) {
43 $currvalue = $shrow[$field_id];
46 $currvalue = lbf_current_value($frow, $id, $encounter);
47 if ($currvalue === false) {
48 continue; // should not happen
52 // For brevity, skip fields without a value.
53 if ($currvalue === '') {
57 // $arr[$field_id] = $currvalue;
58 // A previous change did this instead of the above, not sure if desirable? -- Rod
59 // $arr[$field_id] = wordwrap($currvalue, 30, "\n", true);
60 // Hi Rod content width issue in Encounter Summary - epsdky
61 // Also had it not wordwrap nation notes which breaks it since it splits
62 // html tags apart - brady
63 if ($no_wrap ||
($frow['data_type'] == 34)) {
64 $arr[$field_id] = $currvalue;
66 $arr[$field_id] = wordwrap($currvalue, 30, "\n", true);
71 display_layout_rows($formname, $arr);