source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCMCMU1.m@ 1093

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

initial load of WorldVistAEHR

File size: 5.7 KB
RevLine 
[613]1SCMCMU1 ;ALB/MJK - PCMM Mass Team/Position List Manager ; 10-JUL-1998
2 ;;5.3;Scheduling;**148**;AUG 13, 1993
3 ;
4EN(SCTEAM,SCPOS,SCTPDIS,SCMUTYPE,SCDATE) ; -- main entry point for SCMC MU MASS TEAM UNASSIGNMENT
5 D EN^VALM("SCMC MU MASS TEAM UNASSIGNMENT")
6 Q
7 ;
8HDR ; -- header code
9 N X,SCTEAM0
10 S SCTEAM0=$G(^SCTM(404.51,+SCTEAM,0),"Unknown")
11 S X=$E(" Team: "_$P(SCTEAM0,U),1,40)
12 S X=$$SETSTR^VALM1(" Total: "_+$G(SCALLCNT)_" Selected: "_+$G(SCSELCNT),X,45,35)
13 S VALMHDR(1)=X
14 ;
15 S X=""
16 IF SCMUTYPE="P" D
17 . S SCPOS0=$G(^SCTM(404.57,+SCPOS,0),"Unknown")
18 . S X=$E("Position: "_$P(SCPOS0,U),1,40)
19 . IF '$G(SCTPDIS(+SCPOS)) Q
20 . S X=$$SETSTR^VALM1("Clinic: "_$P($G(^SC(+$P(SCPOS0,U,9),0),"Unknown"),U),X,45,35)
21 .Q
22 ;
23 S VALMHDR(2)=X
24 S X="Proposed Effective Date: "_$$FMTE^XLFDT($E(SCDATE,1,7),"5Z")
25 S X=$$SETSTR^VALM1(" View: "_SCVIEW_$S(SCVIEW="ALL":"",1:"ED"),X,45,35)
26 S VALMHDR(3)=X
27 Q
28 ;
29INIT ; -- init variables and list array
30 N SCPATS,SCI,SCALPHA,SCX,SCDTE
31 S SCPATS=$NA(^TMP("SCMU",$J,"PATIENTS"))
32 S SCALPHA=$NA(^TMP("SCMU",$J,"PATS ALPHA"))
33 K @SCPATS,@SCALPHA
34 ;
35 ; -- set up persistent structures
36 S SCPTINFO=$NA(^TMP("SCMU",$J,"PATIENT INFO")) ; useful patient data
37 S SCPTSEL=$NA(^TMP("SCMU",$J,"SELECTED")) ; patients selected
38 S SCPTALL=$NA(^TMP("SCMU",$J,"PATIENT ALL")) ; listman data
39 ;
40 K @SCPTINFO,@SCPTSEL,@SCPTALL
41 S (SCALLCNT,SCSELCNT,SCMSG)=0
42 S SCVIEW="ALL"
43 ;
44 W ! D WAIT^DICD
45 ;
46 ; -- change title is appropriate
47 IF SCMUTYPE="P" S VALM("TITLE")="Mass Position Unassignment"
48 ;
49 ; -- get patients
50 D DATE(SCDATE,.SCDTE)
51 IF SCMUTYPE="T",'$$PTTM^SCAPMC(SCTEAM,SCDTE,SCPATS) G INITQ
52 IF SCMUTYPE="P",'$$PTTP^SCAPMC(SCPOS,SCDTE,SCPATS) G INITQ
53 ;
54 ; -- build list for display
55 S SCI=0
56 F S SCI=$O(@SCPATS@(SCI)) Q:'SCI D
57 . S SCX=@SCPATS@(SCI)
58 . S @SCALPHA@($P(SCX,U,2)_SCI)=SCI
59 . Q
60 ;
61 S SCNT=0
62 S SCI=""
63 F S SCI=$O(@SCALPHA@(SCI)) Q:SCI="" D
64 . S SCX=$G(@SCPATS@(+@SCALPHA@(SCI)))
65 . IF '$$FILTER(SCX,SCDATE) Q
66 . S SCNT=SCNT+1
67 . S Y=$$SETSTR^VALM1(SCNT,"",1,4) ; number
68 . S Y=$$SETSTR^VALM1($P(SCX,U,2),Y,15,25) ; pt name
69 . S Y=$$SETSTR^VALM1($P(SCX,U,6),Y,42,12) ; pt id
70 . S Y=$$SETSTR^VALM1($$FMTE^XLFDT($P(SCX,U,4),"5Z"),Y,56,10) ; assigned
71 . S Y=$$SETSTR^VALM1($$FMTE^XLFDT($P(SCX,U,5),"5Z"),Y,69,10) ; unassigned
72 . ;
73 . ; -- flag if this is a future assignment
74 . IF $P(SCX,U,4)>DT D
75 . . S Y=$$SETSTR^VALM1("*",Y,55,1)
76 . . IF 'SCMSG S SCMSG=1 D MSG
77 . ;
78 . ; -- flag if this is a future unassignment
79 . IF $P(SCX,U,5)>DT D
80 . . S Y=$$SETSTR^VALM1("*",Y,68,1)
81 . . IF 'SCMSG S SCMSG=1 D MSG
82 . ;
83 . S @SCPTALL@(SCNT,0)=Y
84 . S @SCPTALL@("IDX",SCNT,SCNT)=SCNT
85 . S @SCPTINFO@(SCNT)=SCX
86 . Q
87 K @SCPATS,@SCALPHA
88 S SCALLCNT=SCNT
89 ;
90 ; -- set up lm array
91 D BLD
92 ;
93INITQ Q
94 ;
95FILTER(SCX,SCDATE) ; -- apply filter criteria
96 N SCOK
97 S SCOK=1
98 ; -- if inactivation date is =< effective then don't use
99 IF $P(SCX,U,5),$P(SCX,U,5)'>SCDATE S SCOK=0
100 Q SCOK
101 ;
102BLD ; -- build VALMAR
103 K @VALMAR
104 ;
105 IF SCVIEW="ALL" D
106 . M @VALMAR=@SCPTALL
107 . S VALMCNT=SCALLCNT
108 . Q
109 ;
110 ELSE D
111 . N SCNT
112 . S (SCNT,VALMCNT)=0
113 . F S SCNT=$O(@SCPTALL@(SCNT)) Q:'SCNT D
114 . . ; -- if in select view and patient not selected then don't use
115 . . IF SCVIEW="SELECT",'$D(@SCPTSEL@(SCNT)) Q
116 . . ; -- if in de-select view and patient selected then don't use
117 . . IF SCVIEW="DE-SELECT",$D(@SCPTSEL@(SCNT)) Q
118 . . ;
119 . . S VALMCNT=VALMCNT+1
120 . . S Y=@SCPTALL@(SCNT,0)
121 . . S @VALMAR@(VALMCNT,0)=$$SETSTR^VALM1(VALMCNT,Y,1,4)
122 . . ;
123 . . ; -- set idx to pointer back to SCPTALL (this is key!)
124 . . S @VALMAR@("IDX",VALMCNT,VALMCNT)=SCNT
125 . . Q
126 . Q
127 ;
128 IF '$O(@VALMAR@(0)) D
129 . S @VALMAR@(1,0)=" "
130 . S @VALMAR@(2,0)=" "
131 . S @VALMAR@(3,0)=" No patients to list."
132 . Q
133 IF $G(VALMBG),'$D(@VALMAR@(VALMBG,0)) S VALMBG=1
134 K VALMHDR
135 D BACK("R")
136 Q
137 ;
138SETSEL(FLAG,SCNT) ; -- set selected flag indicator
139 N Y,SCPTCNT
140 ;
141 ; -- get pointer back to SCPTALL
142 S SCPTCNT=+$G(@VALMAR@("IDX",SCNT,SCNT))
143 IF FLAG="DE-SELECT",$D(@SCPTSEL@(SCPTCNT)) D
144 . K @SCPTSEL@(SCPTCNT)
145 . S SCSELCNT=$S(SCSELCNT=0:0,1:SCSELCNT-1)
146 ;
147 IF FLAG="SELECT",'$D(@SCPTSEL@(SCPTCNT)) D
148 . S @SCPTSEL@(SCPTCNT)=""
149 . S SCSELCNT=$S(SCSELCNT=SCALLCNT:SCALLCNT,1:SCSELCNT+1)
150 ;
151 S Y=$G(@VALMAR@(SCNT,0))
152 S Y=$$SETSTR^VALM1($S(FLAG="SELECT":"Yes",1:""),Y,8,3)
153 S @VALMAR@(SCNT,0)=Y
154 ;
155 ; -- need to do SCPTALL separately because of potential for differnt #'s
156 S Y=$G(@SCPTALL@(SCPTCNT,0))
157 S Y=$$SETSTR^VALM1($S(FLAG="SELECT":"Yes",1:""),Y,8,3)
158 S @SCPTALL@(SCPTCNT,0)=Y
159 Q
160 ;
161HELP ; -- help code
162 S X="?" D DISP^XQORM1 W !!
163 Q
164 ;
165EXIT ; -- exit code
166 D CLEAR^VALM1
167 K @VALMAR,SCSELCNT,SCVIEW,SCALLCNT,SCMSG
168 K @SCPTALL,@SCPTSEL,@SCPTINFO
169 K SCPTALL,SCPTSEL,SCPTINFO
170 Q
171 ;
172EXPND ; -- expand code
173 Q
174 ;
175ALL(SCACT) ; -- entry point for SCMC SELECT ALL & SCMC DESELECT ALL protocols
176 IF SCVIEW=SCACT D Q
177 . W !!,"All patients in current view are already '"_SCACT_"ED'."
178 . D PAUSE
179 . D BACK("")
180 . Q
181 D ACT(SCACT,SCPTALL)
182 Q
183 ;
184SOME(SCACT) ; -- entry point for SCMC SELECT SOME & SCMC DESELECT SOME protocols
185 IF SCVIEW=SCACT D Q
186 . W !!,"All patients in current view are already '"_SCACT_"ED'."
187 . D PAUSE
188 . D BACK("")
189 . Q
190 D EN^VALM2(XQORNOD(0),"O")
191 D ACT(SCACT,"VALMY")
192 Q
193 ;
194ACT(SCACT,SCLIST) ; -- change select flag
195 N SCNT
196 S SCNT=0
197 F S SCNT=$O(@SCLIST@(SCNT)) Q:'SCNT D SETSEL(SCACT,SCNT)
198 W !
199 D WAIT^DICD,BLD
200 Q
201 ;
202VIEW(SCVW) ; -- change view
203 S SCVIEW=SCVW
204 W !
205 D WAIT^DICD,BLD
206 Q
207 ;
208BACK(ACTION) ; -- return to lm processing
209 IF $G(SCMSG) D MSG
210 S VALMBCK=ACTION
211 Q
212 ;
213MSG ; -- set message var
214 S VALMSG="* Future date"
215 Q
216 ;
217DATE(SCDATE,SCDTE) ; -- setup date array
218 S SCDTE="SCDTE"
219 S SCDTE("BEGIN")=SCDATE
220 S SCDTE("END")=9999999
221 S SCDTE("INCL")=0
222 Q
223 ;
224PAUSE ; -- pause
225 N DIR,Y
226 S DIR(0)="EA"
227 S DIR("A")="Enter RETURN to continue:"
228 D ^DIR
229 Q
Note: See TracBrowser for help on using the repository browser.