Highway to PSR2
[openemr.git] / interface / main / left_nav.php
blobb1a79fd6672b2353e26be45eaa206c56a0e84fe9
1 <?php
2 use ESign\Api;
4 /* Copyright (C) 2006-2012 Rod Roark <rod@sunsetsystems.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
12 // This provides the left navigation frame.
13 // Following are notes as to what else was changed for this feature:
15 // * interface/main/main_screen.php: the top-level frameset.
16 // * interface/main/finder/patient_select.php: loads stuff when a new patient
17 // is selected.
18 // * interface/patient_file/summary/demographics.php: this is the first frame
19 // loaded when a new patient is chosen, and in turn sets the current pid and
20 // then loads the initial bottom frame.
21 // * interface/patient_file/summary/demographics_full.php: added support for
22 // setting a new pid, needed for going to demographics from billing.
23 // * interface/patient_file/summary/demographics_save.php: redisplay
24 // demographics.php and not the frameset.
25 // * interface/patient_file/summary/summary_bottom.php: new frameset for the
26 // summary, prescriptions and notes for a selected patient, cloned from
27 // patient_summary.php.
28 // * interface/patient_file/encounter/encounter_bottom.php: new frameset for
29 // the selected encounter, mosting coding/billing stuff, cloned from
30 // patient_encounter.php. This will also self-load the superbill pages
31 // as requested.
32 // * interface/usergroup/user_info.php: removed Back link.
33 // * interface/usergroup/admin_frameset.php: new frameset for Admin pages,
34 // cloned from usergroup.php.
35 // * interface/main/onotes/office_comments.php: removed Back link target.
36 // * interface/main/onotes/office_comments_full.php: changed Back link.
37 // * interface/billing/billing_report.php: removed Back link; added logic
38 // to properly go to demographics or to an encounter when requested.
39 // * interface/new/new.php: removed Back link and revised form target.
40 // * interface/new/new_patient_save.php: modified to load the demographics
41 // page to the current frame instead of loading a new frameset.
42 // * interface/patient_file/history/history.php: target change.
43 // * interface/patient_file/history/history_full.php: target changes.
44 // * interface/patient_file/history/history_save.php: target change.
45 // * interface/patient_file/history/encounters.php: link/target changes.
46 // * interface/patient_file/encounter/encounter_top.php: another new frameset
47 // cloned from patient_encounter.php.
48 // * interface/patient_file/encounter/forms.php: link target removal.
49 // * interface/forms/newpatient/new.php, view.php, save.php: link/target
50 // changes.
51 // * interface/patient_file/summary/immunizations.php: removed back link.
52 // * interface/patient_file/summary/pnotes.php: changed link targets.
53 // * interface/patient_file/summary/pnotes_full.php: changed back link and
54 // added set_pid logic.
55 // * interface/patient_file/transaction/transactions.php: various changes.
56 // * interface/patient_file/transaction/add_transaction.php: new return js.
57 // * interface/patient_file/encounter/superbill_codes.php: target and link
58 // changes.
59 // * interface/patient_file/encounter/superbill_custom_full.php: target and
60 // link changes.
61 // * interface/patient_file/encounter/diagnosis.php: target changes.
62 // * interface/patient_file/encounter/diagnosis_full.php: target and link
63 // changes.
64 // * interface/main/authorizations/authorizations.php: link and target changes.
65 // * library/api.inc: url change.
66 // * interface/patient_file/summary/rx_frameset.php: new frameset.
67 // * interface/patient_file/summary/rx_left.php: new for prescriptions.
68 // * all encounter forms: remove all instances of "target=Main" and change
69 // all instances of "patient_encounter.php" to "encounter_top.php".
71 // Our find_patient form, when submitted, invokes patient_select.php in the
72 // upper frame. When the patient is selected, demographics.php is invoked
73 // with the set_pid parameter, which establishes the new session pid and also
74 // calls the setPatient() function (below). In this case demographics.php
75 // will also load the summary frameset into the bottom frame, invoking our
76 // loadFrame() function.
78 // Similarly, we have the concept of selecting an encounter from the
79 // Encounters list, and then having that "stick" until some other encounter
80 // or a new encounter is chosen. We also have a navigation item for creating
81 // a new encounter. interface/patient_file/encounter/encounter_top.php
82 // supports set_encounter to establish an encounter.
84 // TBD: Include active_pid and/or active_encounter in relevant submitted
85 // form data, and add logic to the save routines to make sure they match
86 // the corresponding session values.
88 require_once("../globals.php");
89 require_once($GLOBALS['fileroot']."/library/acl.inc");
90 require_once($GLOBALS['fileroot']."/custom/code_types.inc.php");
91 require_once($GLOBALS['fileroot']."/library/patient.inc");
92 require_once($GLOBALS['fileroot']."/library/lists.inc");
93 require_once $GLOBALS['srcdir'].'/ESign/Api.php';
94 require_once $GLOBALS['srcdir'].'/user.inc';
96 // Fetch user preferences saved from prior session
97 $uspfx = substr(__FILE__, strlen($GLOBALS['fileroot']."/")) . '.';
98 $cb_top_chk = prevSetting($uspfx, 'cb_top', 'frame0_chk', 'checked');
99 $cb_bot_chk = prevSetting($uspfx, 'cb_bot', 'frame1_chk', 'checked');
100 $usrval = json_encode(array ( $cb_top_chk, $cb_bot_chk ));
102 // This array defines the list of primary documents that may be
103 // chosen. Each element value is an array of 3 values:
105 // * Name to appear in the navigation table
106 // * Usage: 0 = global, 1 = patient-specific, 2 = encounter-specific, 3 = therapy group-specific, 4 = therapy group encounter - specific
107 // * The URL relative to the interface directory
110 $primary_docs = array(
111 'cal' => array(xl('Calendar') , 0, 'main/main_info.php'),
112 'pfb' => array(xl('Patient Flow Board') , 0, '../interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1'),
113 'app' => array(xl('Portal Activity') , 0, '../myportal/index.php'),
114 'aop' => array(xl('Portal Dashboard') , 0, '../portal/patient/provider'),
115 'msg' => array(xl('Messages') , 0, 'main/messages/messages.php?form_active=1'),
116 'pwd' => array(xl('Password') , 0, 'usergroup/user_info.php'),
117 'prf' => array(xl('Preferences') , 0, 'super/edit_globals.php?mode=user'),
118 'adm' => array(xl('Admin') , 0, 'usergroup/admin_frameset.php'),
119 'rep' => array(xl('Reports') , 0, 'reports/index.php'),
120 'ono' => array(xl('Ofc Notes') , 0, 'main/onotes/office_comments.php'),
121 'fax' => array(xl('Fax/Scan') , 0, 'fax/faxq.php'),
122 'adb' => array(xl('Addr Bk') , 0, 'usergroup/addrbook_list.php'),
123 'orl' => array(xl('Proc Prov') , 0, 'orders/procedure_provider_list.php'),
124 'ort' => array(xl('Proc Cat') , 0, 'orders/types.php'),
125 'orc' => array(xl('Proc Load') , 0, 'orders/load_compendium.php'),
126 'orb' => array(xl('Proc Bat') , 0, 'orders/orders_results.php?batch=1'),
127 'ore' => array(xl('E-Reports') , 0, 'orders/list_reports.php'),
128 'ppo' => array(xl('CMS Portal'), 0, 'cmsportal/list_requests.php'),
129 'cht' => array(xl('Chart Trk') , 0, '../custom/chart_tracker.php'),
130 'imp' => array(xl('Import') , 0, '../custom/import.php'),
131 'bil' => array(xl('Billing') , 0, 'billing/billing_report.php'),
132 'sup' => array(xl('Superbill') , 0, 'patient_file/encounter/superbill_custom_full.php'),
133 'aun' => array(xl('Authorizations'), 0, 'main/authorizations/authorizations.php'),
134 'new' => array(xl('New Pt') , 0, 'new/new.php'),
135 'ped' => array(xl('Patient Education'), 0, 'reports/patient_edu_web_lookup.php'),
136 'lab' => array(xl('Check Lab Results') , 0, 'orders/lab_exchange.php'),
137 'dem' => array(xl('Patient') , 1, "patient_file/summary/demographics.php"),
138 'his' => array(xl('History') , 1, 'patient_file/history/history.php'),
139 'ens' => array(xl('Visit History'), 1, 'patient_file/history/encounters.php'),
140 'nen' => array(xl('Create Visit'), 1, 'forms/newpatient/new.php?autoloaded=1&calenc='),
141 'pre' => array(xl('Rx') , 1, 'patient_file/summary/rx_frameset.php'),
142 'iss' => array(xl('Issues') , 1, 'patient_file/summary/stats_full.php?active=all'),
143 'imm' => array(xl('Immunize') , 1, 'patient_file/summary/immunizations.php'),
144 'doc' => array(xl('Documents') , 1, '../controller.php?document&list&patient_id={PID}'),
145 'orp' => array(xl('Proc Pending Rev'), 1, 'orders/orders_results.php?review=1'),
146 'orr' => array(xl('Proc Res') , 1, 'orders/orders_results.php'),
147 'lda' => array(xl('Lab overview') , 1, 'patient_file/summary/labdata.php'),
148 'tan' => array(xl('Configure Tracks') , 0, 'forms/track_anything/create.php'),
149 'prp' => array(xl('Pt Report') , 1, 'patient_file/report/patient_report.php'),
150 'prq' => array(xl('Pt Rec Request') , 1, 'patient_file/transaction/record_request.php'),
151 'pno' => array(xl('Pt Notes') , 1, 'patient_file/summary/pnotes.php'),
152 'tra' => array(xl('Transact') , 1, 'patient_file/transaction/transactions.php'),
153 'sum' => array(xl('Summary') , 1, 'patient_file/summary/summary_bottom.php'),
154 'enc' => array(xl('Encounter') , 2, 'patient_file/encounter/encounter_top.php'),
155 'erx' => array(xl('e-Rx') , 1, 'eRx.php'),
156 'err' => array(xl('e-Rx Renewal') , 1, 'eRx.php?page=status'),
157 'ere' => array(xl('e-Rx EPCS') , 1, 'eRx.php?page=epcs-admin'),
158 'pay' => array(xl('Payment') , 1, '../patient_file/front_payment.php'),
159 'edi' => array(xl('EDI History') , 0, 'billing/edih_view.php'),
160 'eob' => array(xl('Posting') , 0, 'billing/sl_eob_search.php'),
161 'dld' => array(xl('Display Documents'), 0, 'main/display_documents.php')
163 $disallowed = array();
166 $primary_docs['npa']=array(xl('Batch Payments') , 0, 'billing/new_payment.php');
167 if ($GLOBALS['use_charges_panel'] || $GLOBALS['menu_styling_vertical'] == 0) {
168 $primary_docs['cod'] = array(xl('Charges'), 2, 'patient_file/encounter/encounter_bottom.php');
171 if ($GLOBALS['enable_group_therapy']) {
172 $disallowed['gng'] = !acl_check("groups", "gadd");
173 $disallowed['gdg'] = !acl_check("groups", "gadd");
174 $disallowed['gcv'] = !acl_check("groups", "gcalendar");
175 $disallowed['gce'] = !acl_check("groups", "glog");
176 $disallowed['gvh'] = !acl_check("groups", "glog");
178 $primary_docs['gng'] = array(xl('New') , 0, 'therapy_groups/index.php?method=addGroup');
179 $primary_docs['gdg'] = array(xl('Group Details') , 3, '/therapy_groups/index.php?method=groupDetails&group_id=from_session');
180 $primary_docs['gcv'] = array(xl('Create Visit'), 3, 'forms/newGroupEncounter/new.php?autoloaded=1&calenc=');
181 $primary_docs['gce'] = array(xl('Current') , 4, 'patient_file/encounter/encounter_top.php');
182 $primary_docs['gvh'] = array(xl('Visit History'), 3, 'patient_file/history/encounters.php');
186 $esignApi = new Api();
187 // This section decides which navigation items will not appear.
190 $disallowed['edi'] = !($GLOBALS['enable_edihistory_in_left_menu'] && acl_check('acct', 'eob'));
191 $disallowed['adm'] = !(acl_check('admin', 'calendar') ||
192 acl_check('admin', 'database') || acl_check('admin', 'forms') ||
193 acl_check('admin', 'practice') || acl_check('admin', 'users') ||
194 acl_check('admin', 'acl') || acl_check('admin', 'super') ||
195 acl_check('admin', 'superbill') || acl_check('admin', 'drugs'));
197 $disallowed['bil'] = !(acl_check('acct', 'eob') || acl_check('acct', 'bill'));
199 $disallowed['new'] = !(acl_check('patients', 'demo', '', array('write','addonly')));
201 $disallowed['fax'] = !(($GLOBALS['enable_hylafax'] || $GLOBALS['enable_scanner']) && acl_check('patients', 'docs'));
203 $disallowed['iss'] = !((acl_check('encounters', 'notes', '', 'write') ||
204 acl_check('encounters', 'notes_a', '', 'write') ) &&
205 acl_check('patients', 'med', '', 'write') );
207 $disallowed['imp'] = $disallowed['new'] || !is_readable("$webserver_root/custom/import.php");
209 $disallowed['cht'] = !is_readable("$webserver_root/custom/chart_tracker.php");
211 $disallowed['pre'] = !(acl_check('patients', 'med'));
212 $disallowed['eob'] = !(acl_check('acct', 'eob'));
214 // Helper functions for treeview generation.
215 function genTreeLink($frame, $name, $title, $mono = false)
217 global $primary_docs, $disallowed;
218 if (empty($disallowed[$name])) {
219 $id = $name . $primary_docs[$name][1];
220 echo "<li><a href='' id='$id' onclick=\"";
221 if ($mono) {
222 if ($frame == 'RTop') {
223 echo "forceSpec(true,false);";
224 } else {
225 echo "forceSpec(false,true);";
229 echo "return loadFrame2('$id','$frame','" .
230 $primary_docs[$name][2] . "')\">" . $title . ($name == 'msg' ? ' <span id="reminderCountSpan" class="bold"></span>' : '')."</a></li>";
233 function genMiscLink($frame, $name, $level, $title, $url, $mono = false)
235 global $disallowed;
236 if (empty($disallowed[$name])) {
237 $id = $name . $level;
238 echo "<li><a href='' id='$id' onclick=\"";
239 if ($mono) {
240 if ($frame == 'RTop') {
241 echo "forceSpec(true,false);";
242 } else {
243 echo "forceSpec(false,true);";
247 echo "return loadFrame2('$id','$frame','" .
248 $url . "')\">" . $title . "</a></li>";
251 function genMiscLink2($frame, $name, $level, $title, $url, $mono = false, $mouseovertext = "")
253 global $disallowed;
254 if (empty($disallowed[$name])) {
255 $id = $name . $level;
256 echo "<li><a href='' id='$id' title='$mouseovertext' onclick=\"";
257 if ($mono) {
258 if ($frame == 'RTop') {
259 echo "forceSpec(true,false);";
260 } else {
261 echo "forceSpec(false,true);";
265 echo "return loadFrame3('$id','$frame','" .
266 $url . "')\">" . $title . "</a></li>";
269 function genPopLink($title, $url, $linkid = '')
271 echo "<li><a href='' ";
272 if ($linkid) {
273 echo "id='$linkid' ";
276 echo "onclick=\"return repPopup('$url')\"" .
277 ">" . $title . "</a></li>";
279 function genDualLink($topname, $botname, $title)
281 global $primary_docs, $disallowed;
282 if (empty($disallowed[$topname]) && empty($disallowed[$botname])) {
283 $topid = $topname . $primary_docs[$topname][1];
284 $botid = $botname . $primary_docs[$botname][1];
285 echo "<li><a href='' id='$topid' " .
286 "onclick=\"return loadFrameDual('$topid','$botid','" .
287 $primary_docs[$topname][2] . "','" .
288 $primary_docs[$botname][2] . "')\">" . $title . "</a></li>";
292 function genPopupsList($style = '')
294 global $disallowed, $webserver_root;
296 <select name='popups' onchange='selpopup(this)' style='background-color:transparent;font-size:9pt;<?php echo $style; ?>'>
297 <option value=''><?php xl('Popups', 'e'); ?></option>
298 <?php if (!$disallowed['iss']) { ?>
299 <option value='../patient_file/problem_encounter.php'><?php xl('Issues', 'e'); ?></option>
300 <?php } ?>
301 <?php if (!$GLOBALS['ippf_specific'] && acl_check('patients', 'demo')) { ?>
302 <option value='../../custom/export_xml.php'><?php xl('Export', 'e'); ?></option>
303 <?php if (acl_check('patients', 'demo', '', 'write')) { ?>
304 <option value='../../custom/import_xml.php'><?php xl('Import', 'e'); ?></option>
305 <?php }
308 if (!$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) { ?>
309 <option value='../reports/appointments_report.php?patient=<?php if (isset($pid)) {
310 echo $pid;
311 } ?>'><?php xl('Appts', 'e'); ?></option>
312 <?php } ?>
313 <?php if (acl_check('patients', 'med')) { ?>
314 <option value='../patient_file/printed_fee_sheet.php?fill=1'><?php xl('Superbill', 'e'); ?></option>
315 <?php } ?>
316 <?php if (acl_check('acct', 'bill', '', 'write')) { ?>
317 <option value='../patient_file/front_payment.php'><?php xl('Payment', 'e'); ?></option>
318 <?php } ?>
319 <?php if ($GLOBALS['inhouse_pharmacy'] && acl_check('acct', 'bill', '', 'write')) { ?>
320 <option value='../patient_file/pos_checkout.php'><?php xl('Checkout', 'e'); ?></option>
321 <?php } ?>
322 <?php if (is_dir($GLOBALS['OE_SITE_DIR'] . "/letter_templates") && acl_check('patients', 'med')) { ?>
323 <option value='../patient_file/letter.php'><?php xl('Letter', 'e'); ?></option>
324 <?php } ?>
325 <?php if ($GLOBALS['chart_label_type'] != '0' && acl_check('patients', 'demo')) { ?>
326 <option value='../patient_file/label.php'><?php xl('Chart Label', 'e'); ?></option>
327 <?php } ?>
328 <?php if ($GLOBALS['barcode_label_type'] != '0' && acl_check('patients', 'demo')) { ?>
329 <option value='../patient_file/barcode_label.php'><?php xl('Barcode Label', 'e'); ?></option>
330 <?php } ?>
331 <?php if ($GLOBALS['addr_label_type'] && acl_check('patients', 'demo')) { ?>
332 <option value='../patient_file/addr_label.php'><?php xl('Address Label', 'e'); ?></option>
333 <?php } ?>
334 </select>
335 <?php
338 function genFindBlock()
341 <table cellpadding='0' cellspacing='0' border='0'>
342 <tr>
343 <td class='smalltext'><?php xl('Find', 'e') ?>:&nbsp;</td>
344 <td class='smalltext' colspan='2'>
345 <input type="entry" size="7" name="patient" class='inputtext' style='width:65px;' />
346 </td>
347 </tr>
348 <tr>
349 <td class='smalltext'><?php xl('by', 'e') ?>:</td>
350 <td class='smalltext'>
351 <a href="javascript:findPatient('Last');" class="navitem"><?php xl('Name', 'e'); ?></a>
352 </td>
353 <td class='smalltext' align='right'>
354 <a href="javascript:findPatient('ID');" class="navitem"><?php xl('ID', 'e'); ?></a>
355 </td>
356 </tr>
357 <tr>
358 <td class='smalltext'>&nbsp;</td>
359 <td class='smalltext'>
360 <a href="javascript:findPatient('SSN');" class="navitem"><?php xl('SSN', 'e'); ?></a>
361 </td>
362 <td class='smalltext' align='right'>
363 <a href="javascript:findPatient('DOB');" class="navitem"><?php xl('DOB', 'e'); ?></a>
364 </td>
365 </tr>
366 <tr>
367 <td class='smalltext'>&nbsp;</td>
368 <td class='smalltext'>
369 <a href="javascript:findPatient('Any');" class="navitem"><?php xl('Any', 'e'); ?></a>
370 </td>
371 <td class='smalltext' align='right'>
372 <a href="javascript:initFilter();" class="navitem"><?php xl('Filter', 'e'); ?></a>
373 </td>
374 </tr>
375 </table>
376 <?php
377 } // End function genFindBlock()
379 <html>
380 <head>
381 <title>Navigation</title>
383 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
384 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative'];?>/font-awesome-4-6-3/css/font-awesome.css" type="text/css">
385 <style type="text/css">
386 body {
387 font-size:8pt;
388 font-weight:normal;
389 padding: 5px 3px 5px 3px;
391 .smalltext {
392 font-family:sans-serif;
393 font-size:8pt;
394 font-weight:normal;
396 a.navitem, a.navitem:visited {
397 color:#0000ff;
398 font-family:sans-serif;
399 font-size:8pt;
400 font-weight:bold;
402 .inputtext {
403 font-size:9pt;
404 font-weight:normal;
405 border-style:solid;
406 border-width:1px;
407 padding-left:2px;
408 padding-right:2px;
409 border-color: #000000;
410 background-color:transparent;
413 #navigation ul {
414 background-color:transparent;
416 #navigation-slide ul {
417 background-color:transparent;
419 #navigation-slide a{
420 width: 92%;
422 .nav-menu-img{
423 width:25px;
424 height:25px;
425 border:none;
426 margin-right:5px;
427 vertical-align:middle;
429 </style>
431 <link rel="stylesheet" href="../../library/js/jquery.treeview-1.4.1/jquery.treeview.css" />
432 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script>
433 <script type="text/javascript" src="../../library/js/jquery.treeview-1.4.1/jquery.treeview.js" ></script>
435 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
437 <script language='JavaScript'>
438 // User settings
439 var usrval = jQuery.parseJSON('<?php echo $usrval ?>');
441 // tajemo work by CB 2012/01/31 12:32:57 PM dated reminders counter
442 function getReminderCount(){
443 top.restoreSession();
444 // Send the skip_timeout_reset parameter to not count this as a manual entry in the
445 // timing out mechanism in OpenEMR.
446 $.post("<?php echo $GLOBALS['webroot']; ?>/library/ajax/dated_reminders_counter.php",
447 { skip_timeout_reset: "1" },
448 function(data) {
449 $("#reminderCountSpan").html(data);
450 // run updater every 60 seconds
451 var repeater = setTimeout("getReminderCount()", 60000);
453 //piggy-back on this repeater to run other background-services
454 //this is a silent task manager that returns no output
455 $.post("<?php echo $GLOBALS['webroot']; ?>/library/ajax/execute_background_services.php",
456 { skip_timeout_reset: "1", ajax: "1" });
459 $(document).ready(function (){
460 getReminderCount();//
461 parent.loadedFrameCount += 1;
462 for (var i = 0, len = usrval.length; i < len; i++) {
463 if (usrval[i] != "checked") toggleFrame(i+1);
466 // end of tajemo work dated reminders counter
468 // Master values for current pid and encounter.
469 var active_pid = 0;
470 var active_encounter = 0;
471 var encounter_locked = false;
472 //therapy group id
473 var active_gid = 0;
475 // Current selections in the top and bottom frames.
476 var topName = '';
477 var botName = '';
479 // Expand and/or collapse frames in response to checkbox clicks.
480 // fnum indicates which checkbox was clicked (1=left, 2=right).
481 function toggleFrame(fnum) {
482 var f = document.forms[0];
483 var fset = top.document.getElementById('fsright');
484 if (!f.cb_top.checked && !f.cb_bot.checked) {
485 if (fnum == 1) f.cb_bot.checked = true;
486 else f.cb_top.checked = true;
488 var rows = f.cb_top.checked ? '*' : '0';
489 rows += f.cb_bot.checked ? ',*' : ',0';
490 fset.rows = rows;
491 save_setting ([(f.cb_top.checked ? 'checked' : '&nbsp;'), (f.cb_bot.checked ? 'checked' : '&nbsp;')]);
494 // Load the specified url into the specified frame (RTop or RBot).
495 // The URL provided must be relative to interface.
496 function loadFrame(fname, frame, url) {
497 top.restoreSession();
498 var i = url.indexOf('{PID}');
499 if (i >= 0) url = url.substring(0,i) + active_pid + url.substring(i+5);
500 top.frames[frame].location = '<?php echo "$web_root/interface/" ?>' + url;
501 if (frame == 'RTop') topName = fname; else botName = fname;
504 // Load the specified url into a frame to be determined, with the specified
505 // frame as the default; the url must be relative to interface.
506 function loadFrame2(fname, frame, url) {
507 var usage = fname.substring(3);
508 if (active_pid == 0 && active_gid == 0 && (usage > '0' && usage < '5')){
509 <?php if ($GLOBALS['enable_group_therapy']) { ?>
510 alert('<?php xl('You must first select or add a patient or therapy group.', 'e') ?>');
511 <?php } else { ?>
512 alert('<?php xl('You must first select or add a patient.', 'e') ?>');
513 <?php } ?>
514 return false;
516 if (active_encounter == 0 && (usage > '1' && usage < '3')) {
517 alert('<?php xl('You must first select or create an encounter.', 'e') ?>');
518 return false;
520 if (encounter_locked && usage > '1' && (usage > '1' && usage < '3')) {
521 alert('<?php echo xls('This encounter is locked. No new forms can be added.') ?>');
522 return false;
524 var f = document.forms[0];
525 top.restoreSession();
526 var i = url.indexOf('{PID}');
527 if (i >= 0) url = url.substring(0,i) + active_pid + url.substring(i+5);
528 if(f.sel_frame)
530 var fi = f.sel_frame.selectedIndex;
531 if (fi == 1) frame = 'RTop'; else if (fi == 2) frame = 'RBot';
533 if (!f.cb_bot.checked) frame = 'RTop'; else if (!f.cb_top.checked) frame = 'RBot';
534 top.frames[frame].location = '<?php echo "$web_root/interface/" ?>' + url;
535 if (frame == 'RTop') topName = fname; else botName = fname;
536 return false;
539 function loadFrame3(fname, frame, url) {
540 var f = document.forms[0];
541 top.restoreSession();
542 var i = url.indexOf('{PID}');
543 if (i >= 0) url = url.substring(0,i) + active_pid + url.substring(i+5);
544 if(f.sel_frame)
546 var fi = f.sel_frame.selectedIndex;
547 if (fi == 1) frame = 'RTop'; else if (fi == 2) frame = 'RBot';
549 if (!f.cb_bot.checked) frame = 'RTop'; else if (!f.cb_top.checked) frame = 'RBot';
550 top.frames[frame].location = '<?php echo "$web_root/interface/" ?>' + url;
551 if (frame == 'RTop') topName = fname; else botName = fname;
552 return false;
555 // Make sure the the top and bottom frames are open or closed, as specified.
556 function forceSpec(istop, isbot) {
557 var f = document.forms[0];
558 if (f.cb_top.checked != istop) {
559 f.cb_top.checked = istop;
560 toggleFrame(1);
562 if (f.cb_bot.checked != isbot) {
563 f.cb_bot.checked = isbot;
564 toggleFrame(2);
568 // Make sure both frames are open.
569 function forceDual() {
570 forceSpec(true, true);
573 // Load the specified url into a frame to be determined, with the specified
574 // frame as the default; the url must be relative to interface.
575 function loadFrameDual(tname, bname, topurl, boturl) {
576 var topusage = tname.substring(3);
577 var botusage = bname.substring(3);
578 if (active_pid == 0 && (topusage > '0' || botusage > '0')) {
579 alert('<?php xl('You must first select or add a patient.', 'e') ?>');
580 return false;
582 if (active_encounter == 0 && (topusage > '1' || botusage > '1')) {
583 alert('<?php xl('You must first select or create an encounter.', 'e') ?>');
584 return false;
586 if (encounter_locked && (topusage > '1' || botusage > '1')) {
587 alert('<?php echo xls('This encounter is locked. No new forms can be added.') ?>');
588 return false;
590 var f = document.forms[0];
591 forceDual();
592 top.restoreSession();
593 var i = topurl.indexOf('{PID}');
594 if (i >= 0) topurl = topurl.substring(0,i) + active_pid + topurl.substring(i+5);
595 i = boturl.indexOf('{PID}');
596 if (i >= 0) boturl = boturl.substring(0,i) + active_pid + boturl.substring(i+5);
597 top.frames.RTop.location = '<?php echo "$web_root/interface/" ?>' + topurl;
598 top.frames.RBot.location = '<?php echo "$web_root/interface/" ?>' + boturl;
599 topName = tname;
600 botName = bname;
601 return false;
604 // Set disabled/enabled state of radio buttons and associated labels
605 // depending on whether there is an active patient or encounter.
606 function syncRadios() {
607 var f = document.forms[0];
608 encounter_locked = isEncounterLocked(active_encounter);
609 var nlinks = document.links.length;
610 for (var i = 0; i < nlinks; ++i) {
611 var lnk = document.links[i];
612 if (lnk.id.length != 4) continue;
613 var usage = lnk.id.substring(3);
614 if (usage == '1' || usage == '2') {
615 var da = false;
616 if (active_pid == 0) da = true;
617 if (active_encounter == 0 && usage > '1') da = true;
618 if (encounter_locked && usage > '1') da = true;
619 <?php
620 if ($GLOBALS['menu_styling_vertical'] == 0) {
621 $color = "'#0000ff'";
622 } else { // ($GLOBALS['menu_styling_vertical'] == 1)
623 $color = "'#000000'";
626 lnk.style.color = da ? '#888888' : <?php echo $color; ?>;
628 //for therapy groups menu
629 <?php if ($GLOBALS['enable_group_therapy']) { ?>
630 if (usage == '3' || usage == '4') {
631 var da = false;
632 if (active_gid == 0) da = true;
633 if (active_encounter == 0 && usage > '3') da = true;
634 if (encounter_locked && usage > '3') da = true;
635 <?php
636 if ($GLOBALS['menu_styling_vertical'] == 0) {
637 $color = "'#0000ff'";
638 } else { // ($GLOBALS['menu_styling_vertical'] == 1)
639 $color = "'#000000'";
642 lnk.style.color = da ? '#888888' : <?php echo $color; ?>;
644 <?php } ?>
647 f.popups.disabled = (active_pid == 0);
650 function goHome() {
651 top.frames['RTop'].location='<?php echo $GLOBALS['default_top_pane']?>';
652 top.frames['RBot'].location='messages/messages.php?form_active=1';
655 //Function to clear active patient and encounter in the server side
656 function clearactive() {
657 top.restoreSession();
658 //Ajax call to clear active patient in session
659 var method = (active_pid > 0) ? 'unset_pid' : 'unset_gid';
660 $.ajax({
661 type: "POST",
662 url: "<?php echo $GLOBALS['webroot'] ?>/library/ajax/unset_session_ajax.php",
663 data: { func: method},
664 success:function( msg ) {
665 clearPatient();
666 clearTherapyGroup();
667 top.frames['RTop'].location='<?php echo $GLOBALS['default_top_pane']?>';
668 top.frames['RBot'].location='messages/messages.php?form_active=1';
672 $(parent.Title.document.getElementById('clear_active')).hide();
673 $(parent.Title.document.getElementById('clear_active_group')).hide();
675 // Reference to the search.php window.
676 var my_window;
678 // Open the search.php window.
679 function initFilter() {
680 my_window = window.open("../../custom/search.php", "mywindow","status=1");
683 // This is called by the search.php (Filter) window.
684 function processFilter(fieldString, serviceCode) {
685 var f = document.forms[0];
686 document.getElementById('searchFields').value = fieldString;
687 f.search_service_code.value = serviceCode;
688 findPatient("Filter");
689 f.search_service_code.value = '';
690 my_window.close();
693 // Process the click to find a patient by name, id, ssn or dob.
694 function findPatient(findby) {
695 var f = document.forms[0];
696 if (! f.cb_top.checked) {
697 f.cb_top.checked = true;
698 toggleFrame(1);
700 f.findBy.value = findby;
701 top.restoreSession();
702 document.find_patient.submit();
705 // Helper function to set the contents of a div.
706 function setSomeContent(id, content, doc) {
707 if (doc.getElementById) {
708 var x = doc.getElementById(id);
709 x.innerHTML = '';
710 x.innerHTML = content;
712 else if (doc.all) {
713 var x = doc.all[id];
714 x.innerHTML = content;
717 function setDivContent(id, content) {
718 setSomeContent(id, content, document);
720 function setTitleContent(id, content) {
721 setSomeContent(id, content, parent.Title.document);
724 // This is called automatically when a new patient is set, to make sure
725 // there are no patient-specific documents showing stale data. If a frame
726 // was just loaded with data for the correct patient, its name is passed so
727 // that it will not be zapped. At this point the new server-side pid is not
728 // assumed to be set, so this function will only load global data.
729 function reloadPatient(frname) {
730 var f = document.forms[0];
731 if (topName.length > 3 && topName.substring(3) > '0' && frname != 'RTop') {
732 loadFrame('cal0','RTop', '<?php echo $primary_docs['cal'][2]; ?>');
734 if (botName.length > 3 && botName.substring(3) > '0' && frname != 'RBot') {
735 loadFrame('ens0','RBot', '<?php echo $primary_docs['ens'][2]; ?>');
739 // Reload encounter-specific frames, excluding a specified frame. At this
740 // point the new server-side encounter ID may not be set and loading the same
741 // document for the new encounter will not work, so load patient info instead.
742 function reloadEncounter(frname) {
743 var f = document.forms[0];
744 if (topName.length > 3 && topName.substring(3) > '1' && frname != 'RTop') {
745 loadFrame('dem1','RTop', '<?php echo $primary_docs['dem'][2]; ?>');
747 if (botName.length > 3 && botName.substring(3) > '1' && frname != 'RBot') {
748 loadFrame('ens1','RBot', '<?php echo $primary_docs['ens'][2]; ?>');
753 // Call this to announce that the patient has changed. You must call this
754 // if you change the session PID, so that the navigation frame will show the
755 // correct patient and so that the other frame will be reloaded if it contains
756 // patient-specific information from the previous patient. frname is the name
757 // of the frame that the call came from, so we know to only reload content
758 // from the *other* frame if it is patient-specific.
759 function setPatient(pname, pid, pubpid, frname, str_dob) {
760 clearTherapyGroup();
761 var str = '<a href=\'javascript:;\' onclick="parent.left_nav.loadCurrentPatientFromTitle()" title="PID = ' + pid + '"><b>' + pname + ' (' + pubpid + ')<br /></b></a>';
762 setDivContent('current_patient', str);
763 setTitleContent('current_patient', str + str_dob);
764 if (pid == active_pid) return;
765 setDivContent('current_encounter', '<b><?php xl('None', 'e'); ?></b>');
766 active_pid = pid;
767 active_encounter = 0;
768 encounter_locked = false;
769 if (frname) reloadPatient(frname);
770 syncRadios();
771 $(parent.Title.document.getElementById('current_patient_block')).show();
772 var encounter_block = $(parent.Title.document.getElementById('current_encounter_block'));
773 $(encounter_block).hide();
775 // zero out the encounter frame, replace it with the encounter list frame
776 var f = document.forms[0];
777 if ( f.cb_top.checked && f.cb_bot.checked ) {
778 var encounter_frame = getEncounterTargetFrame('enc');
779 if ( encounter_frame != undefined ) {
780 loadFrame('ens0',encounter_frame, '<?php echo $primary_docs['ens'][2]; ?>');
784 $(parent.Title.document.getElementById('clear_active')).show();//To display Clear Active Patient button on selecting a patient
785 $(parent.Title.document.getElementById('clear_active_group')).hide();//To hide Clear Active group button on selecting a patient
789 // Call this to announce that the therapy group has changed. You must call this
790 // if you change the session 'therapy_group', so that the navigation frame will show the
791 // correct group.
792 function setTherapyGroup(group_id, group_name) {
793 clearPatient();
795 $(parent.Title.document.querySelector('#current_patient_block span.text')).hide();
796 setTitleContent('current_patient', '<span><?php echo xls('Therapy Group');?> - <a href=\'javascript:;\' onclick="parent.left_nav.loadCurrentGroupFromTitle(' + group_id +')">' + group_name + ' (' + group_id + ')<a></span>' );
797 if (group_id == active_gid) return;
798 setDivContent('current_encounter', '<b><?php xl('None', 'e'); ?></b>');
799 active_gid = group_id;
800 active_encounter = 0;
801 encounter_locked = false;
802 syncRadios();
803 $(parent.Title.document.getElementById('current_patient_block')).show();
804 var encounter_block = $(parent.Title.document.getElementById('current_encounter_block'));
805 $(encounter_block).hide();
807 // zero out the encounter frame, replace it with the encounter list frame
808 var f = document.forms[0];
809 if ( f.cb_top.checked && f.cb_bot.checked ) {
810 var encounter_frame = getEncounterTargetFrame('enc');
811 if ( encounter_frame != undefined ) {
812 loadFrame('ens0',encounter_frame, '<?php echo $primary_docs['ens'][2]; ?>');
816 $(parent.Title.document.getElementById('clear_active_group')).show();//To display Clear Active group button on selecting a patient
817 $(parent.Title.document.getElementById('clear_active')).hide();//To hide Clear Active Patient button on selecting a patient
820 function setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray) {
821 //This function lists all encounters of the patient.
822 //This function writes the drop down in the top frame.
823 //It is called when a new patient is create/selected from the search menu.
824 var str = '<Select class="text" id="EncounterHistory" onchange="{top.restoreSession();toencounter(this.options[this.selectedIndex].value)}">';
825 str+='<option value=""><?php echo htmlspecialchars(xl('Encounter History'), ENT_QUOTES) ?></option>';
826 <?php if (acl_check_form('newpatient', '', array('write', 'addonly'))) { ?>
827 str+='<option value="New Encounter"><?php echo htmlspecialchars(xl('New Encounter'), ENT_QUOTES) ?></option>';
828 <?php } ?>
829 str+='<option value="Past Encounter List"><?php echo htmlspecialchars(xl('Past Encounter List'), ENT_QUOTES) ?></option>';
830 for(CountEncounter=0;CountEncounter<EncounterDateArray.length;CountEncounter++)
832 str+='<option value="'+EncounterIdArray[CountEncounter]+'~'+EncounterDateArray[CountEncounter]+'">'+EncounterDateArray[CountEncounter]+'-'+CalendarCategoryArray[CountEncounter]+'</option>';
834 str+='</Select>';
835 $(parent.Title.document.getElementById('past_encounter_block')).show();
836 top.window.parent.Title.document.getElementById('past_encounter').innerHTML=str;
839 function loadCurrentPatientFromTitle() {
840 top.restoreSession();
841 top.frames['RTop'].location='../patient_file/summary/demographics.php';
844 function loadCurrentGroupFromTitle(gid) {
845 top.restoreSession();
846 top.frames['RTop'].location='../therapy_groups/index.php?method=groupDetails&group_id=' + gid;
849 function getEncounterTargetFrame( name ) {
850 var bias = <?php echo $primary_docs[ 'enc' ][ 1 ]?>;
851 var f = document.forms[0];
852 var r = 'RTop';
853 if (f.cb_top.checked && f.cb_bot.checked) {
854 if ( bias == 2 ) {
855 r = 'RBot';
856 } else {
857 r = 'RTop';
859 } else {
860 if ( f.cb_top.checked ) {
861 r = 'RTop';
862 } else if ( f.cb_bot.checked ) {
863 r = 'RBot';
866 return r;
869 function isEncounterLocked( encounterId ) {
870 <?php if ($esignApi->lockEncounters()) { ?>
871 // If encounter locking is enabled, make a syncronous call (async=false) to check the
872 // DB to see if the encounter is locked.
873 // Call restore session, just in case
874 top.restoreSession();
875 $.ajax({
876 type: 'POST',
877 url: '<?php echo $GLOBALS['webroot']?>/interface/esign/index.php?module=encounter&method=esign_is_encounter_locked',
878 data: { encounterId : encounterId },
879 success: function( data ) {
880 encounter_locked = data;
882 dataType: 'json',
883 async:false
885 return encounter_locked;
886 <?php } else { ?>
887 // If encounter locking isn't enabled, just tell the left_nav that the encounter
888 // isn't locked.
889 return false;
890 <?php } ?>
893 // Call this to announce that the encounter has changed. You must call this
894 // if you change the session encounter, so that the navigation frame will
895 // show the correct encounter and so that the other frame will be reloaded if
896 // it contains encounter-specific information from the previous encounter.
897 // frname is the name of the frame that the call came from, so we know to only
898 // reload encounter-specific content from the *other* frame.
899 function setEncounter(edate, eid, frname) {
900 if (eid == active_encounter) return;
901 if (!eid) edate = '<?php xl('None', 'e'); ?>';
902 var str = '<b>' + edate + '</b>';
903 setDivContent('current_encounter', str);
904 active_encounter = eid;
905 encounter_locked=isEncounterLocked(active_encounter);
906 reloadEncounter(frname);
907 syncRadios();
908 var encounter_block = $(parent.Title.document.getElementById('current_encounter_block'));
909 var encounter = $(parent.Title.document.getElementById('current_encounter'));
910 var estr = '<a href=\'javascript:;\' onclick="parent.left_nav.loadCurrentEncounterFromTitle()"><b>' + edate + ' (' + eid + ')</b></a>';
911 encounter.html( estr );
912 encounter_block.show();
915 function loadCurrentEncounterFromTitle() {
916 top.restoreSession();
917 top.frames[ parent.left_nav.getEncounterTargetFrame('enc') ].location='../patient_file/encounter/encounter_top.php';
920 // You must call this if you delete the active patient (or if for any other
921 // reason you "close" the active patient without opening a new one), so that
922 // the appearance of the navigation frame will be correct and so that any
923 // stale content will be reloaded.
924 function clearPatient() {
925 if (active_pid == 0) return;
926 var f = document.forms[0];
927 active_pid = 0;
928 active_encounter = 0;
929 encounter_locked = false;
930 setDivContent('current_patient', '<b><?php xl('None', 'e'); ?></b>');
931 $(parent.Title.document.getElementById('current_patient_block')).hide();
932 top.window.parent.Title.document.getElementById('past_encounter').innerHTML='';
933 $(parent.Title.document.getElementById('current_encounter_block')).hide();
934 reloadPatient('');
935 syncRadios();
938 // You must call this if you delete the active therapy group so that
939 // the appearance of the navigation frame will be correct and so that any
940 // stale content will be reloaded.
941 function clearTherapyGroup() {
942 if (active_gid == 0) return;
943 var f = document.forms[0];
944 active_gid = 0;
945 active_encounter = 0;
946 encounter_locked = false;
947 setDivContent('current_patient', '<b><?php xl('None', 'e'); ?></b>');
948 $(parent.Title.document.getElementById('current_patient_block')).hide();
949 top.window.parent.Title.document.getElementById('past_encounter').innerHTML='';
950 $(parent.Title.document.getElementById('current_encounter_block')).hide();
951 syncRadios();
954 // You must call this if you delete the active encounter (or if for any other
955 // reason you "close" the active encounter without opening a new one), so that
956 // the appearance of the navigation frame will be correct and so that any
957 // stale content will be reloaded.
958 function clearEncounter() {
959 if (active_encounter == 0) return;
960 top.window.parent.Title.document.getElementById('current_encounter').innerHTML="<b><?php echo htmlspecialchars(xl('None'), ENT_QUOTES) ?></b>";
961 active_encounter = 0;
962 encounter_locked = false;
963 reloadEncounter('');
964 syncRadios();
967 function removeOptionSelected(EncounterId)
968 {//Removes an item from the Encounter drop down.
969 var elSel = top.window.parent.Title.document.getElementById('EncounterHistory');
970 var i;
971 for (i = elSel.length - 1; i>=2; i--) {
972 EncounterHistoryValue=elSel.options[i].value;
973 EncounterHistoryValueArray=EncounterHistoryValue.split('~');
974 if (EncounterHistoryValueArray[0]==EncounterId) {
975 elSel.remove(i);
980 // You can call this to make sure the session pid is what we expect.
981 function pidSanityCheck(pid) {
982 if (pid != active_pid) {
983 alert('Session patient ID is ' + pid + ', expecting ' + active_pid +
984 '. This session is unstable and should be abandoned. Do not use ' +
985 'OpenEMR in multiple browser windows!');
986 return false;
988 return true;
991 // You can call this to make sure the session encounter is what we expect.
992 function encounterSanityCheck(eid) {
993 if (eid != active_encounter) {
994 alert('Session encounter ID is ' + eid + ', expecting ' + active_encounter +
995 '. This session is unstable and should be abandoned. Do not use ' +
996 'OpenEMR in multiple browser windows!');
997 return false;
999 return true;
1002 // Pop up a report.
1003 function repPopup(aurl) {
1004 top.restoreSession();
1005 window.open('<?php echo "$web_root/interface/reports/" ?>' + aurl, '_blank', 'width=750,height=550,resizable=1,scrollbars=1');
1006 return false;
1009 // This is invoked to pop up some window when a popup item is selected.
1010 function selpopup(selobj) {
1011 var i = selobj.selectedIndex;
1012 var opt = selobj.options[i];
1013 if (i > 0) {
1014 var width = 750;
1015 var height = 550;
1016 if (opt.text == 'Export' || opt.text == 'Import') {
1017 width = 500;
1018 height = 400;
1020 dlgopen(opt.value, '_blank', width, height);
1022 selobj.selectedIndex = 0;
1025 // Treeview activation stuff:
1026 $(document).ready(function(){
1027 if(1 == <?php echo $GLOBALS['menu_styling_vertical'] ?>){
1028 $("#navigation-slide > li > a.collapsed + ul").slideToggle("medium");
1029 $("#navigation-slide > li > ul > li > a.collapsed_lv2 + ul").slideToggle("medium");
1030 $("#navigation-slide > li > a.expanded").click(function() {
1031 $("#navigation-slide > li > a.expanded").not(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
1032 $(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
1034 $("#navigation-slide > li > a.collapsed").click(function() {
1035 $("#navigation-slide > li > a.expanded").not(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
1036 $(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
1038 $("#navigation-slide > li > ul > li > a.expanded_lv2").click(function() {
1039 $("#navigation-slide > li > a.expanded").next("ul").find("li > a.expanded_lv2").not(this).toggleClass("expanded_lv2").toggleClass("collapsed_lv2").parent().find('> ul').slideToggle("medium");
1040 $(this).toggleClass("expanded_lv2").toggleClass("collapsed_lv2").parent().find('> ul').slideToggle("medium");
1042 $("#navigation-slide > li > ul > li > a.collapsed_lv2").click(function() {
1043 $("#navigation-slide > li > a.expanded").next("ul").find("li > a.expanded_lv2").not(this).toggleClass("expanded_lv2").toggleClass("collapsed_lv2").parent().find('> ul').slideToggle("medium");
1044 $(this).toggleClass("expanded_lv2").toggleClass("collapsed_lv2").parent().find('> ul').slideToggle("medium");
1046 $("#navigation-slide > li > a#cal0").prepend('<i class="fa fa-fw fa-calendar"></i>&nbsp;');
1047 $("#navigation-slide > li > a#pfb0").prepend('<i class="fa fa-fw fa-list-alt"></i>&nbsp;');
1048 $("#navigation-slide > li > a#msg0").prepend('<i class="fa fa-fw fa-envelope-o"></i>&nbsp;');
1049 $("#navigation-slide > li > a#app0").prepend('<i class="fa fa-fw fa-user"></i>&nbsp;');
1050 $("#navigation-slide > li > a#ppo0").prepend('<i class="fa fa-fw fa-users"></i>&nbsp;');
1051 $("#navigation-slide > li > a#repimg").prepend('<i class="fa fa-fw fa-area-chart"></i>&nbsp;');
1052 $("#navigation-slide > li > a#feeimg").prepend('<i class="fa fa-fw fa-dollar"></i>&nbsp;');
1053 $("#navigation-slide > li > a#adm0").prepend('<i class="fa fa-fw fa-list-ol"></i>&nbsp;');
1054 $("#navigation-slide > li > a#invimg").prepend('<i class="fa fa-fw fa-list-ol"></i>&nbsp;');
1055 $("#navigation-slide > li > a#admimg").prepend('<i class="fa fa-fw fa-cogs"></i>&nbsp;');
1056 $("#navigation-slide > li > a#misimg").prepend('<i class="fa fa-fw fa-cog"></i>&nbsp;');
1057 $("#navigation-slide > li > a#proimg").prepend('<i class="fa fa-fw fa-stethoscope"></i>&nbsp;');
1058 $("#navigation-slide > li > a#modimg").prepend('<i class="fa fa-fw fa-puzzle-piece"></i>&nbsp;');
1059 $("#navigation-slide > li").each(function(index) {
1060 if($(" > ul > li", this).size() == 0){
1061 $(" > a", this).addClass("collapsed");
1064 } else { // $GLOBALS['menu_styling_vertical'] == 0
1066 //Remove the links (used by the sliding menu) that will break treeview
1067 $('a.collapsed').each(function() { $(this).replaceWith('<span>'+$(this).text()+'</span>'); });
1068 $('a.collapsed_lv2').each(function() { $(this).replaceWith('<span>'+$(this).text()+'</span>'); });
1069 $('a.expanded').each(function() { $(this).replaceWith('<span>'+$(this).text()+'</span>'); });
1070 $('a.expanded_lv2').each(function() { $(this).replaceWith('<span>'+$(this).text()+'</span>'); });
1072 // Initiate treeview
1073 $("#navigation").treeview({
1074 animated: "fast",
1075 collapsed: true,
1076 unique: true,
1077 toggle: function() {
1078 window.console && console.log("%o was toggled", this);
1084 </script>
1086 </head>
1088 <body class="body_nav main-left">
1090 <form method='post' name='find_patient' target='RTop'
1091 action='<?php echo $rootdir ?>/main/finder/patient_select.php'>
1093 <center>
1094 <select name='sel_frame' style='background-color:transparent;font-size:9pt;width:100;'>
1095 <option value='0'><?php xl('Default', 'e'); ?></option>
1096 <option value='1'><?php xl('Top', 'e'); ?></option>
1097 <option value='2'><?php xl('Bottom', 'e'); ?></option>
1098 </select>
1099 </center>
1101 <table cellpadding='0' cellspacing='0' border='0' width='100%'>
1102 <tr>
1103 <td class='smalltext' nowrap>
1104 <input type='checkbox' name='cb_top' onclick='toggleFrame(1)' <?php echo $cb_top_chk ?> />
1105 <b><?php xl('Top', 'e') ?></b>
1106 </td>
1107 <td class='smalltext' align='right' nowrap>
1108 <b><?php xl('Bot', 'e') ?></b>
1109 <input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' <?php echo $cb_bot_chk ?> />
1110 </td>
1111 </tr>
1112 </table>
1114 <?php if ($GLOBALS['menu_styling_vertical'] == 1) { ?>
1115 <ul id="navigation-slide">
1116 <?php } else { // ($GLOBALS['menu_styling_vertical'] == 0) ?>
1117 <ul id="navigation">
1118 <?php } ?>
1120 <?php
1121 if (!$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1122 genTreeLink('RTop', 'cal', xl('Calendar'));
1125 if (!$GLOBALS['disable_pat_trkr'] && !$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1126 genTreeLink('RTop', 'pfb', xl('Flow Board'));
1129 if (acl_check('patients', 'notes')) {
1130 genTreeLink('RBot', 'msg', xl('Messages'));
1133 if ($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address'] && acl_check('patientportal', 'portal')) {
1134 genTreeLink('RTop', 'app', xl('Portal Activity'));
1137 if ($GLOBALS['portal_onsite_two_enable'] && acl_check('patientportal', 'portal')) {
1138 genTreeLink('RTop', 'aop', xl('Portal Dashboard'));
1141 if ($GLOBALS['gbl_portal_cms_enable'] && acl_check('patientportal', 'portal')) {
1142 genPopLink(xl('CMS Portal'), '../cmsportal/list_requests.php', 'ppo0');
1146 <li class="open"><a class="expanded" id="patimg" ><i class="fa fa-fw fa-user"></i>&nbsp;<span><?php xl('Patient/Client', 'e') ?></span></a>
1147 <ul>
1148 <?php if (acl_check('patients', 'demo')) {
1149 genMiscLink('RTop', 'fin', '0', xl('Patients'), 'main/finder/dynamic_finder.php');
1150 } ?>
1151 <?php if (acl_check('patients', 'demo', '', 'write') || acl_check('patients', 'demo', '', 'addonly')) {
1152 genTreeLink('RTop', 'new', ($GLOBALS['full_new_patient_form'] ? xl('New/Search') : xl('New')));
1153 } ?>
1154 <?php if (acl_check('patients', 'demo')) {
1155 genTreeLink('RTop', 'dem', xl('Summary'));
1156 } ?>
1158 <?php if (acl_check('patients', 'appt') || acl_check_form('newpatient', '', array('write', 'addonly'))) { ?>
1159 <li class="open"><a class="expanded_lv2"><span><?php xl('Visits', 'e') ?></span></a>
1160 <ul>
1161 <?php if (acl_check_form('newpatient', '', array('write', 'addonly'))) {
1162 genTreeLink('RBot', 'nen', xl('Create Visit'));
1163 } ?>
1164 <?php if (acl_check('patients', 'appt')) {
1165 genTreeLink('RBot', 'enc', xl('Current'));
1166 } ?>
1167 <?php if (acl_check('patients', 'appt')) {
1168 genTreeLink('RBot', 'ens', xl('Visit History'));
1169 } ?>
1170 </ul>
1171 </li>
1172 <?php } ?>
1174 <?php if (acl_check('patients', 'med')) { ?>
1175 <li><a class="collapsed_lv2"><span><?php xl('Records', 'e') ?></span></a>
1176 <ul>
1177 <?php genTreeLink('RTop', 'prq', xl('Patient Record Request')); ?>
1178 </ul>
1179 </li>
1180 <?php } ?>
1182 <?php if ($GLOBALS['gbl_nav_visit_forms'] && acl_check('patients', 'demo')) { ?>
1183 <li><a class="collapsed_lv2"><span><?php xl('Visit Forms', 'e') ?></span></a>
1184 <ul>
1185 <?php
1186 // Generate the items for visit forms, both traditional and LBF.
1188 $lres = sqlStatement("SELECT * FROM list_options " .
1189 "WHERE list_id = 'lbfnames' AND activity = 1 ORDER BY seq, title");
1190 while ($lrow = sqlFetchArray($lres)) {
1191 $option_id = $lrow['option_id']; // should start with LBF
1192 $title = $lrow['title'];
1193 // Check ACO attribute, if any, of this LBF.
1194 $jobj = json_decode($lrow['notes'], true);
1195 if (!empty($jobj['aco'])) {
1196 $tmp = explode('|', $jobj['aco']);
1197 if (!acl_check($tmp[0], $tmp[1], '', 'write')) {
1198 continue;
1202 genMiscLink(
1203 'RBot',
1204 'cod',
1205 '2',
1206 xl_form_title($title),
1207 "patient_file/encounter/load_form.php?formname=$option_id"
1212 include_once("$srcdir/registry.inc");
1213 $reg = getRegistered();
1214 if (!empty($reg)) {
1215 foreach ($reg as $entry) {
1216 $option_id = $entry['directory'];
1217 $title = trim($entry['nickname']);
1218 if ($option_id == 'fee_sheet') {
1219 continue;
1222 if ($option_id == 'newpatient') {
1223 continue;
1226 // Check permission to create forms of this type.
1227 $tmp = explode('|', $entry['aco_spec']);
1228 if (!empty($tmp[1])) {
1229 if (!acl_check($tmp[0], $tmp[1], '', 'write') && !acl_check($tmp[0], $tmp[1], '', 'addonly')) {
1230 continue;
1234 if (empty($title)) {
1235 $title = $entry['name'];
1238 genMiscLink(
1239 'RBot',
1240 'cod',
1241 '2',
1242 xl_form_title($title),
1243 "patient_file/encounter/load_form.php?formname=" .
1244 urlencode($option_id)
1249 </ul>
1250 </li>
1251 <li class="collapsed" ><a class="collapsed_lv2"><span><?php echo xlt('Import') ?></span></a>
1252 <ul>
1253 <?php genMiscLink('RTop', 'ccr', '0', xlt('Upload'), 'patient_file/ccr_import.php'); ?>
1254 <?php genMiscLink('RTop', 'apr', '0', xlt('Pending Approval'), 'patient_file/ccr_pending_approval.php'); ?>
1255 </ul>
1256 </li>
1257 <?php } // end if gbl_nav_visit_forms ?>
1259 </ul>
1260 </li>
1262 <?php if ($GLOBALS['enable_group_therapy']) : ?>
1263 <li><a class="collapsed" id="groupimg" ><i class="fa fa-fw fa-users"></i>&nbsp;<span><?php xl('Group', 'e') ?></span></a>
1264 <ul>
1265 <?php genMiscLink('RTop', 'gfn', '0', xl('Groups'), 'therapy_groups/index.php?method=listGroups'); ?>
1266 <?php genTreeLink('RTop', 'gng', xl('New')); ?>
1267 <?php genTreeLink('RTop', 'gdg', xl('Group Details')); ?>
1268 <li><a class="collapsed_lv2"><span><?php xl('Visits', 'e') ?></span></a>
1269 <ul>
1270 <?php genTreeLink('RBot', 'gcv', xl('Create Visit')); ?>
1271 <?php genTreeLink('RBot', 'gce', xl('Current')); ?>
1272 <?php genTreeLink('RBot', 'gvh', xl('Visit History')); ?>
1273 </ul>
1274 </li>
1276 </ul>
1277 </li>
1278 <?php endif ?>
1280 <?php // TajEmo Work by CB 2012/06/21 10:41:15 AM hides fees if disabled in globals ?>
1281 <?php if ((!isset($GLOBALS['enable_fees_in_left_menu']) || $GLOBALS['enable_fees_in_left_menu'] == 1) &&
1282 (acl_check('encounters', 'coding') || acl_check('acct', 'eob') || acl_check('acct', 'bill', '', 'write'))) { ?>
1283 <li><a class="collapsed" id="feeimg" ><span><?php xl('Fees', 'e') ?></span></a>
1284 <ul>
1285 <?php if (acl_check('encounters', 'coding')) {
1286 genMiscLink('RBot', 'cod', '2', xl('Fee Sheet'), 'patient_file/encounter/load_form.php?formname=fee_sheet');
1287 } ?>
1288 <?php if ($GLOBALS['use_charges_panel'] && acl_check('encounters', 'coding')) {
1289 genTreeLink('RBot', 'cod', xl('Charges'));
1290 } ?>
1291 <?php if (acl_check('acct', 'bill', '', 'write')) {
1292 genMiscLink('RBot', 'pay', '1', xl('Payment'), 'patient_file/front_payment.php');
1293 } ?>
1294 <?php if (acl_check('acct', 'bill', '', 'write')) {
1295 genMiscLink('RBot', 'bil', '1', xl('Checkout'), 'patient_file/pos_checkout.php?framed=1');
1296 } ?>
1297 <?php if (!$GLOBALS['simplified_demographics'] && (acl_check('acct', 'bill', '', 'write') || acl_check('acct', 'eob', '', 'write'))) {
1298 genTreeLink('RTop', 'bil', xl('Billing'));
1299 } ?>
1300 <?php if ($GLOBALS['enable_batch_payment'] && (acl_check('acct', 'bill', '', 'write') || acl_check('acct', 'eob', '', 'write'))) {
1301 genTreeLink('RTop', 'npa', xl('Batch Payments'), false, 2);
1303 <?php if ($GLOBALS['enable_posting'] && acl_check('acct', 'eob', '', 'write')) {
1304 genMiscLink('RTop', 'eob', '0', xl('Posting'), 'billing/sl_eob_search.php');
1305 } ?>
1306 <?php if ($GLOBALS['enable_edihistory_in_left_menu'] && acl_check('acct', 'eob')) {
1307 genTreeLink('RTop', 'edi', xl('EDI History'), false, 2);
1309 </ul>
1310 </li>
1311 <?php } ?>
1313 <?php if (acl_check('menus', 'modle')) {?>
1314 <li><a class="collapsed" id="modimg" ><span><?php echo xlt('Modules') ?></span></a>
1315 <ul>
1316 <?php genMiscLink('RTop', 'adm', '0', xl('Manage Modules'), 'modules/zend_modules/public/Installer'); ?>
1317 <?php //genTreeLink('RTop','ort',xl('Settings')); ?>
1318 <?php
1319 $module_query = sqlStatement("select mod_id, mod_directory,mod_name,mod_nick_name,mod_relative_link,type from modules where mod_active = 1 AND sql_run= 1 order by mod_ui_order asc");
1320 if (sqlNumRows($module_query)) {
1321 while ($modulerow = sqlFetchArray($module_query)) {
1322 $module_hooks = sqlStatement("SELECT msh.*,ms.obj_name,ms.menu_name,ms.path,m.mod_ui_name,m.type FROM modules_hooks_settings AS msh LEFT OUTER JOIN modules_settings AS ms ON
1323 obj_name=enabled_hooks AND ms.mod_id=msh.mod_id LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
1324 WHERE m.mod_id = ? AND fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='modules' ORDER BY m.mod_id", array($modulerow['mod_id']));
1326 $modulePath = "";
1327 $added = "";
1328 if ($modulerow['type'] == 0) {
1329 $modulePath = $GLOBALS['customModDir'];
1330 $added = "";
1331 } else {
1332 $added = "index";
1333 $modulePath = $GLOBALS['zendModDir'];
1336 if (sqlNumRows($module_hooks) == 0) {
1337 // module without hooks in module section
1338 $acl_section = strtolower($modulerow['mod_directory']);
1339 $disallowed[$acl_section] = zh_acl_check($_SESSION['authUserID'], $acl_section) ? "" : "1";
1341 $relative_link ="modules/".$modulePath."/".$modulerow['mod_relative_link'].$added;
1342 $mod_nick_name = $modulerow['mod_nick_name'] ? $modulerow['mod_nick_name'] : $modulerow['mod_name'];
1343 genMiscLink2('RTop', $acl_section, '0', xlt($mod_nick_name), $relative_link);
1344 } else {
1345 // module with hooks in module section
1346 $jid = 0;
1347 $modid = '';
1348 while ($hookrow = sqlFetchArray($module_hooks)) {
1349 $disallowed[$hookrow['obj_name']] = !$disallowed['adm'] || zh_acl_check($_SESSION['authUserID'], $hookrow['obj_name']) ? "" : "1";
1351 $relative_link ="modules/".$modulePath."/".$hookrow['mod_relative_link'].$hookrow['path'];
1352 $mod_nick_name = $hookrow['menu_name'] ? $hookrow['menu_name'] : 'NoName';
1354 if ($jid==0 || ($modid!=$hookrow['mod_id'])) {
1355 if ($modid!='') {
1356 echo "</ul>";
1359 <li><a class="collapsed_lv2"><span><?php echo xlt($hookrow['mod_ui_name']); ?></span></a>
1360 <ul>
1361 <?php
1364 $jid++;
1365 $modid = $hookrow['mod_id'];
1366 genMiscLink('RTop', $hookrow['obj_name'], '0', xlt($mod_nick_name), $relative_link);
1369 echo "</ul>";
1373 <?php
1374 } ?>
1375 </ul>
1376 </li>
1378 <?php } ?>
1380 <?php if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) { ?>
1381 <li><a class="collapsed" id="invimg" ><span><?php xl('Inventory', 'e') ?></span></a>
1382 <ul>
1383 <?php genMiscLink('RTop', 'adm', '0', xl('Management'), 'drugs/drug_inventory.php'); ?>
1384 <?php genPopLink(xl('Destroyed'), 'destroyed_drugs_report.php'); ?>
1385 </ul>
1386 </li>
1387 <?php } ?>
1389 <?php if (acl_check('patients', 'lab')) { ?>
1390 <li><a class="collapsed" id="proimg" ><span><?php xl('Procedures', 'e') ?></span></a>
1391 <ul>
1392 <?php if (acl_check('admin', 'super')) {
1393 genTreeLink('RTop', 'orl', xl('Providers'));
1394 } ?>
1395 <?php if (acl_check('admin', 'super')) {
1396 genTreeLink('RTop', 'ort', xl('Configuration'));
1397 } ?>
1398 <?php if (acl_check('admin', 'super')) {
1399 genTreeLink('RTop', 'orc', xl('Load Compendium'));
1400 } ?>
1401 <?php genTreeLink('RTop', 'orp', xl('Pending Review')); ?>
1402 <?php genTreeLink('RTop', 'orr', xl('Patient Results')); ?>
1403 <?php genTreeLink('RTop', 'lda', xl('Lab Overview')); ?>
1404 <?php genTreeLink('RTop', 'orb', xl('Batch Results')); ?>
1405 <?php genTreeLink('RTop', 'ore', xl('Electronic Reports')); ?>
1406 <?php genTreeLink('RTop', 'dld', xl('Lab Documents'));?>
1407 </ul>
1408 </li>
1409 <?php } ?>
1411 <?php
1412 if ($GLOBALS['erx_enable'] && acl_check('patients', 'rx')) {
1413 $newcrop_user_role = sqlQuery("SELECT newcrop_user_role FROM users WHERE username = '".$_SESSION['authUser']."'");
1414 if ($newcrop_user_role['newcrop_user_role']) {
1416 <li><a class="collapsed" id="feeimg" ><span><?php xl('New Crop', 'e') ?></span></a>
1417 <ul>
1418 <li><a class="collapsed_lv2"><span><?php xl('Status', 'e') ?></span></a>
1419 <ul>
1420 <?php genTreeLink('RTop', 'erx', xl('e-Rx')); ?>
1421 <?php genMiscLink('RTop', 'err', '0', xl('e-Rx Renewal'), 'eRx.php?page=status'); ?>
1422 <?php if ($newcrop_user_role['newcrop_user_role'] === 'erxadmin') {
1423 genMiscLink('RTop', 'ere', '0', xl('e-Rx EPCS'), 'eRx.php?page=epcs-admin');
1424 } ?>
1425 </ul>
1426 </li>
1427 </ul>
1428 </li>
1429 <?php
1434 <?php if (!$disallowed['adm']) { ?>
1435 <li><a class="collapsed" id="admimg" ><span><?php xl('Administration', 'e') ?></span></a>
1436 <ul>
1437 <?php if (acl_check('admin', 'super')) {
1438 genMiscLink('RTop', 'adm', '0', xl('Globals'), 'super/edit_globals.php');
1439 } ?>
1440 <?php if (acl_check('admin', 'users')) {
1441 genMiscLink('RTop', 'adm', '0', xl('Facilities'), 'usergroup/facilities.php');
1442 } ?>
1443 <?php if (acl_check('admin', 'users')) {
1444 genMiscLink('RTop', 'adm', '0', xl('Users'), 'usergroup/usergroup_admin.php');
1445 } ?>
1446 <?php if (acl_check('admin', 'practice')) {
1447 genTreeLink('RTop', 'adb', xl('Addr Book'));
1448 } ?>
1449 <?php
1450 // Changed the target URL from practice settings -> Practice Settings - Pharmacy... Dec 09,09 .. Visolve ... This replaces empty frame with Pharmacy window
1451 if (acl_check('admin', 'practice')) {
1452 genMiscLink('RTop', 'adm', '0', xl('Practice'), '../controller.php?practice_settings&pharmacy&action=list');
1453 } ?>
1454 <?php if (acl_check('admin', 'superbill')) {
1455 genTreeLink('RTop', 'sup', xl('Codes'));
1456 } ?>
1457 <?php if (acl_check('admin', 'super')) {
1458 genMiscLink('RTop', 'adm', '0', xl('Layouts'), 'super/edit_layout.php');
1459 } ?>
1460 <?php if (acl_check('admin', 'super')) {
1461 genMiscLink('RTop', 'adm', '0', xl('Lists'), 'super/edit_list.php');
1462 } ?>
1463 <?php if (acl_check('admin', 'acl')) {
1464 genMiscLink('RTop', 'adm', '0', xl('ACL'), 'usergroup/adminacl.php');
1465 } ?>
1466 <?php if (acl_check('admin', 'super')) {
1467 genMiscLink('RTop', 'adm', '0', xl('Files'), 'super/manage_site_files.php');
1468 } ?>
1469 <?php if (acl_check('admin', 'super')) {
1470 genMiscLink('RTop', 'adm', '0', xl('Backup'), 'main/backup.php');
1471 } ?>
1472 <?php if (acl_check('admin', 'super') && $GLOBALS['enable_cdr']) {
1473 genMiscLink('RTop', 'adm', '0', xl('Rules'), 'super/rules/index.php?action=browse!list');
1474 } ?>
1475 <?php if (acl_check('admin', 'super') && $GLOBALS['enable_cdr']) {
1476 genMiscLink('RTop', 'adm', '0', xl('Alerts'), 'super/rules/index.php?action=alerts!listactmgr');
1477 } ?>
1478 <?php if (acl_check('admin', 'super') && $GLOBALS['enable_cdr']) {
1479 genMiscLink('RTop', 'adm', '0', xl('Patient Reminders'), 'patient_file/reminder/patient_reminders.php?mode=admin&patient_id=');
1480 } ?>
1481 <?php if (($GLOBALS['include_de_identification']) && (acl_check('admin', 'super'))) {
1482 genMiscLink('RTop', 'adm', '0', xl('De Identification'), 'de_identification_forms/de_identification_screen1.php');
1483 } ?>
1484 <?php if (($GLOBALS['include_de_identification']) && (acl_check('admin', 'super'))) {
1485 genMiscLink('RTop', 'adm', '0', xl('Re Identification'), 'de_identification_forms/re_identification_input_screen.php');
1486 } ?>
1487 <?php if (acl_check('admin', 'super') && !empty($GLOBALS['code_types']['IPPF'])) {
1488 genMiscLink('RTop', 'adm', '0', xl('Export'), 'main/ippf_export.php');
1489 } ?>
1490 <li><a class="collapsed_lv2"><span><?php xl('Other', 'e') ?></span></a>
1491 <ul>
1492 <?php if (acl_check('admin', 'language')) {
1493 genMiscLink('RTop', 'adm', '0', xl('Language'), 'language/language.php');
1494 } ?>
1495 <?php if (acl_check('admin', 'forms')) {
1496 genMiscLink('RTop', 'adm', '0', xl('Forms'), 'forms_admin/forms_admin.php');
1497 } ?>
1498 <?php if (acl_check('admin', 'calendar') && !$GLOBALS['disable_calendar']) {
1499 genMiscLink('RTop', 'adm', '0', xl('Calendar'), 'main/calendar/index.php?module=PostCalendar&type=admin&func=modifyconfig');
1500 } ?>
1501 <?php if (acl_check('admin', 'users')) {
1502 genMiscLink('RTop', 'adm', '0', xl('Logs'), 'logview/logview.php');
1503 } ?>
1504 <?php
1505 if ($newcrop_user_role['newcrop_user_role'] || $GLOBALS['erx_enable']) {
1506 if (acl_check('admin', 'users')) {
1507 genMiscLink('RTop', 'adm', '0', xl('eRx Logs'), 'logview/erx_logview.php');
1511 <?php if (acl_check('admin', 'users')) {
1512 genMiscLink('RTop', 'adm', '0', xl('Certificates'), 'usergroup/ssl_certificates_admin.php');
1513 } ?>
1514 <?php if (acl_check('admin', 'super')) {
1515 genMiscLink('RTop', 'adm', '0', xl('Native Data Loads'), '../interface/super/load_codes.php');
1516 } ?>
1517 <?php if (acl_check('admin', 'super')) {
1518 genMiscLink('RTop', 'adm', '0', xl('External Data Loads'), '../interface/code_systems/dataloads_ajax.php');
1519 } ?>
1520 <?php if (acl_check('admin', 'super')) {
1521 genMiscLink('RTop', 'adm', '0', xl('Merge Patients'), 'patient_file/merge_patients.php');
1522 } ?>
1523 <?php if (acl_check('admin', 'super')) {
1524 genMiscLink('RTop', 'adm', '0', xl('Import Holidays'), '../interface/main/holidays/import_holidays.php');
1525 } ?>
1526 <?php if ($GLOBALS['enable_auditlog_encryption']) {
1527 genMiscLink('RTop', 'rep', '0', xl('Audit Log Tamper'), 'reports/audit_log_tamper_report.php');
1528 } ?>
1529 </ul>
1530 </li>
1531 </ul>
1532 </li>
1533 <?php } ?>
1535 <li><a class="collapsed" id="repimg" ><span><?php xl('Reports', 'e') ?></span></a>
1536 <ul>
1537 <?php
1538 $module_query = sqlStatement("SELECT msh.*,ms.obj_name,ms.menu_name,ms.path,m.mod_ui_name,m.type FROM modules_hooks_settings AS msh LEFT OUTER JOIN modules_settings AS ms ON
1539 obj_name=enabled_hooks AND ms.mod_id=msh.mod_id LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
1540 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='reports' ORDER BY mod_id");
1541 if (sqlNumRows($module_query)) {
1542 $jid = 0;
1543 $modid = '';
1544 while ($modulerow = sqlFetchArray($module_query)) {
1545 $modulePath = "";
1546 $added = "";
1547 if ($modulerow['type'] == 0) {
1548 $modulePath = $GLOBALS['customModDir'];
1549 $added = "";
1550 } else {
1551 $added = "index";
1552 $modulePath = $GLOBALS['zendModDir'];
1555 $disallowed[$modulerow['obj_name']] = !$disallowed['adm'] || zh_acl_check($_SESSION['authUserID'], $modulerow['obj_name']) ? "" : "1";
1557 $relative_link ="modules/".$modulePath."/".$modulerow['mod_relative_link'].$modulerow['path'];
1558 $mod_nick_name = $modulerow['menu_name'] ? $modulerow['menu_name'] : 'NoName';
1560 if ($jid==0 || ($modid!=$modulerow['mod_id'])) {
1561 if ($modid!='') {
1562 echo "</ul>";
1565 <li><a class="collapsed_lv2"><span><?php echo xlt($modulerow['mod_ui_name']); ?></span></a>
1566 <ul>
1567 <?php
1570 $jid++;
1571 $modid = $modulerow['mod_id'];
1572 genMiscLink('RTop', $modulerow['obj_name'], '0', xlt($mod_nick_name), $relative_link);
1575 echo "</ul>";
1576 } ?>
1578 <?php if (acl_check('patients', 'demo') || acl_check('patients', 'med') ||
1579 (acl_check('patients', 'rx') && !$GLOBALS['disable_prescriptions'])) { ?>
1580 <li><a class="collapsed_lv2"><span><?php xl('Clients', 'e') ?></span></a>
1581 <ul>
1582 <?php if (acl_check('patients', 'demo')) {
1583 genMiscLink('RTop', 'rep', '0', xl('List'), 'reports/patient_list.php');
1584 } ?>
1585 <?php if (acl_check('patients', 'rx') && !$GLOBALS['disable_prescriptions']) {
1586 genMiscLink('RTop', 'rep', '0', xl('Rx'), 'reports/prescriptions_report.php');
1587 } ?>
1588 <?php if (acl_check('patients', 'med')) {
1589 genMiscLink('RTop', 'rep', '0', xl('Patient List Creation'), 'reports/patient_list_creation.php');
1590 } ?>
1591 <?php if (acl_check('patients', 'med')) {
1592 genMiscLink('RTop', 'rep', '0', xl('Clinical'), 'reports/clinical_reports.php');
1593 } ?>
1594 <?php if (acl_check('patients', 'med')) {
1595 genMiscLink('RTop', 'rep', '0', xl('Referrals'), 'reports/referrals_report.php');
1596 } ?>
1597 <?php if (acl_check('patients', 'med')) {
1598 genMiscLink('RTop', 'rep', '0', xl('Immunization Registry'), 'reports/immunization_report.php');
1599 } ?>
1600 </ul>
1601 </li>
1602 <?php } ?>
1604 <?php if (acl_check('patients', 'med')) { ?>
1605 <li><a class="collapsed_lv2"><span><?php xl('Clinic', 'e') ?></span></a>
1606 <ul>
1607 <?php if (($GLOBALS['enable_cdr'] || $GLOBALS['enable_cqm'] || $GLOBALS['enable_amc']) && acl_check('patients', 'med')) {
1608 genMiscLink('RTop', 'rep', '0', xl('Report Results'), 'reports/report_results.php');
1609 } ?>
1610 <?php if ($GLOBALS['enable_cdr'] && acl_check('patients', 'med')) {
1611 genMiscLink('RTop', 'rep', '0', xl('Standard Measures'), 'reports/cqm.php?type=standard');
1612 } ?>
1613 <?php if ($GLOBALS['enable_cqm'] && acl_check('patients', 'med')) {
1614 genMiscLink('RTop', 'rep', '0', xl('Quality Measures (CQM)'), 'reports/cqm.php?type=cqm');
1615 } ?>
1616 <?php if ($GLOBALS['enable_amc'] && acl_check('patients', 'med')) {
1617 genMiscLink('RTop', 'rep', '0', xl('Automated Measures (AMC)'), 'reports/cqm.php?type=amc');
1618 } ?>
1619 <?php if ($GLOBALS['enable_amc_tracking'] && acl_check('patients', 'med')) {
1620 genMiscLink('RTop', 'rep', '0', xl('AMC Tracking'), 'reports/amc_tracking.php');
1621 } ?>
1622 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_alert_log'] && acl_check('patients', 'med')) {
1623 genMiscLink('RTop', 'rep', '0', xl('Alerts Log'), 'reports/cdr_log.php');
1624 } ?>
1625 </ul>
1626 </li>
1627 <?php } ?>
1629 <li><a class="collapsed_lv2"><span><?php xl('Visits', 'e') ?></span></a>
1630 <ul>
1631 <?php if (acl_check('acct', 'rep_a')) {
1632 genMiscLink('RTop', 'rep', '0', xl('Daily Report'), 'reports/daily_summary_report.php');
1633 } ?>
1634 <?php if (!$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1635 genMiscLink('RTop', 'rep', '0', xl('Appointments'), 'reports/appointments_report.php');
1636 } ?>
1637 <?php if (!$GLOBALS['disable_pat_trkr'] && !$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1638 genMiscLink('RTop', 'rep', '0', xl('Patient Flow Board'), 'reports/patient_flow_board_report.php');
1639 } ?>
1640 <?php if (acl_check('encounters', 'coding_a')) {
1641 genMiscLink('RTop', 'rep', '0', xl('Encounters'), 'reports/encounters_report.php');
1642 } ?>
1643 <?php if (!$GLOBALS['disable_calendar'] && acl_check('acct', 'rep_a')) {
1644 genMiscLink('RTop', 'rep', '0', xl('Appt-Enc'), 'reports/appt_encounter_report.php');
1645 } ?>
1646 <?php if (empty($GLOBALS['code_types']['IPPF']) && acl_check('encounters', 'coding_a')) {
1647 genMiscLink('RTop', 'rep', '0', xl('Superbill'), 'reports/custom_report_range.php');
1648 } ?>
1649 <?php if (acl_check('patients', 'demo')) {
1650 genMiscLink('RTop', 'rep', '0', xl('Eligibility'), 'reports/edi_270.php');
1651 } ?>
1652 <?php if (acl_check('patients', 'demo')) {
1653 genMiscLink('RTop', 'rep', '0', xl('Eligibility Response'), 'reports/edi_271.php');
1654 } ?>
1655 <?php if (!$GLOBALS['disable_chart_tracker'] && acl_check('patients', 'appt')) {
1656 genMiscLink('RTop', 'rep', '0', xl('Chart Activity'), 'reports/chart_location_activity.php');
1657 } ?>
1658 <?php if (!$GLOBALS['disable_chart_tracker'] && acl_check('patients', 'appt')) {
1659 genMiscLink('RTop', 'rep', '0', xl('Charts Out'), 'reports/charts_checked_out.php');
1660 } ?>
1661 <?php genMiscLink('RTop', 'rep', '0', xl('Services'), 'reports/services_by_category.php'); ?>
1662 <?php if (acl_check('patients', 'med')) {
1663 genMiscLink('RTop', 'rep', '0', xl('Syndromic Surveillance'), 'reports/non_reported.php');
1664 } ?>
1665 </ul>
1666 </li>
1668 <?php if (acl_check('acct', 'rep_a')) { ?>
1669 <li><a class="collapsed_lv2"><span><?php xl('Financial', 'e') ?></span></a>
1670 <ul>
1671 <?php genMiscLink('RTop', 'rep', '0', xl('Sales'), 'reports/sales_by_item.php'); ?>
1672 <?php genMiscLink('RTop', 'rep', '0', xl('Cash Rec'), 'billing/sl_receipts_report.php'); ?>
1673 <?php genMiscLink('RTop', 'rep', '0', xl('Front Rec'), 'reports/front_receipts_report.php'); ?>
1674 <?php genMiscLink('RTop', 'rep', '0', xl('Pmt Method'), 'reports/receipts_by_method_report.php'); ?>
1675 <?php genMiscLink('RTop', 'rep', '0', xl('Collections'), 'reports/collections_report.php'); ?>
1676 <?php genMiscLink('RTop', 'rep', '0', xl('Pat Ledger'), 'reports/pat_ledger.php?form=0'); ?>
1677 <?php genMiscLink('RTop', 'rep', '0', xl('Financial Summary by Service Code'), 'reports/svc_code_financial_report.php'); ?>
1678 </ul>
1679 </li>
1680 <?php } ?>
1682 <?php if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) { ?>
1683 <li><a class="collapsed_lv2"><span><?php xl('Inventory', 'e') ?></span></a>
1684 <ul>
1685 <?php genMiscLink('RTop', 'rep', '0', xl('List'), 'reports/inventory_list.php'); ?>
1686 <?php genMiscLink('RTop', 'rep', '0', xl('Activity'), 'reports/inventory_activity.php'); ?>
1687 <?php genMiscLink('RTop', 'rep', '0', xl('Transactions'), 'reports/inventory_transactions.php'); ?>
1688 </ul>
1689 </li>
1690 <?php } ?>
1692 <?php if (acl_check('patients', 'lab')) { ?>
1693 <li><a class="collapsed_lv2"><span><?php xl('Procedures', 'e') ?></span></a>
1694 <ul>
1695 <?php genPopLink(xl('Pending Res'), '../orders/pending_orders.php'); ?>
1696 <?php if (!empty($GLOBALS['code_types']['IPPF'])) {
1697 genPopLink(xl('Pending F/U'), '../orders/pending_followup.php');
1698 } ?>
1699 <?php genPopLink(xl('Statistics'), '../orders/procedure_stats.php'); ?>
1700 </ul>
1701 </li>
1702 <?php } ?>
1704 <?php if (!$GLOBALS['simplified_demographics'] && (acl_check('acct', 'rep_a') || acl_check('patients', 'demo'))) { ?>
1705 <li><a class="collapsed_lv2"><span><?php xl('Insurance', 'e') ?></span></a>
1706 <ul>
1707 <?php if (acl_check('acct', 'rep_a')) {
1708 genMiscLink('RTop', 'rep', '0', xl('Distribution'), 'reports/insurance_allocation_report.php');
1709 } ?>
1710 <?php if (acl_check('acct', 'rep_a')) {
1711 genMiscLink('RTop', 'rep', '0', xl('Indigents'), 'billing/indigent_patients_report.php');
1712 } ?>
1713 <?php if (acl_check('patients', 'demo')) {
1714 genMiscLink('RTop', 'rep', '0', xl('Unique SP'), 'reports/unique_seen_patients_report.php');
1715 } ?>
1716 </ul>
1717 </li>
1718 <?php } ?>
1720 <?php if (!empty($GLOBALS['code_types']['IPPF']) && acl_check('acct', 'rep_a')) { ?>
1721 <li><a class="collapsed_lv2"><span><?php xl('Statistics', 'e') ?></span></a>
1722 <ul>
1723 <?php genPopLink(xl('IPPF Stats'), 'ippf_statistics.php?t=i'); ?>
1724 <?php genPopLink(xl('GCAC Stats'), 'ippf_statistics.php?t=g'); ?>
1725 <?php genPopLink(xl('MA Stats'), 'ippf_statistics.php?t=m'); ?>
1726 <?php genPopLink(xl('CYP'), 'ippf_cyp_report.php'); ?>
1727 <?php genPopLink(xl('Daily Record'), 'ippf_daily.php'); ?>
1728 </ul>
1729 </li>
1730 <?php } // end ippf-specific ?>
1732 <li><a class="collapsed_lv2"><span><?php xl('Blank Forms', 'e') ?></span></a>
1733 <ul>
1734 <?php genPopLink(xl('Demographics'), '../patient_file/summary/demographics_print.php'); ?>
1735 <?php genPopLink(xl('Superbill/Fee Sheet'), '../patient_file/printed_fee_sheet.php'); ?>
1736 <?php genPopLink(xl('Referral'), '../patient_file/transaction/print_referral.php'); ?>
1737 <?php
1738 $lres = sqlStatement("SELECT * FROM list_options " .
1739 "WHERE list_id = 'lbfnames' AND activity = 1 ORDER BY seq, title");
1740 while ($lrow = sqlFetchArray($lres)) {
1741 $option_id = $lrow['option_id']; // should start with LBF
1742 $title = $lrow['title'];
1743 // Check ACO attribute, if any, of this LBF.
1744 $jobj = json_decode($lrow['notes'], true);
1745 if (!empty($jobj['aco'])) {
1746 $tmp = explode('|', $jobj['aco']);
1747 if (!acl_check($tmp[0], $tmp[1])) {
1748 continue;
1752 genPopLink($title, "../forms/LBF/printable.php?formname=$option_id");
1755 </ul>
1756 </li>
1758 <?php if (acl_check('admin', 'batchcom')) { ?>
1759 <li><a class="collapsed_lv2"><span><?php echo xlt('Services') ?></span></a>
1760 <ul>
1761 <?php genMiscLink('RTop', 'rep', '0', xl('Background Services'), 'reports/background_services.php'); ?>
1762 <?php genMiscLink('RTop', 'rep', '0', xl('Direct Message Log'), 'reports/direct_message_log.php'); ?>
1763 </ul>
1764 </li>
1765 <?php } ?>
1767 </ul>
1768 </li>
1770 <li><a class="collapsed" id="misimg" ><span><?php xl('Miscellaneous', 'e') ?></span></a>
1771 <ul>
1772 <?php genTreeLink('RTop', 'ped', xl('Patient Education')); ?>
1773 <?php if (acl_check('encounters', 'auth')) {
1774 genTreeLink('RBot', 'aun', xl('Authorizations'));
1775 } ?>
1776 <?php if (acl_check('patients', 'docs')) {
1777 genTreeLink('RTop', 'fax', xl('Fax/Scan'));
1778 } ?>
1779 <?php if (acl_check('admin', 'practice')) {
1780 genTreeLink('RTop', 'adb', xl('Addr Book'));
1781 } ?>
1782 <?php if (acl_check('admin', 'practice')) {
1783 genTreeLink('RTop', 'ort', xl('Order Catalog'));
1784 } ?>
1785 <?php if (!$GLOBALS['disable_chart_tracker'] && acl_check('patients', 'appt')) {
1786 genTreeLink('RTop', 'cht', xl('Chart Tracker'));
1787 } ?>
1788 <?php if (acl_check('encounters', 'notes')) {
1789 genTreeLink('RTop', 'ono', xl('Ofc Notes'));
1790 } ?>
1791 <?php if (acl_check('admin', 'batchcom') || acl_check('admin', 'practice')) {
1792 genMiscLink('RTop', 'adm', '0', xl('BatchCom'), 'batchcom/batchcom.php');
1793 } ?>
1794 <?php $myrow = sqlQuery("SELECT state FROM registry WHERE directory = 'track_anything'");
1795 if ($myrow['state']=='1') {
1796 genTreeLink('RTop', 'tan', xl('Configure Tracks'));
1797 } ?>
1798 <?php if (!$GLOBALS['use_active_directory']) {
1799 genTreeLink('RTop', 'pwd', xl('Password'));
1800 } ?>
1801 <?php genMiscLink('RTop', 'prf', '0', xl('Preferences'), 'super/edit_globals.php?mode=user'); ?>
1802 <?php if (acl_check('patients', 'docs', '', 'write') || acl_check('patients', 'docs', '', 'addonly')) {
1803 genMiscLink('RTop', 'adm', '0', xl('New Documents'), '../controller.php?document&list&patient_id=00');
1804 } ?>
1805 <?php if (acl_check('admin', 'practice')) {
1806 genMiscLink('RTop', 'adm', '0', xl('Document Templates'), 'super/manage_document_templates.php');
1807 } ?>
1808 </ul>
1809 </li>
1811 </ul>
1813 <br /><hr />
1815 <div id='current_patient' style = 'display:none'>
1816 <b><?php xl('None', 'e'); ?></b>
1817 </div>
1819 <div id='current_encounter' style = 'display:none'>
1820 <b><?php xl('None', 'e'); ?></b>
1821 </div>
1822 <?php
1823 genPopupsList();
1824 echo "<hr />\n";
1825 genFindBlock();
1826 echo "<hr />\n";
1829 <input type='hidden' name='findBy' value='Last' />
1830 <input type="hidden" name="searchFields" id="searchFields"/>
1831 <input type="hidden" name="search_service_code" value='' />
1833 </form>
1835 <script language='JavaScript'>
1836 syncRadios();
1838 function save_setting (cb_frames) {
1839 for (var i = 0, len = cb_frames.length; i < len; i++) {
1840 try {
1841 var fref = '<?php echo $uspfx ?>frame' + i + '_chk';
1842 var ureq = $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
1843 { lab: fref, val: cb_frames[i] })
1844 .done(function(data) {
1845 // alert( "Data Loaded: " + data );
1847 .fail(function(xhr, textStatus, errorThrown) {
1848 alert("Error:"+xhr.responseText+"\n"+textStatus+"\n"+errorThrown);
1850 .always(function() {
1851 // alert( "finished" );
1854 } catch (err) {
1855 alert (err.message);
1859 </script>
1861 </body>
1862 </html>