source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPFDIV.m@ 794

Last change on this file since 794 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.2 KB
Line 
1DGPFDIV ;ALB/KCL - PRF ENABLE MEDICAL CENTER DIVISIONS ; 9/19/05 4:03pm
2 ;;5.3;Registration;**650**;Aug 13, 1993;Build 3
3 ;
4 ;No direct entry
5 QUIT
6 ;
7 ;
8EN ;Main entry point for DGPF ENABLE DIVISIONS option.
9 ;
10 ; Input: none
11 ; Output: none
12 ;
13 ;The following User actions are available:
14 ; Action = 0 = Disable Medical Center Divisions
15 ; Action = 1 = Enable Medical Center Divisions
16 ; Action = 2 = View Medical Center Divisions
17 ;
18 N DGDIV ;selected divisions array
19 N DGQUIT ;user selected action
20 N DGSEL ;user selected action array
21 ;
22 W !
23 W !,"This option allows multi-divisional facilities to enable, disable, and view"
24 W !,"individual medical center divisions as patient record flag assignment owners."
25 ;
26 ;loop actions - quit if none selected
27 S DGQUIT=0
28 F D Q:DGQUIT<1
29 . ;
30 . ;prompt user for action
31 . K DGSEL,DGDIV
32 . S DGQUIT=$$ASKACT(.DGSEL)
33 . Q:DGQUIT<1
34 . ;
35 . ;if view action
36 . I +$G(DGSEL("ACTION"))=2 D VIEW^DGPFDIV1 Q
37 . ;
38 . ;prompt user for divisions
39 . S DGQUIT=$$ASKDIV(.DGSEL,.DGDIV)
40 . ;
41 . ;check to keep looping or Exit the For loop if result less than 0
42 . I DGQUIT<1 S DGQUIT=$S(DGQUIT<0:DGQUIT,1:1) Q
43 . ;
44 . ;if enable/disable action
45 . I +$G(DGSEL("ACTION"))<2 D SET(.DGSEL,.DGDIV)
46 . ;
47 ;
48 Q
49 ;
50SET(DGSEL,DGDIV) ;enable/disable medical center divisions
51 ;This procedure is used to enable or disable user selected medical
52 ;center divisions.
53 ;
54 ; Input:
55 ; DGSEL - (required) array containing the user selected action
56 ; (pass by reference)
57 ; Ex: DGSEL("ACTION")=0^disable
58 ; DGSEL("ACTION")=1^enable
59 ; DGDIV - (required) array of selected MEDICAL CENTER DIVISIONs
60 ; (passed by reference) subscripted by ien.
61 ; Example: DGDIV(500)=""
62 ;
63 ; Output: none
64 ;
65 N DGACT ;user selected action
66 N DGANS ;$$ANSWER^DGPFUT result
67 N DGEXIT ;for loop exit flag
68 N DGIEN ;medical center division ien
69 N DGIENS ;FM iens
70 N DGTXT ;user prompt
71 ;
72 ;quit if not a valid action and division array not setup
73 S DGACT=$G(DGSEL("ACTION"))
74 I +DGACT'=0,(+DGACT'=1),($O(DGDIV(0))="") Q
75 ;
76 W !!,"Preparing to '"_$P(DGACT,U,2)_"' the selected medical center divisions as"
77 W !,"patient record flag assignment owners...",!
78 ;
79 ;loop thru selected divisions and prompt user
80 S DGIEN=0
81 F S DGIEN=$O(DGDIV(DGIEN)) Q:'$G(DGIEN)!$G(DGEXIT) D
82 . S DGIENS=DGIEN_","
83 . S DGTXT="Ok to "_$P(DGACT,U,2)_" division: "
84 . S DGANS=$$ANSWER^DGPFUT(DGTXT_$$GET1^DIQ(40.8,DGIENS,.01),"YES","Y")
85 . I DGANS=0 W !?2,">>> "_$$EZBLD^DIALOG(261131)_".",! Q
86 . I DGANS<0 S DGEXIT=1 Q
87 . ;
88 . ;attempt to lock record before update
89 . I '$$LOCK^DGPFDIV1(DGIEN) D Q
90 . . W !?2,">>> "_$$EZBLD^DIALOG(261131)_": Record is currently locked.",!
91 . ;
92 . ;update record
93 . I $$STODIV^DGPFDIV1(DGIEN,+DGACT) W !?2,">>> Medical center division has been "_$$EXTERNAL^DILFD(40.8,26.01,"",+DGACT),!
94 . E W !?2,">>> "_$$EZBLD^DIALOG(261131)_"Unable to file changes.",!
95 . ;
96 . ;unlock record after update
97 . D UNLOCK^DGPFDIV1(DGIEN)
98 ;
99 Q
100 ;
101ASKACT(DGSEL) ;select division action
102 ;This function is used to ask a user to select an action.
103 ;
104 ; Input: none
105 ;
106 ; Output:
107 ; Function value - returns 1 on success (action selected), or
108 ; 0 if no action selected, or
109 ; -1 if user up-arrows, double up-arrows or
110 ; the ^DIR read times out.
111 ; DGSEL - on success, local array containing selected action
112 ; (passed by reference) Ex: DGSEL("ACTION")=0^disable
113 ; DGSEL("ACTION")=1^enable
114 ; DGSEL("ACTION")=2^view
115 ;
116 N DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y ;^DIR reader vars
117 N DGRSLT ;function result
118 ;
119 S DGRSLT=0
120 ;
121 S DIR(0)="SO^E:Enable Medical Center Divisions;D:Disable Medical Center Divisions;V:View Medical Center Divisions"
122 S DIR("A")="Select action"
123 S DIR("?",1)="Enter 'Enable' if you would like to select medical center divisions as"
124 S DIR("?",2)="being eligible for patient record flag assignment ownership."
125 S DIR("?",3)=""
126 S DIR("?",4)="Enter 'Disable' if you would like to change a division that is already"
127 S DIR("?",5)="eligible for patient record flag assignment ownership to ineligible."
128 S DIR("?",6)="Disabling a division will only be allowed if there are no active"
129 S DIR("?",7)="assignments associated with the division."
130 S DIR("?",8)=""
131 S DIR("?")="Enter 'View' if you would like to view all medical center divisions."
132 ;
133 D ^DIR K DIR
134 ;
135 D:'$D(DIRUT) ;setup user selected action
136 . S DGSEL("ACTION")=$S($G(Y)="E":"1^enable",$G(Y)="D":"0^disable",1:"2^view")
137 . S DGRSLT=1
138 ;
139 Q $S($D(DUOUT):-1,$D(DTOUT):-1,$D(DIROUT):-1,1:DGRSLT)
140 ;
141ASKDIV(DGSEL,DGDIV) ;select medical center divisions
142 ;This function is used to ask a user to select the Medical Center
143 ;Divisions that should be enabled or disabled as a PRF assignment owner.
144 ;
145 ; Input:
146 ; DGSEL - (required) array containing the user selected action
147 ; (pass by reference)
148 ;
149 ; Output:
150 ; Function value - returns 1 on success (divisions selected), or
151 ; returns 0 on failure (divisions not selected)
152 ; DGDIV - on success, the local array of selected MEDICAL CENTER
153 ; DIVISIONs (passed by reference) subscripted by ien.
154 ; Example: DGDIV(500)=""
155 ;
156 N DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y ;reader vars
157 N DGACT ;user selected action
158 N DGEXIT ;for loop exit flag
159 N DGRSLT ;function result
160 ;
161 S (DGRSLT,DGEXIT)=0
162 ;
163 ;quit if not a valid action
164 S DGACT=$G(DGSEL("ACTION"))
165 I +DGACT'=0,(+DGACT'=1) Q 0
166 ;
167 W !!,"Enter each medical center division that you would like to "_$P(DGACT,U,2)_".",!
168 ;
169 ;select medical center divisions
170 S DIR(0)="PO^40.8:AEM"
171 S DIR("A")="Select medical center division"
172 S DIR("S")="I $$SCRNSEL^DGPFDD(+Y,+DGACT),$$SCRNDIV^DGPFDD(+Y,+DGACT)"
173 S DIR("?",1)="Enter the medical center division that you would like to "_$S(+DGACT:"enable",1:"disable")
174 S DIR("?")="as a patient record flag assignment owner."
175 ;
176 K DGDIV
177 ;select divisions loop
178 F D Q:$D(DIRUT)
179 . ;
180 . D ^DIR
181 . ;
182 . ;exit loop on timeout, up-arrow, or null
183 . Q:$D(DIRUT)
184 . ;
185 . ;place selected division ien in array
186 . S DGDIV(+Y)=""
187 ;
188 K DIR
189 I +$O(DGDIV(0)) S DGRSLT=1
190 E S DGRSLT=$S($D(DUOUT):-1,$D(DTOUT):-1,$D(DIROUT):-1,1:DGRSLT)
191 ;
192 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.