6 * @link http://www.open-emr.org
7 * @author Hema Bandaru <hemab@drcloudemr.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2014 Ensoftek
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");
16 require_once("$srcdir/options.inc.php");
18 $amendments = $_REQUEST["ids"];
19 $amendments = rtrim($amendments, ",");
20 $amendmentsList = explode(",", $amendments);
22 $patientDetails = getPatientData($pid, "fname,lname");
23 $patientName = $patientDetails['lname'] . ", " . $patientDetails['fname'];
25 function printAmendment($amendmentID, $lastAmendment)
27 $query = "SELECT lo.title AS 'amendmentFrom', lo1.title AS 'amendmentStatus',a.* FROM amendments a
28 LEFT JOIN list_options lo ON a.amendment_by = lo.option_id AND lo.list_id = 'amendment_from' AND lo.activity = 1
29 LEFT JOIN list_options lo1 ON a.amendment_status = lo1.option_id AND lo1.list_id = 'amendment_status' AND lo1.activity = 1
30 WHERE a.amendment_id = ?";
31 $resultSet = sqlQuery($query, array($amendmentID));
33 echo "<tr class=text>";
34 echo "<td class=bold>" . xlt("Requested Date") . ":" . "</td>";
35 echo "<td>". text(oeFormatShortDate($resultSet['amendment_date'])) . "</td>";
38 echo "<tr class=text>";
39 echo "<td class=bold>" . xlt("Requested By") . ":" . "</td>";
40 echo "<td>". generate_display_field(array('data_type'=>'1','list_id'=>'amendment_from'), $resultSet['amendment_by']) . "</td>";
43 echo "<tr class=text>";
44 echo "<td class=bold>" . xlt("Request Status") . ":" . "</td>";
45 echo "<td>". generate_display_field(array('data_type'=>'1','list_id'=>'amendment_status'), $resultSet['amendment_status']) . "</td>";
48 echo "<tr class=text>";
49 echo "<td class=bold>" . xlt("Request Description") . ":" . "</td>";
50 echo "<td>". text($resultSet['amendment_desc']) . "</td>";
56 echo "<span class='bold'>" . xlt("History") . "</span><br>";
57 $pageBreak = ( $lastAmendment ) ?
"" : "page-break-after:always";
58 echo "<table border='1' cellspacing=0 cellpadding=3 style='width:75%;margin-top:10px;margin-bottom:20px;" . $pageBreak . "'>";
59 echo "<tr class='text bold'>";
60 echo "<th align=left style='width:10%'>" . xlt("Date") . "</th>";
61 echo "<th align=left style='width:20%'>" . xlt("By") . "</th>";
62 echo "<th align=left >" . xlt("Comments") . "</th>";
65 $query = "SELECT u.fname,u.lname,ah.* FROM amendments_history ah INNER JOIN users u ON ah.created_by = u.id WHERE ah.amendment_id = ?";
66 $resultSet = sqlStatement($query, array($amendmentID));
67 while ($row = sqlFetchArray($resultSet)) {
68 echo "<tr class=text>";
69 $created_date = date('Y-m-d', strtotime($row['created_time']));
70 echo "<td>" . text(oeFormatShortDate($created_date)) . "</td>";
71 echo "<td>" . text($row['lname']) . ", " . text($row['fname']) . "</td>";
72 echo "<td>" . text($row['amendment_note']) . "</td>";
83 <?php
html_header_show();?
>
85 <!-- supporting javascript code
-->
86 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/manual-added-packages/jquery-min-1-2-2/index.js"></script
>
87 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/textformat.js"></script
>
88 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
92 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
96 <body
class="body_top">
97 <span
class='title'><?php
echo xlt("Amendments for") . " " . text($patientName); ?
></span
>
101 for ($i = 0; $i < count($amendmentsList); $i++
) {
102 $lastAmendment = ( $i == count($amendmentsList) - 1 ) ?
true : false;
103 printAmendment($amendmentsList[$i], $lastAmendment);
107 <script language
='JavaScript'>
108 opener
.top
.printLogPrint(window
);