final mu2 changes by Visolve for certification, take 2.
[openemr.git] / interface / patient_file / encounter / forms.php
blob44bb544385bd7038caa267d8613373348cf70a5c
1 <?php
2 use ESign\Api;
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 require_once("../../globals.php");
9 require_once("$srcdir/forms.inc");
10 require_once("$srcdir/formdata.inc.php");
11 require_once("$srcdir/calendar.inc");
12 require_once("$srcdir/acl.inc");
13 require_once("$srcdir/formatting.inc.php");
14 require_once("$srcdir/patient.inc");
15 require_once("$srcdir/amc.php");
16 require_once $GLOBALS['srcdir'].'/ESign/Api.php';
17 require_once("$srcdir/../controllers/C_Document.class.php");
18 require_once("forms_review_header.php");
20 <html>
22 <head>
23 <?php html_header_show();?>
24 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
25 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox-1.3.4/jquery.fancybox-1.3.4.css" media="screen" />
26 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
28 <!-- supporting javascript code -->
29 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script>
30 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
31 <script type="text/javascript" src="../../../library/textformat.js"></script>
32 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
33 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
34 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
35 <script type="text/javascript" src="../../../library/js/common.js"></script>
36 <script type="text/javascript" src="../../../library/js/fancybox-1.3.4/jquery.fancybox-1.3.4.js"></script>
37 <script src="<?php echo $GLOBALS['webroot'] ?>/library/ESign/js/jquery.esign.js"></script>
38 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/ESign/css/esign.css" />
40 <?php
41 $esignApi = new Api();
44 <?php // include generic js support for graphing ?>
45 <script type="text/javascript" src="<?php echo $GLOBALS['web_root']?>/library/openflashchart/js/json/json2.js"></script>
46 <script type="text/javascript" src="<?php echo $GLOBALS['web_root']?>/library/openflashchart/js/swfobject.js"></script>
48 <?php // if the track_anything form exists, then include the styling and js functions for graphing
49 if (file_exists(dirname(__FILE__) . "/../../forms/track_anything/style.css")) { ?>
50 <script type="text/javascript" src="<?php echo $GLOBALS['web_root']?>/interface/forms/track_anything/report.js"></script>
51 <link rel="stylesheet" href="<?php echo $GLOBALS['web_root']?>/interface/forms/track_anything/style.css" type="text/css">
52 <?php } ?>
54 <?php
55 // If the user requested attachment of any orphaned procedure orders, do it.
56 if (!empty($_GET['attachid'])) {
57 $attachid = explode(',', $_GET['attachid']);
58 foreach ($attachid as $aid) {
59 $aid = intval($aid);
60 if (!$aid) continue;
61 $tmp = sqlQuery("SELECT COUNT(*) AS count FROM procedure_order WHERE " .
62 "procedure_order_id = ? AND patient_id = ? AND encounter_id = 0 AND activity = 1",
63 array($aid, $pid));
64 if (!empty($tmp['count'])) {
65 sqlStatement("UPDATE procedure_order SET encounter_id = ? WHERE " .
66 "procedure_order_id = ? AND patient_id = ? AND encounter_id = 0 AND activity = 1",
67 array($encounter, $aid, $pid));
68 addForm($encounter, "Procedure Order", $aid, "procedure_order", $pid, $userauthorized);
74 <script type="text/javascript">
75 $.noConflict();
76 jQuery(document).ready( function($) {
77 var formConfig = <?php echo $esignApi->formConfigToJson(); ?>;
78 $(".esign-button-form").esign(
79 formConfig,
81 afterFormSuccess : function( response ) {
82 if ( response.locked ) {
83 var editButtonId = "form-edit-button-"+response.formDir+"-"+response.formId;
84 $("#"+editButtonId).replaceWith( response.editButtonHtml );
87 var logId = "esign-signature-log-"+response.formDir+"-"+response.formId;
88 $.post( formConfig.logViewAction, response, function( html ) {
89 $("#"+logId).replaceWith( html );
90 });
95 var encounterConfig = <?php echo $esignApi->encounterConfigToJson(); ?>;
96 $(".esign-button-encounter").esign(
97 encounterConfig,
99 afterFormSuccess : function( response ) {
100 // If the response indicates a locked encounter, replace all
101 // form edit buttons with a "disabled" button, and "disable" left
102 // nav visit form links
103 if ( response.locked ) {
104 // Lock the form edit buttons
105 $(".form-edit-button").replaceWith( response.editButtonHtml );
106 // Disable the new-form capabilities in left nav
107 top.window.parent.left_nav.syncRadios();
108 // Disable the new-form capabilities in top nav of the encounter
109 $(".encounter-form-category-li").remove();
112 var logId = "esign-signature-log-encounter-"+response.encounterId;
113 $.post( encounterConfig.logViewAction, response, function( html ) {
114 $("#"+logId).replaceWith( html );
120 $(".onerow").mouseover(function() { $(this).toggleClass("highlight"); });
121 $(".onerow").mouseout(function() { $(this).toggleClass("highlight"); });
122 $(".onerow").click(function() { GotoForm(this); });
124 $("#prov_edu_res").click(function() {
125 if ( $('#prov_edu_res').attr('checked') ) {
126 var mode = "add";
128 else {
129 var mode = "remove";
131 top.restoreSession();
132 $.post( "../../../library/ajax/amc_misc_data.php",
133 { amc_id: "patient_edu_amc",
134 complete: true,
135 mode: mode,
136 patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
137 object_category: "form_encounter",
138 object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
143 $("#provide_sum_pat_flag").click(function() {
144 if ( $('#provide_sum_pat_flag').attr('checked') ) {
145 var mode = "add";
147 else {
148 var mode = "remove";
150 top.restoreSession();
151 $.post( "../../../library/ajax/amc_misc_data.php",
152 { amc_id: "provide_sum_pat_amc",
153 complete: true,
154 mode: mode,
155 patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
156 object_category: "form_encounter",
157 object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
162 $("#trans_trand_care").click(function() {
163 if ( $('#trans_trand_care').attr('checked') ) {
164 var mode = "add";
165 // Enable the reconciliation checkbox
166 $("#med_reconc_perf").removeAttr("disabled");
167 $("#soc_provided").removeAttr("disabled");
169 else {
170 var mode = "remove";
171 //Disable the reconciliation checkbox (also uncheck it if applicable)
172 $("#med_reconc_perf").attr("disabled", true);
173 $("#med_reconc_perf").removeAttr("checked");
174 $("#soc_provided").attr("disabled",true);
175 $("#soc_provided").removeAttr("checked");
177 top.restoreSession();
178 $.post( "../../../library/ajax/amc_misc_data.php",
179 { amc_id: "med_reconc_amc",
180 complete: false,
181 mode: mode,
182 patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
183 object_category: "form_encounter",
184 object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
189 $("#med_reconc_perf").click(function() {
190 if ( $('#med_reconc_perf').attr('checked') ) {
191 var mode = "complete";
193 else {
194 var mode = "uncomplete";
196 top.restoreSession();
197 $.post( "../../../library/ajax/amc_misc_data.php",
198 { amc_id: "med_reconc_amc",
199 complete: true,
200 mode: mode,
201 patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
202 object_category: "form_encounter",
203 object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
207 $("#soc_provided").click(function(){
208 if($('#soc_provided').attr('checked')){
209 var mode = "soc_provided";
211 else{
212 var mode = "no_soc_provided";
214 top.restoreSession();
215 $.post( "../../../library/ajax/amc_misc_data.php",
216 { amc_id: "med_reconc_amc",
217 complete: true,
218 mode: mode,
219 patient_id: <?php echo htmlspecialchars($pid,ENT_NOQUOTES); ?>,
220 object_category: "form_encounter",
221 object_id: <?php echo htmlspecialchars($encounter,ENT_NOQUOTES); ?>
226 // $(".deleteme").click(function(evt) { deleteme(); evt.stopPropogation(); });
228 var GotoForm = function(obj) {
229 var parts = $(obj).attr("id").split("~");
230 top.restoreSession();
231 parent.location.href = "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts[0]+"&id="+parts[1];
234 <?php
235 // If the user was not just asked about orphaned orders, build javascript for that.
236 if (!isset($_GET['attachid'])) {
237 $ares = sqlStatement("SELECT procedure_order_id, date_ordered " .
238 "FROM procedure_order WHERE " .
239 "patient_id = ? AND encounter_id = 0 AND activity = 1 " .
240 "ORDER BY procedure_order_id",
241 array($pid));
242 echo " // Ask about attaching orphaned orders to this encounter.\n";
243 echo " var attachid = '';\n";
244 while ($arow = sqlFetchArray($ares)) {
245 $orderid = $arow['procedure_order_id'];
246 $orderdate = $arow['date_ordered'];
247 echo " if (confirm('" . xls('There is a lab order') . " $orderid " .
248 xls('dated') . " $orderdate " .
249 xls('for this patient not yet assigned to any encounter.') . " " .
250 xls('Assign it to this one?') . "')) attachid += '$orderid,';\n";
252 echo " if (attachid) location.href = 'forms.php?attachid=' + attachid;\n";
258 // Process click on Delete link.
259 function deleteme() {
260 dlgopen('../deleter.php?encounterid=<?php echo $encounter; ?>', '_blank', 500, 450);
261 return false;
264 // Called by the deleter.php window on a successful delete.
265 function imdeleted(EncounterId) {
266 top.window.parent.left_nav.removeOptionSelected(EncounterId);
267 top.window.parent.left_nav.clearEncounter();
270 </script>
272 <script language="javascript">
273 function expandcollapse(atr){
274 if(atr == "expand") {
275 for(i=1;i<15;i++){
276 var mydivid="divid_"+i;var myspanid="spanid_"+i;
277 var ele = document.getElementById(mydivid); var text = document.getElementById(myspanid);
278 if (typeof(ele) != 'undefined' && ele != null)
279 ele.style.display = "block";
280 if (typeof(text) != 'undefined' && text != null)
281 text.innerHTML = "<?php xl('Collapse','e'); ?>";
284 else {
285 for(i=1;i<15;i++){
286 var mydivid="divid_"+i;var myspanid="spanid_"+i;
287 var ele = document.getElementById(mydivid); var text = document.getElementById(myspanid);
288 if (typeof(ele) != 'undefined' && ele != null)
289 ele.style.display = "none";
290 if (typeof(text) != 'undefined' && text != null)
291 text.innerHTML = "<?php xl('Expand','e'); ?>";
297 function divtoggle(spanid, divid) {
298 var ele = document.getElementById(divid);
299 var text = document.getElementById(spanid);
300 if(ele.style.display == "block") {
301 ele.style.display = "none";
302 text.innerHTML = "<?php xl('Expand','e'); ?>";
304 else {
305 ele.style.display = "block";
306 text.innerHTML = "<?php xl('Collapse','e'); ?>";
309 </script>
311 <style type="text/css">
312 div.tab {
313 min-height: 50px;
314 padding:8px;
317 div.form_header_controls {
318 float:left;margin-bottom:2px;
321 div.form_header {
322 float:left;
323 margin-left:6px;
326 .encounter-summary-container {
327 float:left;
328 width:100%;
331 .encounter-summary-column {
332 width: 33.3%;
333 float:left;
334 display:inline;
335 margin-top:10px;
337 </style>
339 <?php
340 $hide=1;
341 require_once("$incdir/patient_file/encounter/new_form.php");
344 <div id="encounter_forms">
346 <?php
347 $dateres = getEncounterDateByEncounter($encounter);
348 $encounter_date = date("Y-m-d",strtotime($dateres["date"]));
349 $providerIDres = getProviderIdOfEncounter($encounter);
350 $providerNameRes = getProviderName($providerIDres);
353 <div class='encounter-summary-container'>
354 <div class='encounter-summary-column'>
355 <div>
356 <span class="title"><?php echo oeFormatShortDate($encounter_date) . " " . xl("Encounter"); ?> </span>
357 <?php
358 $auth_notes_a = acl_check('encounters', 'notes_a');
359 $auth_notes = acl_check('encounters', 'notes');
360 $auth_relaxed = acl_check('encounters', 'relaxed');
362 if (is_numeric($pid)) {
363 // Check for no access to the patient's squad.
364 $result = getPatientData($pid, "fname,lname,squad");
365 echo htmlspecialchars( xl('for','',' ',' ') . $result['fname'] . " " . $result['lname'] );
366 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
367 $auth_notes_a = $auth_notes = $auth_relaxed = 0;
369 // Check for no access to the encounter's sensitivity level.
370 $result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " .
371 "pid = '$pid' AND encounter = '$encounter' LIMIT 1");
372 if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
373 $auth_notes_a = $auth_notes = $auth_relaxed = 0;
377 </div>
378 <div style='margin-top:8px;'>
379 <?php
380 // ESign for entire encounter
381 $esign = $esignApi->createEncounterESign( $encounter );
382 if ( $esign->isButtonViewable() ) {
383 echo $esign->buttonHtml();
386 <?php if (acl_check('admin', 'super')) { ?>
387 <a href='toggledivs(this.id,this.id);' class='css_button' onclick='return deleteme()'><span><?php echo xl('Delete') ?></span></a>
388 <?php } ?>
389 &nbsp;&nbsp;&nbsp;<a href="#" onClick='expandcollapse("expand");' style="font-size:80%;"><?php xl('Expand All','e'); ?></a>
390 &nbsp;&nbsp;&nbsp;<a style="font-size:80%;" href="#" onClick='expandcollapse("collapse");'><?php xl('Collapse All','e'); ?></a>
391 </div>
392 </div>
394 <div class='encounter-summary-column'>
395 <?php if ( $esign->isLogViewable() ) {
396 $esign->renderLog();
397 } ?>
398 </div>
400 <div class='encounter-summary-column'>
401 <?php if ($GLOBALS['enable_amc_prompting']) { ?>
402 <div style='float:right;margin-right:25px;border-style:solid;border-width:1px;'>
403 <div style='float:left;margin:5px 5px 5px 5px;'>
404 <table>
405 <tr>
406 <td>
407 <?php // Display the education resource checkbox (AMC prompting)
408 $itemAMC = amcCollect("patient_edu_amc", $pid, 'form_encounter', $encounter);
410 <?php if (!(empty($itemAMC))) { ?>
411 <input type="checkbox" id="prov_edu_res" checked>
412 <?php } else { ?>
413 <input type="checkbox" id="prov_edu_res">
414 <?php } ?>
415 </td>
416 <td>
417 <span class="text"><?php echo xl('Provided Education Resource(s)?') ?></span>
418 </td>
419 </tr>
420 <tr>
421 <td>
422 <?php // Display the Provided Clinical Summary checkbox (AMC prompting)
423 $itemAMC = amcCollect("provide_sum_pat_amc", $pid, 'form_encounter', $encounter);
425 <?php if (!(empty($itemAMC))) { ?>
426 <input type="checkbox" id="provide_sum_pat_flag" checked>
427 <?php } else { ?>
428 <input type="checkbox" id="provide_sum_pat_flag">
429 <?php } ?>
430 </td>
431 <td>
432 <span class="text"><?php echo xl('Provided Clinical Summary?') ?></span>
433 </td>
434 </tr>
435 <?php // Display the medication reconciliation checkboxes (AMC prompting)
436 $itemAMC = amcCollect("med_reconc_amc", $pid, 'form_encounter', $encounter);
438 <?php if (!(empty($itemAMC))) { ?>
439 <tr>
440 <td>
441 <input type="checkbox" id="trans_trand_care" checked>
442 </td>
443 <td>
444 <span class="text"><?php echo xl('Transition/Transfer of Care?') ?></span>
445 </td>
446 </tr>
447 </table>
448 <table style="margin-left:2em;">
449 <tr>
450 <td>
451 <?php if (!(empty($itemAMC['date_completed']))) { ?>
452 <input type="checkbox" id="med_reconc_perf" checked>
453 <?php } else { ?>
454 <input type="checkbox" id="med_reconc_perf">
455 <?php } ?>
456 </td>
457 <td>
458 <span class="text"><?php echo xl('Medication Reconciliation Performed?') ?></span>
459 </td>
460 </tr>
461 <tr>
462 <td>
463 <?php if (!(empty($itemAMC['soc_provided']))) { ?>
464 <input type="checkbox" id="soc_provided" checked>
465 <?php } else { ?>
466 <input type="checkbox" id="soc_provided">
467 <?php } ?>
468 </td>
469 <td>
470 <span class="text"><?php echo xl('Summary Of Care Provided ?') ?></span>
471 </td>
472 </tr>
473 </table>
474 <?php } else { ?>
475 <tr>
476 <td>
477 <input type="checkbox" id="trans_trand_care">
478 </td>
479 <td>
480 <span class="text"><?php echo xl('Transition/Transfer of Care?') ?></span>
481 </td>
482 </tr>
483 </table>
484 <table style="margin-left:2em;">
485 <tr>
486 <td>
487 <input type="checkbox" id="med_reconc_perf" DISABLED>
488 </td>
489 <td>
490 <span class="text"><?php echo xl('Medication Reconciliation Performed?') ?></span>
491 </td>
492 </tr>
493 <tr>
494 <td>
495 <input type="checkbox" id="soc_provided" DISABLED>
496 </td>
497 <td>
498 <span class="text"><?php echo xl('Summary of Care Provided?') ?></span>
499 </td>
500 </tr>
501 </table>
502 <?php } ?>
503 </div>
504 </div>
505 <?php } ?>
506 </div>
508 </div>
510 <!-- Get the documents tagged to this encounter and display the links and notes as the tooltip -->
511 <?php
512 $docs_list = getDocumentsByEncounter($pid,$_SESSION['encounter']);
513 if(count($docs_list) > 0 ) {
515 <div class='enc_docs'>
516 <span class="bold"><?php echo xlt("Document(s)"); ?>:</span>
517 <?php
518 $doc = new C_Document();
519 foreach ($docs_list as $doc_iter) {
520 $doc_url = $doc->_tpl_vars[CURRENT_ACTION]. "&view&patient_id=".attr($pid)."&document_id=" . attr($doc_iter[id]) . "&";
521 // Get notes for this document.
522 $queryString = "SELECT GROUP_CONCAT(note ORDER BY date DESC SEPARATOR '|') AS docNotes, GROUP_CONCAT(date ORDER BY date DESC SEPARATOR '|') AS docDates
523 FROM notes WHERE foreign_id = ? GROUP BY foreign_id";
524 $noteData = sqlQuery($queryString,array($doc_iter[id]));
525 $note = '';
526 if ( $noteData ) {
527 $notes = array();
528 $notes = explode("|",$noteData['docNotes']);
529 $dates = explode("|", $noteData['docDates']);
530 for ( $i = 0 ; $i < count($notes) ; $i++ )
531 $note .= oeFormatShortDate(date('Y-m-d', strtotime($dates[$i]))) . " : " . $notes[$i] . "\n";
534 <br>
535 <a href="<?php echo $doc_url;?>" style="font-size:small;" onsubmit="return top.restoreSession()"><?php echo oeFormatShortDate($doc_iter[docdate]) . ": " . text(basename($doc_iter[url]));?></a>
536 <?php if($note != '') {?>
537 <a href="javascript:void(0);" title="<?php echo attr($note);?>"><img src="../../../images/info.png"/></a>
538 <?php }?>
539 <?php } ?>
540 </div>
541 <?php } ?>
542 <br/>
544 <?php
545 if ($result = getFormByEncounter($pid, $encounter, "id, date, form_id, form_name, formdir, user, deleted")) {
546 echo "<table width='100%' id='partable'>";
547 $divnos=1;
548 foreach ($result as $iter) {
549 $formdir = $iter['formdir'];
551 // skip forms whose 'deleted' flag is set to 1
552 if ($iter['deleted'] == 1) continue;
554 // Skip forms that we are not authorized to see.
555 if (($auth_notes_a) ||
556 ($auth_notes && $iter['user'] == $_SESSION['authUser']) ||
557 ($auth_relaxed && ($formdir == 'sports_fitness' || $formdir == 'podiatry'))) ;
558 else continue;
560 // $form_info = getFormInfoById($iter['id']);
561 if (strtolower(substr($iter['form_name'],0,5)) == 'camos') {
562 //CAMOS generates links from report.php and these links should
563 //be clickable without causing view.php to come up unexpectedly.
564 //I feel that the JQuery code in this file leading to a click
565 //on the report.php content to bring up view.php steps on a
566 //form's autonomy to generate it's own html content in it's report
567 //but until any other form has a problem with this, I will just
568 //make an exception here for CAMOS and allow it to carry out this
569 //functionality for all other forms. --Mark
570 echo '<tr title="' . xl('Edit form') . '" '.
571 'id="'.$formdir.'~'.$iter['form_id'].'">';
572 } else {
573 echo '<tr title="' . xl('Edit form') . '" '.
574 'id="'.$formdir.'~'.$iter['form_id'].'" class="text onerow">';
576 $user = getNameFromUsername($iter['user']);
578 $form_name = ($formdir == 'newpatient') ? xl('Patient Encounter') : xl_form_title($iter['form_name']);
580 // Create the ESign instance for this form
581 $esign = $esignApi->createFormESign( $iter['id'], $formdir, $encounter );
582 echo "<tr>";
583 echo "<td style='border-bottom:1px solid'>";
584 // a link to edit the form
585 echo "<div class='form_header_controls'>";
587 // If the form is locked, it is no longer editable
588 if ( $esign->isLocked() ) {
589 echo "<a href=# class='css_button_small form-edit-button-locked' id='form-edit-button-".attr($formdir)."-".attr($iter['id'])."'><span>".xlt('Locked')."</span></a>";
590 } else {
591 echo "<a class='css_button_small form-edit-button' id='form-edit-button-".attr($formdir)."-".attr($iter['id'])."' target='".
592 "_parent" .
593 "' href='$rootdir/patient_file/encounter/view_form.php?" .
594 "formname=" . attr($formdir) . "&id=" . attr($iter['form_id']) .
595 "' onclick='top.restoreSession()'>";
596 echo "<span>" . xlt('Edit') . "</span></a>";
599 if ( $esign->isButtonViewable() ) {
600 echo $esign->buttonHtml();
603 if (acl_check('admin', 'super') ) {
604 if ( $formdir != 'newpatient') {
605 // a link to delete the form from the encounter
606 echo "<a target='_parent'" .
607 " href='$rootdir/patient_file/encounter/delete_form.php?" .
608 "formname=" . $formdir .
609 "&id=" . $iter['id'] .
610 "&encounter=". $encounter.
611 "&pid=".$pid.
612 "' class='css_button_small' title='" . xl('Delete this form') . "' onclick='top.restoreSession()'><span>" . xl('Delete') . "</span></a>";
613 } else {
614 ?><a href='javascript:;' class='css_button_small' style='color:gray'><span><?php xl('Delete','e'); ?></span></a><?php
618 echo "<div class='form_header'>";
620 // Figure out the correct author (encounter authors are the '$providerNameRes', while other
621 // form authors are the '$user['fname'] . " " . $user['lname']').
622 if ($formdir == 'newpatient') {
623 $form_author = $providerNameRes;
625 else {
626 $form_author = $user['fname'] . " " . $user['lname'];
628 echo "<a href='#' onclick='divtoggle(\"spanid_$divnos\",\"divid_$divnos\");' class='small' id='aid_$divnos'><b>$form_name</b> <span class='text'>by " . htmlspecialchars( $form_author ) . "</span> (<span id=spanid_$divnos class=\"indicator\">" . xl('Collapse') . "</span>)</a></div>";
630 echo "</td>\n";
631 echo "</tr>";
632 echo "<tr>";
633 echo "<td valign='top' class='formrow'><div class='tab' id='divid_$divnos' style='display:block'>";
635 // Use the form's report.php for display. Forms with names starting with LBF
636 // are list-based forms sharing a single collection of code.
638 if (substr($formdir,0,3) == 'LBF') {
639 include_once($GLOBALS['incdir'] . "/forms/LBF/report.php");
640 call_user_func("lbf_report", $pid, $encounter, 2, $iter['form_id'], $formdir);
642 else {
643 include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
644 call_user_func($formdir . "_report", $pid, $encounter, 2, $iter['form_id']);
647 if ( $esign->isLogViewable() ) {
648 $esign->renderLog();
651 echo "</div></td></tr>";
652 $divnos=$divnos+1;
654 echo "</table>";
658 </div> <!-- end large encounter_forms DIV -->
659 </body>
660 <?php require_once("forms_review_footer.php"); ?>
661 </html>