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