Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DGPFDIV

DGPFDIV.m

Go to the documentation of this file.
  1. DGPFDIV ;ALB/KCL - PRF ENABLE MEDICAL CENTER DIVISIONS ; 9/19/05 4:03pm
  1. ;;5.3;Registration;**650**;Aug 13, 1993;Build 3
  1. ;
  1. ;No direct entry
  1. QUIT
  1. ;
  1. ;
  1. EN ;Main entry point for DGPF ENABLE DIVISIONS option.
  1. ;
  1. ; Input: none
  1. ; Output: none
  1. ;
  1. ;The following User actions are available:
  1. ; Action = 0 = Disable Medical Center Divisions
  1. ; Action = 1 = Enable Medical Center Divisions
  1. ; Action = 2 = View Medical Center Divisions
  1. ;
  1. N DGDIV ;selected divisions array
  1. N DGQUIT ;user selected action
  1. N DGSEL ;user selected action array
  1. ;
  1. W !
  1. W !,"This option allows multi-divisional facilities to enable, disable, and view"
  1. W !,"individual medical center divisions as patient record flag assignment owners."
  1. ;
  1. ;loop actions - quit if none selected
  1. S DGQUIT=0
  1. F D Q:DGQUIT<1
  1. . ;
  1. . ;prompt user for action
  1. . K DGSEL,DGDIV
  1. . S DGQUIT=$$ASKACT(.DGSEL)
  1. . Q:DGQUIT<1
  1. . ;
  1. . ;if view action
  1. . I +$G(DGSEL("ACTION"))=2 D VIEW^DGPFDIV1 Q
  1. . ;
  1. . ;prompt user for divisions
  1. . S DGQUIT=$$ASKDIV(.DGSEL,.DGDIV)
  1. . ;
  1. . ;check to keep looping or Exit the For loop if result less than 0
  1. . I DGQUIT<1 S DGQUIT=$S(DGQUIT<0:DGQUIT,1:1) Q
  1. . ;
  1. . ;if enable/disable action
  1. . I +$G(DGSEL("ACTION"))<2 D SET(.DGSEL,.DGDIV)
  1. . ;
  1. ;
  1. Q
  1. ;
  1. SET(DGSEL,DGDIV) ;enable/disable medical center divisions
  1. ;This procedure is used to enable or disable user selected medical
  1. ;center divisions.
  1. ;
  1. ; Input:
  1. ; DGSEL - (required) array containing the user selected action
  1. ; (pass by reference)
  1. ; Ex: DGSEL("ACTION")=0^disable
  1. ; DGSEL("ACTION")=1^enable
  1. ; DGDIV - (required) array of selected MEDICAL CENTER DIVISIONs
  1. ; (passed by reference) subscripted by ien.
  1. ; Example: DGDIV(500)=""
  1. ;
  1. ; Output: none
  1. ;
  1. N DGACT ;user selected action
  1. N DGANS ;$$ANSWER^DGPFUT result
  1. N DGEXIT ;for loop exit flag
  1. N DGIEN ;medical center division ien
  1. N DGIENS ;FM iens
  1. N DGTXT ;user prompt
  1. ;
  1. ;quit if not a valid action and division array not setup
  1. S DGACT=$G(DGSEL("ACTION"))
  1. I +DGACT'=0,(+DGACT'=1),($O(DGDIV(0))="") Q
  1. ;
  1. W !!,"Preparing to '"_$P(DGACT,U,2)_"' the selected medical center divisions as"
  1. W !,"patient record flag assignment owners...",!
  1. ;
  1. ;loop thru selected divisions and prompt user
  1. S DGIEN=0
  1. F S DGIEN=$O(DGDIV(DGIEN)) Q:'$G(DGIEN)!$G(DGEXIT) D
  1. . S DGIENS=DGIEN_","
  1. . S DGTXT="Ok to "_$P(DGACT,U,2)_" division: "
  1. . S DGANS=$$ANSWER^DGPFUT(DGTXT_$$GET1^DIQ(40.8,DGIENS,.01),"YES","Y")
  1. . I DGANS=0 W !?2,">>> "_$$EZBLD^DIALOG(261131)_".",! Q
  1. . I DGANS<0 S DGEXIT=1 Q
  1. . ;
  1. . ;attempt to lock record before update
  1. . I '$$LOCK^DGPFDIV1(DGIEN) D Q
  1. . . W !?2,">>> "_$$EZBLD^DIALOG(261131)_": Record is currently locked.",!
  1. . ;
  1. . ;update record
  1. . I $$STODIV^DGPFDIV1(DGIEN,+DGACT) W !?2,">>> Medical center division has been "_$$EXTERNAL^DILFD(40.8,26.01,"",+DGACT),!
  1. . E W !?2,">>> "_$$EZBLD^DIALOG(261131)_"Unable to file changes.",!
  1. . ;
  1. . ;unlock record after update
  1. . D UNLOCK^DGPFDIV1(DGIEN)
  1. ;
  1. Q
  1. ;
  1. ASKACT(DGSEL) ;select division action
  1. ;This function is used to ask a user to select an action.
  1. ;
  1. ; Input: none
  1. ;
  1. ; Output:
  1. ; Function value - returns 1 on success (action selected), or
  1. ; 0 if no action selected, or
  1. ; -1 if user up-arrows, double up-arrows or
  1. ; the ^DIR read times out.
  1. ; DGSEL - on success, local array containing selected action
  1. ; (passed by reference) Ex: DGSEL("ACTION")=0^disable
  1. ; DGSEL("ACTION")=1^enable
  1. ; DGSEL("ACTION")=2^view
  1. ;
  1. N DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y ;^DIR reader vars
  1. N DGRSLT ;function result
  1. ;
  1. S DGRSLT=0
  1. ;
  1. S DIR(0)="SO^E:Enable Medical Center Divisions;D:Disable Medical Center Divisions;V:View Medical Center Divisions"
  1. S DIR("A")="Select action"
  1. S DIR("?",1)="Enter 'Enable' if you would like to select medical center divisions as"
  1. S DIR("?",2)="being eligible for patient record flag assignment ownership."
  1. S DIR("?",3)=""
  1. S DIR("?",4)="Enter 'Disable' if you would like to change a division that is already"
  1. S DIR("?",5)="eligible for patient record flag assignment ownership to ineligible."
  1. S DIR("?",6)="Disabling a division will only be allowed if there are no active"
  1. S DIR("?",7)="assignments associated with the division."
  1. S DIR("?",8)=""
  1. S DIR("?")="Enter 'View' if you would like to view all medical center divisions."
  1. ;
  1. D ^DIR K DIR
  1. ;
  1. D:'$D(DIRUT) ;setup user selected action
  1. . S DGSEL("ACTION")=$S($G(Y)="E":"1^enable",$G(Y)="D":"0^disable",1:"2^view")
  1. . S DGRSLT=1
  1. ;
  1. Q $S($D(DUOUT):-1,$D(DTOUT):-1,$D(DIROUT):-1,1:DGRSLT)
  1. ;
  1. ASKDIV(DGSEL,DGDIV) ;select medical center divisions
  1. ;This function is used to ask a user to select the Medical Center
  1. ;Divisions that should be enabled or disabled as a PRF assignment owner.
  1. ;
  1. ; Input:
  1. ; DGSEL - (required) array containing the user selected action
  1. ; (pass by reference)
  1. ;
  1. ; Output:
  1. ; Function value - returns 1 on success (divisions selected), or
  1. ; returns 0 on failure (divisions not selected)
  1. ; DGDIV - on success, the local array of selected MEDICAL CENTER
  1. ; DIVISIONs (passed by reference) subscripted by ien.
  1. ; Example: DGDIV(500)=""
  1. ;
  1. N DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y ;reader vars
  1. N DGACT ;user selected action
  1. N DGEXIT ;for loop exit flag
  1. N DGRSLT ;function result
  1. ;
  1. S (DGRSLT,DGEXIT)=0
  1. ;
  1. ;quit if not a valid action
  1. S DGACT=$G(DGSEL("ACTION"))
  1. I +DGACT'=0,(+DGACT'=1) Q 0
  1. ;
  1. W !!,"Enter each medical center division that you would like to "_$P(DGACT,U,2)_".",!
  1. ;
  1. ;select medical center divisions
  1. S DIR(0)="PO^40.8:AEM"
  1. S DIR("A")="Select medical center division"
  1. S DIR("S")="I $$SCRNSEL^DGPFDD(+Y,+DGACT),$$SCRNDIV^DGPFDD(+Y,+DGACT)"
  1. S DIR("?",1)="Enter the medical center division that you would like to "_$S(+DGACT:"enable",1:"disable")
  1. S DIR("?")="as a patient record flag assignment owner."
  1. ;
  1. K DGDIV
  1. ;select divisions loop
  1. F D Q:$D(DIRUT)
  1. . ;
  1. . D ^DIR
  1. . ;
  1. . ;exit loop on timeout, up-arrow, or null
  1. . Q:$D(DIRUT)
  1. . ;
  1. . ;place selected division ien in array
  1. . S DGDIV(+Y)=""
  1. ;
  1. K DIR
  1. I +$O(DGDIV(0)) S DGRSLT=1
  1. E S DGRSLT=$S($D(DUOUT):-1,$D(DTOUT):-1,$D(DIROUT):-1,1:DGRSLT)
  1. ;
  1. Q DGRSLT