Some Module Updates (#7732)
[openemr.git] / contrib / forms / scanned_notes / report.php
blob84d1795e9517ee479fe75cc12b606c11dbf0a88b
1 <?php
3 /**
4 * scanned_notes report.php
6 * @package OpenEMR
7 * @link https://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2006-2012 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../../globals.php");
16 require_once($GLOBALS["srcdir"] . "/api.inc.php");
18 function scanned_notes_report($pid, $useless_encounter, $cols, $id)
20 global $webserver_root, $web_root, $encounter;
22 // In the case of a patient report, the passed encounter is vital.
23 $thisenc = $useless_encounter ? $useless_encounter : $encounter;
25 $count = 0;
27 $data = sqlQuery("SELECT * " .
28 "FROM form_scanned_notes WHERE " .
29 "id = ? AND activity = '1'", array($id));
31 if ($data) {
32 if ($data['notes']) {
33 echo " <span class='bold'>Comments: </span><span class='text'>";
34 echo nl2br(text($data['notes'])) . "</span><br />\n";
37 for ($i = -1; true; ++$i) {
38 $suffix = ($i < 0) ? "" : "-$i";
39 $imagepath = $GLOBALS['OE_SITE_DIR'] . "/documents/" . check_file_dir_name($pid) . "/encounters/" . check_file_dir_name($thisenc) . "_" . check_file_dir_name($id) . check_file_dir_name($suffix) . ".jpg";
40 $imageurl = $web_root . "/sites/" . $_SESSION['site_id'] . "/documents/" . check_file_dir_name($pid) . "/encounters/" . check_file_dir_name($thisenc) . "_" . check_file_dir_name($id) . check_file_dir_name($suffix) . ".jpg";
41 if (is_file($imagepath)) {
42 echo " <img src='$imageurl'";
43 // Flag images with excessive width for possible stylesheet action.
44 $asize = getimagesize($imagepath);
45 if ($asize[0] > 750) {
46 echo " class='bigimage'";
49 echo " />\n";
50 echo " <br />\n";
51 } else {
52 if ($i >= 0) {
53 break;