5 * Copyright (C) 2014 Ensoftek
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @author Hema Bandaru <hemab@drcloudemr.com>
20 * @link http://www.open-emr.org
25 include_once("../../globals.php");
26 include_once("$srcdir/options.inc.php");
28 $amendments = $_REQUEST["ids"];
29 $amendments = rtrim($amendments, ",");
30 $amendmentsList = explode(",", $amendments);
32 $patientDetails = getPatientData($pid, "fname,lname");
33 $patientName = $patientDetails['lname'] . ", " . $patientDetails['fname'];
35 function printAmendment($amendmentID, $lastAmendment)
37 $query = "SELECT lo.title AS 'amendmentFrom', lo1.title AS 'amendmentStatus',a.* FROM amendments a
38 LEFT JOIN list_options lo ON a.amendment_by = lo.option_id AND lo.list_id = 'amendment_from' AND lo.activity = 1
39 LEFT JOIN list_options lo1 ON a.amendment_status = lo1.option_id AND lo1.list_id = 'amendment_status' AND lo1.activity = 1
40 WHERE a.amendment_id = ?";
41 $resultSet = sqlQuery($query, array($amendmentID));
43 echo "<tr class=text>";
44 echo "<td class=bold>" . xlt("Requested Date") . ":" . "</td>";
45 echo "<td>". oeFormatShortDate($resultSet['amendment_date']) . "</td>";
48 echo "<tr class=text>";
49 echo "<td class=bold>" . xlt("Requested By") . ":" . "</td>";
50 echo "<td>". generate_display_field(array('data_type'=>'1','list_id'=>'amendment_from'), $resultSet['amendment_by']) . "</td>";
53 echo "<tr class=text>";
54 echo "<td class=bold>" . xlt("Request Status") . ":" . "</td>";
55 echo "<td>". generate_display_field(array('data_type'=>'1','list_id'=>'amendment_status'), $resultSet['amendment_status']) . "</td>";
58 echo "<tr class=text>";
59 echo "<td class=bold>" . xlt("Request Description") . ":" . "</td>";
60 echo "<td>". text($resultSet['amendment_desc']) . "</td>";
66 echo "<span class='bold'>" . xlt("History") . "</span><br>";
67 $pageBreak = ( $lastAmendment ) ?
"" : "page-break-after:always";
68 echo "<table border='1' cellspacing=0 cellpadding=3 style='width:75%;margin-top:10px;margin-bottom:20px;" . $pageBreak . "'>";
69 echo "<tr class='text bold'>";
70 echo "<th align=left style='width:10%'>" . xlt("Date") . "</th>";
71 echo "<th align=left style='width:20%'>" . xlt("By") . "</th>";
72 echo "<th align=left >" . xlt("Comments") . "</th>";
75 $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 = ?";
76 $resultSet = sqlStatement($query, array($amendmentID));
77 while ($row = sqlFetchArray($resultSet)) {
78 echo "<tr class=text>";
79 $created_date = date('Y-m-d', strtotime($row['created_time']));
80 echo "<td>" . oeFormatShortDate($created_date) . "</td>";
81 echo "<td>" . text($row['lname']) . ", " . text($row['fname']) . "</td>";
82 echo "<td>" . text($row['amendment_note']) . "</td>";
93 <?php
html_header_show();?
>
95 <!-- supporting javascript code
-->
96 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
97 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/textformat.js"></script
>
98 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
102 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
106 <body
class="body_top">
107 <span
class='title'><?php
echo xlt("Amendments for") . " " . text($patientName); ?
></span
>
111 for ($i = 0; $i < count($amendmentsList); $i++
) {
112 $lastAmendment = ( $i == count($amendmentsList) - 1 ) ?
true : false;
113 printAmendment($amendmentsList[$i], $lastAmendment);
117 <script language
='JavaScript'>
118 opener
.top
.printLogPrint(window
);