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:Care Plan Form");
42 $returnurl = 'encounter_top.php';
43 $formid = 0 +
(isset($_GET['id']) ?
$_GET['id'] : '');
45 $sql = "SELECT * FROM `form_care_plan` 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"></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');
77 changeIds('codetext');
78 changeIds('img_code_date');
79 changeIds('code_date');
80 changeIds('displaytext');
85 function removeVal(rowid
)
87 rowid1
= rowid
.split('tb_row_');
88 document
.getElementById("description_" + rowid1
[1]).value
= '';
89 document
.getElementById("code_" + rowid1
[1]).value
= '';
90 document
.getElementById("codetext_" + rowid1
[1]).value
= '';
91 document
.getElementById("img_code_date_" + rowid1
[1]).value
= '';
92 document
.getElementById("code_date_" + rowid1
[1]).value
= '';
93 document
.getElementById("displaytext_" + rowid1
[1]).innerHTML
= '';
96 function changeIds(class_val
) {
97 var elem
= document
.getElementsByClassName(class_val
);
98 for (var i
= 0; i
< elem
.length
; i++
) {
101 elem
[i
].id
= class_val +
"_" + index
;
103 if (class_val
== 'code_date')
105 Calendar
.setup({inputField
: class_val +
"_" + index
, ifFormat
: "%Y-%m-%d", button
: "img_code_date_" + index
});
107 if(class_val
== 'count') {
108 elem
[i
].value
= index
;
113 function deleteRow(rowId
)
115 if (rowId
!= 'tb_row_1') {
116 var table
= document
.getElementById("care_plan");
117 var rowIndex
= document
.getElementById(rowId
).rowIndex
;
118 table
.deleteRow(rowIndex
);
122 function sel_code(id
)
124 id
= id
.split('tb_row_');
125 var checkId
= '_' + id
[1];
126 document
.getElementById('clickId').value
= checkId
;
127 dlgopen('<?php echo $GLOBALS['webroot
'] . "/interface/patient_file/encounter/" ?>find_code_popup.php?codetype=SNOMED-CT', '_blank', 700, 400);
130 function set_related(codetype
, code
, selector
, codedesc
) {
131 var checkId
= document
.getElementById('clickId').value
;
132 document
.getElementById("code" + checkId
).value
= code
;
133 document
.getElementById("codetext" + checkId
).value
= codedesc
;
134 document
.getElementById("displaytext" + checkId
).innerHTML
= codedesc
;
138 <p
><span
class="forms-title"><?php
echo xlt('Care Plan Form'); ?
></span
></p
>
140 <?php
echo "<form method='post' name='my_form' " . "action='$rootdir/forms/care_plan/save.php?id=" . attr($formid) . "'>\n"; ?
>
141 <table id
="care_plan" border
="0">
144 if (!empty($check_res)) {
145 foreach ($check_res as $key => $obj) {
147 <tr
class="tb_row" id
="tb_row_<?php echo $key + 1; ?>">
148 <td align
="left" class="forms"><?php
echo xlt('Code'); ?
>:</td
>
150 <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
>
151 <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
>
152 <input type
="hidden" id
="codetext_<?php echo $key + 1; ?>" name
="codetext[]" class="codetext" value
="<?php echo text($obj{"codetext
"}); ?>">
154 <td align
="left" class="forms"><?php
echo xlt('Description'); ?
>:</td
>
156 <textarea rows
="4" id
="description_<?php echo $key + 1; ?>" cols
="30" name
="description[]" class="description"><?php
echo text($obj{"description"}); ?
></textarea
>
158 <td align
="left" class="forms"><?php
echo xlt('Date'); ?
>:</td
>
160 <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)' />
161 <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
'); ?>'>
164 <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
'); ?>'>
165 <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
'); ?>'>
167 <script language
="javascript">
168 /* required for popup calendar */
169 Calendar
.setup({inputField
: "code_date_<?php echo $key + 1; ?>", ifFormat
: "%Y-%m-%d", button
: "img_code_date_<?php echo $key + 1; ?>"});
171 <input type
="hidden" name
="count[]" id
="count_<?php echo $key + 1; ?>" class="count" value
="<?php echo $key + 1;?>">
177 <tr
class="tb_row" id
="tb_row_1">
178 <td align
="left" class="forms"><?php
echo xlt('Code'); ?
>:</td
>
180 <input type
="text" id
="code_1" name
="code[]" style
="width:210px" class="code" value
="<?php echo text($obj{"code
"}); ?>" onclick
='sel_code(this.parentElement.parentElement.id);'><br
>
181 <span id
="displaytext_1" style
="width:210px !important;display: block;font-size:13px;color: blue;" class="displaytext"></span
>
182 <input type
="hidden" id
="codetext_1" name
="codetext[]" class="codetext" value
="<?php echo text($obj{"codetext
"}); ?>">
184 <td align
="left" class="forms"><?php
echo xlt('Description'); ?
>:</td
>
186 <textarea rows
="4" id
="description_1" cols
="30" name
="description[]" class="description"><?php
echo text($obj{"description"}); ?
></textarea
>
188 <td align
="left" class="forms"><?php
echo xlt('Date'); ?
>:</td
>
190 <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)' />
191 <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
'); ?>'>
194 <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
'); ?>'>
195 <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
'); ?>'>
197 <script language
="javascript">
198 /* required for popup calendar */
199 Calendar
.setup({inputField
: "code_date_1", ifFormat
: "%Y-%m-%d", button
: "img_code_date_1"});
201 <input type
="hidden" name
="count[]" id
="count_1" class="count" value
="1">
207 <td align
="left" colspan
="5" style
="padding-bottom:7px;"></td
>
210 <td colspan
="2"></td
>
212 <input type
="hidden" id
="clickId" value
="">
213 <input type
='submit' value
='<?php echo xla('Save
'); ?>' class="button-css"> 
;
214 <!-- <input type
='button' value
="Print" onclick
="window.print()" class="button-css">-->