2 include_once("../../globals.php");
3 include_once("../../../library/api.inc");
4 include_once("../../../library/sql.inc");
5 formHeader("Form: CAMOS");
6 $returnurl = $GLOBALS['concurrent_layout'] ?
'encounter_top.php' : 'patient_encounter.php';
14 $out_of_encounter = false;
15 if (($_SESSION['encounter'] == '') ||
($_SESSION['pid'] == '')) {
16 $out_of_encounter = true;
25 $previous_encounter_data = '';
26 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
27 $previous_encounter_data = '<hr><p>'.xl('Previous Encounter CAMOS entries').'</p><hr>';
28 //get data from previous encounter to show at bottom of form for reference
29 $tmp = sqlQuery("SELECT max(encounter) AS max FROM forms WHERE " .
30 "form_name LIKE 'CAMOS%' AND encounter < '" . $_SESSION['encounter'] .
31 "' AND pid = '" . $_SESSION['pid'] . "'");
32 $last_encounter_id = $tmp['max'] ?
$tmp['max'] : 0;
33 $query = "SELECT t1.category, t1.subcategory, t1.item, t1.content " .
34 "FROM form_CAMOS as t1 JOIN forms as t2 on (t1.id = t2.form_id) where " .
35 "t2.encounter = '$last_encounter_id' and t1.pid = " . $_SESSION['pid'];
36 $statement = sqlStatement($query);
37 while ($result = sqlFetchArray($statement)) {
38 $previous_encounter_data .= $result['category']." | ".$result['subcategory'].
39 " | ".$result['item']."<p><pre>".$result['content']."</pre></p><hr>";
43 //end of get data from previous encounter
44 //variables for preselect section below (after handle database changes):
45 $preselect_category = '';
46 $preselect_subcategory = '';
48 $preselect_category_override = '';
49 $preselect_subcategory_override = '';
50 $preselect_item_override = '';
52 $quote_search = array("\r","\n");
53 $quote_replace = array("\\r","\\n");
54 $quote_search_content = array("\r","\n");
55 $quote_replace_content = array("\\r","\\n");
56 $category = str_replace($quote_search,$quote_replace,$_POST['change_category']);
57 $subcategory = str_replace($quote_search,$quote_replace,$_POST['change_subcategory']);
58 $item = str_replace($quote_search,$quote_replace,$_POST['change_item']);
59 $content = str_replace($quote_search_content,$quote_replace_content,$_POST['textarea_content']);
60 $category = fixquotes($category);
61 $subcategory = fixquotes($subcategory);
62 $item = fixquotes($item);
63 $content = fixquotes($content);
65 if ($_POST['hidden_category']) {$preselect_category = $_POST['hidden_category'];}
66 if ($_POST['hidden_subcategory']) {$preselect_subcategory = $_POST['hidden_subcategory'];}
67 if ($_POST['hidden_item']) {$preselect_item = $_POST['hidden_item'];}
68 //handle changes to database
69 if ($_POST['hidden_mode'] == 'add') {
70 if ($_POST['hidden_selection'] == 'change_category') {
71 $preselect_category_override = $_POST['change_category'];
72 $query = "INSERT INTO form_CAMOS_category (category) values ('";
73 $query .= $category."')";
76 else if ($_POST['hidden_selection'] == 'change_subcategory') {
77 $preselect_subcategory_override = $_POST['change_subcategory'];
78 $category_id = $_POST['hidden_category'];
79 if ($category_id >= 0 ) {
80 $query = "INSERT INTO form_CAMOS_subcategory (subcategory, category_id) values ('";
81 $query .= $subcategory."', '".$category_id."')";
85 else if ($_POST['hidden_selection'] == 'change_item') {
86 $preselect_item_override = $_POST['change_item'];
87 $category_id = $_POST['hidden_category'];
88 $subcategory_id = $_POST['hidden_subcategory'];
89 if (($category_id >= 0 ) && ($subcategory_id >=0)) {
90 $query = "INSERT INTO form_CAMOS_item (item, content, subcategory_id) values ('";
91 $query .= $item."', '".$content."', '".$subcategory_id."')";
96 else if ($_POST['hidden_selection'] == 'change_content') {
97 $item_id = $_POST['hidden_item'];
99 $query = "UPDATE form_CAMOS_item set content = '".$content."' where id = ".$item_id;
104 else if ($_POST['hidden_mode'] == 'delete') {
105 if ($_POST['hidden_selection'] == 'change_category') {
106 $to_delete_id = $_POST['hidden_category'];
107 $to_delete_from_table = 'form_CAMOS_category';
108 $to_delete_from_subtable = 'form_CAMOS_subcategory';
109 $tablename = 'category';
110 $subtablename = 'subcategory';
112 else if ($_POST['hidden_selection'] == 'change_subcategory') {
113 $to_delete_id = $_POST['hidden_subcategory'];
114 $to_delete_from_table = 'form_CAMOS_subcategory';
115 $to_delete_from_subtable = 'form_CAMOS_item';
116 $tablename = 'subcategory';
117 $subtablename = 'item';
119 else if ($_POST['hidden_selection'] == 'change_item') {
120 $to_delete_id = $_POST['hidden_item'];
121 $to_delete_from_table = 'form_CAMOS_item';
122 $to_delete_from_subtable = '';
127 if ($subtablename == '') {
128 $query = "DELETE FROM ".$to_delete_from_table." WHERE id like '".$to_delete_id."'";
132 $query = "SELECT count(id) FROM ".$to_delete_from_subtable." WHERE ".$tablename."_id like '".$to_delete_id."'";
133 $statement = sqlStatement($query);
134 if ($result = sqlFetchArray($statement)) {
135 if ($result['count(id)'] == 0) {
136 $query = "DELETE FROM ".$to_delete_from_table." WHERE id like '".$to_delete_id."'";
140 $error = $subtablename." not empty!";
145 else if ($_POST['hidden_mode'] == 'alter') {
146 $newval = $_POST[$_POST['hidden_selection']];
147 if ($_POST['hidden_selection'] == 'change_category') {
148 $to_alter_id = $_POST['hidden_category'];
149 $to_alter_table = 'form_CAMOS_category';
150 $to_alter_column = 'category';
152 else if ($_POST['hidden_selection'] == 'change_subcategory') {
153 $to_alter_id = $_POST['hidden_subcategory'];
154 $to_alter_table = 'form_CAMOS_subcategory';
155 $to_alter_column = 'subcategory';
157 else if ($_POST['hidden_selection'] == 'change_item') {
158 $to_alter_id = $_POST['hidden_item'];
159 $to_alter_table = 'form_CAMOS_item';
160 $to_alter_column = 'item';
162 $query = "UPDATE ".$to_alter_table." set ".$to_alter_column." = '".$newval."' where id = ".$to_alter_id;
165 // end handle changes to database
167 //preselect column items
168 //either a database change has been made, so the user should be made to feel that they never left the same CAMOS screen
169 //or, CAMOS has been started freshly, therefore the last entry of the current patient should be selected.
170 $preselect_mode = '';
171 if ($preselect_category == '' && !$out_of_encounter) {
172 $preselect_mode = 'by name';
173 //at this point, if this variable has not been set, CAMOS must have been start over
174 //so let's get the most recent values from form_CAMOS for this patient's pid
175 $query = "SELECT category, subcategory, item FROM form_CAMOS WHERE id =(SELECT max(id) from form_CAMOS WHERE pid=".$_SESSION['pid'].")";
176 $statement = sqlStatement($query);
177 if ($result = sqlFetchArray($statement)) {
178 $preselect_category = $result['category'];
179 $preselect_subcategory = $result['subcategory'];
180 $preselect_item = $result['item'];
182 else {$preselect_mode = '';}
185 $preselect_mode = 'by number';
190 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
192 <script language
="javascript" type
="text/javascript">
194 var array1
= new Array();
195 var array2
= new Array();
196 var array3
= new Array();
198 var preselect_off
= false;
199 var content_change_flag
= false;
200 var lock_override_flag
= false;
201 var switchbox_status
= 'main';
202 var clone_mode
= false;
205 if (substr($_POST['hidden_mode'],0,5) == 'clone') {
206 echo "clone_mode = true;\n";
212 f3
= document
.CAMOS
.textarea_content
.value
;
213 document
.CAMOS
.textarea_multibox
.value
=
214 document
.CAMOS
.textarea_multibox
.value +
"/*camos::" +
215 f2
.select_category
.options
[f2
.select_category
.selectedIndex
].text +
217 f2
.select_subcategory
.options
[f2
.select_subcategory
.selectedIndex
].text +
219 f2
.select_item
.options
[f2
.select_item
.selectedIndex
].text +
223 function switchbox() {
224 var mainbox
= document
.getElementById('mainbox');
225 var multibox
= document
.getElementById('multibox');
226 if (switchbox_status
== 'main') {
227 switchbox_status
= 'multi';
228 mainbox
.style
.display
= 'none';
229 multibox
.style
.display
= 'block';
230 document
.CAMOS
.switch_box
.value
= 'hide multibox';
233 switchbox_status
= 'main';
234 multibox
.style
.display
= 'none';
235 mainbox
.style
.display
= 'block';
236 document
.CAMOS
.switch_box
.value
= 'show multibox';
239 //deal with locking of content = prevent accidental overwrite
241 function trimString (str
) {
242 str
= this
!= window? this
: str
;
243 return str
.replace(/^\s+
/g
, '').replace(/\s+$
/g
, '');
245 function isLocked() {
247 if (lock_override_flag
) {
248 lock_override_flag
= false;
251 return /\
/\
*\s
*lock\s
*\
:\
:\s
*\
*\
//.test(f2.textarea_content.value);
253 function lock_content() {
255 if ((trimString(f2
.textarea_content
.value
) != "") && (!isLocked())) {
256 f2
.textarea_content
.value
= f2
.textarea_content
.value +
"\n\n" +
"/*lock::*/";
257 lock_override_flag
= true;
258 js_button('add','change_content');
261 function allSelected() {
262 var f2
= document
.CAMOS
;
263 if ( (f2
.select_category
.selectedIndex
< 0) ||
(f2
.select_subcategory
.selectedIndex
< 0) ||
(f2
.select_item
.selectedIndex
< 0) ) {
264 return false; //one of the columns is not selected
267 return true; //all columns have a selection
271 function content_focus() {
272 if (content_change_flag
== false) {
273 if (!allSelected()) {
274 alert("If you add text to the 'content' box without a selection in each column (category, subcategory, item), you will likely lose your work.")
278 content_change_flag
= true;
280 function content_blur() {
281 if (content_change_flag
== true) {
282 content_change_flag
= false;
286 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
289 $query = "SELECT code_text, code FROM billing WHERE encounter=".$_SESSION['encounter'].
290 " AND pid=".$_SESSION['pid']." AND code_type like 'ICD9' AND activity=1";
291 $statement = sqlStatement($query);
292 if ($result = sqlFetchArray($statement)) {
294 echo "icd9_list = \"\\n\\n\\\n";
295 echo $result['code']." ".$result['code_text']."\\n\\\n";
297 while ($result = sqlFetchArray($statement)) {
298 echo $result['code']." ".$result['code_text']."\\n\\\n";
300 if ($icd9_flag) {echo "\";\n";}
303 $query = "SELECT id, category FROM form_CAMOS_category ORDER BY category";
304 $statement = sqlStatement($query);
306 while ($result = sqlFetchArray($statement)) {
307 echo "array1[".$i."] = new Array('".$result['category']."','".$result['id']."', new Array());\n";
311 $query = "SELECT id, subcategory, category_id FROM form_CAMOS_subcategory ORDER BY subcategory";
312 $statement = sqlStatement($query);
313 while ($result = sqlFetchArray($statement)) {
314 echo "array2[".$i."] = new Array('".$result['subcategory']."', '".$result['category_id']."', '".$result['id']."', new Array());\n";
318 $query = "SELECT id, item, content, subcategory_id FROM form_CAMOS_item ORDER BY item";
319 $statement = sqlStatement($query);
320 while ($result = sqlFetchArray($statement)) {
321 echo "array3[".$i."] = new Array('".$result['item']."', '".fixquotes(str_replace($quote_search_content,$quote_replace_content,strip_tags($result['content'],"<b>,<i>")))."', '".$result['subcategory_id'].
322 "','".$result['id']."');\n";
327 function append_icd9() {
328 var f2
= document
.CAMOS
;
329 f2
.textarea_content
.value
= f2
.textarea_content
.value + icd9_list
;
332 function select_word(mode
, mystring
, myselect
) { //take a string and select it in a select box if present
333 if (preselect_off
) return 0;
334 for (var i
=0;i
<myselect
.length
;i++
) {
336 if (mode
== 'by name') {
337 match
= myselect
.options
[i
].text
;
339 else if (mode
== 'by number') {
340 match
= myselect
.options
[i
].value
;
343 if (match
== mystring
) {
344 myselect
.selectedIndex
= i
;
350 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
351 //cloning - similar process to preselect set to first time starting CAMOS
353 $clone_category = '';
354 $clone_subcategory = '';
359 $clone_data_array = array();
360 if (substr($_POST['hidden_mode'],0,5) == 'clone') {
361 $clone_category = $_POST['category'];
362 $query = "SELECT subcategory, item, content FROM form_CAMOS WHERE category like '".$clone_category."' and pid=".$_SESSION['pid']." order by id";
363 // if ($_POST['hidden_mode'] == 'clone last visit') {
364 // $query = "SELECT category, subcategory, item, content FROM form_CAMOS WHERE date(date) like (SELECT
365 // date(MAX(date)) FROM form_CAMOS where date(date) < date(now()) and pid=".$_SESSION['pid'].") and pid=".$_SESSION['pid']." order by id";
368 if ($_POST['hidden_mode'] == 'clone last visit') {
369 $tmp = sqlQuery("SELECT max(encounter) AS max FROM forms WHERE " .
370 "form_name LIKE 'CAMOS%' AND encounter < '" . $_SESSION['encounter'] .
371 "' AND pid = '" . $_SESSION['pid'] . "'");
372 $last_encounter_id = $tmp['max'] ?
$tmp['max'] : 0;
373 $query = "SELECT category, subcategory, item, content FROM form_CAMOS " .
374 "left join forms on (form_CAMOS.id = forms.form_id) where " .
375 "forms.encounter = '$last_encounter_id' and form_CAMOS.pid=" .
376 $_SESSION['pid']." order by form_CAMOS.id";
378 $statement = sqlStatement($query);
379 while ($result = sqlFetchArray($statement)) {
380 if (preg_match('/^[\s\r\n]*$/',$result['content']) == 0) {
381 if ($_POST['hidden_mode'] == 'clone last visit') {
382 $clone_category = $result['category'];
384 $clone_subcategory = $result['subcategory'];
385 $clone_item = $result['item'];
386 $clone_content = $result['content'];
387 $clone_data1 = "/* camos :: $clone_category :: $clone_subcategory :: $clone_item :: ";
388 $clone_data2 = "$clone_content */";
389 $clone_data3 = $clone_data1 . $clone_data2;
390 if ($_POST['hidden_mode'] == 'clone last visit') {
391 $clone_data1 = $clone_data3; //make key include whole entry so all 'last visit' data gets recorded and shown
393 $clone_data_array[$clone_data1] = $clone_data3;
395 if ($_POST['hidden_mode'] == 'clone last visit') {
396 // $tmp = sqlQuery("SELECT max(encounter) as max FROM billing where encounter < " .
397 // $_SESSION['encounter'] . " and pid= " . $_SESSION['pid']);
398 // $last_encounter_id = $tmp['max'] ? $tmp['max'] : 0;
399 $query = "SELECT code_type, code, code_text, modifier, units, fee FROM billing WHERE encounter = '$last_encounter_id' and pid=".$_SESSION['pid']." and activity=1 order by id";}
400 $statement = sqlStatement($query);
401 while ($result = sqlFetchArray($statement)) {
402 $clone_code_type = $result['code_type'];
403 $clone_code = $result['code'];
404 $clone_code_text = $result['code_text'];
405 $clone_modifier = $result['modifier'];
406 $clone_units = $result['units'];
407 $clone_fee = $result['fee'];
408 $clone_billing_data = "/* billing :: $clone_code_type :: $clone_code :: $clone_code_text :: $clone_modifier :: $clone_units :: $clone_fee */";
409 $clone_data_array[$clone_billing_data] = $clone_billing_data;
413 //end preselect column items
414 } //end of clone stuff
417 var f2
= document
.CAMOS
;
421 if (substr($_POST['hidden_mode'],0,5) == 'clone') {
422 foreach($clone_data_array as $key => $val) {
423 echo "f2.textarea_multibox.value += \"".fixquotes(str_replace($quote_search,$quote_replace,$val))."\\n\"\n";
425 echo "switchbox();\n";
430 for (i1
=0;i1
<array1
.length
;i1++
) {
431 f2
.select_category
.options
[f2
.select_category
.length
] = new Option(array1
[i1
][0], array1
[i1
][1]);
434 $temp_preselect_mode = $preselect_mode;
435 if ($preselect_category_override != '') {
436 $temp_preselect_mode = "by name";
437 $preselect_category = $preselect_category_override;
440 if (select_word('<? echo $temp_preselect_mode."', '".$preselect_category; ?>' ,f2
.select_category
)) {
445 function click_category() {
446 var f2
= document
.CAMOS
;
447 var category_index
= f2
.select_category
.selectedIndex
;
448 if ((category_index
< 0) ||
(category_index
> f2
.select_category
.length
-1)) {return 0;}
449 var sel
= f2
.select_category
.options
[f2
.select_category
.selectedIndex
].value
;
450 for (var i1
=0;i1
<array1
.length
;i1++
) {
451 if (array1
[i1
][1] == sel
) {
452 f2
.select_subcategory
.length
= 0;
453 f2
.select_item
.length
= 0;
454 f2
.textarea_content
.value
= '';
455 for (var i2
=0;i2
<array2
.length
;i2++
) {
456 if (array1
[i1
][1] == array2
[i2
][1]) {
457 f2
.select_subcategory
.options
[f2
.select_subcategory
.length
] = new Option(array2
[i2
][0], array2
[i2
][2]);
463 $temp_preselect_mode = $preselect_mode;
464 if ($preselect_subcategory_override != '') {
465 $temp_preselect_mode = "by name";
466 $preselect_subcategory = $preselect_subcategory_override;
469 if (select_word('<? echo $temp_preselect_mode."', '".$preselect_subcategory; ?>' ,f2
.select_subcategory
)) {
473 function click_subcategory() {
474 var f2
= document
.CAMOS
;
475 var subcategory_index
= f2
.select_subcategory
.selectedIndex
;
476 if ((subcategory_index
< 0) ||
(subcategory_index
> f2
.select_subcategory
.length
-1)) {return 0;}
477 var sel
= f2
.select_subcategory
.options
[f2
.select_subcategory
.selectedIndex
].value
;
478 for (var i1
=0;i1
<array2
.length
;i1++
) {
479 if (array2
[i1
][2] == sel
) {
480 f2
.select_item
.length
= 0;
481 f2
.textarea_content
.value
= '';
482 for (var i2
=0;i2
<array3
.length
;i2++
) {
483 if (array2
[i1
][2] == array3
[i2
][2]) {
484 f2
.select_item
.options
[f2
.select_item
.length
] = new Option(array3
[i2
][0], array3
[i2
][3]);
490 $temp_preselect_mode = $preselect_mode;
491 if ($preselect_item_override != '') {
492 $temp_preselect_mode = "by name";
493 $preselect_item = $preselect_item_override;
496 if (select_word('<? echo $temp_preselect_mode."', '".$preselect_item; ?>' ,f2
.select_item
)) {
498 preselect_off
= true;
501 function click_item() {
502 var f2
= document
.CAMOS
;
503 var item_index
= f2
.select_item
.selectedIndex
;
504 if ((item_index
< 0) ||
(item_index
> f2
.select_item
.length
-1)) {return 0;}
505 var sel
= f2
.select_item
.options
[item_index
].value
;
506 for (var i1
=0;i1
<array3
.length
;i1++
) {
507 if (array3
[i1
][3] == sel
) {
508 f2
.textarea_content
.value
= array3
[i1
][1].replace(/\\/g
,'');
513 function selectContains(myselect
, str
) {
514 for (var i
=0;i
<myselect
.length
;i++
) {
515 if (myselect
.options
[i
].text
== trimString(str
)) {return true;}
519 function js_button(mode
,selection
) {
520 var f2
= document
.CAMOS
;
522 if ( (mode
== 'add') && (selection
== 'change_content') && (isLocked()) ) {
523 alert("You have attempted to alter content which is locked.\nRemove the lock if you want to do this.\nTo unlock, remove the line, '/*lock::*/'");
528 //check for blank or duplicate submissions
529 if ( (mode
== 'add') ||
(mode
== 'alter') ) {
530 if (selection
== 'change_category') {
531 if (trimString(f2
.change_category
.value
) == "") {
532 alert("You cannot add a blank value for a category!");
535 if (selectContains(f2
.select_category
, trimString(f2
.change_category
.value
))) {
536 alert("There is already a category named "+f2
.change_category
.value+
".");
540 if (selection
== 'change_subcategory') {
541 if (trimString(f2
.change_subcategory
.value
) == "") {
542 alert("You cannot add a blank value for a subcategory!");
545 if (selectContains(f2
.select_subcategory
, trimString(f2
.change_subcategory
.value
))) {
546 alert("There is already a subcategory named "+f2
.change_subcategory
.value+
".");
550 if (selection
== 'change_item') {
551 if (trimString(f2
.change_item
.value
) == "") {
552 alert("You cannot add a blank value for an item!");
555 if (selectContains(f2
.select_item
, trimString(f2
.change_item
.value
))) {
556 alert("There is already an item named "+f2
.change_item
.value+
".");
561 //end of check for blank or duplicate submissions
563 if (mode
== 'delete') {
564 if (!confirm("Are you sure you want to delete this item from the database?")) {
568 var f2
= document
.CAMOS
;
569 var category_index
= f2
.select_category
.selectedIndex
;
571 if (category_index
< 0) {
572 if ((selection
== 'change_subcategory') ||
(selection
== 'change_item') ||
573 (selection
== 'change_content')) {
574 alert ('You have not selected a category!');
580 category
= f2
.select_category
.options
[category_index
].value
;
582 var subcategory_index
= f2
.select_subcategory
.selectedIndex
;
584 if (subcategory_index
< 0) {
585 if ((selection
== 'change_item') ||
(selection
== 'change_content')) {
586 alert ('You have not selected a subcategory!');
592 subcategory
= f2
.select_subcategory
.options
[subcategory_index
].value
;
594 var item_index
= f2
.select_item
.selectedIndex
;
596 if (item_index
< 0) {
597 if (selection
== 'change_content') {
598 alert ('You have not selected an item!');
604 item
= f2
.select_item
.options
[item_index
].value
;
606 //deal with clone buttons
607 if (mode
.substr(0,5) == 'clone') {
608 f2
.category
.value
= f2
.select_category
.options
[f2
.select_category
.selectedIndex
].text
;
609 f2
.hidden_mode
.value
= mode
;
610 f2
.hidden_selection
.value
= selection
;
611 f2
.hidden_category
.value
= category
;
612 f2
.hidden_subcategory
.value
= subcategory
;
613 f2
.hidden_item
.value
= item
;
614 f2
.action
= '<? print $GLOBALS['webroot
'] ?>/interface/patient_file/encounter/load_form.php?formname=CAMOS';
618 if (mode
== 'submit') {
619 f2
.category
.value
= f2
.select_category
.options
[f2
.select_category
.selectedIndex
].text
;
620 f2
.subcategory
.value
= f2
.select_subcategory
.options
[f2
.select_subcategory
.selectedIndex
].text
;
621 f2
.item
.value
= f2
.select_item
.options
[f2
.select_item
.selectedIndex
].text
;
622 if (selection
== 'submit_selection') {
623 f2
.content
.value
= (f2
.textarea_content
.value
).substring(f2
.textarea_content
.selectionStart
, f2
.textarea_content
.selectionEnd
);
625 else if (selection
== 'multibox') {f2
.content
.value
= f2
.textarea_multibox
.value
;}
626 else {f2
.content
.value
= f2
.textarea_content
.value
;}
627 f2
.action
= '<?echo $rootdir;?>/forms/CAMOS/save.php?mode=new';
632 function selectItem () {
634 f2
.item
.value
=f2
.select_item
.options
[f2
.select_item
.selectedIndex
].text
;
635 f2
.content
.value
= f2
.textarea_content
.value
;
640 <body
<?
echo $top_bg_line;?
> topmargin
=0 rightmargin
=0 leftmargin
=2 bottommargin
=0 marginwidth
=2 marginheight
=0 onload
="init()">
641 <form method
=post action
="<?echo $rootdir;?>/forms/CAMOS/save.php?mode=new" name
="CAMOS">
642 <input type
=button name
='switch_box' value
='show multibox' onClick
="switchbox()">
643 <input type
=button name
='add_multibox' value
='add to multibox' onClick
="addbox()">
644 <input type
=button name
='submit_multibox' value
='submit multibox' onClick
="js_button('submit','multibox')">
645 <input type
=button name
=clone value
=clone onClick
="js_button('clone', 'clone')">
646 <input type
=button name
=clone_visit value
='clone last visit' onClick
="js_button('clone last visit', 'clone last visit')">
648 echo "<a href='".$GLOBALS['webroot'] . "/interface/patient_file/encounter/$returnurl' onclick='top.restoreSession()'>[".xl('do not save')."]</a>";
650 <div id
=mainbox style
="display:block">
653 echo "<h1> error: ".$error."</h1>\n";
659 <?php
xl('Category',e
)?
>
662 <?php
xl('Subcategory',e
)?
>
668 <?php
xl('Content',e
)?
>
674 <select name
=select_category size
=<?
echo $select_size ?
> onchange
="click_category()"></select
><br
>
676 if (myAuth() == 1) {//root user only can see administration option
678 <input type
=text name
=change_category
><br
>
679 <input type
=button name
=add1 value
=add onClick
="js_button('add','change_category')">
680 <input type
=button name
=alter1 value
=alter onClick
="js_button('alter','change_category')">
681 <input type
=button name
=del1 value
=del onClick
="js_button('delete','change_category')"><br
>
687 <select name
=select_subcategory size
=<?
echo $select_size ?
> onchange
="click_subcategory()"></select
><br
>
689 if (myAuth() == 1) {//root user only can see administration option
691 <input type
=text name
=change_subcategory
><br
>
692 <input type
=button name
=add2 value
=add onClick
="js_button('add','change_subcategory')">
693 <input type
=button name
=alter1 value
=alter onClick
="js_button('alter','change_subcategory')">
694 <input type
=button name
=del2 value
=del onClick
="js_button('delete','change_subcategory')"><br
>
700 <select name
=select_item size
=<?
echo $select_size ?
> onchange
="click_item()"></select
><br
>
702 if (myAuth() == 1) {//root user only can see administration option
704 <input type
=text name
=change_item
><br
>
705 <input type
=button name
=add3 value
=add onClick
="js_button('add','change_item')">
706 <input type
=button name
=alter1 value
=alter onClick
="js_button('alter','change_item')">
707 <input type
=button name
=del3 value
=del onClick
="js_button('delete','change_item')"><br
>
713 <textarea name
=textarea_content cols
=<?
echo $textarea_cols ?
> rows
=<?
echo $textarea_rows ?
> onFocus
="content_focus()" onBlur
="content_blur()"></textarea
><br
>
715 if (myAuth() == 1) {//root user only can see administration option
717 <input type
=button name
=add4 value
=add onClick
="js_button('add','change_content')">
718 <input type
=button name
=lock value
=lock onClick
="lock_content()">
720 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
722 <input type
=button name
=icd9 value
=icd9 onClick
="append_icd9()">
733 <input type
=hidden name
=hidden_mode
>
734 <input type
=hidden name
=hidden_selection
>
735 <input type
=hidden name
=hidden_category
>
736 <input type
=hidden name
=hidden_subcategory
>
737 <input type
=hidden name
=hidden_item
>
739 <input type
=hidden name
=category
>
740 <input type
=hidden name
=subcategory
>
741 <input type
=hidden name
=item
>
742 <input type
=hidden name
=content
>
744 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
746 <input type
=button name
='submit form' value
='submit all content' onClick
="js_button('submit','submit')">
747 <input type
=button name
='submit form' value
='submit selected content' onClick
="js_button('submit','submit_selection')">
752 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
753 echo "<a href='".$GLOBALS['webroot'] . "/interface/patient_file/encounter/$returnurl' onclick='top.restoreSession()'>[".xl('do not save')."]</a>";
754 echo "<a href='".$GLOBALS['webroot'] . "/interface/forms/CAMOS/help.html' target='new'> | [".xl('help')."]</a>";
755 // echo $previous_encounter_data; //probably don't need anymore now that we have clone last visit
759 <div id
=multibox style
="display:none">
760 <textarea name
=textarea_multibox cols
=<?
echo $multibox_cols ?
> rows
=<?
echo $multibox_rows ?
> onFocus
="content_focus()" onBlur
="content_blur()"></textarea
>
768 function fixquotes ($string) {
769 $string = preg_replace('/([\\\])*\'/', "\\\'", $string);
770 $string = preg_replace('/([\\\])*\"/', "\\\"", $string);