more bug fixes
[openemr.git] / interface / main / left_nav.php
blob0ab71d1a8ed310a4691691aada3148e608ad9328
1 <?php
2 // Copyright (C) 2006, 2008 Rod Roark <rod@sunsetsystems.com>
3 //
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
14 // is selected.
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
28 // as requested.
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
49 // changes.
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
57 // changes.
58 // * interface/patient_file/encounter/superbill_custom_full.php: target and
59 // link changes.
60 // * interface/patient_file/encounter/diagnosis.php: target changes.
61 // * interface/patient_file/encounter/diagnosis_full.php: target and link
62 // changes.
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("../../library/acl.inc");
89 include_once("../../custom/code_types.inc.php");
91 // This array defines the list of primary documents that may be
92 // chosen. Each element value is an array of 3 values:
94 // * Name to appear in the navigation table
95 // * Usage: 0 = global, 1 = patient-specific, 2 = encounter-specific
96 // * The URL relative to the interface directory
99 // larry :: dbc insert
100 $demovarbase = ( $GLOBALS['dutchpc'] ) ? 'demographics_dutch.php' : 'demographics.php';
101 // larry :: end of dbc insert
103 $primary_docs = array(
104 'ros' => array('Roster' , 0, 'reports/players_report.php?embed=1'),
105 'cal' => array('Calendar' , 0, 'main/main_info.php'),
106 'pwd' => array('Password' , 0, 'usergroup/user_info.php'),
107 'adm' => array('Admin' , 0, 'usergroup/admin_frameset.php'),
108 'rep' => array('Reports' , 0, 'reports/index.php'),
109 'ono' => array('Ofc Notes' , 0, 'main/onotes/office_comments.php'),
110 'fax' => array('Fax/Scan' , 0, 'fax/faxq.php'),
111 'adb' => array('Addr Bk' , 0, 'usergroup/addrbook_list.php'),
112 'cht' => array('Chart Trk' , 0, '../custom/chart_tracker.php'),
113 'imp' => array('Import' , 0, '../custom/import.php'),
114 'bil' => array('Billing' , 0, 'billing/billing_report.php'),
115 'sup' => array('Superbill' , 0, 'patient_file/encounter/superbill_custom_full.php'),
116 'aun' => array('Auth/notes', 0, 'main/authorizations/authorizations.php'),
117 'new' => array('New Pt' , 0, 'new/new.php'),
118 'dem' => array('Patient' , 1, "patient_file/summary/$demovarbase"),
119 'his' => array('History' , 1, 'patient_file/history/history.php'),
120 'ens' => array('Encounters', 1, 'patient_file/history/encounters.php'),
121 'nen' => array('New Enctr' , 1, 'forms/newpatient/new.php?autoloaded=1&calenc='),
122 'pre' => array('Rx' , 1, 'patient_file/summary/rx_frameset.php'),
123 'iss' => array('Issues' , 1, 'patient_file/summary/stats_full.php?active=all'),
124 'imm' => array('Immunize' , 1, 'patient_file/summary/immunizations.php'),
125 'doc' => array('Documents' , 1, '../controller.php?document&list&patient_id={PID}'),
126 'prp' => array('Pt Report' , 1, 'patient_file/report/patient_report.php'),
127 'pno' => array('Pt Notes' , 1, 'patient_file/summary/pnotes.php'),
128 'tra' => array('Transact' , 1, 'patient_file/transaction/transactions.php'),
129 'sum' => array('Summary' , 1, 'patient_file/summary/summary_bottom.php'),
130 'enc' => array('Encounter' , 2, 'patient_file/encounter/encounter_top.php'),
131 'cod' => array('Charges' , 2, 'patient_file/encounter/encounter_bottom.php'),
134 // This section decides which navigation items will not appear.
136 $disallowed = array();
138 $disallowed['adm'] = !(acl_check('admin', 'calendar') ||
139 acl_check('admin', 'database') || acl_check('admin', 'forms') ||
140 acl_check('admin', 'practice') || acl_check('admin', 'users') ||
141 acl_check('admin', 'acl'));
143 $disallowed['bil'] = !(acl_check('acct', 'rep') || acl_check('acct', 'eob') ||
144 acl_check('acct', 'bill'));
146 $tmp = acl_check('patients', 'demo');
147 $disallowed['new'] = !($tmp == 'write' || $tmp == 'addonly');
149 if ( isset ($GLOBALS['hylafax_server']) && isset ($GLOBALS['scanner_output_directory']) ) {
150 $disallowed['fax'] = !($GLOBALS['hylafax_server'] || $GLOBALS['scanner_output_directory']);
153 $disallowed['ros'] = !$GLOBALS['athletic_team'];
155 $disallowed['iss'] = !((acl_check('encounters', 'notes') == 'write' ||
156 acl_check('encounters', 'notes_a') == 'write') &&
157 acl_check('patients', 'med') == 'write');
159 $disallowed['imp'] = $disallowed['new'] ||
160 !is_readable("$webserver_root/custom/import.php");
162 $disallowed['cht'] = !is_readable("$webserver_root/custom/chart_tracker.php");
164 // Helper functions for treeview generation.
165 function genTreeLink($frame, $name, $title) {
166 global $primary_docs, $disallowed;
167 if (empty($disallowed[$name])) {
168 $id = $name . $primary_docs[$name][1];
169 echo "<li><a href='' id='$id' " .
170 "onclick=\"return loadFrame2('$id','$frame','" .
171 $primary_docs[$name][2] . "')\">" . xl($title) . "</a></li>";
174 function genMiscLink($frame, $name, $level, $title, $url) {
175 global $primary_docs, $disallowed;
176 if (empty($disallowed[$name])) {
177 $id = $name . $level;
178 echo "<li><a href='' id='$id' " .
179 "onclick=\"return loadFrame2('$id','$frame','" .
180 $url . "')\">" . xl($title) . "</a></li>";
183 function genPopLink($title, $url) {
184 echo "<li><a href='' " .
185 "onclick=\"return repPopup('$url')\"" .
186 ">" . xl($title) . "</a></li>";
188 function genDualLink($topname, $botname, $title) {
189 global $primary_docs, $disallowed;
190 if (empty($disallowed[$topname]) && empty($disallowed[$botname])) {
191 $topid = $topname . $primary_docs[$topname][1];
192 $botid = $botname . $primary_docs[$botname][1];
193 echo "<li><a href='' id='$topid' " .
194 "onclick=\"return loadFrameDual('$topid','$botid','" .
195 $primary_docs[$topname][2] . "','" .
196 $primary_docs[$botname][2] . "')\">" . xl($title) . "</a></li>";
200 function genPopupsList($style='') {
201 global $disallowed, $webserver_root;
203 <select name='popups' onchange='selpopup(this)' style='background-color:transparent;font-size:9pt;<?php echo $style; ?>'>
204 <option value=''><?php xl('Popups','e'); ?></option>
205 <?php if (!$disallowed['iss']) { ?>
206 <option value='../patient_file/problem_encounter.php'><?php xl('Issues','e'); ?></option>
207 <?php } ?>
208 <option value='../../custom/export_xml.php'><?php xl('Export','e'); ?></option>
209 <option value='../../custom/import_xml.php'><?php xl('Import','e'); ?></option>
210 <?php if ($GLOBALS['athletic_team']) { ?>
211 <option value='../reports/players_report.php'><?php xl('Roster','e'); ?></option>
212 <?php } ?>
213 <option value='../reports/appointments_report.php?patient=<?php echo $pid ?>'><?php xl('Appts','e'); ?></option>
214 <?php if (file_exists("$webserver_root/custom/refer.php")) { ?>
215 <option value='../../custom/refer.php'><?php xl('Refer','e'); ?></option>
216 <?php } ?>
217 <?php // if (file_exists("$webserver_root/custom/fee_sheet_codes.php")) { ?>
218 <option value='../patient_file/printed_fee_sheet.php'><?php xl('Superbill','e'); ?></option>
219 <?php // } ?>
220 <?php if ($GLOBALS['inhouse_pharmacy']) { ?>
221 <option value='../patient_file/front_payment.php'><?php xl('Prepay','e'); ?></option>
222 <option value='../patient_file/pos_checkout.php'><?php xl('Checkout','e'); ?></option>
223 <?php } else { ?>
224 <option value='../patient_file/front_payment.php'><?php xl('Payment','e'); ?></option>
225 <?php } ?>
226 <?php if (is_dir("$webserver_root/custom/letter_templates")) { ?>
227 <option value='../patient_file/letter.php'><?php xl('Letter','e'); ?></option>
228 <?php } ?>
229 </select>
230 <?php
234 <html>
235 <head>
236 <title>Navigation</title>
237 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
239 <style type="text/css">
240 body {
241 font-size:8pt;
242 font-weight:normal;
243 padding: 5px 3px 5px 3px;
245 .smalltext {
246 font-family:sans-serif;
247 font-size:8pt;
248 font-weight:normal;
250 a.navitem, a.navitem:visited {
251 color:#0000ff;
252 font-family:sans-serif;
253 font-size:8pt;
254 font-weight:bold;
256 .inputtext {
257 font-size:9pt;
258 font-weight:normal;
259 border-style:solid;
260 border-width:1px;
261 padding-left:2px;
262 padding-right:2px;
263 border-color: #000000;
264 background-color:transparent;
267 #navigation ul {
268 background-color:transparent;
270 </style>
272 <link rel="stylesheet" href="../../library/js/jquery.treeview-1.3/jquery.treeview.css" />
273 <script src="../../library/js/jquery-1.2.2.min.js" type="text/javascript"></script>
274 <script src="../../library/js/jquery.treeview-1.3/jquery.treeview.min.js" type="text/javascript"></script>
276 <script type="text/javascript" src="../../library/dialog.js"></script>
278 <script language='JavaScript'>
280 // Master values for current pid and encounter.
281 var active_pid = 0;
282 var active_encounter = 0;
284 // Current selections in the top and bottom frames.
285 var topName = '';
286 var botName = '';
288 // Expand and/or collapse frames in response to checkbox clicks.
289 // fnum indicates which checkbox was clicked (1=left, 2=right).
290 function toggleFrame(fnum) {
291 var f = document.forms[0];
292 var fset = top.document.getElementById('fsright');
293 if (!f.cb_top.checked && !f.cb_bot.checked) {
294 if (fnum == 1) f.cb_bot.checked = true;
295 else f.cb_top.checked = true;
297 var rows = f.cb_top.checked ? '*' : '0';
298 rows += f.cb_bot.checked ? ',*' : ',0';
299 fset.rows = rows;
300 fset.rows = rows;
303 // Load the specified url into the specified frame (RTop or RBot).
304 // The URL provided must be relative to interface.
305 function loadFrame(fname, frame, url) {
306 top.restoreSession();
307 var i = url.indexOf('{PID}');
308 if (i >= 0) url = url.substring(0,i) + active_pid + url.substring(i+5);
309 top.frames[frame].location = '<?php echo "$web_root/interface/" ?>' + url;
310 if (frame == 'RTop') topName = fname; else botName = fname;
313 // Load the specified url into a frame to be determined, with the specified
314 // frame as the default; the url must be relative to interface.
315 function loadFrame2(fname, frame, url) {
316 var usage = fname.substring(3);
317 if (active_pid == 0 && usage > '0') {
318 alert('<?php xl('You must first select or add a patient.','e') ?>');
319 return false;
321 if (active_encounter == 0 && usage > '1') {
322 alert('<?php xl('You must first select or create an encounter.','e') ?>');
323 return false;
325 var f = document.forms[0];
326 top.restoreSession();
327 var i = url.indexOf('{PID}');
328 if (i >= 0) url = url.substring(0,i) + active_pid + url.substring(i+5);
329 var fi = f.sel_frame.selectedIndex;
330 if (fi == 1) frame = 'RTop'; else if (fi == 2) frame = 'RBot';
331 if (!f.cb_bot.checked) frame = 'RTop'; else if (!f.cb_top.checked) frame = 'RBot';
332 top.frames[frame].location = '<?php echo "$web_root/interface/" ?>' + url;
333 if (frame == 'RTop') topName = fname; else botName = fname;
334 return false;
337 // Make sure both frames are open.
338 function forceDual() {
339 var f = document.forms[0];
340 if (!f.cb_top.checked) {
341 f.cb_top.checked = true;
342 toggleFrame(1);
344 if (!f.cb_bot.checked) {
345 f.cb_bot.checked = true;
346 toggleFrame(2);
350 // Load the specified url into a frame to be determined, with the specified
351 // frame as the default; the url must be relative to interface.
352 function loadFrameDual(tname, bname, topurl, boturl) {
353 var topusage = tname.substring(3);
354 var botusage = bname.substring(3);
355 if (active_pid == 0 && (topusage > '0' || botusage > '0')) {
356 alert('<?php xl('You must first select or add a patient.','e') ?>');
357 return false;
359 if (active_encounter == 0 && (topusage > '1' || botusage > '1')) {
360 alert('<?php xl('You must first select or create an encounter.','e') ?>');
361 return false;
363 var f = document.forms[0];
364 forceDual();
365 top.restoreSession();
366 var i = topurl.indexOf('{PID}');
367 if (i >= 0) topurl = topurl.substring(0,i) + active_pid + topurl.substring(i+5);
368 i = boturl.indexOf('{PID}');
369 if (i >= 0) boturl = boturl.substring(0,i) + active_pid + boturl.substring(i+5);
370 top.frames.RTop.location = '<?php echo "$web_root/interface/" ?>' + topurl;
371 top.frames.RBot.location = '<?php echo "$web_root/interface/" ?>' + boturl;
372 topName = tname;
373 botName = bname;
374 return false;
377 // Select a designated radio button. raname may be either the radio button
378 // array name (rb_top or rb_bot), or the frame name (RTop or RBot).
379 // You should call this if you directly load a document that does not
380 // correspond to the current radio button setting.
381 function setRadio(raname, rbid) {
382 <?php if ($GLOBALS['concurrent_layout'] != 2) { ?>
383 var f = document.forms[0];
384 if (raname == 'RTop') raname = 'rb_top';
385 if (raname == 'RBot') raname = 'rb_bot';
386 for (var i = 0; i < f[raname].length; ++i) {
387 if (f[raname][i].value.substring(0,3) == rbid) {
388 f[raname][i].checked = true;
389 return true;
392 <?php } ?>
393 return false;
396 // Set disabled/enabled state of radio buttons and associated labels
397 // depending on whether there is an active patient or encounter.
398 function syncRadios() {
399 var f = document.forms[0];
400 <?php if ($GLOBALS['concurrent_layout'] == 2) { ?>
401 var nlinks = document.links.length;
402 for (var i = 0; i < nlinks; ++i) {
403 var lnk = document.links[i];
404 if (lnk.id.length != 4) continue;
405 var usage = lnk.id.substring(3);
406 if (usage == '1' || usage == '2') {
407 var da = false;
408 if (active_pid == 0) da = true;
409 if (active_encounter == 0 && usage > '1') da = true;
410 lnk.style.color = da ? '#888888' : '#0000ff';
413 <?php } else { ?>
414 for (var i = 0; i < f.rb_top.length; ++i) {
415 var da = false;
416 var rb1 = f.rb_top[i];
417 var rb2 = f.rb_bot[i];
418 var rbid = rb1.value.substring(0,3);
419 var usage = rb1.value.substring(3);
420 if (active_pid == 0 && usage > '0') da = true;
421 if (active_encounter == 0 && usage > '1') da = true;
422 // daemon_frame can also set special label colors, so don't mess with
423 // them unless we have to.
424 if (rb1.disabled != da) {
425 rb1.disabled = da;
426 rb2.disabled = da;
427 document.getElementById('lbl_' + rbid).style.color = da ? '#888888' : '#000000';
430 <?php } ?>
431 f.popups.disabled = (active_pid == 0);
434 // Process the click to find a patient by name, id, ssn or dob.
435 function findPatient(findby) {
436 var f = document.forms[0];
437 if (! f.cb_top.checked) {
438 f.cb_top.checked = true;
439 toggleFrame(1);
441 f.findBy.value = findby;
442 setRadio('rb_top', 'dem');
443 top.restoreSession();
444 document.find_patient.submit();
447 // Helper function to set the contents of a div.
448 function setSomeContent(id, content, doc) {
449 if (doc.getElementById) {
450 var x = doc.getElementById(id);
451 x.innerHTML = '';
452 x.innerHTML = content;
454 else if (doc.all) {
455 var x = doc.all[id];
456 x.innerHTML = content;
459 function setDivContent(id, content) {
460 setSomeContent(id, content, document);
462 function setTitleContent(id, content) {
463 setSomeContent(id, content, parent.Title.document);
466 // This is called automatically when a new patient is set, to make sure
467 // there are no patient-specific documents showing stale data. If a frame
468 // was just loaded with data for the correct patient, its name is passed so
469 // that it will not be zapped. At this point the new server-side pid is not
470 // assumed to be set, so this function will only load global data.
471 function reloadPatient(frname) {
472 var f = document.forms[0];
473 if (topName.length > 3 && topName.substring(3) > '0' && frname != 'RTop') {
474 loadFrame('cal0','RTop', '<?php echo $primary_docs['cal'][2]; ?>');
475 setRadio('rb_top', 'cal');
477 if (botName.length > 3 && botName.substring(3) > '0' && frname != 'RBot') {
478 loadFrame('aun0','RBot', '<?php echo $primary_docs['aun'][2]; ?>');
479 setRadio('rb_bot', 'aun');
483 // Reload encounter-specific frames, excluding a specified frame. At this
484 // point the new server-side encounter ID may not be set and loading the same
485 // document for the new encounter will not work, so load patient info instead.
486 function reloadEncounter(frname) {
487 var f = document.forms[0];
488 if (topName.length > 3 && topName.substring(3) > '1' && frname != 'RTop') {
489 loadFrame('dem1','RTop', '<?php echo $primary_docs['dem'][2]; ?>');
490 setRadio('rb_top', 'dem');
492 if (botName.length > 3 && botName.substring(3) > '1' && frname != 'RBot') {
493 loadFrame('ens1','RBot', '<?php echo $primary_docs['ens'][2]; ?>');
494 setRadio('rb_bot', 'ens');
498 // Call this to announce that the patient has changed. You must call this
499 // if you change the session PID, so that the navigation frame will show the
500 // correct patient and so that the other frame will be reloaded if it contains
501 // patient-specific information from the previous patient. frname is the name
502 // of the frame that the call came from, so we know to only reload content
503 // from the *other* frame if it is patient-specific.
504 function setPatient(pname, pid, pubpid, frname) {
505 var str = '<b>' + pname + ' (' + pubpid + ')</b>';
506 setDivContent('current_patient', str);
507 setTitleContent('current_patient', str);
508 if (pid == active_pid) return;
509 setDivContent('current_encounter', '<b>None</b>');
510 active_pid = pid;
511 active_encounter = 0;
512 if (frname) reloadPatient(frname);
513 syncRadios();
516 // Call this to announce that the encounter has changed. You must call this
517 // if you change the session encounter, so that the navigation frame will
518 // show the correct encounter and so that the other frame will be reloaded if
519 // it contains encounter-specific information from the previous encounter.
520 // frname is the name of the frame that the call came from, so we know to only
521 // reload encounter-specific content from the *other* frame.
522 function setEncounter(edate, eid, frname) {
523 if (eid == active_encounter) return;
524 if (!eid) edate = 'None';
525 var str = '<b>' + edate + '</b>';
526 setDivContent('current_encounter', str);
527 active_encounter = eid;
528 reloadEncounter(frname);
529 syncRadios();
532 // You must call this if you delete the active patient (or if for any other
533 // reason you "close" the active patient without opening a new one), so that
534 // the appearance of the navigation frame will be correct and so that any
535 // stale content will be reloaded.
536 function clearPatient() {
537 if (active_pid == 0) return;
538 var f = document.forms[0];
539 active_pid = 0;
540 active_encounter = 0;
541 setDivContent('current_encounter', '<b>None</b>');
542 setDivContent('current_patient', '<b>None</b>');
543 setTitleContent('current_patient', '<b>None</b>');
544 reloadPatient('');
545 syncRadios();
548 // You must call this if you delete the active encounter (or if for any other
549 // reason you "close" the active encounter without opening a new one), so that
550 // the appearance of the navigation frame will be correct and so that any
551 // stale content will be reloaded.
552 function clearEncounter() {
553 if (active_encounter == 0) return;
554 setDivContent('current_encounter', '<b>None</b>');
555 active_encounter = 0;
556 reloadEncounter('');
557 syncRadios();
560 // You can call this to make sure the session pid is what we expect.
561 function pidSanityCheck(pid) {
562 if (pid != active_pid) {
563 alert('Session patient ID is ' + pid + ', expecting ' + active_pid +
564 '. This session is unstable and should be abandoned. Do not use ' +
565 'OpenEMR in multiple browser windows!');
566 return false;
568 return true;
571 // You can call this to make sure the session encounter is what we expect.
572 function encounterSanityCheck(eid) {
573 if (eid != active_encounter) {
574 alert('Session encounter ID is ' + eid + ', expecting ' + active_encounter +
575 '. This session is unstable and should be abandoned. Do not use ' +
576 'OpenEMR in multiple browser windows!');
577 return false;
579 return true;
582 // Pop up a report.
583 function repPopup(aurl) {
584 top.restoreSession();
585 window.open('<?php echo "$web_root/interface/reports/" ?>' + aurl, '_blank', 'width=750,height=550,resizable=1,scrollbars=1');
586 return false;
589 // This is invoked to pop up some window when a popup item is selected.
590 function selpopup(selobj) {
591 var i = selobj.selectedIndex;
592 var opt = selobj.options[i];
593 if (i > 0) {
594 var width = 750;
595 var height = 550;
596 if (opt.text == 'Export' || opt.text == 'Import') {
597 width = 500;
598 height = 400;
600 else if (opt.text == 'Refer') {
601 width = 700;
602 height = 500;
604 dlgopen(opt.value, '_blank', width, height);
606 selobj.selectedIndex = 0;
609 // Treeview activation stuff:
610 $(document).ready(function(){
611 $("#navigation").treeview({
612 animated: "fast",
613 collapsed: true,
614 unique: <?php echo $GLOBALS['athletic_team'] ? 'false' : 'true' ?>,
615 toggle: function() {
616 window.console && console.log("%o was toggled", this);
621 </script>
623 </head>
625 <body class="body_nav">
627 <form method='post' name='find_patient' target='RTop'
628 action='<?php echo $rootdir ?>/main/finder/patient_select.php'>
630 <?php if ($GLOBALS['concurrent_layout'] == 2) { ?>
632 <center>
633 <select name='sel_frame' style='background-color:transparent;font-size:9pt;width:<?php echo $GLOBALS['athletic_team'] ? 47 : 100; ?>%;'>
634 <option value='0'><?php xl('Default','e'); ?></option>
635 <option value='1'><?php xl('Top','e'); ?></option>
636 <option value='2'><?php xl('Bottom','e'); ?></option>
637 </select>
638 <?php if ($GLOBALS['athletic_team']) genPopupsList('width:47%'); ?>
639 </center>
641 <table cellpadding='0' cellspacing='0' border='0' width='100%'>
642 <tr>
643 <td class='smalltext' nowrap>
644 <input type='checkbox' name='cb_top' onclick='toggleFrame(1)' checked />
645 <b><?php xl('Top','e') ?></b>
646 </td>
647 <td class='smalltext' align='right' nowrap>
648 <b><?php xl('Bot','e') ?></b>
649 <input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' <?php if (empty($GLOBALS['athletic_team'])) echo 'checked '; ?>/>
650 </td>
651 </tr>
652 </table>
654 <?php if ($GLOBALS['athletic_team']) { // Tree menu for athletic teams ?>
656 <ul id="navigation">
657 <li class="open"><span><?php xl('Patient/Client','e') ?></span>
658 <ul>
659 <li class="open"><span><?php xl('Demographics','e') ?></span>
660 <ul>
661 <?php genTreeLink('RTop','new','New'); ?>
662 <?php genTreeLink('RTop','dem','Current'); ?>
663 <?php genDualLink('dem','sum','Summary'); // with dem on top ?>
664 </ul>
665 </li>
666 <li class="open"><span><?php xl('Medical Records','e') ?></span>
667 <ul>
668 <?php genPopLink ('Team Roster','players_report.php'); ?>
669 <?php genDualLink('nen','ens','New Consultation'); // with ens on bottom ?>
671 <?php // genDualLink('enc','ens','Current Consultation'); // with ens on bottom ?>
672 <?php genTreeLink('RTop','enc','Current Consultation'); // encounter_top will itself load ens on bottom ?>
674 <?php genDualLink('dem','ens','Previous Consultations'); // with dem on top ?>
675 <?php genDualLink('his','ens','Previous History/Screening'); // with ens on bottom ?>
676 <?php genTreeLink('RBot','nen','New Allergy'); // nen with Allergy in chief complaint ?>
677 <?php genTreeLink('RTop','iss','Edit Allergies'); // somehow emphasizing allergies...? ?>
678 <?php genTreeLink('RTop','his','View Allergies'); // his page with Allergies section open ?>
679 <?php genDualLink('iss','ens','Problems/Issues'); // with ens on bottom ?>
680 <?php genDualLink('tra','ens','Transactions/Referrals'); // new transaction form on top and tra list on bottom (or ens if no tra) ?>
681 <?php genDualLink('his','imm','Immunizations'); // imm on bottom, his on top ?>
682 <?php genDualLink('his','pre','Prescriptions'); // pre on bottom, his on top ?>
683 <?php genTreeLink('RTop','doc','Document/Imaging Store'); ?>
684 <?php genTreeLink('RTop','prp','Patient Printed Report'); ?>
685 <?php genDualLink('dem','pno','Additional Notes'); // with dem on top ?>
686 <li><a href='' onclick="return repPopup('../patient_file/letter.php')" id='prp1'>Letter</a></li>
687 <?php genPopLink('Address Book','../usergroup/addrbook_list.php?popup=1'); ?>
688 </ul>
689 </li>
690 <li><span><?php xl('View','e') ?></span>
691 <ul>
692 <?php genTreeLink('RTop','cal','Calendar View'); ?>
693 <?php genTreeLink('RTop','ros','Team Roster View'); // default; and minimize lower frame ?>
694 <?php genTreeLink('RTop','dem','Current Patient'); // this also appears under Demographics ?>
695 </ul>
696 </li>
697 </ul>
698 </li>
699 <li class="open"><span><?php xl('Reports','e') ?></span>
700 <ul>
701 <li class="open"><span><?php xl('Athletic/Injury','e') ?></span>
702 <ul>
703 <?php genTreeLink('RTop','prp','Patient Printed Report'); // also appears above ?>
704 <?php genPopLink('Games/Events Missed','absences_report.php'); ?>
705 <?php genPopLink('Injury Surveillance','football_injury_report.php'); ?>
706 <?php genPopLink('Team Injury Overview','injury_overview_report.php'); ?>
707 </ul>
708 </li>
709 <li><span><?php xl('Patient/Client','e') ?></span>
710 <ul>
711 <?php genPopLink('List','patient_list.php'); ?>
712 <?php genPopLink('Prescriptions','prescriptions_report.php'); ?>
713 <?php genPopLink('Referrals','referrals_report.php'); ?>
714 </ul>
715 </li>
716 <li><span><?php xl('Visits','e') ?></span>
717 <ul>
718 <?php genPopLink('Appointments','appointments_report.php'); ?>
719 <?php genPopLink('Encounters','encounters_report.php'); ?>
720 <?php genPopLink('Appt-Enc','appt_encounter_report.php'); ?>
721 </ul>
722 </li>
723 <li><span><?php xl('General','e') ?></span>
724 <ul>
725 <?php genPopLink('Services','services_by_category.php'); ?>
726 <?php if ($GLOBALS['inhouse_pharmacy']) genPopLink('Inventory','inventory_list.php'); ?>
727 <?php if ($GLOBALS['inhouse_pharmacy']) genPopLink('Destroyed','destroyed_drugs_report.php'); ?>
728 </ul>
729 </li>
730 </ul>
731 </li>
732 <li><span><?php xl('Fees','e') ?></span>
733 <ul>
734 <?php genMiscLink('RBot','cod','2','Fee Sheet','patient_file/encounter/load_form.php?formname=fee_sheet'); ?>
735 <?php genMiscLink('RBot','bil','1','Checkout','patient_file/pos_checkout.php?framed=1'); ?>
736 </ul>
737 </li>
738 <?php if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) genMiscLink('RTop','adm','0','Inventory','drugs/drug_inventory.php'); ?>
739 <li><span><?php xl('Administration','e') ?></span>
740 <ul>
741 <?php if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0','Users','usergroup/usergroup_admin.php'); ?>
742 <?php genTreeLink('RTop','pwd','Users Password Change'); ?>
743 <?php if (acl_check('admin', 'practice' )) genMiscLink('RTop','adm','0','Practice','../controller.php?practice_settings'); ?>
744 <?php if (acl_check('admin', 'superbill')) genTreeLink('RTop','sup','Services'); ?>
745 <?php if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Layouts','super/edit_layout.php'); ?>
746 <?php if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Lists','super/edit_list.php'); ?>
747 <?php if (acl_check('admin', 'acl' )) genMiscLink('RTop','adm','0','ACL','usergroup/adminacl.php'); ?>
748 <li><span><?php xl('Other','e') ?></span>
749 <ul>
750 <?php if (acl_check('admin', 'forms' )) genMiscLink('RTop','adm','0','Forms','forms_admin/forms_admin.php'); ?>
751 <?php if (acl_check('admin', 'calendar')) genMiscLink('RTop','adm','0','Calendar','main/calendar/index.php?module=PostCalendar&type=admin&func=modifyconfig'); ?>
752 <?php if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0','Logs','logview/logview.php'); ?>
753 <?php if (acl_check('admin', 'database')) genMiscLink('RTop','adm','0','Database','main/myadmin/index.php'); ?>
754 <?php if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Backup','main/backup.php'); ?>
755 </ul>
756 </li>
757 </ul>
758 </li>
759 <li><span><?php xl('Miscellaneous','e') ?></span>
760 <ul>
761 <?php genTreeLink('RBot','aun','Pt Notes/Auth'); ?>
762 <?php genTreeLink('RTop','fax','Fax/Scan'); ?>
763 <?php genTreeLink('RTop','adb','Addr Book'); ?>
764 <?php genTreeLink('RTop','ono','Ofc Notes'); ?>
765 <?php genMiscLink('RTop','adm','0','BatchCom','batchcom/batchcom.php'); ?>
766 </ul>
767 </li>
768 </ul>
770 <?php } else { // not athletic team ?>
772 <ul id="navigation">
773 <li class="open"><span><?php xl('Patient/Client','e') ?></span>
774 <ul>
775 <li><span><?php xl('Management','e') ?></span>
776 <ul>
777 <?php genTreeLink('RTop','new','New'); ?>
778 <?php genTreeLink('RTop','dem','Current'); ?>
779 <?php genTreeLink('RBot','sum','Summary'); ?>
780 </ul>
781 </li>
782 <li class="open"><span><?php xl('Visits','e') ?></span>
783 <ul>
784 <?php genTreeLink('RTop','cal','Calendar'); ?>
785 <?php if ($GLOBALS['athletic_team']) genTreeLink('RTop','ros','Roster'); ?>
786 <?php genTreeLink('RBot','nen','New Visit'); ?>
787 <?php genTreeLink('RBot','enc','Current'); ?>
788 <?php genTreeLink('RBot','ens','List'); ?>
789 <?php genTreeLink('RBot','tra','Transact'); ?>
790 </ul>
791 </li>
792 <li><span><?php xl('Medical Record','e') ?></span>
793 <ul>
794 <?php genTreeLink('RBot','pre','Rx'); ?>
795 <?php genTreeLink('RTop','his','History'); ?>
796 <?php genTreeLink('RTop','iss','Issues'); ?>
797 <?php genTreeLink('RBot','imm','Immunize'); ?>
798 <?php genTreeLink('RTop','doc','Documents'); ?>
799 <?php genTreeLink('RBot','pno','Notes'); ?>
800 <?php genTreeLink('RTop','prp','Report'); ?>
801 </ul>
802 </li>
803 </ul>
804 </li>
805 <li><span><?php xl('Fees','e') ?></span>
806 <ul>
807 <?php genMiscLink('RBot','cod','2','Fee Sheet','patient_file/encounter/load_form.php?formname=fee_sheet'); ?>
808 <?php if (false) genTreeLink('RBot','cod','Charges'); ?>
809 <?php genMiscLink('RBot','bil','1','Checkout','patient_file/pos_checkout.php?framed=1'); ?>
810 <?php if (! $GLOBALS['simplified_demographics']) genTreeLink('RTop','bil','Billing'); ?>
811 </ul>
812 </li>
813 <?php if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) genMiscLink('RTop','adm','0','Inventory','drugs/drug_inventory.php'); ?>
814 <li><span><?php xl('Administration','e') ?></span>
815 <ul>
816 <?php if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0','Users','usergroup/usergroup_admin.php'); ?>
817 <?php if (acl_check('admin', 'practice' )) genMiscLink('RTop','adm','0','Practice','../controller.php?practice_settings'); ?>
818 <?php if (acl_check('admin', 'superbill')) genTreeLink('RTop','sup','Services'); ?>
819 <?php if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Layouts','super/edit_layout.php'); ?>
820 <?php if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Lists','super/edit_list.php'); ?>
821 <?php if (acl_check('admin', 'acl' )) genMiscLink('RTop','adm','0','ACL','usergroup/adminacl.php'); ?>
822 <?php if (acl_check('admin', 'super' )) genMiscLink('RTop','adm','0','Backup','main/backup.php'); ?>
823 <?php if (acl_check('admin', 'super') && !empty($GLOBALS['code_types']['IPPF'])) genMiscLink('RTop','adm','0','Export','main/ippf_export.php'); ?>
824 <li><span><?php xl('Other','e') ?></span>
825 <ul>
826 <?php if (acl_check('admin', 'language')) genMiscLink('RTop','adm','0','Language','language/language.php'); ?>
827 <?php if (acl_check('admin', 'forms' )) genMiscLink('RTop','adm','0','Forms','forms_admin/forms_admin.php'); ?>
828 <?php if (acl_check('admin', 'calendar')) genMiscLink('RTop','adm','0','Calendar','main/calendar/index.php?module=PostCalendar&type=admin&func=modifyconfig'); ?>
829 <?php if (acl_check('admin', 'users' )) genMiscLink('RTop','adm','0','Logs','logview/logview.php'); ?>
830 <?php if (acl_check('admin', 'database')) genMiscLink('RTop','adm','0','Database','main/myadmin/index.php'); ?>
831 </ul>
832 </li>
833 </ul>
834 </li>
835 <li><span><?php xl('Reports','e') ?></span>
836 <ul>
837 <li><span><?php xl('Clients','e') ?></span>
838 <ul>
839 <?php genPopLink('List','patient_list.php'); ?>
840 <?php genPopLink('Rx','prescriptions_report.php'); ?>
841 <?php genPopLink('Referrals','referrals_report.php'); ?>
842 <?php if (!empty($GLOBALS['code_types']['IPPF'])) genPopLink('IPPF Stats','ippf_statistics.php?t=i'); ?>
843 <?php if (!empty($GLOBALS['code_types']['IPPF'])) genPopLink('GCAC Stats','ippf_statistics.php?t=g'); ?>
844 <?php if (!empty($GLOBALS['code_types']['IPPF'])) genPopLink('MA Stats','ippf_statistics.php?t=m'); ?>
845 <?php if (!empty($GLOBALS['code_types']['IPPF'])) genPopLink('CYP','ippf_cyp_report.php'); ?>
846 </ul>
847 </li>
848 <li class="open"><span><?php xl('Visits','e') ?></span>
849 <ul>
850 <?php genPopLink('Appointments','appointments_report.php'); ?>
851 <?php genPopLink('Encounters','encounters_report.php'); ?>
852 <?php genPopLink('Appt-Enc','appt_encounter_report.php'); ?>
853 </ul>
854 </li>
855 <?php if (acl_check('acct', 'rep_a')) { ?>
856 <li><span><?php xl('Financial','e') ?></span>
857 <ul>
858 <?php genPopLink('Sales','sales_by_item.php'); ?>
859 <?php genPopLink('Cash Rec','../billing/sl_receipts_report.php'); ?>
860 <?php genPopLink('Front Rec','front_receipts_report.php'); ?>
861 <?php genPopLink('Pmt Method','receipts_by_method_report.php'); ?>
862 <?php genPopLink('Collections','collections_report.php'); ?>
863 </ul>
864 </li>
865 <?php } ?>
866 <li><span><?php xl('General','e') ?></span>
867 <ul>
868 <?php genPopLink('Services','services_by_category.php'); ?>
869 <?php if ($GLOBALS['inhouse_pharmacy']) genPopLink('Inventory','inventory_list.php'); ?>
870 <?php if ($GLOBALS['inhouse_pharmacy']) genPopLink('Destroyed','destroyed_drugs_report.php'); ?>
871 </ul>
872 </li>
873 <?php if (! $GLOBALS['simplified_demographics']) { ?>
874 <li><span><?php xl('Insurance','e') ?></span>
875 <ul>
876 <?php genPopLink('Distribution','insurance_allocation_report.php'); ?>
877 <?php genPopLink('Indigents','../billing/indigent_patients_report.php'); ?>
878 <?php genPopLink('Unique SP','unique_seen_patients_report.php'); ?>
879 </ul>
880 </li>
881 <?php } ?>
882 <?php // genTreeLink('RTop','rep','Other'); ?>
883 </ul>
884 </li>
885 <li><span><?php xl('Miscellaneous','e') ?></span>
886 <ul>
887 <?php genTreeLink('RBot','aun','Pt Notes/Auth'); ?>
888 <?php genTreeLink('RTop','fax','Fax/Scan'); ?>
889 <?php genTreeLink('RTop','adb','Addr Book'); ?>
890 <?php genTreeLink('RTop','cht','Chart Tracker'); ?>
891 <?php genTreeLink('RTop','ono','Ofc Notes'); ?>
892 <?php genMiscLink('RTop','adm','0','BatchCom','batchcom/batchcom.php'); ?>
893 <?php genTreeLink('RTop','pwd','Password'); ?>
894 </ul>
895 </li>
896 </ul>
898 <?php } // end not athletic team ?>
900 <?php } else { // end ($GLOBALS['concurrent_layout'] == 2) ?>
902 <table cellpadding='0' cellspacing='0' border='0'>
903 <tr>
904 <td colspan='3'>
905 <table cellpadding='0' cellspacing='0' border='0' width='100%'>
906 <tr>
907 <td class='smalltext' nowrap>
908 <input type='checkbox' name='cb_top' onclick='toggleFrame(1)' checked /><b><?php xl('Top','e') ?></b>
909 </td>
910 <td class='smalltext' align='right' nowrap>
911 <b><?php xl('Bot','e') ?></b><input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' checked />
912 </td>
913 </tr>
914 </table>
915 </td>
916 </tr>
917 <?php
918 // Builds the table of radio buttons and their labels. Radio button values
919 // are comprised of the 3-character document id and the 1-digit usage type,
920 // so that JavaScript can easily access this information.
921 $default_top_rbid = $GLOBALS['athletic_team'] ? 'ros' : 'cal';
922 foreach ($primary_docs as $key => $varr) {
923 if (!empty($disallowed[$key])) continue;
924 $label = $varr[0];
925 $usage = $varr[1];
926 $url = $varr[2];
927 echo " <tr>\n";
928 echo " <td class='smalltext'><input type='radio' name='rb_top' value='$key$usage' " .
929 "onclick=\"loadFrame('$key$usage','RTop','$url')\"";
930 if ($key == $default_top_rbid) echo " checked";
931 echo " /></td>\n";
932 echo " <td class='smalltext' id='lbl_$key'>$label</td>\n";
933 echo " <td class='smalltext'><input type='radio' name='rb_bot' value='$key$usage' " .
934 "onclick=\"loadFrame('$key$usage','RBot','$url')\"";
935 if ($key == 'aun') echo " checked";
936 echo " /></td>\n";
937 echo " </tr>\n";
940 </table>
942 <?php } ?>
944 <br /><hr />
946 <?php
947 // To use RelayHealth, see comments and parameters in includes/config.php.
948 if (!empty($GLOBALS['ssi']['rh'])) {
949 include_once("../../library/ssi.inc");
950 echo getRelayHealthLink() ."<br /><hr />\n";
954 <?php xl('Active Patient','e') ?>:<br />
955 <div id='current_patient'>
956 <b>None</b>
957 </div>
959 <?php xl('Active Encounter','e') ?>:<br />
960 <div id='current_encounter'>
961 <b>None</b>
962 </div>
964 <?php if (!$GLOBALS['athletic_team']) genPopupsList(); ?>
966 <hr />
968 <table cellpadding='0' cellspacing='0' border='0'>
969 <tr>
970 <td class='smalltext'><?php xl('Find','e') ?>:&nbsp;</td>
971 <td class='smalltext' colspan='2'>
972 <input type="entry" size="7" name="patient" class='inputtext' style='width:65px;' />
973 </td>
974 </tr>
975 <tr>
976 <td class='smalltext'><?php xl('by','e') ?>:</td>
977 <td class='smalltext'>
978 <a href="javascript:findPatient('Last');" class="navitem"><?php xl('Name','e'); ?></a>
979 </td>
980 <td class='smalltext' align='right'>
981 <a href="javascript:findPatient('ID');" class="navitem"><?php xl('ID','e'); ?></a>
982 </td>
983 </tr>
984 <tr>
985 <td class='smalltext'>&nbsp;</td>
986 <td class='smalltext'>
987 <a href="javascript:findPatient('SSN');" class="navitem"><?php xl('SSN','e'); ?></a>
988 </td>
989 <td class='smalltext' align='right'>
990 <a href="javascript:findPatient('DOB');" class="navitem"><?php xl('DOB','e'); ?></a>
991 </td>
992 </tr>
993 </table>
995 <hr />
996 <a href="../logout.php?auth=logout" target="_top" class="navitem" id="logout_link"
997 onclick="top.restoreSession()">
998 <?php xl('Logout','e'); ?></a>
1000 <input type='hidden' name='findBy' value='Last' />
1002 </form>
1004 <script language='JavaScript'>
1005 syncRadios();
1006 </script>
1008 </body>
1009 </html>