ORXTABS ; SLC/PKS - Edit tab parameters preferences.  [10/17/00 2:44pm]
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,47,84**;Dec 17, 1997
 ;
 ; Main control routine is herein for Tab Preferences Editing.
 ;    Works with routines ORXTABS1 and ORXTABS2.  ORXTABS1 contains 
 ;    additional control tags that work in conjunction with the 
 ;    control code at the top of this routine, in order to keep this 
 ;    one below 10K size maximum.  ORXTABS2 contains tags to handle
 ;    individual preference edit/input, making calls to ORXTABS3,
 ;    ORXTABS4, etc., where code for individual dialogues reside.  
 ;
 Q
 ;
EN ; Entry point - called by option [ORX PARAM TAB PREF].
 ;
 ; Variables used:
 ;
 ;    DIR,X,Y = FM user input variables.
 ;    ORXANY  = Flag for number of changes.
 ;    ORXCDIS = Display holder for counter display.
 ;    ORXCHC  = User's choice of parameter value to edit.
 ;    ORXCNT  = Loop counter; re-used in various tags.
 ;    ORXCUR  = Existing settings for a parameter.
 ;    ORXERR  = Error array used in call to XPAR.
 ;    ORXNEW  = New value entered by user.
 ;    ORXNOW  = Cuttent setting of a parameter piece value.
 ;    ORXNUM  = Array count holder.
 ;    ORXPAR  = Working variable for parameter definitions, etc.
 ;    ORXPARS = Becomes array of parameters from TABS tag.
 ;    ORXPCS  = Array of formal parameter string's piece settings.
 ;    ORXPDIR = Display prompt piece (first piece). 
 ;    ORXPDIS = Holder for prompt piece of each value.
 ;    ORXPNAM = Stores name of current parameter definition.  
 ;    ORXPRO  = Current prompt.
 ;    ORXPSTR = String of prompts.
 ;    ORXSETS = Setting(s) pieces for a parameter.
 ;    ORXSTOP = Flag to stop editing.
 ;    ORXTAB  = Becomes current tab, as exists in last part of formal 
 ;              parameter definition string.
 ;    ORXTAG  = Current data tag.
 ;    ORXTCNT = Current tab line counter.
 ;    ORXTNM  = First piece of current tab from text entry.
 ;    ORXVAL  = Value holder.
 ;
 N DIR,X,Y,ORXANY,ORXCDIS,ORXCHC,ORXCNT,ORXCUR,ORXERR,ORXNEW,ORXNOW,ORXNUM,ORXPAR,ORXPARS,ORXPCS,ORXPDIR,ORXPDIS,ORXPNAM,ORXPRO,ORXPSTR,ORXSETS,ORXSTOP,ORXTAB,ORXTAG,ORXTCNT,ORXTNM,ORXVAL
 ;
 S ORXSTOP=0                          ; Preset flag before starting.
 ;
 ; Establish control loop for entire editing process.
 F  Q:ORXSTOP  D
 .D BLDLIST Q:ORXSTOP                 ; ORXSTOP here = list problem.
 .D CHOOSE Q:ORXSTOP                  ; ORXSTOP here = user punted.
 .D PARAMS(ORXTAB)                    ; ORXTAB set by CHOOSE tag.
 .D EDIT^ORXTABS1                     ; User editing.
 .;
 .; ORXANY will be set by EACH, SOME, or ALL calls in ORXTABS1:
 .I ORXANY D SAVE^ORXTABS1            ; If changes made, save?
 .S ORXSTOP=0                         ; Assure loop restart.
 ;
 Q
 ;
BLDLIST ; Get list of tabs with editable parameters for display.
 ;
 K ORXPARS                            ; Clean out array each time.
 S ORXTAG="TABS"                      ; Data tag herein.
 S ORXCNT=0                           ; Initialize counter.
 F  D  Q:ORXPARS(ORXCNT)=""           ; Get each tag's entry.
 .S ORXCNT=ORXCNT+1                   ; Increment counter.
 .S ORXPARS(ORXCNT)=$P($T(@ORXTAG+ORXCNT),";;",2)
 ;
 ; Check for no parameters listed or problem with reading data:
 I ORXCNT<2 S ORXSTOP=1
 ;
 Q
 ;
