forked from openemr/openemr
/
left_nav.php
1451 lines (1357 loc) · 66.2 KB
/
left_nav.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// Copyright (C) 2006-2011 Rod Roark <rod@sunsetsystems.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This provides the left navigation frame when $GLOBALS['concurrent_layout']
// is true. Following are notes as to what else was changed for this feature:
//
// * interface/main/main_screen.php: the top-level frameset.
// * interface/main/finder/patient_select.php: loads stuff when a new patient
// is selected.
// * interface/patient_file/summary/demographics.php: this is the first frame
// loaded when a new patient is chosen, and in turn sets the current pid and
// then loads the initial bottom frame.
// * interface/patient_file/summary/demographics_full.php: added support for
// setting a new pid, needed for going to demographics from billing.
// * interface/patient_file/summary/demographics_save.php: redisplay
// demographics.php and not the frameset.
// * interface/patient_file/summary/summary_bottom.php: new frameset for the
// summary, prescriptions and notes for a selected patient, cloned from
// patient_summary.php.
// * interface/patient_file/encounter/encounter_bottom.php: new frameset for
// the selected encounter, mosting coding/billing stuff, cloned from
// patient_encounter.php. This will also self-load the superbill pages
// as requested.
// * interface/usergroup/user_info.php: removed Back link.
// * interface/usergroup/admin_frameset.php: new frameset for Admin pages,
// cloned from usergroup.php.
// * interface/main/onotes/office_comments.php: removed Back link target.
// * interface/main/onotes/office_comments_full.php: changed Back link.
// * interface/billing/billing_report.php: removed Back link; added logic
// to properly go to demographics or to an encounter when requested.
// * interface/new/new.php: removed Back link and revised form target.
// * interface/new/new_patient_save.php: modified to load the demographics
// page to the current frame instead of loading a new frameset.
// * interface/patient_file/history/history.php: target change.
// * interface/patient_file/history/history_full.php: target changes.
// * interface/patient_file/history/history_save.php: target change.
// * interface/patient_file/history/encounters.php: link/target changes.
// * interface/patient_file/encounter/encounter_top.php: another new frameset
// cloned from patient_encounter.php.
// * interface/patient_file/encounter/forms.php: link target removal.
// * interface/patient_file/encounter/new_form.php: target change.
// * interface/forms/newpatient/new.php, view.php, save.php: link/target
// changes.
// * interface/patient_file/summary/immunizations.php: removed back link.
// * interface/patient_file/summary/pnotes.php: changed link targets.
// * interface/patient_file/summary/pnotes_full.php: changed back link and
// added set_pid logic.
// * interface/patient_file/transaction/transactions.php: various changes.
// * interface/patient_file/transaction/add_transaction.php: new return js.
// * interface/patient_file/encounter/superbill_codes.php: target and link
// changes.
// * interface/patient_file/encounter/superbill_custom_full.php: target and
// link changes.
// * interface/patient_file/encounter/diagnosis.php: target changes.
// * interface/patient_file/encounter/diagnosis_full.php: target and link
// changes.
// * interface/main/authorizations/authorizations.php: link and target changes.
// * library/api.inc: url change.
// * interface/patient_file/summary/rx_frameset.php: new frameset.
// * interface/patient_file/summary/rx_left.php: new for prescriptions.
// * all encounter forms: remove all instances of "target=Main" and change
// all instances of "patient_encounter.php" to "encounter_top.php".
// Our find_patient form, when submitted, invokes patient_select.php in the
// upper frame. When the patient is selected, demographics.php is invoked
// with the set_pid parameter, which establishes the new session pid and also
// calls the setPatient() function (below). In this case demographics.php
// will also load the summary frameset into the bottom frame, invoking our
// loadFrame() and setRadio() functions.
//
// Similarly, we have the concept of selecting an encounter from the
// Encounters list, and then having that "stick" until some other encounter
// or a new encounter is chosen. We also have a navigation item for creating
// a new encounter. interface/patient_file/encounter/encounter_top.php
// supports set_encounter to establish an encounter.
//
// TBD: Include active_pid and/or active_encounter in relevant submitted
// form data, and add logic to the save routines to make sure they match
// the corresponding session values.
require_once("../globals.php");
require_once($GLOBALS['fileroot']."/library/acl.inc");
require_once($GLOBALS['fileroot']."/custom/code_types.inc.php");
require_once($GLOBALS['fileroot']."/library/patient.inc");
require_once($GLOBALS['fileroot']."/library/lists.inc");
// This array defines the list of primary documents that may be
// chosen. Each element value is an array of 3 values:
//
// * Name to appear in the navigation table
// * Usage: 0 = global, 1 = patient-specific, 2 = encounter-specific
// * The URL relative to the interface directory
//
$primary_docs = array(
'ros' => array(xl('Roster') , 0, 'reports/players_report.php?embed=1'),
'cal' => array(xl('Calendar') , 0, 'main/main_info.php'),
'app' => array(xl('Portal Activity') , 0, '../myportal/index.php'),
'msg' => array(xl('Messages') , 0, 'main/messages/messages.php'),
'pwd' => array(xl('Password') , 0, 'usergroup/user_info.php'),
'prf' => array(xl('Preferences') , 0, 'super/edit_globals.php?mode=user'),
'adm' => array(xl('Admin') , 0, 'usergroup/admin_frameset.php'),
'rep' => array(xl('Reports') , 0, 'reports/index.php'),
'ono' => array(xl('Ofc Notes') , 0, 'main/onotes/office_comments.php'),
'fax' => array(xl('Fax/Scan') , 0, 'fax/faxq.php'),
'adb' => array(xl('Addr Bk') , 0, 'usergroup/addrbook_list.php'),
'ort' => array(xl('Proc Cat') , 0, 'orders/types.php'),
'orb' => array(xl('Proc Bat') , 0, 'orders/orders_results.php?batch=1'),
'cht' => array(xl('Chart Trk') , 0, '../custom/chart_tracker.php'),
'imp' => array(xl('Import') , 0, '../custom/import.php'),
'bil' => array(xl('Billing') , 0, 'billing/billing_report.php'),
'sup' => array(xl('Superbill') , 0, 'patient_file/encounter/superbill_custom_full.php'),
'aun' => array(xl('Authorizations'), 0, 'main/authorizations/authorizations.php'),
'new' => array(xl('New Pt') , 0, 'new/new.php'),
'ped' => array(xl('Patient Education'), 0, 'reports/patient_edu_web_lookup.php'),
'lab' => array(xl('Check Lab Results') , 0, 'orders/lab_exchange.php'),
'dem' => array(xl('Patient') , 1, "patient_file/summary/demographics.php"),
'his' => array(xl('History') , 1, 'patient_file/history/history.php'),
'ens' => array(xl('Visit History'), 1, 'patient_file/history/encounters.php'),
'nen' => array(xl('Create Visit'), 1, 'forms/newpatient/new.php?autoloaded=1&calenc='),
'pre' => array(xl('Rx') , 1, 'patient_file/summary/rx_frameset.php'),
'iss' => array(xl('Issues') , 1, 'patient_file/summary/stats_full.php?active=all'),
'imm' => array(xl('Immunize') , 1, 'patient_file/summary/immunizations.php'),
'doc' => array(xl('Documents') , 1, '../controller.php?document&list&patient_id={PID}'),
'orp' => array(xl('Proc Pending Rev'), 1, 'orders/orders_results.php?review=1'),
'orr' => array(xl('Proc Res') , 1, 'orders/orders_results.php'),
'prp' => array(xl('Pt Report') , 1, 'patient_file/report/patient_report.php'),
'prq' => array(xl('Pt Rec Request') , 1, 'patient_file/transaction/record_request.php'),
'pno' => array(xl('Pt Notes') , 1, 'patient_file/summary/pnotes.php'),
'tra' => array(xl('Transact') , 1, 'patient_file/transaction/transactions.php'),
'sum' => array(xl('Summary') , 1, 'patient_file/summary/summary_bottom.php'),
'enc' => array(xl('Encounter') , 2, 'patient_file/encounter/encounter_top.php'),
'erx' => array(xl('e-Rx') , 1, 'eRx.php'),
'err' => array(xl('e-Rx Renewal') , 1, 'eRx.php?page=status'),
);
$primary_docs['npa']=array(xl('Payments') , 0, 'billing/new_payment.php');
if ($GLOBALS['use_charges_panel'] || $GLOBALS['concurrent_layout'] == 2) {
$primary_docs['cod'] = array(xl('Charges'), 2, 'patient_file/encounter/encounter_bottom.php');
}
// This section decides which navigation items will not appear.
$disallowed = array();
$disallowed['adm'] = !(acl_check('admin', 'calendar') ||
acl_check('admin', 'database') || acl_check('admin', 'forms') ||
acl_check('admin', 'practice') || acl_check('admin', 'users') ||
acl_check('admin', 'acl') || acl_check('admin', 'super') ||
acl_check('admin', 'superbill'));
$disallowed['bil'] = !(acl_check('acct', 'rep') || acl_check('acct', 'eob') ||
acl_check('acct', 'bill'));
$tmp = acl_check('patients', 'demo');
$disallowed['new'] = !($tmp == 'write' || $tmp == 'addonly');
$disallowed['fax'] = !($GLOBALS['enable_hylafax'] || $GLOBALS['enable_scanner']);
$disallowed['ros'] = !$GLOBALS['athletic_team'];
$disallowed['iss'] = !((acl_check('encounters', 'notes') == 'write' ||
acl_check('encounters', 'notes_a') == 'write') &&
acl_check('patients', 'med') == 'write');
$disallowed['imp'] = $disallowed['new'] ||
!is_readable("$webserver_root/custom/import.php");
$disallowed['cht'] = !is_readable("$webserver_root/custom/chart_tracker.php");
$disallowed['pre'] = !(acl_check('patients', 'med'));
// Helper functions for treeview generation.
function genTreeLink($frame, $name, $title, $mono=false) {
global $primary_docs, $disallowed;
if (empty($disallowed[$name])) {
$id = $name . $primary_docs[$name][1];
echo "<li><a href='' id='$id' onclick=\"";
if ($mono) {
if ($frame == 'RTop')
echo "forceSpec(true,false);";
else
echo "forceSpec(false,true);";
}
echo "return loadFrame2('$id','$frame','" .
$primary_docs[$name][2] . "')\">" . $title . ($name == 'msg' ? ' <span id="reminderCountSpan" class="bold"></span>' : '')."</a></li>";
}
}
function genMiscLink($frame, $name, $level, $title, $url, $mono=false) {
global $disallowed;
if (empty($disallowed[$name])) {
$id = $name . $level;
echo "<li><a href='' id='$id' onclick=\"";
if ($mono) {
if ($frame == 'RTop')
echo "forceSpec(true,false);";
else
echo "forceSpec(false,true);";
}
echo "return loadFrame2('$id','$frame','" .
$url . "')\">" . $title . "</a></li>";
}
}
function genPopLink($title, $url, $linkid='') {
echo "<li><a href='' ";
if ($linkid) echo "id='$linkid' ";
echo "onclick=\"return repPopup('$url')\"" .
">" . $title . "</a></li>";
}
function genDualLink($topname, $botname, $title) {
global $primary_docs, $disallowed;
if (empty($disallowed[$topname]) && empty($disallowed[$botname])) {
$topid = $topname . $primary_docs[$topname][1];
$botid = $botname . $primary_docs[$botname][1];
echo "<li><a href='' id='$topid' " .
"onclick=\"return loadFrameDual('$topid','$botid','" .
$primary_docs[$topname][2] . "','" .
$primary_docs[$botname][2] . "')\">" . $title . "</a></li>";
}
}
function genPopupsList($style='') {
global $disallowed, $webserver_root;
?>
<select name='popups' onchange='selpopup(this)' style='background-color:transparent;font-size:9pt;<?php echo $style; ?>'>
<option value=''><?php xl('Popups','e'); ?></option>
<?php if (!$disallowed['iss']) { ?>
<option value='../patient_file/problem_encounter.php'><?php xl('Issues','e'); ?></option>
<?php } ?>
<?php if (!$GLOBALS['ippf_specific']) { ?>
<option value='../../custom/export_xml.php'><?php xl('Export','e'); ?></option>
<option value='../../custom/import_xml.php'><?php xl('Import','e'); ?></option>
<?php } ?>
<?php if ($GLOBALS['athletic_team']) { ?>
<option value='../reports/players_report.php'><?php xl('Roster','e'); ?></option>
<?php } ;
if (!$GLOBALS['disable_calendar']) { ?>
<option value='../reports/appointments_report.php?patient=<?php if(isset($pid)) {echo $pid;} ?>'><?php xl('Appts','e'); ?></option>
<?php } ;
if (file_exists("$webserver_root/custom/refer.php")) { ?>
<option value='../../custom/refer.php'><?php xl('Refer','e'); ?></option>
<?php } ?>
<?php // if (file_exists("$webserver_root/custom/fee_sheet_codes.php")) { ?>
<option value='../patient_file/printed_fee_sheet.php?fill=1'><?php xl('Superbill','e'); ?></option>
<?php // } ?>
<?php if ($GLOBALS['inhouse_pharmacy']) { ?>
<option value='../patient_file/front_payment.php'><?php xl('Prepay','e'); ?></option>
<option value='../patient_file/pos_checkout.php'><?php xl('Checkout','e'); ?></option>
<?php } else { ?>
<option value='../patient_file/front_payment.php'><?php xl('Payment','e'); ?></option>
<?php } ?>
<?php if (is_dir($GLOBALS['OE_SITE_DIR'] . "/letter_templates")) { ?>
<option value='../patient_file/letter.php'><?php xl('Letter','e'); ?></option>
<?php } ?>
</select>
<?php
}
function genFindBlock() {
?>
<table cellpadding='0' cellspacing='0' border='0'>
<tr>
<td class='smalltext'><?php xl('Find','e') ?>: </td>
<td class='smalltext' colspan='2'>
<input type="entry" size="7" name="patient" class='inputtext' style='width:65px;' />
</td>
</tr>
<tr>
<td class='smalltext'><?php xl('by','e') ?>:</td>
<td class='smalltext'>
<a href="javascript:findPatient('Last');" class="navitem"><?php xl('Name','e'); ?></a>
</td>
<td class='smalltext' align='right'>
<a href="javascript:findPatient('ID');" class="navitem"><?php xl('ID','e'); ?></a>
</td>
</tr>
<tr>
<td class='smalltext'> </td>
<td class='smalltext'>
<a href="javascript:findPatient('SSN');" class="navitem"><?php xl('SSN','e'); ?></a>
</td>
<td class='smalltext' align='right'>
<a href="javascript:findPatient('DOB');" class="navitem"><?php xl('DOB','e'); ?></a>
</td>
</tr>
<tr>
<td class='smalltext'> </td>
<td class='smalltext'>
<a href="javascript:findPatient('Any');" class="navitem"><?php xl('Any', 'e'); ?></a>
</td>
<td class='smalltext' align='right'>
<a href="javascript:initFilter();" class="navitem"><?php xl('Filter', 'e'); ?></a>
</td>
</tr>
</table>
<?php
} // End function genFindBlock()
?>
<html>
<head>
<title>Navigation</title>
<link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
<style type="text/css">
body {
font-size:8pt;
font-weight:normal;
padding: 5px 3px 5px 3px;
}
.smalltext {
font-family:sans-serif;
font-size:8pt;
font-weight:normal;
}
a.navitem, a.navitem:visited {
color:#0000ff;
font-family:sans-serif;
font-size:8pt;
font-weight:bold;
}
.inputtext {
font-size:9pt;
font-weight:normal;
border-style:solid;
border-width:1px;
padding-left:2px;
padding-right:2px;
border-color: #000000;
background-color:transparent;
}
#navigation ul {
background-color:transparent;
}
#navigation-slide ul {
background-color:transparent;
}
#navigation-slide a{
width: 92%;
}
.nav-menu-img{
width:25px;
height:25px;
border:none;
margin-right:5px;
vertical-align:middle;
}
</style>
<link rel="stylesheet" href="../../library/js/jquery.treeview-1.4.1/jquery.treeview.css" />
<script src="../../library/js/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="../../library/js/jquery.treeview-1.4.1/jquery.treeview.js" type="text/javascript"></script>
<script type="text/javascript" src="../../library/dialog.js"></script>
<script language='JavaScript'>
// tajemo work by CB 2012/01/31 12:32:57 PM dated reminders counter
function getReminderCount(){
top.restoreSession();
// Send the skip_timeout_reset parameter to not count this as a manual entry in the
// timing out mechanism in OpenEMR.
$.post("<?php echo $GLOBALS['webroot']; ?>/library/ajax/dated_reminders_counter.php",
{ skip_timeout_reset: "1" },
function(data) {
$("#reminderCountSpan").html(data);
// run updater every 60 seconds
var repeater = setTimeout("getReminderCount()", 60000);
});
}
$(document).ready(function (){
getReminderCount();//
})
// end of tajemo work dated reminders counter
// Master values for current pid and encounter.
var active_pid = 0;
var active_encounter = 0;
// Current selections in the top and bottom frames.
var topName = '';
var botName = '';
// Expand and/or collapse frames in response to checkbox clicks.
// fnum indicates which checkbox was clicked (1=left, 2=right).
function toggleFrame(fnum) {
var f = document.forms[0];
var fset = top.document.getElementById('fsright');
if (!f.cb_top.checked && !f.cb_bot.checked) {
if (fnum == 1) f.cb_bot.checked = true;
else f.cb_top.checked = true;
}
var rows = f.cb_top.checked ? '*' : '0';
rows += f.cb_bot.checked ? ',*' : ',0';
fset.rows = rows;
fset.rows = rows;
}
// Load the specified url into the specified frame (RTop or RBot).
// The URL provided must be relative to interface.
function loadFrame(fname, frame, url) {
top.restoreSession();
var i = url.indexOf('{PID}');
if (i >= 0) url = url.substring(0,i) + active_pid + url.substring(i+5);
top.frames[frame].location = '<?php echo "$web_root/interface/" ?>' + url;
if (frame == 'RTop') topName = fname; else botName = fname;
}
// Load the specified url into a frame to be determined, with the specified
// frame as the default; the url must be relative to interface.
function loadFrame2(fname, frame, url) {
var usage = fname.substring(3);
if (active_pid == 0 && usage > '0') {
alert('<?php xl('You must first select or add a patient.','e') ?>');
return false;
}
if (active_encounter == 0 && usage > '1') {
alert('<?php xl('You must first select or create an encounter.','e') ?>');
return false;
}
var f = document.forms[0];
top.restoreSession();
var i = url.indexOf('{PID}');
if (i >= 0) url = url.substring(0,i) + active_pid + url.substring(i+5);
if(f.sel_frame)
{
var fi = f.sel_frame.selectedIndex;
if (fi == 1) frame = 'RTop'; else if (fi == 2) frame = 'RBot';
}
if (!f.cb_bot.checked) frame = 'RTop'; else if (!f.cb_top.checked) frame = 'RBot';
top.frames[frame].location = '<?php echo "$web_root/interface/" ?>' + url;
if (frame == 'RTop') topName = fname; else botName = fname;
return false;
}
// Make sure the the top and bottom frames are open or closed, as specified.
function forceSpec(istop, isbot) {
var f = document.forms[0];
if (f.cb_top.checked != istop) {
f.cb_top.checked = istop;
toggleFrame(1);
}
if (f.cb_bot.checked != isbot) {
f.cb_bot.checked = isbot;
toggleFrame(2);
}
}
// Make sure both frames are open.
function forceDual() {
forceSpec(true, true);
}
// Load the specified url into a frame to be determined, with the specified
// frame as the default; the url must be relative to interface.
function loadFrameDual(tname, bname, topurl, boturl) {
var topusage = tname.substring(3);
var botusage = bname.substring(3);
if (active_pid == 0 && (topusage > '0' || botusage > '0')) {
alert('<?php xl('You must first select or add a patient.','e') ?>');
return false;
}
if (active_encounter == 0 && (topusage > '1' || botusage > '1')) {
alert('<?php xl('You must first select or create an encounter.','e') ?>');
return false;
}
var f = document.forms[0];
forceDual();
top.restoreSession();
var i = topurl.indexOf('{PID}');
if (i >= 0) topurl = topurl.substring(0,i) + active_pid + topurl.substring(i+5);
i = boturl.indexOf('{PID}');
if (i >= 0) boturl = boturl.substring(0,i) + active_pid + boturl.substring(i+5);
top.frames.RTop.location = '<?php echo "$web_root/interface/" ?>' + topurl;
top.frames.RBot.location = '<?php echo "$web_root/interface/" ?>' + boturl;
topName = tname;
botName = bname;
return false;
}
// Select a designated radio button. raname may be either the radio button
// array name (rb_top or rb_bot), or the frame name (RTop or RBot).
// You should call this if you directly load a document that does not
// correspond to the current radio button setting.
function setRadio(raname, rbid) {
<?php if ($GLOBALS['concurrent_layout'] < 2) { ?>
var f = document.forms[0];
if (raname == 'RTop') raname = 'rb_top';
if (raname == 'RBot') raname = 'rb_bot';
for (var i = 0; i < f[raname].length; ++i) {
if (f[raname][i].value.substring(0,3) == rbid) {
f[raname][i].checked = true;
return true;
}
}
<?php } ?>
return false;
}
// Set disabled/enabled state of radio buttons and associated labels
// depending on whether there is an active patient or encounter.
function syncRadios() {
var f = document.forms[0];
<?php if (($GLOBALS['concurrent_layout'] == 2)||($GLOBALS['concurrent_layout'] == 3)) { ?>
var nlinks = document.links.length;
for (var i = 0; i < nlinks; ++i) {
var lnk = document.links[i];
if (lnk.id.length != 4) continue;
var usage = lnk.id.substring(3);
if (usage == '1' || usage == '2') {
var da = false;
if (active_pid == 0) da = true;
if (active_encounter == 0 && usage > '1') da = true;
<?php
if ($GLOBALS['concurrent_layout'] == 2){
$color = "'#0000ff'";
}else{
$color = "'#000000'";
}
?>
lnk.style.color = da ? '#888888' : <?php echo $color; ?>;
}
}
<?php } else if ($GLOBALS['concurrent_layout'] < 2) { ?>
for (var i = 0; i < f.rb_top.length; ++i) {
var da = false;
var rb1 = f.rb_top[i];
var rb2 = f.rb_bot[i];
var rbid = rb1.value.substring(0,3);
var usage = rb1.value.substring(3);
if (active_pid == 0 && usage > '0') da = true;
if (active_encounter == 0 && usage > '1') da = true;
// daemon_frame can also set special label colors, so don't mess with
// them unless we have to.
if (rb1.disabled != da) {
rb1.disabled = da;
rb2.disabled = da;
document.getElementById('lbl_' + rbid).style.color = da ? '#888888' : '#000000';
}
}
<?php } ?>
f.popups.disabled = (active_pid == 0);
}
function goHome() {
top.frames['RTop'].location='<?php echo $GLOBALS['default_top_pane']?>';
top.frames['RBot'].location='messages/messages.php';
}
// Reference to the search.php window.
var my_window;
// Open the search.php window.
function initFilter() {
my_window = window.open("../../custom/search.php", "mywindow","status=1");
}
// This is called by the search.php (Filter) window.
function processFilter(fieldString, serviceCode) {
var f = document.forms[0];
document.getElementById('searchFields').value = fieldString;
f.search_service_code.value = serviceCode;
findPatient("Filter");
f.search_service_code.value = '';
my_window.close();
}
// Process the click to find a patient by name, id, ssn or dob.
function findPatient(findby) {
var f = document.forms[0];
if (! f.cb_top.checked) {
f.cb_top.checked = true;
toggleFrame(1);
}
f.findBy.value = findby;
setRadio('rb_top', 'dem');
top.restoreSession();
document.find_patient.submit();
}
// Helper function to set the contents of a div.
function setSomeContent(id, content, doc) {
if (doc.getElementById) {
var x = doc.getElementById(id);
x.innerHTML = '';
x.innerHTML = content;
}
else if (doc.all) {
var x = doc.all[id];
x.innerHTML = content;
}
}
function setDivContent(id, content) {
setSomeContent(id, content, document);
}
function setTitleContent(id, content) {
setSomeContent(id, content, parent.Title.document);
}
// This is called automatically when a new patient is set, to make sure
// there are no patient-specific documents showing stale data. If a frame
// was just loaded with data for the correct patient, its name is passed so
// that it will not be zapped. At this point the new server-side pid is not
// assumed to be set, so this function will only load global data.
function reloadPatient(frname) {
var f = document.forms[0];
if (topName.length > 3 && topName.substring(3) > '0' && frname != 'RTop') {
loadFrame('cal0','RTop', '<?php echo $primary_docs['cal'][2]; ?>');
setRadio('rb_top', 'cal');
}
if (botName.length > 3 && botName.substring(3) > '0' && frname != 'RBot') {
loadFrame('ens0','RBot', '<?php echo $primary_docs['ens'][2]; ?>');
setRadio('rb_bot', 'ens');
}
}
// Reload encounter-specific frames, excluding a specified frame. At this
// point the new server-side encounter ID may not be set and loading the same
// document for the new encounter will not work, so load patient info instead.
function reloadEncounter(frname) {
var f = document.forms[0];
if (topName.length > 3 && topName.substring(3) > '1' && frname != 'RTop') {
loadFrame('dem1','RTop', '<?php echo $primary_docs['dem'][2]; ?>');
setRadio('rb_top', 'dem');
}
if (botName.length > 3 && botName.substring(3) > '1' && frname != 'RBot') {
loadFrame('ens1','RBot', '<?php echo $primary_docs['ens'][2]; ?>');
setRadio('rb_bot', 'ens');
}
}
// Clear and reload issue-related menu items for active_pid.
// Currently this only applies to athletic teams, but might be implemented
// in the general menu at some future time.
//
function reloadIssues() {
<?php
if ($GLOBALS['athletic_team']) {
// Generates a menu item for each active issue that this patient
// has of each issue type. Each one looks like this:
// Onset-Date Issue-Title [List] [Add]
// where the first part is a link to open the issue dialog,
// [List] is a link that shows related encounters, and
// [Add] is a link that auto-creates and opens a new encounter.
foreach ($ISSUE_TYPES as $key => $value) {
?>
$('#icontainer_<?php echo $key ?>').empty();
if (active_pid != 0) {
$('#icontainer_<?php echo $key ?>').append("<li>" +
"<a href='' id='xxx1' onclick='return repPopup(" +
"\"../patient_file/summary/add_edit_issue.php?thistype=" +
"<?php echo $key; ?>\")' " +
"title='<?php echo xl('Create new issue'); ?>'>" +
"<?php echo xl('New') . " " . $value[1]; ?></a></li>");
top.restoreSession();
$.getScript('../../library/ajax/left_nav_issues_ajax.php?type=<?php echo $key; ?>');
}
<?php
}
}
?>
} // end function reloadIssues
// This is referenced in left_nav_issues_ajax.php and is called when [Add]
// is clicked for an issue menu item to add encounter notes to a new or
// existing encounter linked to that issue. So far this only applies to
// the Athletic Team version of the menu.
//
function addEncNotes(issue) {
top.restoreSession();
$.getScript('../../library/ajax/left_nav_encounter_ajax.php?issue=' + issue);
return false;
}
// Call this to announce that the patient has changed. You must call this
// if you change the session PID, so that the navigation frame will show the
// correct patient and so that the other frame will be reloaded if it contains
// patient-specific information from the previous patient. frname is the name
// of the frame that the call came from, so we know to only reload content
// from the *other* frame if it is patient-specific.
function setPatient(pname, pid, pubpid, frname, str_dob) {
var str = '<a href=\'javascript:;\' onclick="parent.left_nav.loadCurrentPatientFromTitle()" title="PID = ' + pid + '"><b>' + pname + ' (' + pubpid + ')<br /></b></a>';
setDivContent('current_patient', str);
setTitleContent('current_patient', str + str_dob);
if (pid == active_pid) return;
setDivContent('current_encounter', '<b><?php xl('None','e'); ?></b>');
active_pid = pid;
active_encounter = 0;
if (frname) reloadPatient(frname);
syncRadios();
$(parent.Title.document.getElementById('current_patient_block')).show();
var encounter_block = $(parent.Title.document.getElementById('current_encounter_block'));
$(encounter_block).hide();
// zero out the encounter frame, replace it with the encounter list frame
var f = document.forms[0];
if ( f.cb_top.checked && f.cb_bot.checked ) {
var encounter_frame = getEncounterTargetFrame('enc');
if ( encounter_frame != undefined ) {
loadFrame('ens0',encounter_frame, '<?php echo $primary_docs['ens'][2]; ?>');
setRadio(encounter_frame, 'ens');
}
}
reloadIssues(pid);
}
function setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray) {
//This function lists all encounters of the patient.
//This function writes the drop down in the top frame.
//It is called when a new patient is create/selected from the search menu.
var str = '<Select class="text" id="EncounterHistory" onchange="{top.restoreSession();toencounter(this.options[this.selectedIndex].value)}">';
str+='<option value=""><?php echo htmlspecialchars( xl('Encounter History'), ENT_QUOTES) ?></option>';
str+='<option value="New Encounter"><?php echo htmlspecialchars( xl('New Encounter'), ENT_QUOTES) ?></option>';
str+='<option value="Past Encounter List"><?php echo htmlspecialchars( xl('Past Encounter List'), ENT_QUOTES) ?></option>';
for(CountEncounter=0;CountEncounter<EncounterDateArray.length;CountEncounter++)
{
str+='<option value="'+EncounterIdArray[CountEncounter]+'~'+EncounterDateArray[CountEncounter]+'">'+EncounterDateArray[CountEncounter]+'-'+CalendarCategoryArray[CountEncounter]+'</option>';
}
str+='</Select>';
$(parent.Title.document.getElementById('past_encounter_block')).show();
top.window.parent.Title.document.getElementById('past_encounter').innerHTML=str;
}
function loadCurrentPatientFromTitle() {
top.frames['RTop'].location='../patient_file/summary/demographics.php';
}
function getEncounterTargetFrame( name ) {
var bias = <?php echo $primary_docs[ 'enc' ][ 1 ]?>;
var f = document.forms[0];
var r = 'RTop';
if (f.cb_top.checked && f.cb_bot.checked) {
if ( bias == 2 ) {
r = 'RBot';
} else {
r = 'RTop';
}
} else {
if ( f.cb_top.checked ) {
r = 'RTop';
} else if ( f.cb_bot.checked ) {
r = 'RBot';
}
}
return r;
}
// Call this to announce that the encounter has changed. You must call this
// if you change the session encounter, so that the navigation frame will
// show the correct encounter and so that the other frame will be reloaded if
// it contains encounter-specific information from the previous encounter.
// frname is the name of the frame that the call came from, so we know to only
// reload encounter-specific content from the *other* frame.
function setEncounter(edate, eid, frname) {
if (eid == active_encounter) return;
if (!eid) edate = '<?php xl('None','e'); ?>';
var str = '<b>' + edate + '</b>';
setDivContent('current_encounter', str);
active_encounter = eid;
reloadEncounter(frname);
syncRadios();
var encounter_block = $(parent.Title.document.getElementById('current_encounter_block'));
var encounter = $(parent.Title.document.getElementById('current_encounter'));
var estr = '<a href=\'javascript:;\' onclick="parent.left_nav.loadCurrentEncounterFromTitle()"><b>' + edate + ' (' + eid + ')</b></a>';
encounter.html( estr );
encounter_block.show();
}
function loadCurrentEncounterFromTitle() {
top.frames[ parent.left_nav.getEncounterTargetFrame('enc') ].location='../patient_file/encounter/encounter_top.php';
}
// You must call this if you delete the active patient (or if for any other
// reason you "close" the active patient without opening a new one), so that
// the appearance of the navigation frame will be correct and so that any
// stale content will be reloaded.
function clearPatient() {
if (active_pid == 0) return;
var f = document.forms[0];
active_pid = 0;
active_encounter = 0;
setDivContent('current_patient', '<b><?php xl('None','e'); ?></b>');
setTitleContent('current_patient', '<b><?php xl('None','e'); ?></b>');
top.window.parent.Title.document.getElementById('past_encounter').innerHTML='';
top.window.parent.Title.document.getElementById('current_encounter').innerHTML="<b><?php echo htmlspecialchars( xl('None'), ENT_QUOTES) ?></b>";
reloadPatient('');
syncRadios();
}
// You must call this if you delete the active encounter (or if for any other
// reason you "close" the active encounter without opening a new one), so that
// the appearance of the navigation frame will be correct and so that any
// stale content will be reloaded.
function clearEncounter() {
if (active_encounter == 0) return;
top.window.parent.Title.document.getElementById('current_encounter').innerHTML="<b><?php echo htmlspecialchars( xl('None'), ENT_QUOTES) ?></b>";
active_encounter = 0;
reloadEncounter('');
syncRadios();
}
function removeOptionSelected(EncounterId)
{//Removes an item from the Encounter drop down.
var elSel = top.window.parent.Title.document.getElementById('EncounterHistory');
var i;
for (i = elSel.length - 1; i>=2; i--) {
EncounterHistoryValue=elSel.options[i].value;
EncounterHistoryValueArray=EncounterHistoryValue.split('~');
if (EncounterHistoryValueArray[0]==EncounterId) {
elSel.remove(i);
}
}
}
// You can call this to make sure the session pid is what we expect.
function pidSanityCheck(pid) {
if (pid != active_pid) {
alert('Session patient ID is ' + pid + ', expecting ' + active_pid +
'. This session is unstable and should be abandoned. Do not use ' +
'OpenEMR in multiple browser windows!');
return false;
}
return true;
}
// You can call this to make sure the session encounter is what we expect.
function encounterSanityCheck(eid) {
if (eid != active_encounter) {
alert('Session encounter ID is ' + eid + ', expecting ' + active_encounter +
'. This session is unstable and should be abandoned. Do not use ' +
'OpenEMR in multiple browser windows!');
return false;
}
return true;
}
// Pop up a report.
function repPopup(aurl) {
top.restoreSession();
window.open('<?php echo "$web_root/interface/reports/" ?>' + aurl, '_blank', 'width=750,height=550,resizable=1,scrollbars=1');
return false;
}
// This is invoked to pop up some window when a popup item is selected.
function selpopup(selobj) {
var i = selobj.selectedIndex;
var opt = selobj.options[i];
if (i > 0) {
var width = 750;
var height = 550;
if (opt.text == 'Export' || opt.text == 'Import') {
width = 500;
height = 400;
}
else if (opt.text == 'Refer') {
width = 700;
height = 500;
}
dlgopen(opt.value, '_blank', width, height);
}
selobj.selectedIndex = 0;
}
// Treeview activation stuff:
$(document).ready(function(){
if(3 == <?php echo $GLOBALS['concurrent_layout'] ?>){
$("#navigation-slide > li > a.collapsed + ul").slideToggle("medium");
$("#navigation-slide > li > ul > li > a.collapsed_lv2 + ul").slideToggle("medium");
$("#navigation-slide > li > a.expanded").click(function() {
$("#navigation-slide > li > a.expanded").not(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
$(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
});
$("#navigation-slide > li > a.collapsed").click(function() {
$("#navigation-slide > li > a.expanded").not(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
$(this).toggleClass("expanded").toggleClass("collapsed").parent().find('> ul').slideToggle("medium");
});
$("#navigation-slide > li > ul > li > a.expanded_lv2").click(function() {
$("#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");
$(this).toggleClass("expanded_lv2").toggleClass("collapsed_lv2").parent().find('> ul').slideToggle("medium");
});
$("#navigation-slide > li > ul > li > a.collapsed_lv2").click(function() {
$("#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");
$(this).toggleClass("expanded_lv2").toggleClass("collapsed_lv2").parent().find('> ul').slideToggle("medium");
});
$("#navigation-slide > li > a#cal0").prepend('<img src="../../images/calendar.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#msg0").prepend('<img src="../../images/messages.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#patimg").prepend('<img src="../../images/patient.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#app0").prepend('<img src="../../images/patient.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#repimg").prepend('<img src="../../images/reports.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#feeimg").prepend('<img src="../../images/fee.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#adm0").prepend('<img src="../../images/inventory.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#invimg").prepend('<img src="../../images/inventory.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#admimg").prepend('<img src="../../images/admin.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#misimg").prepend('<img src="../../images/misc.png" class="nav-menu-img" />');
$("#navigation-slide > li > a#proimg").prepend('<img src="../../images/procedures.png" class="nav-menu-img" />');
$("#navigation-slide > li").each(function(index) {
if($(" > ul > li", this).size() == 0){
$(" > a", this).addClass("collapsed");
}
});
}else if(2 == <?php echo $GLOBALS['concurrent_layout'] ?>){
//Remove the links (used by the sliding menu) that will break treeview
$('a.collapsed').each(function() { $(this).replaceWith('<span>'+$(this).text()+'</span>'); });
$('a.collapsed_lv2').each(function() { $(this).replaceWith('<span>'+$(this).text()+'</span>'); });
$('a.expanded').each(function() { $(this).replaceWith('<span>'+$(this).text()+'</span>'); });
$('a.expanded_lv2').each(function() { $(this).replaceWith('<span>'+$(this).text()+'</span>'); });
// Initiate treeview
$("#navigation").treeview({
animated: "fast",
collapsed: true,
unique: <?php echo $GLOBALS['athletic_team'] ? 'false' : 'true' ?>,
toggle: function() {
window.console && console.log("%o was toggled", this);
}
});
}
});
</script>
</head>
<body class="body_nav">
<form method='post' name='find_patient' target='RTop'
action='<?php echo $rootdir ?>/main/finder/patient_select.php'>
<?php
// Find widget is at the top for the athletic team layout.
if ($GLOBALS['athletic_team']) {
genFindBlock();
echo "<hr />\n";
}
?>
<?php if ( ( $GLOBALS['concurrent_layout'] == 2) || ($GLOBALS['concurrent_layout'] == 3) ) { ?>
<center>
<select name='sel_frame' style='background-color:transparent;font-size:9pt;width:<?php echo $GLOBALS['athletic_team'] ? 47 : 100; ?>%;'>
<option value='0'><?php xl('Default','e'); ?></option>
<option value='1'><?php xl('Top','e'); ?></option>
<option value='2'><?php xl('Bottom','e'); ?></option>
</select>
<?php if ($GLOBALS['athletic_team']) genPopupsList('width:47%'); ?>
</center>
<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td class='smalltext' nowrap>
<input type='checkbox' name='cb_top' onclick='toggleFrame(1)' checked />
<b><?php xl('Top','e') ?></b>
</td>
<td class='smalltext' align='right' nowrap>
<b><?php xl('Bot','e') ?></b>
<input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' <?php if (empty($GLOBALS['athletic_team'])) echo 'checked '; ?>/>
</td>
</tr>
</table>
<?php if ( $GLOBALS['concurrent_layout'] == 3) { ?>
<ul id="navigation-slide">
<?php } else { // ($GLOBALS['concurrent_layout'] == 2) ?>
<ul id="navigation">
<?php } ?>
<?php if ($GLOBALS['athletic_team']) { // Tree menu for athletic teams ?>
<?php genTreeLink('RBot','msg',xl('Messages')); ?>
<li><a class="collapsed" id="patimg" ><span><?php xl('View','e') ?></span></a>
<ul>
<?php genTreeLink('RTop','ros',xl('Weekly Exposures'),true); ?>
<?php genMiscLink('RTop','ros','0',xl('Team Roster'),'reports/old_players_report.php?embed=1',true); ?>
<?php if (!$GLOBALS['disable_calendar']) genTreeLink('RTop','cal',xl('Calendar'),true); ?>
</ul>
</li>
<li class="open"><a class="collapsed" id="patimg" ><span><?php xl('Demographics','e') ?></span></a>
<ul>
<?php genTreeLink('RTop','new',($GLOBALS['full_new_patient_form'] ? xl('New/Search') : xl('New'))); ?>
<?php genTreeLink('RTop','dem',xl('Current')); ?>
</ul>
</li>
<li class="open"><a class="expanded" id="patimg" ><span><?php xl('Medical Records','e') ?></span></a>
<ul>
<?php genDualLink('iss','ens',xl('All Injuries/Problems/Issues')); // with ens on bottom ?>
<?php
// Add a container for each issue type.
foreach ($ISSUE_TYPES as $key => $value) {
echo " <li class='open'><a class='collapsed_lv2'><span>" . xl('Active') . " " . $value[0] . "</span></a>\n";
echo " <ul id='icontainer_$key'>\n";
echo " </ul>\n";
echo " </li>\n";
}
?>
<?php genDualLink('nen','ens',xl('New Consultation')); // with ens on bottom ?>
<?php // genDualLink('enc','ens','Current Consultation'); // with ens on bottom ?>