2 // Copyright (C) 2006-2009 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(xl('Roster') , 0, 'reports/players_report.php?embed=1'),
106 'cal' => array(xl('Calendar') , 0, 'main/main_info.php'),
107 'pwd' => array(xl('Password') , 0, 'usergroup/user_info.php'),
108 'adm' => array(xl('Admin') , 0, 'usergroup/admin_frameset.php'),
109 'rep' => array(xl('Reports') , 0, 'reports/index.php'),
110 'ono' => array(xl('Ofc Notes') , 0, 'main/onotes/office_comments.php'),
111 'fax' => array(xl('Fax/Scan') , 0, 'fax/faxq.php'),
112 'adb' => array(xl('Addr Bk') , 0, 'usergroup/addrbook_list.php'),
113 'cht' => array(xl('Chart Trk') , 0, '../custom/chart_tracker.php'),
114 'imp' => array(xl('Import') , 0, '../custom/import.php'),
115 'bil' => array(xl('Billing') , 0, 'billing/billing_report.php'),
116 'sup' => array(xl('Superbill') , 0, 'patient_file/encounter/superbill_custom_full.php'),
117 'aun' => array(xl('Auth/notes'), 0, 'main/authorizations/authorizations.php'),
118 'new' => array(xl('New Pt') , 0, 'new/new.php'),
119 'dem' => array(xl('Patient') , 1, "patient_file/summary/$demovarbase"),
120 'his' => array(xl('History') , 1, 'patient_file/history/history.php'),
121 'ens' => array(xl('Encounters'), 1, 'patient_file/history/encounters.php'),
122 'nen' => array(xl('New Enctr') , 1, 'forms/newpatient/new.php?autoloaded=1&calenc='),
123 'pre' => array(xl('Rx') , 1, 'patient_file/summary/rx_frameset.php'),
124 'iss' => array(xl('Issues') , 1, 'patient_file/summary/stats_full.php?active=all'),
125 'imm' => array(xl('Immunize') , 1, 'patient_file/summary/immunizations.php'),
126 'doc' => array(xl('Documents') , 1, '../controller.php?document&list&patient_id={PID}'),
127 'prp' => array(xl('Pt Report') , 1, 'patient_file/report/patient_report.php'),
128 'pno' => array(xl('Pt Notes') , 1, 'patient_file/summary/pnotes.php'),
129 'tra' => array(xl('Transact') , 1, 'patient_file/transaction/transactions.php'),
130 'sum' => array(xl('Summary') , 1, 'patient_file/summary/summary_bottom.php'),
131 'enc' => array(xl('Encounter') , 2, 'patient_file/encounter/encounter_top.php'),
132 'cod' => array(xl('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') ||
acl_check('admin', 'super') ||
143 acl_check('admin', 'superbill'));
145 $disallowed['bil'] = !(acl_check('acct', 'rep') ||
acl_check('acct', 'eob') ||
146 acl_check('acct', 'bill'));
148 $tmp = acl_check('patients', 'demo');
149 $disallowed['new'] = !($tmp == 'write' ||
$tmp == 'addonly');
151 if ( isset ($GLOBALS['hylafax_server']) && isset ($GLOBALS['scanner_output_directory']) ) {
152 $disallowed['fax'] = !($GLOBALS['hylafax_server'] ||
$GLOBALS['scanner_output_directory']);
155 $disallowed['ros'] = !$GLOBALS['athletic_team'];
157 $disallowed['iss'] = !((acl_check('encounters', 'notes') == 'write' ||
158 acl_check('encounters', 'notes_a') == 'write') &&
159 acl_check('patients', 'med') == 'write');
161 $disallowed['imp'] = $disallowed['new'] ||
162 !is_readable("$webserver_root/custom/import.php");
164 $disallowed['cht'] = !is_readable("$webserver_root/custom/chart_tracker.php");
166 $disallowed['pre'] = !(acl_check('patients', 'med'));
168 // Helper functions for treeview generation.
169 function genTreeLink($frame, $name, $title) {
170 global $primary_docs, $disallowed;
171 if (empty($disallowed[$name])) {
172 $id = $name . $primary_docs[$name][1];
173 echo "<li><a href='' id='$id' " .
174 "onclick=\"return loadFrame2('$id','$frame','" .
175 $primary_docs[$name][2] . "')\">" . $title . "</a></li>";
178 function genMiscLink($frame, $name, $level, $title, $url) {
179 global $primary_docs, $disallowed;
180 if (empty($disallowed[$name])) {
181 $id = $name . $level;
182 echo "<li><a href='' id='$id' " .
183 "onclick=\"return loadFrame2('$id','$frame','" .
184 $url . "')\">" . $title . "</a></li>";
187 function genPopLink($title, $url) {
188 echo "<li><a href='' " .
189 "onclick=\"return repPopup('$url')\"" .
190 ">" . $title . "</a></li>";
192 function genDualLink($topname, $botname, $title) {
193 global $primary_docs, $disallowed;
194 if (empty($disallowed[$topname]) && empty($disallowed[$botname])) {
195 $topid = $topname . $primary_docs[$topname][1];
196 $botid = $botname . $primary_docs[$botname][1];
197 echo "<li><a href='' id='$topid' " .
198 "onclick=\"return loadFrameDual('$topid','$botid','" .
199 $primary_docs[$topname][2] . "','" .
200 $primary_docs[$botname][2] . "')\">" . $title . "</a></li>";
204 function genPopupsList($style='') {
205 global $disallowed, $webserver_root;
207 <select name
='popups' onchange
='selpopup(this)' style
='background-color:transparent;font-size:9pt;<?php echo $style; ?>'>
208 <option value
=''><?php
xl('Popups','e'); ?
></option
>
209 <?php
if (!$disallowed['iss']) { ?
>
210 <option value
='../patient_file/problem_encounter.php'><?php
xl('Issues','e'); ?
></option
>
212 <option value
='../../custom/export_xml.php'><?php
xl('Export','e'); ?
></option
>
213 <option value
='../../custom/import_xml.php'><?php
xl('Import','e'); ?
></option
>
214 <?php
if ($GLOBALS['athletic_team']) { ?
>
215 <option value
='../reports/players_report.php'><?php
xl('Roster','e'); ?
></option
>
217 <option value
='../reports/appointments_report.php?patient=<?php echo $pid ?>'><?php
xl('Appts','e'); ?
></option
>
218 <?php
if (file_exists("$webserver_root/custom/refer.php")) { ?
>
219 <option value
='../../custom/refer.php'><?php
xl('Refer','e'); ?
></option
>
221 <?php
// if (file_exists("$webserver_root/custom/fee_sheet_codes.php")) { ?>
222 <option value
='../patient_file/printed_fee_sheet.php?fill=1'><?php
xl('Superbill','e'); ?
></option
>
224 <?php
if ($GLOBALS['inhouse_pharmacy']) { ?
>
225 <option value
='../patient_file/front_payment.php'><?php
xl('Prepay','e'); ?
></option
>
226 <option value
='../patient_file/pos_checkout.php'><?php
xl('Checkout','e'); ?
></option
>
228 <option value
='../patient_file/front_payment.php'><?php
xl('Payment','e'); ?
></option
>
230 <?php
if (is_dir("$webserver_root/custom/letter_templates")) { ?
>
231 <option value
='../patient_file/letter.php'><?php
xl('Letter','e'); ?
></option
>
240 <title
>Navigation
</title
>
241 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
243 <style type
="text/css">
247 padding
: 5px
3px
5px
3px
;
250 font
-family
:sans
-serif
;
254 a
.navitem
, a
.navitem
:visited
{
256 font
-family
:sans
-serif
;
267 border
-color
: #000000;
268 background
-color
:transparent
;
272 background
-color
:transparent
;
276 <link rel
="stylesheet" href
="../../library/js/jquery.treeview-1.3/jquery.treeview.css" />
277 <script src
="../../library/js/jquery-1.2.2.min.js" type
="text/javascript"></script
>
278 <script src
="../../library/js/jquery.treeview-1.3/jquery.treeview.min.js" type
="text/javascript"></script
>
280 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
282 <script language
='JavaScript'>
284 // Master values for current pid and encounter.
286 var active_encounter
= 0;
288 // Current selections in the top and bottom frames.
292 // Expand and/or collapse frames in response to checkbox clicks.
293 // fnum indicates which checkbox was clicked (1=left, 2=right).
294 function toggleFrame(fnum
) {
295 var f
= document
.forms
[0];
296 var fset
= top
.document
.getElementById('fsright');
297 if (!f
.cb_top
.checked
&& !f
.cb_bot
.checked
) {
298 if (fnum
== 1) f
.cb_bot
.checked
= true;
299 else f
.cb_top
.checked
= true;
301 var rows
= f
.cb_top
.checked ?
'*' : '0';
302 rows +
= f
.cb_bot
.checked ?
',*' : ',0';
307 // Load the specified url into the specified frame (RTop or RBot).
308 // The URL provided must be relative to interface.
309 function loadFrame(fname
, frame
, url
) {
310 top
.restoreSession();
311 var i
= url
.indexOf('{PID}');
312 if (i
>= 0) url
= url
.substring(0,i
) + active_pid + url
.substring(i+
5);
313 top
.frames
[frame
].location
= '<?php echo "$web_root/interface/" ?>' + url
;
314 if (frame
== 'RTop') topName
= fname
; else botName
= fname
;
317 // Load the specified url into a frame to be determined, with the specified
318 // frame as the default; the url must be relative to interface.
319 function loadFrame2(fname
, frame
, url
) {
320 var usage
= fname
.substring(3);
321 if (active_pid
== 0 && usage
> '0') {
322 alert('<?php xl('You must first select
or add a patient
.','e
') ?>');
325 if (active_encounter
== 0 && usage
> '1') {
326 alert('<?php xl('You must first select
or create an encounter
.','e
') ?>');
329 var f
= document
.forms
[0];
330 top
.restoreSession();
331 var i
= url
.indexOf('{PID}');
332 if (i
>= 0) url
= url
.substring(0,i
) + active_pid + url
.substring(i+
5);
333 var fi
= f
.sel_frame
.selectedIndex
;
334 if (fi
== 1) frame
= 'RTop'; else if (fi
== 2) frame
= 'RBot';
335 if (!f
.cb_bot
.checked
) frame
= 'RTop'; else if (!f
.cb_top
.checked
) frame
= 'RBot';
336 top
.frames
[frame
].location
= '<?php echo "$web_root/interface/" ?>' + url
;
337 if (frame
== 'RTop') topName
= fname
; else botName
= fname
;
341 // Make sure both frames are open.
342 function forceDual() {
343 var f
= document
.forms
[0];
344 if (!f
.cb_top
.checked
) {
345 f
.cb_top
.checked
= true;
348 if (!f
.cb_bot
.checked
) {
349 f
.cb_bot
.checked
= true;
354 // Load the specified url into a frame to be determined, with the specified
355 // frame as the default; the url must be relative to interface.
356 function loadFrameDual(tname
, bname
, topurl
, boturl
) {
357 var topusage
= tname
.substring(3);
358 var botusage
= bname
.substring(3);
359 if (active_pid
== 0 && (topusage
> '0' || botusage
> '0')) {
360 alert('<?php xl('You must first select
or add a patient
.','e
') ?>');
363 if (active_encounter
== 0 && (topusage
> '1' || botusage
> '1')) {
364 alert('<?php xl('You must first select
or create an encounter
.','e
') ?>');
367 var f
= document
.forms
[0];
369 top
.restoreSession();
370 var i
= topurl
.indexOf('{PID}');
371 if (i
>= 0) topurl
= topurl
.substring(0,i
) + active_pid + topurl
.substring(i+
5);
372 i
= boturl
.indexOf('{PID}');
373 if (i
>= 0) boturl
= boturl
.substring(0,i
) + active_pid + boturl
.substring(i+
5);
374 top
.frames
.RTop
.location
= '<?php echo "$web_root/interface/" ?>' + topurl
;
375 top
.frames
.RBot
.location
= '<?php echo "$web_root/interface/" ?>' + boturl
;
381 // Select a designated radio button. raname may be either the radio button
382 // array name (rb_top or rb_bot), or the frame name (RTop or RBot).
383 // You should call this if you directly load a document that does not
384 // correspond to the current radio button setting.
385 function setRadio(raname
, rbid
) {
386 <?php
if ($GLOBALS['concurrent_layout'] != 2) { ?
>
387 var f
= document
.forms
[0];
388 if (raname
== 'RTop') raname
= 'rb_top';
389 if (raname
== 'RBot') raname
= 'rb_bot';
390 for (var i
= 0; i
< f
[raname
].length
; ++i
) {
391 if (f
[raname
][i
].value
.substring(0,3) == rbid
) {
392 f
[raname
][i
].checked
= true;
400 // Set disabled/enabled state of radio buttons and associated labels
401 // depending on whether there is an active patient or encounter.
402 function syncRadios() {
403 var f
= document
.forms
[0];
404 <?php
if ($GLOBALS['concurrent_layout'] == 2) { ?
>
405 var nlinks
= document
.links
.length
;
406 for (var i
= 0; i
< nlinks
; ++i
) {
407 var lnk
= document
.links
[i
];
408 if (lnk
.id
.length
!= 4) continue;
409 var usage
= lnk
.id
.substring(3);
410 if (usage
== '1' || usage
== '2') {
412 if (active_pid
== 0) da
= true;
413 if (active_encounter
== 0 && usage
> '1') da
= true;
414 lnk
.style
.color
= da ?
'#888888' : '#0000ff';
418 for (var i
= 0; i
< f
.rb_top
.length
; ++i
) {
420 var rb1
= f
.rb_top
[i
];
421 var rb2
= f
.rb_bot
[i
];
422 var rbid
= rb1
.value
.substring(0,3);
423 var usage
= rb1
.value
.substring(3);
424 if (active_pid
== 0 && usage
> '0') da
= true;
425 if (active_encounter
== 0 && usage
> '1') da
= true;
426 // daemon_frame can also set special label colors, so don't mess with
427 // them unless we have to.
428 if (rb1
.disabled
!= da
) {
431 document
.getElementById('lbl_' + rbid
).style
.color
= da ?
'#888888' : '#000000';
435 f
.popups
.disabled
= (active_pid
== 0);
438 // Process the click to find a patient by name, id, ssn or dob.
439 function findPatient(findby
) {
440 var f
= document
.forms
[0];
441 if (! f
.cb_top
.checked
) {
442 f
.cb_top
.checked
= true;
445 f
.findBy
.value
= findby
;
446 setRadio('rb_top', 'dem');
447 top
.restoreSession();
448 document
.find_patient
.submit();
451 // Helper function to set the contents of a div.
452 function setSomeContent(id
, content
, doc
) {
453 if (doc
.getElementById
) {
454 var x
= doc
.getElementById(id
);
456 x
.innerHTML
= content
;
460 x
.innerHTML
= content
;
463 function setDivContent(id
, content
) {
464 setSomeContent(id
, content
, document
);
466 function setTitleContent(id
, content
) {
467 setSomeContent(id
, content
, parent
.Title
.document
);
470 // This is called automatically when a new patient is set, to make sure
471 // there are no patient-specific documents showing stale data. If a frame
472 // was just loaded with data for the correct patient, its name is passed so
473 // that it will not be zapped. At this point the new server-side pid is not
474 // assumed to be set, so this function will only load global data.
475 function reloadPatient(frname
) {
476 var f
= document
.forms
[0];
477 if (topName
.length
> 3 && topName
.substring(3) > '0' && frname
!= 'RTop') {
478 loadFrame('cal0','RTop', '<?php echo $primary_docs['cal
'][2]; ?>');
479 setRadio('rb_top', 'cal');
481 if (botName
.length
> 3 && botName
.substring(3) > '0' && frname
!= 'RBot') {
482 loadFrame('aun0','RBot', '<?php echo $primary_docs['aun
'][2]; ?>');
483 setRadio('rb_bot', 'aun');
487 // Reload encounter-specific frames, excluding a specified frame. At this
488 // point the new server-side encounter ID may not be set and loading the same
489 // document for the new encounter will not work, so load patient info instead.
490 function reloadEncounter(frname
) {
491 var f
= document
.forms
[0];
492 if (topName
.length
> 3 && topName
.substring(3) > '1' && frname
!= 'RTop') {
493 loadFrame('dem1','RTop', '<?php echo $primary_docs['dem
'][2]; ?>');
494 setRadio('rb_top', 'dem');
496 if (botName
.length
> 3 && botName
.substring(3) > '1' && frname
!= 'RBot') {
497 loadFrame('ens1','RBot', '<?php echo $primary_docs['ens
'][2]; ?>');
498 setRadio('rb_bot', 'ens');
502 // Call this to announce that the patient has changed. You must call this
503 // if you change the session PID, so that the navigation frame will show the
504 // correct patient and so that the other frame will be reloaded if it contains
505 // patient-specific information from the previous patient. frname is the name
506 // of the frame that the call came from, so we know to only reload content
507 // from the *other* frame if it is patient-specific.
508 function setPatient(pname
, pid
, pubpid
, frname
, str_dob
) {
509 var str
= '<b>' + pname +
' (' + pubpid +
')</b>';
510 setDivContent('current_patient', str
);
511 setTitleContent('current_patient', str + str_dob
);
512 if (pid
== active_pid
) return;
513 setDivContent('current_encounter', '<b><?php xl('None
','e
'); ?></b>');
515 active_encounter
= 0;
516 if (frname
) reloadPatient(frname
);
520 // Call this to announce that the encounter has changed. You must call this
521 // if you change the session encounter, so that the navigation frame will
522 // show the correct encounter and so that the other frame will be reloaded if
523 // it contains encounter-specific information from the previous encounter.
524 // frname is the name of the frame that the call came from, so we know to only
525 // reload encounter-specific content from the *other* frame.
526 function setEncounter(edate
, eid
, frname
) {
527 if (eid
== active_encounter
) return;
528 if (!eid
) edate
= '<?php xl('None
','e
'); ?>';
529 var str
= '<b>' + edate +
'</b>';
530 setDivContent('current_encounter', str
);
531 active_encounter
= eid
;
532 reloadEncounter(frname
);
536 // You must call this if you delete the active patient (or if for any other
537 // reason you "close" the active patient without opening a new one), so that
538 // the appearance of the navigation frame will be correct and so that any
539 // stale content will be reloaded.
540 function clearPatient() {
541 if (active_pid
== 0) return;
542 var f
= document
.forms
[0];
544 active_encounter
= 0;
545 setDivContent('current_encounter', '<b><?php xl('None
','e
'); ?></b>');
546 setDivContent('current_patient', '<b><?php xl('None
','e
'); ?></b>');
547 setTitleContent('current_patient', '<b><?php xl('None
','e
'); ?></b>');
552 // You must call this if you delete the active encounter (or if for any other
553 // reason you "close" the active encounter without opening a new one), so that
554 // the appearance of the navigation frame will be correct and so that any
555 // stale content will be reloaded.
556 function clearEncounter() {
557 if (active_encounter
== 0) return;
558 setDivContent('current_encounter', '<b><?php xl('None
','e
'); ?></b>');
559 active_encounter
= 0;
564 // You can call this to make sure the session pid is what we expect.
565 function pidSanityCheck(pid
) {
566 if (pid
!= active_pid
) {
567 alert('Session patient ID is ' + pid +
', expecting ' + active_pid +
568 '. This session is unstable and should be abandoned. Do not use ' +
569 'OpenEMR in multiple browser windows!');
575 // You can call this to make sure the session encounter is what we expect.
576 function encounterSanityCheck(eid
) {
577 if (eid
!= active_encounter
) {
578 alert('Session encounter ID is ' + eid +
', expecting ' + active_encounter +
579 '. This session is unstable and should be abandoned. Do not use ' +
580 'OpenEMR in multiple browser windows!');
587 function repPopup(aurl
) {
588 top
.restoreSession();
589 window
.open('<?php echo "$web_root/interface/reports/" ?>' + aurl
, '_blank', 'width=750,height=550,resizable=1,scrollbars=1');
593 // This is invoked to pop up some window when a popup item is selected.
594 function selpopup(selobj
) {
595 var i
= selobj
.selectedIndex
;
596 var opt
= selobj
.options
[i
];
600 if (opt
.text
== 'Export' || opt
.text
== 'Import') {
604 else if (opt
.text
== 'Refer') {
608 dlgopen(opt
.value
, '_blank', width
, height
);
610 selobj
.selectedIndex
= 0;
613 // Treeview activation stuff:
614 $
(document
).ready(function(){
615 $
("#navigation").treeview({
618 unique
: <?php
echo $GLOBALS['athletic_team'] ?
'false' : 'true' ?
>,
620 window
.console
&& console
.log("%o was toggled", this
);
629 <body
class="body_nav">
631 <form method
='post' name
='find_patient' target
='RTop'
632 action
='<?php echo $rootdir ?>/main/finder/patient_select.php'>
634 <?php
if ($GLOBALS['concurrent_layout'] == 2) { ?
>
637 <select name
='sel_frame' style
='background-color:transparent;font-size:9pt;width:<?php echo $GLOBALS['athletic_team
'] ? 47 : 100; ?>%;'>
638 <option value
='0'><?php
xl('Default','e'); ?
></option
>
639 <option value
='1'><?php
xl('Top','e'); ?
></option
>
640 <option value
='2'><?php
xl('Bottom','e'); ?
></option
>
642 <?php
if ($GLOBALS['athletic_team']) genPopupsList('width:47%'); ?
>
645 <table cellpadding
='0' cellspacing
='0' border
='0' width
='100%'>
647 <td
class='smalltext' nowrap
>
648 <input type
='checkbox' name
='cb_top' onclick
='toggleFrame(1)' checked
/>
649 <b
><?php
xl('Top','e') ?
></b
>
651 <td
class='smalltext' align
='right' nowrap
>
652 <b
><?php
xl('Bot','e') ?
></b
>
653 <input type
='checkbox' name
='cb_bot' onclick
='toggleFrame(2)' <?php
if (empty($GLOBALS['athletic_team'])) echo 'checked '; ?
>/>
658 <?php
if ($GLOBALS['athletic_team']) { // Tree menu for athletic teams ?>
661 <li
class="open"><span
><?php
xl('Patient/Client','e') ?
></span
>
663 <li
class="open"><span
><?php
xl('Demographics','e') ?
></span
>
665 <?php
genTreeLink('RTop','new',($GLOBALS['full_new_patient_form'] ?
xl('New/Search') : xl('New'))); ?
>
666 <?php
genTreeLink('RTop','dem',xl('Current')); ?
>
667 <?php
genDualLink('dem','sum',xl('Summary')); // with dem on top ?>
670 <li
class="open"><span
><?php
xl('Medical Records','e') ?
></span
>
672 <?php
genPopLink (xl('Team Roster'),'players_report.php'); ?
>
673 <?php
genDualLink('nen','ens',xl('New Consultation')); // with ens on bottom ?>
675 <?php
// genDualLink('enc','ens','Current Consultation'); // with ens on bottom ?>
676 <?php
genTreeLink('RTop','enc',xl('Current Consultation')); // encounter_top will itself load ens on bottom ?>
678 <?php
genDualLink('dem','ens',xl('Previous Consultations')); // with dem on top ?>
679 <?php
genDualLink('his','ens',xl('Previous History/Screening')); // with ens on bottom ?>
680 <?php
genTreeLink('RBot','nen',xl('New Allergy')); // nen with Allergy in chief complaint ?>
681 <?php
genTreeLink('RTop','iss',xl('Edit Allergies')); // somehow emphasizing allergies...? ?>
682 <?php
genTreeLink('RTop','his',xl('View Allergies')); // his page with Allergies section open ?>
683 <?php
genDualLink('iss','ens',xl('Problems/Issues')); // with ens on bottom ?>
684 <?php
genDualLink('tra','ens',xl('Transactions/Referrals')); // new transaction form on top and tra list on bottom (or ens if no tra) ?>
685 <?php
genDualLink('his','imm',xl('Immunizations')); // imm on bottom, his on top ?>
686 <?php
if (acl_check('patients', 'med')) genDualLink('his','pre',xl('Prescriptions')); // pre on bottom, his on top ?>
687 <?php
genTreeLink('RTop','doc',xl('Document/Imaging Store')); ?
>
688 <?php
genTreeLink('RTop','prp',xl('Patient Printed Report')); ?
>
689 <?php
genDualLink('dem','pno',xl('Additional Notes')); // with dem on top ?>
690 <li
><a href
='' onclick
="return repPopup('../patient_file/letter.php')" id
='prp1'>Letter
</a
></li
>
691 <?php
genPopLink('Address Book','../usergroup/addrbook_list.php?popup=1'); ?
>
694 <li
><span
><?php
xl('View','e') ?
></span
>
696 <?php
genTreeLink('RTop','cal',xl('Calendar View')); ?
>
697 <?php
genTreeLink('RTop','ros',xl('Team Roster View')); // default; and minimize lower frame ?>
698 <?php
genTreeLink('RTop','dem',xl('Current Patient')); // this also appears under Demographics ?>
703 <li
class="open"><span
><?php
xl('Reports','e') ?
></span
>
705 <li
class="open"><span
><?php
xl('Athletic/Injury','e') ?
></span
>
707 <?php
genTreeLink('RTop','prp',xl('Patient Printed Report')); // also appears above ?>
708 <?php
genPopLink(xl('Games/Events Missed'),'absences_report.php'); ?
>
709 <?php
genPopLink(xl('Injury Surveillance'),'football_injury_report.php'); ?
>
710 <?php
genPopLink(xl('Team Injury Overview'),'injury_overview_report.php'); ?
>
713 <li
><span
><?php
xl('Patient/Client','e') ?
></span
>
715 <?php
genPopLink('List','patient_list.php'); ?
>
716 <?php
if (acl_check('patients', 'med')) genPopLink(xl('Prescriptions'),'prescriptions_report.php'); ?
>
717 <?php
genPopLink(xl('Referrals'),'referrals_report.php'); ?
>
720 <li
><span
><?php
xl('Visits','e') ?
></span
>
722 <?php
genPopLink(xl('Appointments'),'appointments_report.php'); ?
>
723 <?php
genPopLink(xl('Encounters'),'encounters_report.php'); ?
>
724 <?php
genPopLink(xl('Appt-Enc'),'appt_encounter_report.php'); ?
>
727 <li
><span
><?php
xl('General','e') ?
></span
>
729 <?php
genPopLink(xl('Services'),'services_by_category.php'); ?
>
730 <?php
if ($GLOBALS['inhouse_pharmacy']) genPopLink(xl('Inventory'),'inventory_list.php'); ?
>
731 <?php
if ($GLOBALS['inhouse_pharmacy']) genPopLink(xl('Destroyed'),'destroyed_drugs_report.php'); ?
>
736 <li
><span
><?php
xl('Fees','e') ?
></span
>
738 <?php
genMiscLink('RBot','cod','2',xl('Fee Sheet'),'patient_file/encounter/load_form.php?formname=fee_sheet'); ?
>
739 <?php
genMiscLink('RBot','bil','1',xl('Checkout'),'patient_file/pos_checkout.php?framed=1'); ?
>
742 <?php
if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) genMiscLink('RTop','adm','0',xl('Inventory'),'drugs/drug_inventory.php'); ?
>
743 <li
><span
><?php
xl('Administration','e') ?
></span
>
745 <?php
if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0',xl('Users'),'usergroup/usergroup_admin.php'); ?
>
746 <?php
genTreeLink('RTop','pwd','Users Password Change'); ?
>
747 <?php
if (acl_check('admin', 'practice' )) genMiscLink('RTop','adm','0',xl('Practice'),'../controller.php?practice_settings'); ?
>
748 <?php
if (acl_check('admin', 'superbill')) genTreeLink('RTop','sup',xl('Services')); ?
>
749 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0',xl('Layouts'),'super/edit_layout.php'); ?
>
750 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0',xl('Lists'),'super/edit_list.php'); ?
>
751 <?php
if (acl_check('admin', 'acl' )) genMiscLink('RTop','adm','0',xl('ACL'),'usergroup/adminacl.php'); ?
>
752 <li
><span
><?php
xl('Other','e') ?
></span
>
754 <?php
if (acl_check('admin', 'forms' )) genMiscLink('RTop','adm','0',xl('Forms'),'forms_admin/forms_admin.php'); ?
>
755 <?php
if (acl_check('admin', 'calendar')) genMiscLink('RTop','adm','0',xl('Calendar'),'main/calendar/index.php?module=PostCalendar&type=admin&func=modifyconfig'); ?
>
756 <?php
if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0',xl('Logs'),'logview/logview.php'); ?
>
757 <?php
if (acl_check('admin', 'database')) genMiscLink('RTop','adm','0',xl('Database'),'../phpmyadmin/index.php'); ?
>
758 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0',xl('Backup'),'main/backup.php'); ?
>
763 <li
><span
><?php
xl('Miscellaneous','e') ?
></span
>
765 <?php
genTreeLink('RBot','aun',xl('Pt Notes/Auth')); ?
>
766 <?php
genTreeLink('RTop','fax',xl('Fax/Scan')); ?
>
767 <?php
genTreeLink('RTop','adb',xl('Addr Book')); ?
>
768 <?php
genTreeLink('RTop','ono',xl('Ofc Notes')); ?
>
769 <?php
genMiscLink('RTop','adm','0',xl('BatchCom'),'batchcom/batchcom.php'); ?
>
774 <?php
} else { // not athletic team ?>
777 <?php
if (!$GLOBALS['ippf_specific']) genTreeLink('RTop','cal',xl('Calendar')); ?
>
778 <li
class="open"><span
><?php
xl('Patient/Client','e') ?
></span
>
780 <li
><span
><?php
xl('Management','e') ?
></span
>
782 <?php
genTreeLink('RTop','new',($GLOBALS['full_new_patient_form'] ?
xl('New/Search') : xl('New'))); ?
>
783 <?php
genTreeLink('RTop','dem',xl('Current')); ?
>
784 <?php
genTreeLink('RBot','sum',xl('Summary')); ?
>
787 <li
class="open"><span
><?php
xl('Visits','e') ?
></span
>
789 <?php
if ($GLOBALS['ippf_specific']) genTreeLink('RTop','cal',xl('Calendar')); ?
>
790 <?php
genTreeLink('RBot','nen',xl('New Visit')); ?
>
791 <?php
genTreeLink('RBot','enc',xl('Current')); ?
>
792 <?php
genTreeLink('RBot','ens',xl('List')); ?
>
793 <?php
genTreeLink('RBot','tra',xl('Transact')); ?
>
794 <?php
genPopLink(xl('Chart Tracker'),'../../custom/chart_tracker.php'); ?
>
797 <li
><span
><?php
xl('Medical Record','e') ?
></span
>
799 <?php
if (acl_check('patients', 'med')) genTreeLink('RBot','pre',xl('Rx')); ?
>
800 <?php
genTreeLink('RTop','his',xl('History')); ?
>
801 <?php
genTreeLink('RTop','iss',xl('Issues')); ?
>
802 <?php
genTreeLink('RBot','imm',xl('Immunize')); ?
>
803 <?php
genTreeLink('RTop','doc',xl('Documents')); ?
>
804 <?php
genTreeLink('RBot','pno',xl('Notes')); ?
>
805 <?php
genTreeLink('RTop','prp',xl('Report')); ?
>
810 <li
><span
><?php
xl('Fees','e') ?
></span
>
812 <?php
genMiscLink('RBot','cod','2',xl('Fee Sheet'),'patient_file/encounter/load_form.php?formname=fee_sheet'); ?
>
813 <?php
if (false) genTreeLink('RBot','cod',xl('Charges')); ?
>
814 <?php
genMiscLink('RBot','bil','1',xl('Checkout'),'patient_file/pos_checkout.php?framed=1'); ?
>
815 <?php
if (! $GLOBALS['simplified_demographics']) genTreeLink('RTop','bil',xl('Billing')); ?
>
818 <?php
if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) genMiscLink('RTop','adm','0',xl('Inventory'),'drugs/drug_inventory.php'); ?
>
819 <?php
if (!$disallowed['adm']) { ?
>
820 <li
><span
><?php
xl('Administration','e') ?
></span
>
822 <?php
if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0',xl('Users'),'usergroup/usergroup_admin.php'); ?
>
823 <?php
if (acl_check('admin', 'practice' )) genMiscLink('RTop','adm','0',xl('Practice'),'../controller.php?practice_settings'); ?
>
824 <?php
if (acl_check('admin', 'superbill')) genTreeLink('RTop','sup',xl('Services')); ?
>
825 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0',xl('Layouts'),'super/edit_layout.php'); ?
>
826 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0',xl('Lists'),'super/edit_list.php'); ?
>
827 <?php
if (acl_check('admin', 'acl' )) genMiscLink('RTop','adm','0',xl('ACL'),'usergroup/adminacl.php'); ?
>
828 <?php
if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0',xl('Backup'),'main/backup.php'); ?
>
829 <?php
if (acl_check('admin', 'super') && !empty($GLOBALS['code_types']['IPPF'])) genMiscLink('RTop','adm','0',xl('Export'),'main/ippf_export.php'); ?
>
830 <li
><span
><?php
xl('Other','e') ?
></span
>
832 <?php
if (acl_check('admin', 'language')) genMiscLink('RTop','adm','0',xl('Language'),'language/language.php'); ?
>
833 <?php
if (acl_check('admin', 'forms' )) genMiscLink('RTop','adm','0',xl('Forms'),'forms_admin/forms_admin.php'); ?
>
834 <?php
if (acl_check('admin', 'calendar')) genMiscLink('RTop','adm','0',xl('Calendar'),'main/calendar/index.php?module=PostCalendar&type=admin&func=modifyconfig'); ?
>
835 <?php
if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0',xl('Logs'),'logview/logview.php'); ?
>
836 <?php
if (acl_check('admin', 'database')) genMiscLink('RTop','adm','0',xl('Database'),'../phpmyadmin/index.php'); ?
>
842 <li
><span
><?php
xl('Reports','e') ?
></span
>
844 <li
><span
><?php
xl('Clients','e') ?
></span
>
846 <?php
genPopLink(xl('List'),'patient_list.php'); ?
>
847 <?php
if (acl_check('patients', 'med')) genPopLink(xl('Rx'),'prescriptions_report.php'); ?
>
848 <?php
genPopLink(xl('Referrals'),'referrals_report.php'); ?
>
851 <li
class="open"><span
><?php
xl('Visits','e') ?
></span
>
853 <?php
genPopLink(xl('Appointments'),'appointments_report.php'); ?
>
854 <?php
genPopLink(xl('Encounters'),'encounters_report.php'); ?
>
855 <?php
genPopLink(xl('Appt-Enc'),'appt_encounter_report.php'); ?
>
856 <?php
if (empty($GLOBALS['code_types']['IPPF'])) { ?
>
857 <?php
genPopLink(xl('Superbill'),'custom_report_range.php'); ?
>
859 <?php
genPopLink(xl('Chart Activity'),'chart_location_activity.php'); ?
>
860 <?php
genPopLink(xl('Charts Out'),'charts_checked_out.php'); ?
>
863 <?php
if (acl_check('acct', 'rep_a')) { ?
>
864 <li
><span
><?php
xl('Financial','e') ?
></span
>
866 <?php
genPopLink(xl('Sales'),'sales_by_item.php'); ?
>
867 <?php
genPopLink(xl('Cash Rec'),'../billing/sl_receipts_report.php'); ?
>
868 <?php
genPopLink(xl('Front Rec'),'front_receipts_report.php'); ?
>
869 <?php
genPopLink(xl('Pmt Method'),'receipts_by_method_report.php'); ?
>
870 <?php
genPopLink(xl('Collections'),'collections_report.php'); ?
>
874 <li
><span
><?php
xl('General','e') ?
></span
>
876 <?php
genPopLink(xl('Services'),'services_by_category.php'); ?
>
877 <?php
if ($GLOBALS['inhouse_pharmacy']) genPopLink(xl('Inventory'),'inventory_list.php'); ?
>
878 <?php
if ($GLOBALS['inhouse_pharmacy']) genPopLink(xl('Destroyed'),'destroyed_drugs_report.php'); ?
>
881 <?php
if (! $GLOBALS['simplified_demographics']) { ?
>
882 <li
><span
><?php
xl('Insurance','e') ?
></span
>
884 <?php
genPopLink(xl('Distribution'),'insurance_allocation_report.php'); ?
>
885 <?php
genPopLink(xl('Indigents'),'../billing/indigent_patients_report.php'); ?
>
886 <?php
genPopLink(xl('Unique SP'),'unique_seen_patients_report.php'); ?
>
890 <?php
if (!empty($GLOBALS['code_types']['IPPF'])) { ?
>
891 <li
><span
><?php
xl('Statistics','e') ?
></span
>
893 <?php
genPopLink('IPPF Stats','ippf_statistics.php?t=i'); ?
>
894 <?php
genPopLink('GCAC Stats','ippf_statistics.php?t=g'); ?
>
895 <?php
genPopLink('MA Stats','ippf_statistics.php?t=m'); ?
>
896 <?php
genPopLink('CYP','ippf_cyp_report.php'); ?
>
897 <?php
genPopLink('Daily Record','ippf_daily.php'); ?
>
900 <li
><span
><?php
xl('Blank Forms','e') ?
></span
>
902 <?php
genPopLink(xl('Demographics'),'../patient_file/summary/demographics_print.php'); ?
>
903 <?php
genPopLink(xl('Fee Sheet'),'../patient_file/printed_fee_sheet.php'); ?
>
904 <?php
genPopLink(xl('Referral'),'../patient_file/transaction/print_referral.php'); ?
>
908 <?php
// genTreeLink('RTop','rep','Other'); ?>
911 <li
><span
><?php
xl('Miscellaneous','e') ?
></span
>
913 <?php
genTreeLink('RBot','aun',xl('Pt Notes/Auth')); ?
>
914 <?php
genTreeLink('RTop','fax',xl('Fax/Scan')); ?
>
915 <?php
genTreeLink('RTop','adb',xl('Addr Book')); ?
>
916 <?php
genTreeLink('RTop','cht',xl('Chart Tracker')); ?
>
917 <?php
genTreeLink('RTop','ono',xl('Ofc Notes')); ?
>
918 <?php
genMiscLink('RTop','adm','0',xl('BatchCom'),'batchcom/batchcom.php'); ?
>
919 <?php
genTreeLink('RTop','pwd',xl('Password')); ?
>
924 <?php
} // end not athletic team ?>
926 <?php
} else { // end ($GLOBALS['concurrent_layout'] == 2) ?>
928 <table cellpadding
='0' cellspacing
='0' border
='0'>
931 <table cellpadding
='0' cellspacing
='0' border
='0' width
='100%'>
933 <td
class='smalltext' nowrap
>
934 <input type
='checkbox' name
='cb_top' onclick
='toggleFrame(1)' checked
/><b
><?php
xl('Top','e') ?
></b
>
936 <td
class='smalltext' align
='right' nowrap
>
937 <b
><?php
xl('Bot','e') ?
></b
><input type
='checkbox' name
='cb_bot' onclick
='toggleFrame(2)' checked
/>
944 // Builds the table of radio buttons and their labels. Radio button values
945 // are comprised of the 3-character document id and the 1-digit usage type,
946 // so that JavaScript can easily access this information.
947 $default_top_rbid = $GLOBALS['athletic_team'] ?
'ros' : 'cal';
948 foreach ($primary_docs as $key => $varr) {
949 if (!empty($disallowed[$key])) continue;
954 echo " <td class='smalltext'><input type='radio' name='rb_top' value='$key$usage' " .
955 "onclick=\"loadFrame('$key$usage','RTop','$url')\"";
956 if ($key == $default_top_rbid) echo " checked";
958 echo " <td class='smalltext' id='lbl_$key'>$label</td>\n";
959 echo " <td class='smalltext'><input type='radio' name='rb_bot' value='$key$usage' " .
960 "onclick=\"loadFrame('$key$usage','RBot','$url')\"";
961 if ($key == 'aun') echo " checked";
973 // To use RelayHealth, see comments and parameters in includes/config.php.
974 if (!empty($GLOBALS['ssi']['rh'])) {
975 include_once("../../library/ssi.inc");
976 echo getRelayHealthLink() ."<br /><hr />\n";
980 <?php
xl('Active Patient','e') ?
>:<br
/>
981 <div id
='current_patient'>
982 <b
><?php
xl('None','e'); ?
></b
>
985 <?php
xl('Active Encounter','e') ?
>:<br
/>
986 <div id
='current_encounter'>
987 <b
><?php
xl('None','e'); ?
></b
>
990 <?php
if (!$GLOBALS['athletic_team']) genPopupsList(); ?
>
994 <table cellpadding
='0' cellspacing
='0' border
='0'>
996 <td
class='smalltext'><?php
xl('Find','e') ?
>: 
;</td
>
997 <td
class='smalltext' colspan
='2'>
998 <input type
="entry" size
="7" name
="patient" class='inputtext' style
='width:65px;' />
1002 <td
class='smalltext'><?php
xl('by','e') ?
>:</td
>
1003 <td
class='smalltext'>
1004 <a href
="javascript:findPatient('Last');" class="navitem"><?php
xl('Name','e'); ?
></a
>
1006 <td
class='smalltext' align
='right'>
1007 <a href
="javascript:findPatient('ID');" class="navitem"><?php
xl('ID','e'); ?
></a
>
1011 <td
class='smalltext'> 
;</td
>
1012 <td
class='smalltext'>
1013 <a href
="javascript:findPatient('SSN');" class="navitem"><?php
xl('SSN','e'); ?
></a
>
1015 <td
class='smalltext' align
='right'>
1016 <a href
="javascript:findPatient('DOB');" class="navitem"><?php
xl('DOB','e'); ?
></a
>
1022 <a href
="../logout.php?auth=logout" target
="_top" class="navitem" id
="logout_link"
1023 onclick
="top.restoreSession()">
1024 <?php
xl('Logout','e'); ?
></a
>
1027 <a href
="../../Documentation/User_Guide/" target
="_blank" class="navitem" id
="help_link"
1028 onclick
="top.restoreSession()">
1029 <?php
xl('Help','e'); ?
></a
>
1031 <input type
='hidden' name
='findBy' value
='Last' />
1035 <script language
='JavaScript'>