CHOOSE ; Display tabs, allow user to choose.
 ;
 ; Clear, reset DIR variables:
 K DIR,X,Y
 S DIR("A")="     Select tab for preferences editing"
 S DIR("?")="   Select by entry of item number:"
 ;
 ; Assign array [DIR("A")] items for display:
 S ORXCNT=0
 S ORXVAL=""
 F  D  Q:ORXVAL=""
 .S ORXCNT=ORXCNT+1                   ; Increment counter.
 .S ORXVAL=$P($G(ORXPARS(ORXCNT)),U)  ; Get first piece of string.
 .;
 .; Assign the actual display line:
 .S ORXCDIS=ORXCNT
 .S ORXCDIS=$$RJ^XLFSTR(ORXCDIS,2)    ; Right justify to 2 places.
 .S:(ORXVAL'="") DIR("A",ORXCNT)="        "_ORXCDIS_"    "_ORXVAL
 ;
 ; Check for errors:
 I ORXCNT<2 W !!,"   Problem reading TABS data!" S ORXSTOP=1 Q
 ;
 ; Define DIR input requirements:
 S DIR(0)="NO^1:"_(ORXCNT-1)_":0"
 ;
 ; Call DIR for user choice:
 W !! ; Spacing for screen display.
 D ^DIR
 ;
 ; Check user response:
 I '$L($G(Y)) S ORXSTOP=1 Q           ; Punt if Y not assigned.
 I Y="" S ORXSTOP=1 Q                 ; Punt if Y is null.
 I Y="^" S ORXSTOP=1 Q                ; Punt if Y is "^" character.
 I Y<1 S ORXSTOP=1 Q                  ; Punt if Y is less than one.
 I Y>(ORXCNT-1) S ORXSTOP=1 Q         ; Punt if Y isn't within range.
 S (ORXTCNT,ORXTAB)=Y                 ; Otherwise, get entry and go.
 ;
 Q
 ;
PARAMS(ORXPAR) ; Retrieve selected tab's current parameter values.
 ;
 S ORXTAB=$P(ORXPARS(ORXPAR),U)       ; Tab name from user display.
 S ORXTNM=ORXTAB                      ; Comparison value holder.
 S ORXSETS=$P(ORXPARS(ORXPAR),U,2)    ; Settings info.
 S ORXTAB=$$EXCX                      ; Display name differences.
 S ORXPAR="ORCH CONTEXT "_ORXTAB      ; Construct formal param name.
 S ORXPNAM=ORXPAR                     ; Store for saving changes.
 ;
 ; Get current parameter values from Parameters file:
 S ORXCUR=""
 S ORXCUR=$$GET^XPAR("ALL",ORXPAR)
 ;
 Q
 ;
EXCX() ; Deal with exceptions in spelling.
 ;
 I ORXTAB="D/C SUMMARIES" S ORXTAB="SUMMRIES"     ; Shorter spelling.
 I ORXTAB="IMAGING" S ORXTAB="XRAYS"              ; IMAGING is XRAYS.
 I ORXTAB="INPATIENT LABS" S ORXTAB="INPT LABS"   ; Shorter spelling.
 I ORXTAB="OUTPATIENT LABS" S ORXTAB="OUTPT LABS" ; Shorter spelling.
 ;
 Q ORXTAB
 ;
 ;
 ; NOTES ON ENTRIES FOR THE FOLLOWING "TABS" TAG:
 ;    Each TABS entry MUST have a corresponding PROMPTS entry in
 ;    PROMPTS^ORXTABS, in the same order and with matching first
 ;    pieces.  There MUST ALSO be a tag in ORXTABS2, to get user
 ;    input, which matches the actual name of the parameter in the
 ;    Parameter Definition [^XTV(8989.51,] file.  For example, 
 ;    the NOTES entry in TABS below is the last word of the "ORCH 
 ;    CONTEXT NOTES" entry in the Parameter Definition file.  If 
 ;    the first piece listed in the TABS tag below differs from the 
 ;    actual Parameter Definition file entry - as is the case for
 ;    XRAYS, which is the IMAGING entry below - add code in the EXCX
 ;    tag above to deal with it.  The third "^" piece in each TABS 
 ;    entry represents the positions in the parameter string entry 
 ;    itself, i.e. in the Parameters [^XTV(8989.5,] file, where
 ;    each individual value is stored, in the order listed in the 
 ;    second "^" piece of the TABS entry.  IMPORTANT: Keep all "BEG" 
 ;    and "END" pairs together consecutively - with "BEG" first, and
 ;    all "STATUS" and "AUTHOR" pairs together - with "STATUS" first.
 ;
TABS ; Data strings for parameters/preferences.
 ;;CONSULTS^BEG;END;STATUS;SERVICE^1;2;3;4
 ;;INPATIENT LABS^BEG;END;TYPE^1;2;3
 ;;OUTPATIENT LABS^BEG;END;TYPE^1;2;3
 ;;MEDS^BEG;END;OUTPT^1;2;3
 ;;NOTES^BEG;END;STATUS;AUTHOR;OCCLIM;SUBJECT^1;2;3;4;5;6
 ;;ORDERS^BEG;END;STATUS;DISPGRP;FORMAT^1;2;3;4;5
 ;;PROBLEMS^STATUS;COMMENTS^3;4
 ;;REPORTS^BEG;END;MAX^1;2;5
 ;;D/C SUMMARIES^BEG;END;STATUS;AUTHOR^1;2;3;4
 ;;IMAGING^BEG;END;MAX^1;2;5
 ;
 Q
 ;
 ; NOTES ON ENTRIES FOR "PROMPTS" TAG:
 ;    Each PROMPTS entry below needs a corresponding TABS entry 
 ;    in TABS^ORXTABS, must be listed in the same order, and with 
 ;    a matching number of pieces.
 ;    
PROMPTS ; 24 char-max Prompts - MUST match TABS^ORXTABS entries/piece counts!
 ;;CONSULTS^Begin Date;End Date;Status;Service
 ;;INPATIENT LABS^Begin Date;End Date;Type
 ;;OUTPATIENT LABS^Begin Date;End Date;Type
 ;;MEDS^Begin Date;End Date;Outpatient or Inpatient Meds Default Display
 ;;NOTES^Begin Date;End Date;Status;Author;Occurrence Limit;Show/Hide Subject
 ;;ORDERS^Begin Date;End Date;Status;Service/Section;Format
 ;;PROBLEMS^Status;Comments
 ;;REPORTS^Begin Date;End Date;Maximum
 ;;D/C SUMMARIES^Begin Date;End Date;Status;Author
 ;;IMAGING^Begin Date;End Date;Maximum
 ;
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORXTABS   8129     printed  Sep 23, 2025@20:14:27                                                                                                                                                                                                     Page 2
ORXTABS   ; SLC/PKS - Edit tab parameters preferences.  [10/17/00 2:44pm]
 +1       ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,47,84**;Dec 17, 1997
 +2       ;
 +3       ; Main control routine is herein for Tab Preferences Editing.
 +4       ;    Works with routines ORXTABS1 and ORXTABS2.  ORXTABS1 contains 
 +5       ;    additional control tags that work in conjunction with the 
 +6       ;    control code at the top of this routine, in order to keep this 
 +7       ;    one below 10K size maximum.  ORXTABS2 contains tags to handle
 +8       ;    individual preference edit/input, making calls to ORXTABS3,
 +9       ;    ORXTABS4, etc., where code for individual dialogues reside.  
 +10      ;
 +11       QUIT 
 +12      ;
EN        ; Entry point - called by option [ORX PARAM TAB PREF].
 +1       ;
 +2       ; Variables used:
 +3       ;
 +4       ;    DIR,X,Y = FM user input variables.
 +5       ;    ORXANY  = Flag for number of changes.
 +6       ;    ORXCDIS = Display holder for counter display.
 +7       ;    ORXCHC  = User's choice of parameter value to edit.
 +8       ;    ORXCNT  = Loop counter; re-used in various tags.
 +9       ;    ORXCUR  = Existing settings for a parameter.
 +10      ;    ORXERR  = Error array used in call to XPAR.
 +11      ;    ORXNEW  = New value entered by user.
 +12      ;    ORXNOW  = Cuttent setting of a parameter piece value.
 +13      ;    ORXNUM  = Array count holder.
 +14      ;    ORXPAR  = Working variable for parameter definitions, etc.
 +15      ;    ORXPARS = Becomes array of parameters from TABS tag.
 +16      ;    ORXPCS  = Array of formal parameter string's piece settings.
 +17      ;    ORXPDIR = Display prompt piece (first piece). 
 +18      ;    ORXPDIS = Holder for prompt piece of each value.
 +19      ;    ORXPNAM = Stores name of current parameter definition.  
 +20      ;    ORXPRO  = Current prompt.
 +21      ;    ORXPSTR = String of prompts.
 +22      ;    ORXSETS = Setting(s) pieces for a parameter.
 +23      ;    ORXSTOP = Flag to stop editing.
 +24      ;    ORXTAB  = Becomes current tab, as exists in last part of formal 
 +25      ;              parameter definition string.
 +26      ;    ORXTAG  = Current data tag.
 +27      ;    ORXTCNT = Current tab line counter.
 +28      ;    ORXTNM  = First piece of current tab from text entry.
 +29      ;    ORXVAL  = Value holder.
 +30      ;
 +31       NEW DIR,X,Y,ORXANY,ORXCDIS,ORXCHC,ORXCNT,ORXCUR,ORXERR,ORXNEW,ORXNOW,ORXNUM,ORXPAR,ORXPARS,ORXPCS,ORXPDIR,ORXPDIS,ORXPNAM,ORXPRO,ORXPSTR,ORXSETS,ORXSTOP,ORXTAB,ORXTAG,ORXTCNT,ORXTNM,ORXVAL
 +32      ;
 +33      ; Preset flag before starting.
           SET ORXSTOP=0
 +34      ;
 +35      ; Establish control loop for entire editing process.
 +36       FOR 
               if ORXSTOP
                   QUIT 
               Begin DoDot:1
 +37      ; ORXSTOP here = list problem.
                   DO BLDLIST
                   if ORXSTOP
                       QUIT 
 +38      ; ORXSTOP here = user punted.
                   DO CHOOSE
                   if ORXSTOP
                       QUIT 
 +39      ; ORXTAB set by CHOOSE tag.
                   DO PARAMS(ORXTAB)
 +40      ; User editing.
                   DO EDIT^ORXTABS1
 +41      ;
 +42      ; ORXANY will be set by EACH, SOME, or ALL calls in ORXTABS1:
 +43      ; If changes made, save?
                   IF ORXANY
                       DO SAVE^ORXTABS1
 +44      ; Assure loop restart.
                   SET ORXSTOP=0
               End DoDot:1
 +45      ;
 +46       QUIT 
 +47      ;
BLDLIST   ; Get list of tabs with editable parameters for display.
 +1       ;
 +2       ; Clean out array each time.
           KILL ORXPARS
 +3       ; Data tag herein.
           SET ORXTAG="TABS"
 +4       ; Initialize counter.
           SET ORXCNT=0
 +5       ; Get each tag's entry.
           FOR 
               Begin DoDot:1
 +6       ; Increment counter.
                   SET ORXCNT=ORXCNT+1
 +7                SET ORXPARS(ORXCNT)=$PIECE($TEXT(@ORXTAG+ORXCNT),";;",2)
               End DoDot:1
               if ORXPARS(ORXCNT)=""
                   QUIT 
 +8       ;
 +9       ; Check for no parameters listed or problem with reading data:
 +10       IF ORXCNT<2
               SET ORXSTOP=1
 +11      ;
 +12       QUIT 
 +13      ;
CHOOSE    ; Display tabs, allow user to choose.
 +1       ;
 +2       ; Clear, reset DIR variables:
 +3        KILL DIR,X,Y
 +4        SET DIR("A")="     Select tab for preferences editing"
 +5        SET DIR("?")="   Select by entry of item number:"
 +6       ;
 +7       ; Assign array [DIR("A")] items for display:
 +8        SET ORXCNT=0
 +9        SET ORXVAL=""
 +10       FOR 
               Begin DoDot:1
 +11      ; Increment counter.
                   SET ORXCNT=ORXCNT+1
 +12      ; Get first piece of string.
                   SET ORXVAL=$PIECE($GET(ORXPARS(ORXCNT)),U)
 +13      ;
 +14      ; Assign the actual display line:
 +15               SET ORXCDIS=ORXCNT
 +16      ; Right justify to 2 places.
                   SET ORXCDIS=$$RJ^XLFSTR(ORXCDIS,2)
 +17               if (ORXVAL'="")
                       SET DIR("A",ORXCNT)="        "_ORXCDIS_"    "_ORXVAL
               End DoDot:1
               if ORXVAL=""
                   QUIT 
 +18      ;
 +19      ; Check for errors:
 +20       IF ORXCNT<2
               WRITE !!,"   Problem reading TABS data!"
               SET ORXSTOP=1
               QUIT 
 +21      ;
 +22      ; Define DIR input requirements:
 +23       SET DIR(0)="NO^1:"_(ORXCNT-1)_":0"
 +24      ;
 +25      ; Call DIR for user choice:
 +26      ; Spacing for screen display.
           WRITE !!
 +27       DO ^DIR
 +28      ;
 +29      ; Check user response:
 +30      ; Punt if Y not assigned.
           IF '$LENGTH($GET(Y))
               SET ORXSTOP=1
               QUIT 
 +31      ; Punt if Y is null.
           IF Y=""
               SET ORXSTOP=1
               QUIT 
 +32      ; Punt if Y is "^" character.
           IF Y="^"
               SET ORXSTOP=1
               QUIT 
 +33      ; Punt if Y is less than one.
           IF Y<1
               SET ORXSTOP=1
               QUIT 
 +34      ; Punt if Y isn't within range.
           IF Y>(ORXCNT-1)
               SET ORXSTOP=1
               QUIT 
 +35      ; Otherwise, get entry and go.
           SET (ORXTCNT,ORXTAB)=Y
 +36      ;
 +37       QUIT 
 +38      ;
PARAMS(ORXPAR) ; Retrieve selected tab's current parameter values.
 +1       ;
 +2       ; Tab name from user display.
           SET ORXTAB=$PIECE(ORXPARS(ORXPAR),U)
 +3       ; Comparison value holder.
           SET ORXTNM=ORXTAB
 +4       ; Settings info.
           SET ORXSETS=$PIECE(ORXPARS(ORXPAR),U,2)
 +5       ; Display name differences.
           SET ORXTAB=$$EXCX
 +6       ; Construct formal param name.
           SET ORXPAR="ORCH CONTEXT "_ORXTAB
 +7       ; Store for saving changes.
           SET ORXPNAM=ORXPAR
 +8       ;
 +9       ; Get current parameter values from Parameters file:
 +10       SET ORXCUR=""
 +11       SET ORXCUR=$$GET^XPAR("ALL",ORXPAR)
 +12      ;
 +13       QUIT 
 +14      ;
EXCX()    ; Deal with exceptions in spelling.
 +1       ;
 +2       ; Shorter spelling.
           IF ORXTAB="D/C SUMMARIES"
               SET ORXTAB="SUMMRIES"
 +3       ; IMAGING is XRAYS.
           IF ORXTAB="IMAGING"
               SET ORXTAB="XRAYS"
 +4       ; Shorter spelling.
           IF ORXTAB="INPATIENT LABS"
               SET ORXTAB="INPT LABS"
 +5       ; Shorter spelling.
           IF ORXTAB="OUTPATIENT LABS"
               SET ORXTAB="OUTPT LABS"
 +6       ;
 +7        QUIT ORXTAB
 +8       ;
 +9       ;
 +10      ; NOTES ON ENTRIES FOR THE FOLLOWING "TABS" TAG:
 +11      ;    Each TABS entry MUST have a corresponding PROMPTS entry in
 +12      ;    PROMPTS^ORXTABS, in the same order and with matching first
 +13      ;    pieces.  There MUST ALSO be a tag in ORXTABS2, to get user
 +14      ;    input, which matches the actual name of the parameter in the
 +15      ;    Parameter Definition [^XTV(8989.51,] file.  For example, 
 +16      ;    the NOTES entry in TABS below is the last word of the "ORCH 
 +17      ;    CONTEXT NOTES" entry in the Parameter Definition file.  If 
 +18      ;    the first piece listed in the TABS tag below differs from the 
 +19      ;    actual Parameter Definition file entry - as is the case for
 +20      ;    XRAYS, which is the IMAGING entry below - add code in the EXCX
 +21      ;    tag above to deal with it.  The third "^" piece in each TABS 
 +22      ;    entry represents the positions in the parameter string entry 
 +23      ;    itself, i.e. in the Parameters [^XTV(8989.5,] file, where
 +24      ;    each individual value is stored, in the order listed in the 
 +25      ;    second "^" piece of the TABS entry.  IMPORTANT: Keep all "BEG" 
 +26      ;    and "END" pairs together consecutively - with "BEG" first, and
 +27      ;    all "STATUS" and "AUTHOR" pairs together - with "STATUS" first.
 +28      ;
TABS      ; Data strings for parameters/preferences.
 +1       ;;CONSULTS^BEG;END;STATUS;SERVICE^1;2;3;4
 +2       ;;INPATIENT LABS^BEG;END;TYPE^1;2;3
 +3       ;;OUTPATIENT LABS^BEG;END;TYPE^1;2;3
 +4       ;;MEDS^BEG;END;OUTPT^1;2;3
 +5       ;;NOTES^BEG;END;STATUS;AUTHOR;OCCLIM;SUBJECT^1;2;3;4;5;6
 +6       ;;ORDERS^BEG;END;STATUS;DISPGRP;FORMAT^1;2;3;4;5
 +7       ;;PROBLEMS^STATUS;COMMENTS^3;4
 +8       ;;REPORTS^BEG;END;MAX^1;2;5
 +9       ;;D/C SUMMARIES^BEG;END;STATUS;AUTHOR^1;2;3;4
 +10      ;;IMAGING^BEG;END;MAX^1;2;5
 +11      ;
 +12       QUIT 
 +13      ;
 +14      ; NOTES ON ENTRIES FOR "PROMPTS" TAG:
 +15      ;    Each PROMPTS entry below needs a corresponding TABS entry 
 +16      ;    in TABS^ORXTABS, must be listed in the same order, and with 
 +17      ;    a matching number of pieces.
 +18      ;    
PROMPTS   ; 24 char-max Prompts - MUST match TABS^ORXTABS entries/piece counts!
 +1       ;;CONSULTS^Begin Date;End Date;Status;Service
 +2       ;;INPATIENT LABS^Begin Date;End Date;Type
 +3       ;;OUTPATIENT LABS^Begin Date;End Date;Type
 +4       ;;MEDS^Begin Date;End Date;Outpatient or Inpatient Meds Default Display
 +5       ;;NOTES^Begin Date;End Date;Status;Author;Occurrence Limit;Show/Hide Subject
 +6       ;;ORDERS^Begin Date;End Date;Status;Service/Section;Format
 +7       ;;PROBLEMS^Status;Comments
 +8       ;;REPORTS^Begin Date;End Date;Maximum
 +9       ;;D/C SUMMARIES^Begin Date;End Date;Status;Author
 +10      ;;IMAGING^Begin Date;End Date;Maximum
 +11      ;
 +12       QUIT 
 +13      ;