made patient/visit details optional in printed fee sheet
[openemr.git] / interface / main / left_nav.php
blob3fbbe4e895b752469d29d664223fcbf809d6aa2f
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($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>
210 <?php } ?>
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>
215 <?php } ?>
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>
219 <?php } ?>
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>
222 <?php // } ?>
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>
226 <?php } else { ?>
227 <option value='../patient_file/front_payment.php'><?php xl('Payment','e'); ?></option>
228 <?php } ?>
229 <?php if (is_dir("$webserver_root/custom/letter_templates")) { ?>
230 <option value='../patient_file/letter.php'><?php xl('Letter','e'); ?></option>
231 <?php } ?>
232 </select>
233 <?php
237 <html>
238 <head>
239 <title>Navigation</title>
240 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
242 <style type="text/css">
243 body {
244 font-size:8pt;
245 font-weight:normal;
246 padding: 5px 3px 5px 3px;
248 .smalltext {
249 font-family:sans-serif;
250 font-size:8pt;
251 font-weight:normal;
253 a.navitem, a.navitem:visited {
254 color:#0000ff;
255 font-family:sans-serif;
256 font-size:8pt;
257 font-weight:bold;
259 .inputtext {
260 font-size:9pt;
261 font-weight:normal;
262 border-style:solid;
263 border-width:1px;
264 padding-left:2px;
265 padding-right:2px;
266 border-color: #000000;
267 background-color:transparent;
270 #navigation ul {
271 background-color:transparent;
273 </style>
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.
284 var active_pid = 0;
285 var active_encounter = 0;
287 // Current selections in the top and bottom frames.
288 var topName = '';
289 var botName = '';
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';
302 fset.rows = rows;
303 fset.rows = rows;
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') ?>');
322 return false;
324 if (active_encounter == 0 && usage > '1') {
325 alert('<?php xl('You must first select or create an encounter.','e') ?>');
326 return false;
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;
337 return false;
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;
345 toggleFrame(1);
347 if (!f.cb_bot.checked) {
348 f.cb_bot.checked = true;
349 toggleFrame(2);
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') ?>');
360 return false;
362 if (active_encounter == 0 && (topusage > '1' || botusage > '1')) {
363 alert('<?php xl('You must first select or create an encounter.','e') ?>');
364 return false;
366 var f = document.forms[0];
367 forceDual();
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;
375 topName = tname;
376 botName = bname;
377 return false;
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;
392 return true;
395 <?php } ?>
396 return false;
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') {
410 var da = false;
411 if (active_pid == 0) da = true;
412 if (active_encounter == 0 && usage > '1') da = true;
413 lnk.style.color = da ? '#888888' : '#0000ff';
416 <?php } else { ?>
417 for (var i = 0; i < f.rb_top.length; ++i) {
418 var da = false;
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) {
428 rb1.disabled = da;
429 rb2.disabled = da;
430 document.getElementById('lbl_' + rbid).style.color = da ? '#888888' : '#000000';
433 <?php } ?>
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;
442 toggleFrame(1);
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);
454 x.innerHTML = '';
455 x.innerHTML = content;
457 else if (doc.all) {
458 var x = doc.all[id];
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>');
513 active_pid = pid;
514 active_encounter = 0;
515 if (frname) reloadPatient(frname);
516 syncRadios();
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);
532 syncRadios();
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];
542 active_pid = 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>');
547 reloadPatient('');
548 syncRadios();
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;
559 reloadEncounter('');
560 syncRadios();
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!');
569 return false;
571 return true;
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!');
580 return false;
582 return true;
585 // Pop up a report.
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');
589 return false;
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];
596 if (i > 0) {
597 var width = 750;
598 var height = 550;
599 if (opt.text == 'Export' || opt.text == 'Import') {
600 width = 500;
601 height = 400;
603 else if (opt.text == 'Refer') {
604 width = 700;
605 height = 500;
607 dlgopen(opt.value, '_blank', width, height);
609 selobj.selectedIndex = 0;
612 // Treeview activation stuff:
613 $(document).ready(function(){
614 $("#navigation").treeview({
615 animated: "fast",
616 collapsed: true,
617 unique: <?php echo $GLOBALS['athletic_team'] ? 'false' : 'true' ?>,
618 toggle: function() {
619 window.console && console.log("%o was toggled", this);
624 </script>
626 </head>
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) { ?>
635 <center>
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>
640 </select>
641 <?php if ($GLOBALS['athletic_team']) genPopupsList('width:47%'); ?>
642 </center>
644 <table cellpadding='0' cellspacing='0' border='0' width='100%'>
645 <tr>
646 <td class='smalltext' nowrap>
647 <input type='checkbox' name='cb_top' onclick='toggleFrame(1)' checked />
648 <b><?php xl('Top','e') ?></b>
649 </td>
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 '; ?>/>
653 </td>
654 </tr>
655 </table>
657 <?php if ($GLOBALS['athletic_team']) { // Tree menu for athletic teams ?>
659 <ul id="navigation">
660 <li class="open"><span><?php xl('Patient/Client','e') ?></span>
661 <ul>
662 <li class="open"><span><?php xl('Demographics','e') ?></span>
663 <ul>
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 ?>
667 </ul>
668 </li>
669 <li class="open"><span><?php xl('Medical Records','e') ?></span>
670 <ul>
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'); ?>
691 </ul>
692 </li>
693 <li><span><?php xl('View','e') ?></span>
694 <ul>
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 ?>
698 </ul>
699 </li>
700 </ul>
701 </li>
702 <li class="open"><span><?php xl('Reports','e') ?></span>
703 <ul>
704 <li class="open"><span><?php xl('Athletic/Injury','e') ?></span>
705 <ul>
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'); ?>
710 </ul>
711 </li>
712 <li><span><?php xl('Patient/Client','e') ?></span>
713 <ul>
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'); ?>
717 </ul>
718 </li>
719 <li><span><?php xl('Visits','e') ?></span>
720 <ul>
721 <?php genPopLink('Appointments','appointments_report.php'); ?>
722 <?php genPopLink('Encounters','encounters_report.php'); ?>
723 <?php genPopLink('Appt-Enc','appt_encounter_report.php'); ?>
724 </ul>
725 </li>
726 <li><span><?php xl('General','e') ?></span>
727 <ul>
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'); ?>
731 </ul>
732 </li>
733 </ul>
734 </li>
735 <li><span><?php xl('Fees','e') ?></span>
736 <ul>
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'); ?>
739 </ul>
740 </li>
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>
743 <ul>
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>
752 <ul>
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'); ?>
758 </ul>
759 </li>
760 </ul>
761 </li>
762 <li><span><?php xl('Miscellaneous','e') ?></span>
763 <ul>
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'); ?>
769 </ul>
770 </li>
771 </ul>
773 <?php } else { // not athletic team ?>
775 <ul id="navigation">
776 <li class="open"><span><?php xl('Patient/Client','e') ?></span>
777 <ul>
778 <li><span><?php xl('Management','e') ?></span>
779 <ul>
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'); ?>
783 </ul>
784 </li>
785 <li class="open"><span><?php xl('Visits','e') ?></span>
786 <ul>
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'); ?>
794 </ul>
795 </li>
796 <li><span><?php xl('Medical Record','e') ?></span>
797 <ul>
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'); ?>
805 </ul>
806 </li>
807 </ul>
808 </li>
809 <li><span><?php xl('Fees','e') ?></span>
810 <ul>
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'); ?>
815 </ul>
816 </li>
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>
819 <ul>
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>
829 <ul>
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'); ?>
835 </ul>
836 </li>
837 </ul>
838 </li>
839 <li><span><?php xl('Reports','e') ?></span>
840 <ul>
841 <li><span><?php xl('Clients','e') ?></span>
842 <ul>
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'); ?>
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 <?php if (empty($GLOBALS['code_types']['IPPF'])) { ?>
854 <?php genPopLink('Superbill','custom_report_range.php'); ?>
855 <?php } ?>
856 <?php genPopLink('Chart Activity','chart_location_activity.php'); ?>
857 <?php genPopLink('Charts Out','charts_checked_out.php'); ?>
858 </ul>
859 </li>
860 <?php if (acl_check('acct', 'rep_a')) { ?>
861 <li><span><?php xl('Financial','e') ?></span>
862 <ul>
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'); ?>
868 </ul>
869 </li>
870 <?php } ?>
871 <li><span><?php xl('General','e') ?></span>
872 <ul>
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'); ?>
876 </ul>
877 </li>
878 <?php if (! $GLOBALS['simplified_demographics']) { ?>
879 <li><span><?php xl('Insurance','e') ?></span>
880 <ul>
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'); ?>
884 </ul>
885 </li>
886 <?php } ?>
887 <?php if (!empty($GLOBALS['code_types']['IPPF'])) { ?>
888 <li><span><?php xl('Statistics','e') ?></span>
889 <ul>
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'); ?>
895 </ul>
896 </li>
897 <li><span><?php xl('Blank Forms','e') ?></span>
898 <ul>
899 <?php genPopLink('Fee Sheet','../patient_file/printed_fee_sheet.php'); ?>
900 <?php genPopLink('Referral','../patient_file/transaction/print_referral.php'); ?>
901 </ul>
902 </li>
903 <?php } ?>
904 <?php // genTreeLink('RTop','rep','Other'); ?>
905 </ul>
906 </li>
907 <li><span><?php xl('Miscellaneous','e') ?></span>
908 <ul>
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'); ?>
916 </ul>
917 </li>
918 </ul>
920 <?php } // end not athletic team ?>
922 <?php } else { // end ($GLOBALS['concurrent_layout'] == 2) ?>
924 <table cellpadding='0' cellspacing='0' border='0'>
925 <tr>
926 <td colspan='3'>
927 <table cellpadding='0' cellspacing='0' border='0' width='100%'>
928 <tr>
929 <td class='smalltext' nowrap>
930 <input type='checkbox' name='cb_top' onclick='toggleFrame(1)' checked /><b><?php xl('Top','e') ?></b>
931 </td>
932 <td class='smalltext' align='right' nowrap>
933 <b><?php xl('Bot','e') ?></b><input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' checked />
934 </td>
935 </tr>
936 </table>
937 </td>
938 </tr>
939 <?php
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;
946 $label = $varr[0];
947 $usage = $varr[1];
948 $url = $varr[2];
949 echo " <tr>\n";
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";
953 echo " /></td>\n";
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";
958 echo " /></td>\n";
959 echo " </tr>\n";
962 </table>
964 <?php } ?>
966 <br /><hr />
968 <?php
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'>
978 <b>None</b>
979 </div>
981 <?php xl('Active Encounter','e') ?>:<br />
982 <div id='current_encounter'>
983 <b>None</b>
984 </div>
986 <?php if (!$GLOBALS['athletic_team']) genPopupsList(); ?>
988 <hr />
990 <table cellpadding='0' cellspacing='0' border='0'>
991 <tr>
992 <td class='smalltext'><?php xl('Find','e') ?>:&nbsp;</td>
993 <td class='smalltext' colspan='2'>
994 <input type="entry" size="7" name="patient" class='inputtext' style='width:65px;' />
995 </td>
996 </tr>
997 <tr>
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>
1001 </td>
1002 <td class='smalltext' align='right'>
1003 <a href="javascript:findPatient('ID');" class="navitem"><?php xl('ID','e'); ?></a>
1004 </td>
1005 </tr>
1006 <tr>
1007 <td class='smalltext'>&nbsp;</td>
1008 <td class='smalltext'>
1009 <a href="javascript:findPatient('SSN');" class="navitem"><?php xl('SSN','e'); ?></a>
1010 </td>
1011 <td class='smalltext' align='right'>
1012 <a href="javascript:findPatient('DOB');" class="navitem"><?php xl('DOB','e'); ?></a>
1013 </td>
1014 </tr>
1015 </table>
1017 <hr />
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' />
1024 </form>
1026 <script language='JavaScript'>
1027 syncRadios();
1028 </script>
1030 </body>
1031 </html>