- DGPFDIV ;ALB/KCL - PRF ENABLE MEDICAL CENTER DIVISIONS ; 9/19/05 4:03pm
- ;;5.3;Registration;**650**;Aug 13, 1993;Build 3
- ;
- ;No direct entry
- QUIT
- ;
- ;
- EN ;Main entry point for DGPF ENABLE DIVISIONS option.
- ;
- ; Input: none
- ; Output: none
- ;
- ;The following User actions are available:
- ; Action = 0 = Disable Medical Center Divisions
- ; Action = 1 = Enable Medical Center Divisions
- ; Action = 2 = View Medical Center Divisions
- ;
- N DGDIV ;selected divisions array
- N DGQUIT ;user selected action
- N DGSEL ;user selected action array
- ;
- W !
- W !,"This option allows multi-divisional facilities to enable, disable, and view"
- W !,"individual medical center divisions as patient record flag assignment owners."
- ;
- ;loop actions - quit if none selected
- S DGQUIT=0
- F D Q:DGQUIT<1
- . ;
- . ;prompt user for action
- . K DGSEL,DGDIV
- . S DGQUIT=$$ASKACT(.DGSEL)
- . Q:DGQUIT<1
- . ;
- . ;if view action
- . I +$G(DGSEL("ACTION"))=2 D VIEW^DGPFDIV1 Q
- . ;
- . ;prompt user for divisions
- . S DGQUIT=$$ASKDIV(.DGSEL,.DGDIV)
- . ;
- . ;check to keep looping or Exit the For loop if result less than 0
- . I DGQUIT<1 S DGQUIT=$S(DGQUIT<0:DGQUIT,1:1) Q
- . ;
- . ;if enable/disable action
- . I +$G(DGSEL("ACTION"))<2 D SET(.DGSEL,.DGDIV)
- . ;
- ;
- Q
- ;
- SET(DGSEL,DGDIV) ;enable/disable medical center divisions
- ;This procedure is used to enable or disable user selected medical
- ;center divisions.
- ;
- ; Input:
- ; DGSEL - (required) array containing the user selected action
- ; (pass by reference)
- ; Ex: DGSEL("ACTION")=0^disable
- ; DGSEL("ACTION")=1^enable
- ; DGDIV - (required) array of selected MEDICAL CENTER DIVISIONs
- ; (passed by reference) subscripted by ien.
- ; Example: DGDIV(500)=""
- ;
- ; Output: none
- ;
- N DGACT ;user selected action
- N DGANS ;$$ANSWER^DGPFUT result
- N DGEXIT ;for loop exit flag
- N DGIEN ;medical center division ien
- N DGIENS ;FM iens
- N DGTXT ;user prompt
- ;
- ;quit if not a valid action and division array not setup
- S DGACT=$G(DGSEL("ACTION"))
- I +DGACT'=0,(+DGACT'=1),($O(DGDIV(0))="") Q
- ;
- W !!,"Preparing to '"_$P(DGACT,U,2)_"' the selected medical center divisions as"
- W !,"patient record flag assignment owners...",!
- ;
- ;loop thru selected divisions and prompt user
- S DGIEN=0
- F S DGIEN=$O(DGDIV(DGIEN)) Q:'$G(DGIEN)!$G(DGEXIT) D
- . S DGIENS=DGIEN_","
- . S DGTXT="Ok to "_$P(DGACT,U,2)_" division: "
- . S DGANS=$$ANSWER^DGPFUT(DGTXT_$$GET1^DIQ(40.8,DGIENS,.01),"YES","Y")
- . I DGANS=0 W !?2,">>> "_$$EZBLD^DIALOG(261131)_".",! Q
- . I DGANS<0 S DGEXIT=1 Q
- . ;
- . ;attempt to lock record before update
- . I '$$LOCK^DGPFDIV1(DGIEN) D Q
- . . W !?2,">>> "_$$EZBLD^DIALOG(261131)_": Record is currently locked.",!
- . ;
- . ;update record
- . I $$STODIV^DGPFDIV1(DGIEN,+DGACT) W !?2,">>> Medical center division has been "_$$EXTERNAL^DILFD(40.8,26.01,"",+DGACT),!
- . E W !?2,">>> "_$$EZBLD^DIALOG(261131)_"Unable to file changes.",!
- . ;
- . ;unlock record after update
- . D UNLOCK^DGPFDIV1(DGIEN)
- ;
- Q
- ;
- ASKACT(DGSEL) ;select division action
- ;This function is used to ask a user to select an action.
- ;
- ; Input: none
- ;
- ; Output:
- ; Function value - returns 1 on success (action selected), or
- ; 0 if no action selected, or
- ; -1 if user up-arrows, double up-arrows or
- ; the ^DIR read times out.
- ; DGSEL - on success, local array containing selected action
- ; (passed by reference) Ex: DGSEL("ACTION")=0^disable
- ; DGSEL("ACTION")=1^enable
- ; DGSEL("ACTION")=2^view
- ;
- N DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y ;^DIR reader vars
- N DGRSLT ;function result
- ;
- S DGRSLT=0
- ;
- S DIR(0)="SO^E:Enable Medical Center Divisions;D:Disable Medical Center Divisions;V:View Medical Center Divisions"
- S DIR("A")="Select action"
- S DIR("?",1)="Enter 'Enable' if you would like to select medical center divisions as"
- S DIR("?",2)="being eligible for patient record flag assignment ownership."
- S DIR("?",3)=""
- S DIR("?",4)="Enter 'Disable' if you would like to change a division that is already"
- S DIR("?",5)="eligible for patient record flag assignment ownership to ineligible."
- S DIR("?",6)="Disabling a division will only be allowed if there are no active"
- S DIR("?",7)="assignments associated with the division."
- S DIR("?",8)=""
- S DIR("?")="Enter 'View' if you would like to view all medical center divisions."
- ;
- D ^DIR K DIR
- ;
- D:'$D(DIRUT) ;setup user selected action
- . S DGSEL("ACTION")=$S($G(Y)="E":"1^enable",$G(Y)="D":"0^disable",1:"2^view")
- . S DGRSLT=1
- ;
- Q $S($D(DUOUT):-1,$D(DTOUT):-1,$D(DIROUT):-1,1:DGRSLT)
- ;
- ASKDIV(DGSEL,DGDIV) ;select medical center divisions
- ;This function is used to ask a user to select the Medical Center
- ;Divisions that should be enabled or disabled as a PRF assignment owner.
- ;
- ; Input:
- ; DGSEL - (required) array containing the user selected action
- ; (pass by reference)
- ;
- ; Output:
- ; Function value - returns 1 on success (divisions selected), or
- ; returns 0 on failure (divisions not selected)
- ; DGDIV - on success, the local array of selected MEDICAL CENTER
- ; DIVISIONs (passed by reference) subscripted by ien.
- ; Example: DGDIV(500)=""
- ;
- N DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y ;reader vars
- N DGACT ;user selected action
- N DGEXIT ;for loop exit flag
- N DGRSLT ;function result
- ;
- S (DGRSLT,DGEXIT)=0
- ;
- ;quit if not a valid action
- S DGACT=$G(DGSEL("ACTION"))
- I +DGACT'=0,(+DGACT'=1) Q 0
- ;
- W !!,"Enter each medical center division that you would like to "_$P(DGACT,U,2)_".",!
- ;
- ;select medical center divisions
- S DIR(0)="PO^40.8:AEM"
- S DIR("A")="Select medical center division"
- S DIR("S")="I $$SCRNSEL^DGPFDD(+Y,+DGACT),$$SCRNDIV^DGPFDD(+Y,+DGACT)"
- S DIR("?",1)="Enter the medical center division that you would like to "_$S(+DGACT:"enable",1:"disable")
- S DIR("?")="as a patient record flag assignment owner."
- ;
- K DGDIV
- ;select divisions loop
- F D Q:$D(DIRUT)
- . ;
- . D ^DIR
- . ;
- . ;exit loop on timeout, up-arrow, or null
- . Q:$D(DIRUT)
- . ;
- . ;place selected division ien in array
- . S DGDIV(+Y)=""
- ;
- K DIR
- I +$O(DGDIV(0)) S DGRSLT=1
- E S DGRSLT=$S($D(DUOUT):-1,$D(DTOUT):-1,$D(DIROUT):-1,1:DGRSLT)
- ;
- Q DGRSLT
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGPFDIV 6545 printed Feb 19, 2025@00:13:37 Page 2
- DGPFDIV ;ALB/KCL - PRF ENABLE MEDICAL CENTER DIVISIONS ; 9/19/05 4:03pm
- +1 ;;5.3;Registration;**650**;Aug 13, 1993;Build 3
- +2 ;
- +3 ;No direct entry
- +4 QUIT
- +5 ;
- +6 ;
- EN ;Main entry point for DGPF ENABLE DIVISIONS option.
- +1 ;
- +2 ; Input: none
- +3 ; Output: none
- +4 ;
- +5 ;The following User actions are available:
- +6 ; Action = 0 = Disable Medical Center Divisions
- +7 ; Action = 1 = Enable Medical Center Divisions
- +8 ; Action = 2 = View Medical Center Divisions
- +9 ;
- +10 ;selected divisions array
- NEW DGDIV
- +11 ;user selected action
- NEW DGQUIT
- +12 ;user selected action array
- NEW DGSEL
- +13 ;
- +14 WRITE !
- +15 WRITE !,"This option allows multi-divisional facilities to enable, disable, and view"
- +16 WRITE !,"individual medical center divisions as patient record flag assignment owners."
- +17 ;
- +18 ;loop actions - quit if none selected
- +19 SET DGQUIT=0
- +20 FOR
- Begin DoDot:1
- +21 ;
- +22 ;prompt user for action
- +23 KILL DGSEL,DGDIV
- +24 SET DGQUIT=$$ASKACT(.DGSEL)
- +25 if DGQUIT<1
- QUIT
- +26 ;
- +27 ;if view action
- +28 IF +$GET(DGSEL("ACTION"))=2
- DO VIEW^DGPFDIV1
- QUIT
- +29 ;
- +30 ;prompt user for divisions
- +31 SET DGQUIT=$$ASKDIV(.DGSEL,.DGDIV)
- +32 ;
- +33 ;check to keep looping or Exit the For loop if result less than 0
- +34 IF DGQUIT<1
- SET DGQUIT=$SELECT(DGQUIT<0:DGQUIT,1:1)
- QUIT
- +35 ;
- +36 ;if enable/disable action
- +37 IF +$GET(DGSEL("ACTION"))<2
- DO SET(.DGSEL,.DGDIV)
- +38 ;
- End DoDot:1
- if DGQUIT<1
- QUIT
- +39 ;
- +40 QUIT
- +41 ;
- SET(DGSEL,DGDIV) ;enable/disable medical center divisions
- +1 ;This procedure is used to enable or disable user selected medical
- +2 ;center divisions.
- +3 ;
- +4 ; Input:
- +5 ; DGSEL - (required) array containing the user selected action
- +6 ; (pass by reference)
- +7 ; Ex: DGSEL("ACTION")=0^disable
- +8 ; DGSEL("ACTION")=1^enable
- +9 ; DGDIV - (required) array of selected MEDICAL CENTER DIVISIONs
- +10 ; (passed by reference) subscripted by ien.
- +11 ; Example: DGDIV(500)=""
- +12 ;
- +13 ; Output: none
- +14 ;
- +15 ;user selected action
- NEW DGACT
- +16 ;$$ANSWER^DGPFUT result
- NEW DGANS
- +17 ;for loop exit flag
- NEW DGEXIT
- +18 ;medical center division ien
- NEW DGIEN
- +19 ;FM iens
- NEW DGIENS
- +20 ;user prompt
- NEW DGTXT
- +21 ;
- +22 ;quit if not a valid action and division array not setup
- +23 SET DGACT=$GET(DGSEL("ACTION"))
- +24 IF +DGACT'=0
- IF (+DGACT'=1)
- IF ($ORDER(DGDIV(0))="")
- QUIT
- +25 ;
- +26 WRITE !!,"Preparing to '"_$PIECE(DGACT,U,2)_"' the selected medical center divisions as"
- +27 WRITE !,"patient record flag assignment owners...",!
- +28 ;
- +29 ;loop thru selected divisions and prompt user
- +30 SET DGIEN=0
- +31 FOR
- SET DGIEN=$ORDER(DGDIV(DGIEN))
- if '$GET(DGIEN)!$GET(DGEXIT)
- QUIT
- Begin DoDot:1
- +32 SET DGIENS=DGIEN_","
- +33 SET DGTXT="Ok to "_$PIECE(DGACT,U,2)_" division: "
- +34 SET DGANS=$$ANSWER^DGPFUT(DGTXT_$$GET1^DIQ(40.8,DGIENS,.01),"YES","Y")
- +35 IF DGANS=0
- WRITE !?2,">>> "_$$EZBLD^DIALOG(261131)_".",!
- QUIT
- +36 IF DGANS<0
- SET DGEXIT=1
- QUIT
- +37 ;
- +38 ;attempt to lock record before update
- +39 IF '$$LOCK^DGPFDIV1(DGIEN)
- Begin DoDot:2
- +40 WRITE !?2,">>> "_$$EZBLD^DIALOG(261131)_": Record is currently locked.",!
- End DoDot:2
- QUIT
- +41 ;
- +42 ;update record
- +43 IF $$STODIV^DGPFDIV1(DGIEN,+DGACT)
- WRITE !?2,">>> Medical center division has been "_$$EXTERNAL^DILFD(40.8,26.01,"",+DGACT),!
- +44 IF '$TEST
- WRITE !?2,">>> "_$$EZBLD^DIALOG(261131)_"Unable to file changes.",!
- +45 ;
- +46 ;unlock record after update
- +47 DO UNLOCK^DGPFDIV1(DGIEN)
- End DoDot:1
- +48 ;
- +49 QUIT
- +50 ;
- ASKACT(DGSEL) ;select division action
- +1 ;This function is used to ask a user to select an action.
- +2 ;
- +3 ; Input: none
- +4 ;
- +5 ; Output:
- +6 ; Function value - returns 1 on success (action selected), or
- +7 ; 0 if no action selected, or
- +8 ; -1 if user up-arrows, double up-arrows or
- +9 ; the ^DIR read times out.
- +10 ; DGSEL - on success, local array containing selected action
- +11 ; (passed by reference) Ex: DGSEL("ACTION")=0^disable
- +12 ; DGSEL("ACTION")=1^enable
- +13 ; DGSEL("ACTION")=2^view
- +14 ;
- +15 ;^DIR reader vars
- NEW DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y
- +16 ;function result
- NEW DGRSLT
- +17 ;
- +18 SET DGRSLT=0
- +19 ;
- +20 SET DIR(0)="SO^E:Enable Medical Center Divisions;D:Disable Medical Center Divisions;V:View Medical Center Divisions"
- +21 SET DIR("A")="Select action"
- +22 SET DIR("?",1)="Enter 'Enable' if you would like to select medical center divisions as"
- +23 SET DIR("?",2)="being eligible for patient record flag assignment ownership."
- +24 SET DIR("?",3)=""
- +25 SET DIR("?",4)="Enter 'Disable' if you would like to change a division that is already"
- +26 SET DIR("?",5)="eligible for patient record flag assignment ownership to ineligible."
- +27 SET DIR("?",6)="Disabling a division will only be allowed if there are no active"
- +28 SET DIR("?",7)="assignments associated with the division."
- +29 SET DIR("?",8)=""
- +30 SET DIR("?")="Enter 'View' if you would like to view all medical center divisions."
- +31 ;
- +32 DO ^DIR
- KILL DIR
- +33 ;
- +34 ;setup user selected action
- if '$DATA(DIRUT)
- Begin DoDot:1
- +35 SET DGSEL("ACTION")=$SELECT($GET(Y)="E":"1^enable",$GET(Y)="D":"0^disable",1:"2^view")
- +36 SET DGRSLT=1
- End DoDot:1
- +37 ;
- +38 QUIT $SELECT($DATA(DUOUT):-1,$DATA(DTOUT):-1,$DATA(DIROUT):-1,1:DGRSLT)
- +39 ;
- ASKDIV(DGSEL,DGDIV) ;select medical center divisions
- +1 ;This function is used to ask a user to select the Medical Center
- +2 ;Divisions that should be enabled or disabled as a PRF assignment owner.
- +3 ;
- +4 ; Input:
- +5 ; DGSEL - (required) array containing the user selected action
- +6 ; (pass by reference)
- +7 ;
- +8 ; Output:
- +9 ; Function value - returns 1 on success (divisions selected), or
- +10 ; returns 0 on failure (divisions not selected)
- +11 ; DGDIV - on success, the local array of selected MEDICAL CENTER
- +12 ; DIVISIONs (passed by reference) subscripted by ien.
- +13 ; Example: DGDIV(500)=""
- +14 ;
- +15 ;reader vars
- NEW DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y
- +16 ;user selected action
- NEW DGACT
- +17 ;for loop exit flag
- NEW DGEXIT
- +18 ;function result
- NEW DGRSLT
- +19 ;
- +20 SET (DGRSLT,DGEXIT)=0
- +21 ;
- +22 ;quit if not a valid action
- +23 SET DGACT=$GET(DGSEL("ACTION"))
- +24 IF +DGACT'=0
- IF (+DGACT'=1)
- QUIT 0
- +25 ;
- +26 WRITE !!,"Enter each medical center division that you would like to "_$PIECE(DGACT,U,2)_".",!
- +27 ;
- +28 ;select medical center divisions
- +29 SET DIR(0)="PO^40.8:AEM"
- +30 SET DIR("A")="Select medical center division"
- +31 SET DIR("S")="I $$SCRNSEL^DGPFDD(+Y,+DGACT),$$SCRNDIV^DGPFDD(+Y,+DGACT)"
- +32 SET DIR("?",1)="Enter the medical center division that you would like to "_$SELECT(+DGACT:"enable",1:"disable")
- +33 SET DIR("?")="as a patient record flag assignment owner."
- +34 ;
- +35 KILL DGDIV
- +36 ;select divisions loop
- +37 FOR
- Begin DoDot:1
- +38 ;
- +39 DO ^DIR
- +40 ;
- +41 ;exit loop on timeout, up-arrow, or null
- +42 if $DATA(DIRUT)
- QUIT
- +43 ;
- +44 ;place selected division ien in array
- +45 SET DGDIV(+Y)=""
- End DoDot:1
- if $DATA(DIRUT)
- QUIT
- +46 ;
- +47 KILL DIR
- +48 IF +$ORDER(DGDIV(0))
- SET DGRSLT=1
- +49 IF '$TEST
- SET DGRSLT=$SELECT($DATA(DUOUT):-1,$DATA(DTOUT):-1,$DATA(DIROUT):-1,1:DGRSLT)
- +50 ;
- +51 QUIT DGRSLT