2 // Copyright (C) 2006, 2008 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This provides the left navigation frame when $GLOBALS['concurrent_layout']
10 // is true. Following are notes as to what else was changed for this feature:
12 // * interface/main/main_screen.php: the top-level frameset.
13 // * interface/main/finder/patient_select.php: loads stuff when a new patient
15 // * interface/patient_file/summary/demographics.php: this is the first frame
16 // loaded when a new patient is chosen, and in turn sets the current pid and
17 // then loads the initial bottom frame.
18 // * interface/patient_file/summary/demographics_full.php: added support for
19 // setting a new pid, needed for going to demographics from billing.
20 // * interface/patient_file/summary/demographics_save.php: redisplay
21 // demographics.php and not the frameset.
22 // * interface/patient_file/summary/summary_bottom.php: new frameset for the
23 // summary, prescriptions and notes for a selected patient, cloned from
24 // patient_summary.php.
25 // * interface/patient_file/encounter/encounter_bottom.php: new frameset for
26 // the selected encounter, mosting coding/billing stuff, cloned from
27 // patient_encounter.php. This will also self-load the superbill pages
29 // * interface/usergroup/user_info.php: removed Back link.
30 // * interface/usergroup/admin_frameset.php: new frameset for Admin pages,
31 // cloned from usergroup.php.
32 // * interface/main/onotes/office_comments.php: removed Back link target.
33 // * interface/main/onotes/office_comments_full.php: changed Back link.
34 // * interface/billing/billing_report.php: removed Back link; added logic
35 // to properly go to demographics or to an encounter when requested.
36 // * interface/new/new.php: removed Back link and revised form target.
37 // * interface/new/new_patient_save.php: modified to load the demographics
38 // page to the current frame instead of loading a new frameset.
39 // * interface/patient_file/history/history.php: target change.
40 // * interface/patient_file/history/history_full.php: target changes.
41 // * interface/patient_file/history/history_save.php: target change.
42 // * interface/patient_file/history/encounters.php: link/target changes.
43 // * interface/patient_file/history/encounters_full.php: link/target changes.
44 // * interface/patient_file/encounter/encounter_top.php: another new frameset
45 // cloned from patient_encounter.php.
46 // * interface/patient_file/encounter/forms.php: link target removal.
47 // * interface/patient_file/encounter/new_form.php: target change.
48 // * interface/forms/newpatient/new.php, view.php, save.php: link/target
50 // * interface/patient_file/summary/immunizations.php: removed back link.
51 // * interface/patient_file/summary/pnotes.php: changed link targets.
52 // * interface/patient_file/summary/pnotes_full.php: changed back link and
53 // added set_pid logic.
54 // * interface/patient_file/transaction/transactions.php: various changes.
55 // * interface/patient_file/transaction/add_transaction.php: new return js.
56 // * interface/patient_file/encounter/superbill_codes.php: target and link
58 // * interface/patient_file/encounter/superbill_custom_full.php: target and
60 // * interface/patient_file/encounter/diagnosis.php: target changes.
61 // * interface/patient_file/encounter/diagnosis_full.php: target and link
63 // * interface/main/authorizations/authorizations.php: link and target changes.
64 // * library/api.inc: url change.
65 // * interface/patient_file/summary/rx_frameset.php: new frameset.
66 // * interface/patient_file/summary/rx_left.php: new for prescriptions.
67 // * all encounter forms: remove all instances of "target=Main" and change
68 // all instances of "patient_encounter.php" to "encounter_top.php".
70 // Our find_patient form, when submitted, invokes patient_select.php in the
71 // upper frame. When the patient is selected, demographics.php is invoked
72 // with the set_pid parameter, which establishes the new session pid and also
73 // calls the setPatient() function (below). In this case demographics.php
74 // will also load the summary frameset into the bottom frame, invoking our
75 // loadFrame() and setRadio() functions.
77 // Similarly, we have the concept of selecting an encounter from the
78 // Encounters list, and then having that "stick" until some other encounter
79 // or a new encounter is chosen. We also have a navigation item for creating
80 // a new encounter. interface/patient_file/encounter/encounter_top.php
81 // supports set_encounter to establish an encounter.
83 // TBD: Include active_pid and/or active_encounter in relevant submitted
84 // form data, and add logic to the save routines to make sure they match
85 // the corresponding session values.
87 include_once("../globals.php");
88 include_once($GLOBALS['fileroot']."/library/acl.inc");
89 include_once($GLOBALS['fileroot']."/custom/code_types.inc.php");
90 include_once($GLOBALS['fileroot']."/library/patient.inc");
92 // This array defines the list of primary documents that may be
93 // chosen. Each element value is an array of 3 values:
95 // * Name to appear in the navigation table
96 // * Usage: 0 = global, 1 = patient-specific, 2 = encounter-specific
97 // * The URL relative to the interface directory
100 // larry :: dbc insert
101 $demovarbase = ( $GLOBALS['dutchpc'] ) ?
'demographics_dutch.php' : 'demographics.php';
102 // larry :: end of dbc insert
104 $primary_docs = array(
105 'ros' => array('Roster' , 0, 'reports/players_report.php?embed=1'),
106 'cal' => array('Calendar' , 0, 'main/main_info.php'),
107 'pwd' => array('Password' , 0, 'usergroup/user_info.php'),
108 'adm' => array('Admin' , 0, 'usergroup/admin_frameset.php'),
109 'rep' => array('Reports' , 0, 'reports/index.php'),
110 'ono' => array('Ofc Notes' , 0, 'main/onotes/office_comments.php'),
111 'fax' => array('Fax/Scan' , 0, 'fax/faxq.php'),
112 'adb' => array('Addr Bk' , 0, 'usergroup/addrbook_list.php'),
113 'cht' => array('Chart Trk' , 0, '../custom/chart_tracker.php'),
114 'imp' => array('Import' , 0, '../custom/import.php'),
115 'bil' => array('Billing' , 0, 'billing/billing_report.php'),
116 'sup' => array('Superbill' , 0, 'patient_file/encounter/superbill_custom_full.php'),
117 'aun' => array('Auth/notes', 0, 'main/authorizations/authorizations.php'),
118 'new' => array('New Pt' , 0, 'new/new.php'),
119 'dem' => array('Patient' , 1, "patient_file/summary/$demovarbase"),
120 'his' => array('History' , 1, 'patient_file/history/history.php'),
121 'ens' => array('Encounters', 1, 'patient_file/history/encounters.php'),
122 'nen' => array('New Enctr' , 1, 'forms/newpatient/new.php?autoloaded=1&calenc='),
123 'pre' => array('Rx' , 1, 'patient_file/summary/rx_frameset.php'),
124 'iss' => array('Issues' , 1, 'patient_file/summary/stats_full.php?active=all'),
125 'imm' => array('Immunize' , 1, 'patient_file/summary/immunizations.php'),
126 'doc' => array('Documents' , 1, '../controller.php?document&list&patient_id={PID}'),
127 'prp' => array('Pt Report' , 1, 'patient_file/report/patient_report.php'),
128 'pno' => array('Pt Notes' , 1, 'patient_file/summary/pnotes.php'),
129 'tra' => array('Transact' , 1, 'patient_file/transaction/transactions.php'),
130 'sum' => array('Summary' , 1, 'patient_file/summary/summary_bottom.php'),
131 'enc' => array('Encounter' , 2, 'patient_file/encounter/encounter_top.php'),
132 'cod' => array('Charges' , 2, 'patient_file/encounter/encounter_bottom.php'),
135 // This section decides which navigation items will not appear.
137 $disallowed = array();
139 $disallowed['adm'] = !(acl_check('admin', 'calendar') ||
140 acl_check('admin', 'database') ||
acl_check('admin', 'forms') ||
141 acl_check('admin', 'practice') ||
acl_check('admin', 'users') ||
142 acl_check('admin', 'acl'));
144 $disallowed['bil'] = !(acl_check('acct', 'rep') ||
acl_check('acct', 'eob') ||
145 acl_check('acct', 'bill'));
147 $tmp = acl_check('patients', 'demo');
148 $disallowed['new'] = !($tmp == 'write' ||
$tmp == 'addonly');
150 if ( isset ($GLOBALS['hylafax_server']) && isset ($GLOBALS['scanner_output_directory']) ) {
151 $disallowed['fax'] = !($GLOBALS['hylafax_server'] ||
$GLOBALS['scanner_output_directory']);
154 $disallowed['ros'] = !$GLOBALS['athletic_team'];
156 $disallowed['iss'] = !((acl_check('encounters', 'notes') == 'write' ||
157 acl_check('encounters', 'notes_a') == 'write') &&
158 acl_check('patients', 'med') == 'write');
160 $disallowed['imp'] = $disallowed['new'] ||
161 !is_readable("$webserver_root/custom/import.php");
163 $disallowed['cht'] = !is_readable("$webserver_root/custom/chart_tracker.php");
165 $disallowed['pre'] = !(acl_check('patients', 'med'));
167 // Helper functions for treeview generation.
168 function genTreeLink($frame, $name, $title) {
169 global $primary_docs, $disallowed;
170 if (empty($disallowed[$name])) {
171 $id = $name . $primary_docs[$name][1];
172 echo "<li><a href='' id='$id' " .
173 "onclick=\"return loadFrame2('$id','$frame','" .
174 $primary_docs[$name][2] . "')\">" . xl($title) . "</a></li>";
177 function genMiscLink($frame, $name, $level, $title, $url) {
178 global $primary_docs, $disallowed;
179 if (empty($disallowed[$name])) {
180 $id = $name . $level;
181 echo "<li><a href='' id='$id' " .
182 "onclick=\"return loadFrame2('$id','$frame','" .
183 $url . "')\">" . xl($title) . "</a></li>";
186 function genPopLink($title, $url) {
187 echo "<li><a href='' " .
188 "onclick=\"return repPopup('$url')\"" .
189 ">" . xl($title) . "</a></li>";
191 function genDualLink($topname, $botname, $title) {
192 global $primary_docs, $disallowed;
193 if (empty($disallowed[$topname]) && empty($disallowed[$botname])) {
194 $topid = $topname . $primary_docs[$topname][1];
195 $botid = $botname . $primary_docs[$botname][1];
196 echo "<li><a href='' id='$topid' " .
197 "onclick=\"return loadFrameDual('$topid','$botid','" .
198 $primary_docs[$topname][2] . "','" .
199 $primary_docs[$botname][2] . "')\">" . xl($title) . "</a></li>";
203 function genPopupsList($style='') {
204 global $disallowed, $webserver_root;
206 <select name
='popups' onchange
='selpopup(this)' style
='background-color:transparent;font-size:9pt;<?php echo $style; ?>'>
207 <option value
=''><?php
xl('Popups','e'); ?
></option
>
208 <?php
if (!$disallowed['iss']) { ?
>
209 <option value
='../patient_file/problem_encounter.php'><?php
xl('Issues','e'); ?
></option
>
211 <option value
='../../custom/export_xml.php'><?php
xl('Export','e'); ?
></option
>
212 <option value
='../../custom/import_xml.php'><?php
xl('Import','e'); ?
></option
>
213 <?php
if ($GLOBALS['athletic_team']) { ?
>
214 <option value
='../reports/players_report.php'><?php
xl('Roster','e'); ?
></option
>
216 <option value
='../reports/appointments_report.php?patient=<?php echo $pid ?>'><?php
xl('Appts','e'); ?
></option
>
217 <?php
if (file_exists("$webserver_root/custom/refer.php")) { ?
>
218 <option value
='../../custom/refer.php'><?php
xl('Refer','e'); ?
></option
>
220 <?php
// if (file_exists("$webserver_root/custom/fee_sheet_codes.php")) { ?>
221 <option value
='../patient_file/printed_fee_sheet.php?fill=1'><?php
xl('Superbill','e'); ?
></option
>
223 <?php
if ($GLOBALS['inhouse_pharmacy']) { ?
>
224 <option value
='../patient_file/front_payment.php'><?php
xl('Prepay','e'); ?
></option
>
225 <option value
='../patient_file/pos_checkout.php'><?php
xl('Checkout','e'); ?
></option
>
227 <option value
='../patient_file/front_payment.php'><?php
xl('Payment','e'); ?
></option
>
229 <?php
if (is_dir("$webserver_root/custom/letter_templates")) { ?
>
230 <option value
='../patient_file/letter.php'><?php
xl('Letter','e'); ?
></option
>
239 <title
>Navigation
</title
>
240 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
242 <style type
="text/css">
246 padding
: 5px
3px
5px
3px
;
249 font
-family
:sans
-serif
;
253 a
.navitem
, a
.navitem
:visited
{
255 font
-family
:sans
-serif
;
266 border
-color
: #000000;
267 background
-color
:transparent
;
271 background
-color
:transparent
;
275 <link rel
="stylesheet" href
="../../library/js/jquery.treeview-1.3/jquery.treeview.css" />
276 <script src
="../../library/js/jquery-1.2.2.min.js" type
="text/javascript"></script
>
277 <script src
="../../library/js/jquery.treeview-1.3/jquery.treeview.min.js" type
="text/javascript"></script
>
279 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
281 <script language
='JavaScript'>
283 // Master values for current pid and encounter.
285 var active_encounter
= 0;
287 // Current selections in the top and bottom frames.
291 // Expand and/or collapse frames in response to checkbox clicks.
292 // fnum indicates which checkbox was clicked (1=left, 2=right).
293 function toggleFrame(fnum
) {
294 var f
= document
.forms
[0];
295 var fset
= top
.document
.getElementById('fsright');
296 if (!f
.cb_top
.checked
&& !f
.cb_bot
.checked
) {
297 if (fnum
== 1) f
.cb_bot
.checked
= true;
298 else f
.cb_top
.checked
= true;
300 var rows
= f
.cb_top
.checked ?
'*' : '0';
301 rows +
= f
.cb_bot
.checked ?
',*' : ',0';
306 // Load the specified url into the specified frame (RTop or RBot).
307 // The URL provided must be relative to interface.
308 function loadFrame(fname
, frame
, url
) {
309 top
.restoreSession();
310 var i
= url
.indexOf('{PID}');
311 if (i
>= 0) url
= url
.substring(0,i
) + active_pid + url
.substring(i+
5);
312 top
.frames
[frame
].location
= '<?php echo "$web_root/interface/" ?>' + url
;
313 if (frame
== 'RTop') topName
= fname
; else botName
= fname
;
316 // Load the specified url into a frame to be determined, with the specified
317 // frame as the default; the url must be relative to interface.
318 function loadFrame2(fname
, frame
, url
) {
319 var usage
= fname
.substring(3);
320 if (active_pid
== 0 && usage
> '0') {
321 alert('<?php xl('You must first select
or add a patient
.','e
') ?>');
324 if (active_encounter
== 0 && usage
> '1') {
325 alert('<?php xl('You must first select
or create an encounter
.','e
') ?>');
328 var f
= document
.forms
[0];
329 top
.restoreSession();
330 var i
= url
.indexOf('{PID}');
331 if (i
>= 0) url
= url
.substring(0,i
) + active_pid + url
.substring(i+
5);
332 var fi
= f
.sel_frame
.selectedIndex
;
333 if (fi
== 1) frame
= 'RTop'; else if (fi
== 2) frame
= 'RBot';
334 if (!f
.cb_bot
.checked
) frame
= 'RTop'; else if (!f
.cb_top
.checked
) frame
= 'RBot';
335 top
.frames
[frame
].location
= '<?php echo "$web_root/interface/" ?>' + url
;
336 if (frame
== 'RTop') topName
= fname
; else botName
= fname
;
340 // Make sure both frames are open.
341 function forceDual() {
342 var f
= document
.forms
[0];
343 if (!f
.cb_top
.checked
) {
344 f
.cb_top
.checked
= true;
347 if (!f
.cb_bot
.checked
) {
348 f
.cb_bot
.checked
= true;
353 // Load the specified url into a frame to be determined, with the specified
354 // frame as the default; the url must be relative to interface.
355 function loadFrameDual(tname
, bname
, topurl
, boturl
) {
356 var topusage
= tname
.substring(3);
357 var botusage
= bname
.substring(3);
358 if (active_pid
== 0 && (topusage
> '0' || botusage
> '0')) {
359 alert('<?php xl('You must first select
or add a patient
.','e
') ?>');
362 if (active_encounter
== 0 && (topusage
> '1' || botusage
> '1')) {
363 alert('<?php xl('You must first select
or create an encounter
.','e
') ?>');
366 var f
= document
.forms
[0];
368 top
.restoreSession();
369 var i
= topurl
.indexOf('{PID}');
370 if (i
>= 0) topurl
= topurl
.substring(0,i
) + active_pid + topurl
.substring(i+
5);
371 i
= boturl
.indexOf('{PID}');
372 if (i
>= 0) boturl
= boturl
.substring(0,i
) + active_pid + boturl
.substring(i+
5);
373 top
.frames
.RTop
.location
= '<?php echo "$web_root/interface/" ?>' + topurl
;
374 top
.frames
.RBot
.location
= '<?php echo "$web_root/interface/" ?>' + boturl
;
380 // Select a designated radio button. raname may be either the radio button
381 // array name (rb_top or rb_bot), or the frame name (RTop or RBot).
382 // You should call this if you directly load a document that does not
383 // correspond to the current radio button setting.
384 function setRadio(raname
, rbid
) {
385 <?php
if ($GLOBALS['concurrent_layout'] != 2) { ?
>
386 var f
= document
.forms
[0];
387 if (raname
== 'RTop') raname
= 'rb_top';
388 if (raname
== 'RBot') raname
= 'rb_bot';
389 for (var i
= 0; i
< f
[raname
].length
; ++i
) {
390 if (f
[raname
][i
].value
.substring(0,3) == rbid
) {
391 f
[raname
][i
].checked
= true;
399 // Set disabled/enabled state of radio buttons and associated labels
400 // depending on whether there is an active patient or encounter.
401 function syncRadios() {
402 var f
= document
.forms
[0];
403 <?php
if ($GLOBALS['concurrent_layout'] == 2) { ?
>
404 var nlinks
= document
.links
.length
;
405 for (var i
= 0; i
< nlinks
; ++i
) {
406 var lnk
= document
.links
[i
];
407 if (lnk
.id
.length
!= 4) continue;
408 var usage
= lnk
.id
.substring(3);
409 if (usage
== '1' || usage
== '2') {
411 if (active_pid
== 0) da
= true;
412 if (active_encounter
== 0 && usage
> '1') da
= true;
413 lnk
.style
.color
= da ?
'#888888' : '#0000ff';
417 for (var i
= 0; i
< f
.rb_top
.length
; ++i
) {
419 var rb1
= f
.rb_top
[i
];
420 var rb2
= f
.rb_bot
[i
];
421 var rbid
= rb1
.value
.substring(0,3);
422 var usage
= rb1
.value
.substring(3);
423 if (active_pid
== 0 && usage
> '0') da
= true;
424 if (active_encounter
== 0 && usage
> '1') da
= true;
425 // daemon_frame can also set special label colors, so don't mess with
426 // them unless we have to.
427 if (rb1
.disabled
!= da
) {
430 document
.getElementById('lbl_' + rbid
).style
.color
= da ?
'#888888' : '#000000';
434 f
.popups
.disabled
= (active_pid
== 0);
437 // Process the click to find a patient by name, id, ssn or dob.
438 function findPatient(findby
) {
439 var f
= document
.forms
[0];
440 if (! f
.cb_top
.checked
) {
441 f
.cb_top
.checked
= true;
444 f
.findBy
.value
= findby
;
445 setRadio('rb_top', 'dem');
446 top
.restoreSession();
447 document
.find_patient
.submit();
450 // Helper function to set the contents of a div.
451 function setSomeContent(id
, content
, doc
) {
452 if (doc
.getElementById
) {
453 var x
= doc
.getElementById(id
);
455 x
.innerHTML
= content
;
459 x
.innerHTML
= content
;
462 function setDivContent(id
, content
) {
463 setSomeContent(id
, content
, document
);
465 function setTitleContent(id
, content
) {
466 setSomeContent(id
, content
, parent
.Title
.document
);
469 // This is called automatically when a new patient is set, to make sure
470 // there are no patient-specific documents showing stale data. If a frame
471 // was just loaded with data for the correct patient, its name is passed so
472 // that it will not be zapped. At this point the new server-side pid is not
473 // assumed to be set, so this function will only load global data.
474 function reloadPatient(frname
) {
475 var f
= document
.forms
[0];
476 if (topName
.length
> 3 && topName
.substring(3) > '0' && frname
!= 'RTop') {
477 loadFrame('cal0','RTop', '<?php echo $primary_docs['cal
'][2]; ?>');
478 setRadio('rb_top', 'cal');
480 if (botName
.length
> 3 && botName
.substring(3) > '0' && frname
!= 'RBot') {
481 loadFrame('aun0','RBot', '<?php echo $primary_docs['aun
'][2]; ?>');
482 setRadio('rb_bot', 'aun');
486 // Reload encounter-specific frames, excluding a specified frame. At this
487 // point the new server-side encounter ID may not be set and loading the same
488 // document for the new encounter will not work, so load patient info instead.
489 function reloadEncounter(frname
) {
490 var f
= document
.forms
[0];
491 if (topName
.length
> 3 && topName
.substring(3) > '1' && frname
!= 'RTop') {
492 loadFrame('dem1','RTop', '<?php echo $primary_docs['dem
'][2]; ?>');
493 setRadio('rb_top', 'dem');
495 if (botName
.length
> 3 && botName
.substring(3) > '1' && frname
!= 'RBot') {
496 loadFrame('ens1','RBot', '<?php echo $primary_docs['ens
'][2]; ?>');
497 setRadio('rb_bot', 'ens');
501 // Call this to announce that the patient has changed. You must call this
502 // if you change the session PID, so that the navigation frame will show the
503 // correct patient and so that the other frame will be reloaded if it contains
504 // patient-specific information from the previous patient. frname is the name
505 // of the frame that the call came from, so we know to only reload content
506 // from the *other* frame if it is patient-specific.
507 function setPatient(pname
, pid
, pubpid
, frname
, str_dob
) {
508 var str
= '<b>' + pname +
' (' + pubpid +
')</b>';
509 setDivContent('current_patient', str
);
510 setTitleContent('current_patient', str + str_dob
);
511 if (pid
== active_pid
) return;
512 setDivContent('current_encounter', '<b>None</b>');
514 active_encounter
= 0;
515 if (frname
) reloadPatient(frname
);
519 // Call this to announce that the encounter has changed. You must call this
520 // if you change the session encounter, so that the navigation frame will
521 // show the correct encounter and so that the other frame will be reloaded if
522 // it contains encounter-specific information from the previous encounter.
523 // frname is the name of the frame that the call came from, so we know to only
524 // reload encounter-specific content from the *other* frame.
525 function setEncounter(edate
, eid
, frname
) {
526 if (eid
== active_encounter
) return;
527 if (!eid
) edate
= 'None';
528 var str
= '<b>' + edate +
'</b>';
529 setDivContent('current_encounter', str
);
530 active_encounter
= eid
;
531 reloadEncounter(frname
);
535 // You must call this if you delete the active patient (or if for any other
536 // reason you "close" the active patient without opening a new one), so that
537 // the appearance of the navigation frame will be correct and so that any
538 // stale content will be reloaded.
539 function clearPatient() {
540 if (active_pid
== 0) return;
541 var f
= document
.forms
[0];
543 active_encounter
= 0;
544 setDivContent('current_encounter', '<b>None</b>');
545 setDivContent('current_patient', '<b>None</b>');
546 setTitleContent('current_patient', '<b>None</b>');
551 // You must call this if you delete the active encounter (or if for any other
552 // reason you "close" the active encounter without opening a new one), so that
553 // the appearance of the navigation frame will be correct and so that any
554 // stale content will be reloaded.
555 function clearEncounter() {
556 if (active_encounter
== 0) return;
557 setDivContent('current_encounter', '<b>None</b>');
558 active_encounter
= 0;
563 // You can call this to make sure the session pid is what we expect.
564 function pidSanityCheck(pid
) {
565 if (pid
!= active_pid
) {
566 alert('Session patient ID is ' + pid +
', expecting ' + active_pid +
567 '. This session is unstable and should be abandoned. Do not use ' +
568 'OpenEMR in multiple browser windows!');
574 // You can call this to make sure the session encounter is what we expect.
575 function encounterSanityCheck(eid
) {
576 if (eid
!= active_encounter
) {
577 alert('Session encounter ID is ' + eid +
', expecting ' + active_encounter +
578 '. This session is unstable and should be abandoned. Do not use ' +
579 'OpenEMR in multiple browser windows!');
586 function repPopup(aurl
) {
587 top
.restoreSession();
588 window
.open('<?php echo "$web_root/interface/reports/" ?>' + aurl
, '_blank', 'width=750,height=550,resizable=1,scrollbars=1');
592 // This is invoked to pop up some window when a popup item is selected.
593 function selpopup(selobj
) {
594 var i
= selobj
.selectedIndex
;
595 var opt
= selobj
.options
[i
];
599 if (opt
.text
== 'Export' || opt
.text
== 'Import') {
603 else if (opt
.text
== 'Refer') {
607 dlgopen(opt
.value
, '_blank', width
, height
);
609 selobj
.selectedIndex
= 0;
612 // Treeview activation stuff:
613 $
(document
).ready(function(){
614 $
("#navigation").treeview({
617 unique
: <?php
echo $GLOBALS['athletic_team'] ?
'false' : 'true' ?
>,
619 window
.console
&& console
.log("%o was toggled", this
);
628 <body
class="body_nav">
630 <form method
='post' name
='find_patient' target
='RTop'
631 action
='<?php echo $rootdir ?>/main/finder/patient_select.php'>
633 <?php
if ($GLOBALS['concurrent_layout'] == 2) { ?
>
636 <select name
='sel_frame' style
='background-color:transparent;font-size:9pt;width:<?php echo $GLOBALS['athletic_team
'] ? 47 : 100; ?>%;'>
637 <option value
='0'><?php
xl('Default','e'); ?
></option
>
638 <option value
='1'><?php
xl('Top','e'); ?
></option
>
639 <option value
='2'><?php
xl('Bottom','e'); ?
></option
>
641 <?php
if ($GLOBALS['athletic_team']) genPopupsList('width:47%'); ?
>
644 <table cellpadding
='0' cellspacing
='0' border
='0' width
='100%'>
646 <td
class='smalltext' nowrap
>
647 <input type
='checkbox' name
='cb_top' onclick
='toggleFrame(1)' checked
/>
648 <b
><?php
xl('Top','e') ?
></b
>
650 <td
class='smalltext' align
='right' nowrap
>
651 <b
><?php
xl('Bot','e') ?
></b
>
652 <input type
='checkbox' name
='cb_bot' onclick
='toggleFrame(2)' <?php
if (empty($GLOBALS['athletic_team'])) echo 'checked '; ?
>/>
657 <?php
if ($GLOBALS['athletic_team']) { // Tree menu for athletic teams ?>
660 <li
class="open"><span
><?php
xl('Patient/Client','e') ?
></span
>
662 <li
class="open"><span
><?php
xl('Demographics','e') ?
></span
>
664 <?php
genTreeLink('RTop','new',($GLOBALS['full_new_patient_form'] ?
'New/Search' : 'New')); ?
>
665 <?php
genTreeLink('RTop','dem','Current'); ?
>
666 <?php
genDualLink('dem','sum','Summary'); // with dem on top ?>
669 <li
class="open"><span
><?php
xl('Medical Records','e') ?
></span
>
671 <?php
genPopLink ('Team Roster','players_report.php'); ?
>
672 <?php
genDualLink('nen','ens','New Consultation'); // with ens on bottom ?>
674 <?php
// genDualLink('enc','ens','Current Consultation'); // with ens on bottom ?>
675 <?php
genTreeLink('RTop','enc','Current Consultation'); // encounter_top will itself load ens on bottom ?>
677 <?php
genDualLink('dem','ens','Previous Consultations'); // with dem on top ?>
678 <?php
genDualLink('his','ens','Previous History/Screening'); // with ens on bottom ?>
679 <?php
genTreeLink('RBot','nen','New Allergy'); // nen with Allergy in chief complaint ?>
680 <?php
genTreeLink('RTop','iss','Edit Allergies'); // somehow emphasizing allergies...? ?>
681 <?php
genTreeLink('RTop','his','View Allergies'); // his page with Allergies section open ?>
682 <?php
genDualLink('iss','ens','Problems/Issues'); // with ens on bottom ?>
683 <?php
genDualLink('tra','ens','Transactions/Referrals'); // new transaction form on top and tra list on bottom (or ens if no tra) ?>
684 <?php
genDualLink('his','imm','Immunizations'); // imm on bottom, his on top ?>
685 <?php
if (acl_check('patients', 'med')) genDualLink('his','pre','Prescriptions'); // pre on bottom, his on top ?>
686 <?php
genTreeLink('RTop','doc','Document/Imaging Store'); ?
>
687 <?php
genTreeLink('RTop','prp','Patient Printed Report'); ?
>
688 <?php
genDualLink('dem','pno','Additional Notes'); // with dem on top ?>
689 <li
><a href
='' onclick
="return repPopup('../patient_file/letter.php')" id
='prp1'>Letter
</a
></li
>
690 <?php
genPopLink('Address Book','../usergroup/addrbook_list.php?popup=1'); ?
>
693 <li
><span
><?php
xl('View','e') ?
></span
>
695 <?php
genTreeLink('RTop','cal','Calendar View'); ?
>
696 <?php
genTreeLink('RTop','ros','Team Roster View'); // default; and minimize lower frame ?>
697 <?php
genTreeLink('RTop','dem','Current Patient'); // this also appears under Demographics ?>
702 <li
class="open"><span
><?php
xl('Reports','e') ?
></span
>
704 <li
class="open"><span
><?php
xl('Athletic/Injury','e') ?
></span
>
706 <?php
genTreeLink('RTop','prp','Patient Printed Report'); // also appears above ?>
707 <?php
genPopLink('Games/Events Missed','absences_report.php'); ?
>
708 <?php
genPopLink('Injury Surveillance','football_injury_report.php'); ?
>
709 <?php
genPopLink('Team Injury Overview','injury_overview_report.php'); ?
>
712 <li
><span
><?php
xl('Patient/Client','e') ?
></span
>
714 <?php
genPopLink('List','patient_list.php'); ?
>
715 <?php
if (acl_check('patients', 'med')) genPopLink('Prescriptions','prescriptions_report.php'); ?
>
716 <?php
genPopLink('Referrals','referrals_report.php'); ?
>
719 <li
><span
><?php
xl('Visits','e') ?
></span
>
721 <?php
genPopLink('Appointments','appointments_report.php'); ?
>
722 <?php
genPopLink('Encounters','encounters_report.php'); ?
>
723 <?php
genPopLink('Appt-Enc','appt_encounter_report.php'); ?
>
726 <li
><span
><?php
xl('General','e') ?
></span
>
728 <?php
genPopLink('Services','services_by_category.php'); ?
>
729 <?php
if ($GLOBALS['inhouse_pharmacy']) genPopLink('Inventory','inventory_list.php'); ?
>
730 <?php
if ($GLOBALS['inhouse_pharmacy']) genPopLink('Destroyed','destroyed_drugs_report.php'); ?
>
735 <li
><span
><?php
xl('Fees','e') ?
></span
>
737 <?php
genMiscLink('RBot','cod','2','Fee Sheet','patient_file/encounter/load_form.php?formname=fee_sheet'); ?
>
738 <?php
genMiscLink('RBot','bil','1','Checkout','patient_file/pos_checkout.php?framed=1'); ?
>
741 <?php
if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) genMiscLink('RTop','adm','0','Inventory','drugs/drug_inventory.php'); ?
>
742 <li
><span
><?php
xl('Administration','e') ?
></span
>
744 <?php
if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0','Users','usergroup/usergroup_admin.php'); ?
>
745 <?php
genTreeLink('RTop','pwd','Users Password Change'); ?
>
746 <?php
if (acl_check('admin', 'practice' )) genMiscLink('RTop','adm','0','Practice','../controller.php?practice_settings'); ?
>
747 <?php
if (acl_check('admin', 'superbill')) genTreeLink('RTop','sup','Services'); ?
>
748 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Layouts','super/edit_layout.php'); ?
>
749 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Lists','super/edit_list.php'); ?
>
750 <?php
if (acl_check('admin', 'acl' )) genMiscLink('RTop','adm','0','ACL','usergroup/adminacl.php'); ?
>
751 <li
><span
><?php
xl('Other','e') ?
></span
>
753 <?php
if (acl_check('admin', 'forms' )) genMiscLink('RTop','adm','0','Forms','forms_admin/forms_admin.php'); ?
>
754 <?php
if (acl_check('admin', 'calendar')) genMiscLink('RTop','adm','0','Calendar','main/calendar/index.php?module=PostCalendar&type=admin&func=modifyconfig'); ?
>
755 <?php
if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0','Logs','logview/logview.php'); ?
>
756 <?php
if (acl_check('admin', 'database')) genMiscLink('RTop','adm','0','Database','../phpmyadmin/index.php'); ?
>
757 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Backup','main/backup.php'); ?
>
762 <li
><span
><?php
xl('Miscellaneous','e') ?
></span
>
764 <?php
genTreeLink('RBot','aun','Pt Notes/Auth'); ?
>
765 <?php
genTreeLink('RTop','fax','Fax/Scan'); ?
>
766 <?php
genTreeLink('RTop','adb','Addr Book'); ?
>
767 <?php
genTreeLink('RTop','ono','Ofc Notes'); ?
>
768 <?php
genMiscLink('RTop','adm','0','BatchCom','batchcom/batchcom.php'); ?
>
773 <?php
} else { // not athletic team ?>
776 <li
class="open"><span
><?php
xl('Patient/Client','e') ?
></span
>
778 <li
><span
><?php
xl('Management','e') ?
></span
>
780 <?php
genTreeLink('RTop','new',($GLOBALS['full_new_patient_form'] ?
'New/Search' : 'New')); ?
>
781 <?php
genTreeLink('RTop','dem','Current'); ?
>
782 <?php
genTreeLink('RBot','sum','Summary'); ?
>
785 <li
class="open"><span
><?php
xl('Visits','e') ?
></span
>
787 <?php
genTreeLink('RTop','cal','Calendar'); ?
>
788 <?php
if ($GLOBALS['athletic_team']) genTreeLink('RTop','ros','Roster'); ?
>
789 <?php
genTreeLink('RBot','nen','New Visit'); ?
>
790 <?php
genTreeLink('RBot','enc','Current'); ?
>
791 <?php
genTreeLink('RBot','ens','List'); ?
>
792 <?php
genTreeLink('RBot','tra','Transact'); ?
>
793 <?php
genPopLink('Chart Tracker','../../custom/chart_tracker.php'); ?
>
796 <li
><span
><?php
xl('Medical Record','e') ?
></span
>
798 <?php
if (acl_check('patients', 'med')) genTreeLink('RBot','pre','Rx'); ?
>
799 <?php
genTreeLink('RTop','his','History'); ?
>
800 <?php
genTreeLink('RTop','iss','Issues'); ?
>
801 <?php
genTreeLink('RBot','imm','Immunize'); ?
>
802 <?php
genTreeLink('RTop','doc','Documents'); ?
>
803 <?php
genTreeLink('RBot','pno','Notes'); ?
>
804 <?php
genTreeLink('RTop','prp','Report'); ?
>
809 <li
><span
><?php
xl('Fees','e') ?
></span
>
811 <?php
genMiscLink('RBot','cod','2','Fee Sheet','patient_file/encounter/load_form.php?formname=fee_sheet'); ?
>
812 <?php
if (false) genTreeLink('RBot','cod','Charges'); ?
>
813 <?php
genMiscLink('RBot','bil','1','Checkout','patient_file/pos_checkout.php?framed=1'); ?
>
814 <?php
if (! $GLOBALS['simplified_demographics']) genTreeLink('RTop','bil','Billing'); ?
>
817 <?php
if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) genMiscLink('RTop','adm','0','Inventory','drugs/drug_inventory.php'); ?
>
818 <li
><span
><?php
xl('Administration','e') ?
></span
>
820 <?php
if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0','Users','usergroup/usergroup_admin.php'); ?
>
821 <?php
if (acl_check('admin', 'practice' )) genMiscLink('RTop','adm','0','Practice','../controller.php?practice_settings'); ?
>
822 <?php
if (acl_check('admin', 'superbill')) genTreeLink('RTop','sup','Services'); ?
>
823 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Layouts','super/edit_layout.php'); ?
>
824 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Lists','super/edit_list.php'); ?
>
825 <?php
if (acl_check('admin', 'acl' )) genMiscLink('RTop','adm','0','ACL','usergroup/adminacl.php'); ?
>
826 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Backup','main/backup.php'); ?
>
827 <?php
if (acl_check('admin', 'super') && !empty($GLOBALS['code_types']['IPPF'])) genMiscLink('RTop','adm','0','Export','main/ippf_export.php'); ?
>
828 <li
><span
><?php
xl('Other','e') ?
></span
>
830 <?php
if (acl_check('admin', 'language')) genMiscLink('RTop','adm','0','Language','language/language.php'); ?
>
831 <?php
if (acl_check('admin', 'forms' )) genMiscLink('RTop','adm','0','Forms','forms_admin/forms_admin.php'); ?
>
832 <?php
if (acl_check('admin', 'calendar')) genMiscLink('RTop','adm','0','Calendar','main/calendar/index.php?module=PostCalendar&type=admin&func=modifyconfig'); ?
>
833 <?php
if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0','Logs','logview/logview.php'); ?
>
834 <?php
if (acl_check('admin', 'database')) genMiscLink('RTop','adm','0','Database','../phpmyadmin/index.php'); ?
>
839 <li
><span
><?php
xl('Reports','e') ?
></span
>
841 <li
><span
><?php
xl('Clients','e') ?
></span
>
843 <?php
genPopLink('List','patient_list.php'); ?
>
844 <?php
if (acl_check('patients', 'med')) genPopLink('Rx','prescriptions_report.php'); ?
>
845 <?php
genPopLink('Referrals','referrals_report.php'); ?
>
848 <li
class="open"><span
><?php
xl('Visits','e') ?
></span
>
850 <?php
genPopLink('Appointments','appointments_report.php'); ?
>
851 <?php
genPopLink('Encounters','encounters_report.php'); ?
>
852 <?php
genPopLink('Appt-Enc','appt_encounter_report.php'); ?
>
853 <?php
if (empty($GLOBALS['code_types']['IPPF'])) { ?
>
854 <?php
genPopLink('Superbill','custom_report_range.php'); ?
>
856 <?php
genPopLink('Chart Activity','chart_location_activity.php'); ?
>
857 <?php
genPopLink('Charts Out','charts_checked_out.php'); ?
>
860 <?php
if (acl_check('acct', 'rep_a')) { ?
>
861 <li
><span
><?php
xl('Financial','e') ?
></span
>
863 <?php
genPopLink('Sales','sales_by_item.php'); ?
>
864 <?php
genPopLink('Cash Rec','../billing/sl_receipts_report.php'); ?
>
865 <?php
genPopLink('Front Rec','front_receipts_report.php'); ?
>
866 <?php
genPopLink('Pmt Method','receipts_by_method_report.php'); ?
>
867 <?php
genPopLink('Collections','collections_report.php'); ?
>
871 <li
><span
><?php
xl('General','e') ?
></span
>
873 <?php
genPopLink('Services','services_by_category.php'); ?
>
874 <?php
if ($GLOBALS['inhouse_pharmacy']) genPopLink('Inventory','inventory_list.php'); ?
>
875 <?php
if ($GLOBALS['inhouse_pharmacy']) genPopLink('Destroyed','destroyed_drugs_report.php'); ?
>
878 <?php
if (! $GLOBALS['simplified_demographics']) { ?
>
879 <li
><span
><?php
xl('Insurance','e') ?
></span
>
881 <?php
genPopLink('Distribution','insurance_allocation_report.php'); ?
>
882 <?php
genPopLink('Indigents','../billing/indigent_patients_report.php'); ?
>
883 <?php
genPopLink('Unique SP','unique_seen_patients_report.php'); ?
>
887 <?php
if (!empty($GLOBALS['code_types']['IPPF'])) { ?
>
888 <li
><span
><?php
xl('Statistics','e') ?
></span
>
890 <?php
genPopLink('IPPF Stats','ippf_statistics.php?t=i'); ?
>
891 <?php
genPopLink('GCAC Stats','ippf_statistics.php?t=g'); ?
>
892 <?php
genPopLink('MA Stats','ippf_statistics.php?t=m'); ?
>
893 <?php
genPopLink('CYP','ippf_cyp_report.php'); ?
>
894 <?php
genPopLink('Daily Record','ippf_daily.php'); ?
>
897 <li
><span
><?php
xl('Blank Forms','e') ?
></span
>
899 <?php
genPopLink('Fee Sheet','../patient_file/printed_fee_sheet.php'); ?
>
900 <?php
genPopLink('Referral','../patient_file/transaction/print_referral.php'); ?
>
904 <?php
// genTreeLink('RTop','rep','Other'); ?>
907 <li
><span
><?php
xl('Miscellaneous','e') ?
></span
>
909 <?php
genTreeLink('RBot','aun','Pt Notes/Auth'); ?
>
910 <?php
genTreeLink('RTop','fax','Fax/Scan'); ?
>
911 <?php
genTreeLink('RTop','adb','Addr Book'); ?
>
912 <?php
genTreeLink('RTop','cht','Chart Tracker'); ?
>
913 <?php
genTreeLink('RTop','ono','Ofc Notes'); ?
>
914 <?php
genMiscLink('RTop','adm','0','BatchCom','batchcom/batchcom.php'); ?
>
915 <?php
genTreeLink('RTop','pwd','Password'); ?
>
920 <?php
} // end not athletic team ?>
922 <?php
} else { // end ($GLOBALS['concurrent_layout'] == 2) ?>
924 <table cellpadding
='0' cellspacing
='0' border
='0'>
927 <table cellpadding
='0' cellspacing
='0' border
='0' width
='100%'>
929 <td
class='smalltext' nowrap
>
930 <input type
='checkbox' name
='cb_top' onclick
='toggleFrame(1)' checked
/><b
><?php
xl('Top','e') ?
></b
>
932 <td
class='smalltext' align
='right' nowrap
>
933 <b
><?php
xl('Bot','e') ?
></b
><input type
='checkbox' name
='cb_bot' onclick
='toggleFrame(2)' checked
/>
940 // Builds the table of radio buttons and their labels. Radio button values
941 // are comprised of the 3-character document id and the 1-digit usage type,
942 // so that JavaScript can easily access this information.
943 $default_top_rbid = $GLOBALS['athletic_team'] ?
'ros' : 'cal';
944 foreach ($primary_docs as $key => $varr) {
945 if (!empty($disallowed[$key])) continue;
950 echo " <td class='smalltext'><input type='radio' name='rb_top' value='$key$usage' " .
951 "onclick=\"loadFrame('$key$usage','RTop','$url')\"";
952 if ($key == $default_top_rbid) echo " checked";
954 echo " <td class='smalltext' id='lbl_$key'>$label</td>\n";
955 echo " <td class='smalltext'><input type='radio' name='rb_bot' value='$key$usage' " .
956 "onclick=\"loadFrame('$key$usage','RBot','$url')\"";
957 if ($key == 'aun') echo " checked";
969 // To use RelayHealth, see comments and parameters in includes/config.php.
970 if (!empty($GLOBALS['ssi']['rh'])) {
971 include_once("../../library/ssi.inc");
972 echo getRelayHealthLink() ."<br /><hr />\n";
976 <?php
xl('Active Patient','e') ?
>:<br
/>
977 <div id
='current_patient'>
981 <?php
xl('Active Encounter','e') ?
>:<br
/>
982 <div id
='current_encounter'>
986 <?php
if (!$GLOBALS['athletic_team']) genPopupsList(); ?
>
990 <table cellpadding
='0' cellspacing
='0' border
='0'>
992 <td
class='smalltext'><?php
xl('Find','e') ?
>: 
;</td
>
993 <td
class='smalltext' colspan
='2'>
994 <input type
="entry" size
="7" name
="patient" class='inputtext' style
='width:65px;' />
998 <td
class='smalltext'><?php
xl('by','e') ?
>:</td
>
999 <td
class='smalltext'>
1000 <a href
="javascript:findPatient('Last');" class="navitem"><?php
xl('Name','e'); ?
></a
>
1002 <td
class='smalltext' align
='right'>
1003 <a href
="javascript:findPatient('ID');" class="navitem"><?php
xl('ID','e'); ?
></a
>
1007 <td
class='smalltext'> 
;</td
>
1008 <td
class='smalltext'>
1009 <a href
="javascript:findPatient('SSN');" class="navitem"><?php
xl('SSN','e'); ?
></a
>
1011 <td
class='smalltext' align
='right'>
1012 <a href
="javascript:findPatient('DOB');" class="navitem"><?php
xl('DOB','e'); ?
></a
>
1018 <a href
="../logout.php?auth=logout" target
="_top" class="navitem" id
="logout_link"
1019 onclick
="top.restoreSession()">
1020 <?php
xl('Logout','e'); ?
></a
>
1022 <input type
='hidden' name
='findBy' value
='Last' />
1026 <script language
='JavaScript'>