2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2015 Z&H Consultancy Services Private Limited <sam@zhservices.com>
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.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
18 // A copy of the GNU General Public License is included along with this program:
19 // openemr/interface/login/GnuGPL.html
20 // For more information write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Author: Jacob T Paul <jacob@zhservices.com>
24 // Vinish K <vinish@zhservices.com>
26 // +------------------------------------------------------------------------------+
28 //SANITIZE ALL ESCAPES
29 $sanitize_all_escapes = true;
31 //STOP FAKE REGISTER GLOBALS
32 $fake_register_globals = false;
34 include_once("../../globals.php");
35 include_once("$srcdir/api.inc");
36 require_once("$srcdir/patient.inc");
37 require_once("$srcdir/options.inc.php");
38 require_once($GLOBALS['srcdir'] . '/csv_like_join.php');
39 require_once($GLOBALS['fileroot'] . '/custom/code_types.inc.php');
41 formHeader("Form:Functional and Cognitive Status Form");
42 $returnurl = 'encounter_top.php';
43 $formid = 0 +
(isset($_GET['id']) ?
$_GET['id'] : '');
45 $sql = "SELECT * FROM `form_functional_cognitive_status` WHERE id=? AND pid = ? AND encounter = ?";
46 $res = sqlStatement($sql, array($formid,$_SESSION["pid"], $_SESSION["encounter"]));
48 for ($iter = 0; $row = sqlFetchArray($res); $iter++
)
53 $check_res = $formid ?
$check_res : array();
57 <?php
html_header_show(); ?
>
58 <!-- pop up calendar
-->
59 <style type
="text/css">@import
url(<?php
echo $GLOBALS['webroot'] ?
>/library
/dynarch_calendar
.css
);</style
>
60 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script
>
61 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
62 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script
>
63 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/textformat.js"></script
>
64 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
65 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
68 <body
class="body_top">
69 <script type
="text/javascript">
71 function duplicateRow(e
) {
72 var newRow
= e
.cloneNode(true);
73 e
.parentNode
.insertBefore(newRow
, e
.nextSibling
);
75 changeIds('description');
76 changeIds('activity');
77 changeIds('activity1');
79 changeIds('codetext');
80 changeIds('img_code_date');
81 changeIds('code_date');
82 changeIds('displaytext');
86 function removeVal(rowid
)
88 rowid1
= rowid
.split('tb_row_');
89 document
.getElementById("description_" + rowid1
[1]).value
= '';
90 document
.getElementById("activity_" + rowid1
[1]).checked
= false;
91 document
.getElementById("activity_" + rowid1
[1]).value
= 0;
92 document
.getElementById("activity1_" + rowid1
[1]).value
= 0;
93 document
.getElementById("code_" + rowid1
[1]).value
= '';
94 document
.getElementById("codetext_" + rowid1
[1]).value
= '';
95 document
.getElementById("img_code_date_" + rowid1
[1]).value
= '';
96 document
.getElementById("code_date_" + rowid1
[1]).value
= '';
97 document
.getElementById("displaytext_" + rowid1
[1]).innerHTML
= '';
100 function changeIds(class_val
) {
101 var elem
= document
.getElementsByClassName(class_val
);
102 for (var i
= 0; i
< elem
.length
; i++
) {
105 elem
[i
].id
= class_val +
"_" + index
;
107 if (class_val
== 'code_date')
109 Calendar
.setup({inputField
: class_val +
"_" + index
, ifFormat
: "%Y-%m-%d", button
: "img_code_date_" + index
});
114 function deleteRow(rowId
)
116 if (rowId
!= 'tb_row_1') {
117 var table
= document
.getElementById("functional_cognitive_status");
118 var rowIndex
= document
.getElementById(rowId
).rowIndex
;
119 table
.deleteRow(rowIndex
);
123 function sel_code(id
)
125 id
= id
.split('tb_row_');
126 var checkId
= '_' + id
[1];
127 document
.getElementById('clickId').value
= checkId
;
128 dlgopen('<?php echo $GLOBALS['webroot
'] . "/interface/patient_file/encounter/" ?>find_code_popup.php?codetype=SNOMED-CT', '_blank', 700, 400);
131 function set_related(codetype
, code
, selector
, codedesc
) {
132 var checkId
= document
.getElementById('clickId').value
;
133 document
.getElementById("code" + checkId
).value
= code
;
134 document
.getElementById("codetext" + checkId
).value
= codedesc
;
135 document
.getElementById("displaytext" + checkId
).innerHTML
= codedesc
;
138 function checkVal(id
)
140 var id1
= id
.split('activity_')
141 if (document
.getElementById(id
).checked
)
143 document
.getElementById(id
).value
= 1;
144 document
.getElementById('activity1_' + id1
[1]).value
= 1;
148 document
.getElementById(id
).value
= 0;
149 document
.getElementById('activity1_' + id1
[1]).value
= 0;
153 <p
><span
class="forms-title"><?php
echo xlt('Functional and Cognitive Status Form'); ?
></span
></p
>
155 <?php
echo "<form method='post' name='my_form' " . "action='$rootdir/forms/functional_cognitive_status/save.php?id=" . attr($formid) . "'>\n"; ?
>
156 <table id
="functional_cognitive_status" border
="0">
159 if (!empty($check_res)) {
160 foreach ($check_res as $key => $obj) {
162 <tr
class="tb_row" id
="tb_row_<?php echo $key + 1; ?>">
163 <td align
="left" class="forms"><?php
echo xlt('Code'); ?
>:</td
>
165 <input type
="text" id
="code_<?php echo $key + 1; ?>" style
="width:210px" name
="code[]" class="code" value
="<?php echo text($obj{"code
"}); ?>" onclick
='sel_code(this.parentElement.parentElement.id);'><br
>
166 <span id
="displaytext_<?php echo $key + 1; ?>" style
="width:210px !important;display: block;font-size:13px;color: blue;" class="displaytext"><?php
echo text($obj{"codetext"}); ?
></span
>
167 <input type
="hidden" id
="codetext_<?php echo $key + 1; ?>" name
="codetext[]" class="codetext" value
="<?php echo text($obj{"codetext
"}); ?>">
169 <td align
="left" class="forms"><?php
echo xlt('Description'); ?
>:</td
>
171 <textarea rows
="4" id
="description_<?php echo $key + 1; ?>" cols
="30" name
="description[]" class="description"><?php
echo text($obj{"description"}); ?
></textarea
>
173 <td align
="left" class="forms"><?php
echo xlt('Date'); ?
>:</td
>
175 <input type
='text' id
="code_date_<?php echo $key + 1; ?>" size
='10' name
='code_date[]' class="code_date" <?php
echo attr($disabled) ?
> value
='<?php echo attr($obj{"date"}); ?>' title
='<?php echo xla('yyyy
-mm
-dd Date of service
'); ?>' onkeyup
='datekeyup(this, mypcc)' onblur
='dateblur(this, mypcc)' />
176 <img src
='../../pic/show_calendar.gif' align
='absbottom' id
="img_code_date_<?php echo $key + 1; ?>" width
='24' height
='22' class="img_code_date" border
='0' alt
='[?]' style
='cursor:pointer;cursor:hand' title
='<?php echo xla('Click here to choose a date
'); ?>'>
178 <td align
="left" class="forms"><?php
echo xlt('Active'); ?
>:</td
>
180 <input type
="checkbox" name
="activity[]" onclick
="checkVal(this.id);" id
="activity_<?php echo $key + 1; ?>" value
="<?php echo text($obj{"activity
"}); ?>" <?php
if ($obj{"activity"} == 1) echo "checked='checked'" ?
> class="activity">
181 <input type
="hidden" name
="activity1[]" id
="activity1_<?php echo $key + 1; ?>" value
="<?php echo text($obj{"activity
"}); ?>" class="activity1">
184 <img src
='../../pic/add.png' onclick
="duplicateRow(this.parentElement.parentElement);" align
='absbottom' width
='27' height
='24' border
='0' style
='cursor:pointer;cursor:hand' title
='<?php echo xla('Click here to duplicate the row
'); ?>'>
185 <img src
='../../pic/remove.png' onclick
="deleteRow(this.parentElement.parentElement.id);" align
='absbottom' width
='24' height
='22' border
='0' style
='cursor:pointer;cursor:hand' title
='<?php echo xla('Click here to delete the row
'); ?>'>
187 <script language
="javascript">
188 /* required for popup calendar */
189 Calendar
.setup({inputField
: "code_date_<?php echo $key + 1; ?>", ifFormat
: "%Y-%m-%d", button
: "img_code_date_<?php echo $key + 1; ?>"});
196 <tr
class="tb_row" id
="tb_row_1">
197 <td align
="left" class="forms"><?php
echo xlt('Code'); ?
>:</td
>
199 <input type
="text" id
="code_1" name
="code[]" class="code" style
="width:210px" value
="<?php echo text($obj{"code
"}); ?>" onclick
='sel_code(this.parentElement.parentElement.id);'><br
>
200 <span id
="displaytext_1" style
="width:210px !important;display: block;font-size:13px;color: blue;" class="displaytext"></span
>
201 <input type
="hidden" id
="codetext_1" name
="codetext[]" class="codetext" value
="<?php echo text($obj{"codetext
"}); ?>">
203 <td align
="left" class="forms"><?php
echo xlt('Description'); ?
>:</td
>
205 <textarea rows
="4" id
="description_1" cols
="30" name
="description[]" class="description"><?php
echo text($obj{"description"}); ?
></textarea
>
207 <td align
="left" class="forms"><?php
echo xlt('Date'); ?
>:</td
>
209 <input type
='text' id
="code_date_1" size
='10' name
='code_date[]' class="code_date" <?php
echo attr($disabled) ?
> value
='<?php echo attr($obj{"date"}); ?>' title
='<?php echo xla('yyyy
-mm
-dd Date of service
'); ?>' onkeyup
='datekeyup(this, mypcc)' onblur
='dateblur(this, mypcc)' />
210 <img src
='../../pic/show_calendar.gif' align
='absbottom' id
="img_code_date_<?php echo $key + 1; ?>" width
='24' height
='22' class="img_code_date" border
='0' alt
='[?]' style
='cursor:pointer;cursor:hand' title
='<?php echo xla('Click here to choose a date
'); ?>'>
212 <td align
="left" class="forms"><?php
echo xlt('Active'); ?
>:</td
>
214 <input type
="checkbox" name
="activity[]" onclick
="checkVal(this.id);" id
="activity_1" value
="0" class="activity">
215 <input type
="hidden" name
="activity1[]" id
="activity1_1" value
="0" class="activity1">
218 <img src
='../../pic/add.png' onclick
="duplicateRow(this.parentElement.parentElement);" align
='absbottom' width
='27' height
='24' border
='0' style
='cursor:pointer;cursor:hand' title
='<?php echo xla('Click here to duplicate the row
'); ?>'>
219 <img src
='../../pic/remove.png' onclick
="deleteRow(this.parentElement.parentElement.id);" align
='absbottom' width
='24' height
='22' border
='0' style
='cursor:pointer;cursor:hand' title
='<?php echo xla('Click here to delete the row
'); ?>'>
221 <script language
="javascript">
222 /* required for popup calendar */
223 Calendar
.setup({inputField
: "code_date_1", ifFormat
: "%Y-%m-%d", button
: "img_code_date_1"});
230 <td align
="left" colspan
="5" style
="padding-bottom:7px;"></td
>
233 <td colspan
="2"></td
>
235 <input type
="hidden" id
="clickId" value
="">
236 <input type
='submit' value
='<?php echo xla('Save
'); ?>' class="button-css"> 
;