source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCMCCV3.m@ 1739

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

initial load of WorldVistAEHR

File size: 5.5 KB
RevLine 
[613]1SCMCCV3 ;bp/cmf - 195 Test/177 File - 404.57 preceptors to 404.53 ; Sep 1999
2 ;;5.3;Scheduling;**195,177**;AUG 13, 1993
3 ;
4 Q
5 ;
6ENXPD D EN(1) Q
7 ;
8ENPRE D EN(0) Q
9 ;
10EN(SCF) ;input = 1: Postinit(file)
11 ; = 0: PrePatch(validate)
12 ;
13 N SCY,SCI,SCTM,SCTP,SCREASON,SCZSTOP
14 K ^TMP("SCMC",$J)
15 S SCI=1
16 D BLDI("")
17 D BLDI($S(SCF:$$S(1),1:$$S(3)))
18 D BLDI($$DTU())
19 D BLDI($S(SCF:$$S(2),1:$$S(4)))
20 D BLDI("")
21 I SCF D I 'SCREASON D BLD($$S(16)) G MAIL
22 . S SCREASON=+$$FIND1^DIC(403.44,"","X","ACTIVATE PRECEPTOR LINK")
23 . Q
24 ;
25LOOP S SCZSTOP=0
26 S SCTMNM=""
27 F S SCTMNM=$O(^SCTM(404.51,"B",SCTMNM)) Q:(SCTMNM="")!(SCZSTOP) D
28 . S SCZSTOP=$S($$S^%ZTLOAD:1,1:0)
29 . Q:SCZSTOP
30 . S SCTM=$O(^SCTM(404.51,"B",SCTMNM,0))
31 . Q:'+$$ACTTM^SCMCTMU(SCTM) ;team inactive
32 . Q:'$D(^SCTM(404.57,"C",SCTM)) ;no team positions
33 . S SCTM(0)=1
34 . S SCTP=0 ;team position ien
35 . F S SCTP=$O(^SCTM(404.57,"C",SCTM,SCTP)) Q:('SCTP)!(SCZSTOP) D
36 . . S SCZSTOP=$S($$S^%ZTLOAD:1,1:0)
37 . . Q:SCZSTOP
38 . . S SCTP0=^SCTM(404.57,SCTP,0) ;team position node
39 . . Q:'+$P(SCTP0,U,10) ;no preceptor entry
40 . . S SCTPNM=$P(SCTP0,U)
41 . . S SCTP(0)=1
42 . . Q:$$AS(SCTP,SCTPNM,25) ;already seeded
43 . . Q:'+$$ACTTP(SCTP) ;not active
44 . . S SCTPFLAG=0
45 . . D SCII
46 . . I +$P(SCTP0,U,12) D SCY(6,SCTPNM,8) Q:$$SCF()
47 . . S SCTPP=+$P(SCTP0,U,10) ;preceptor team position ien
48 . . I SCTPP=SCTP D SCY(6,SCTPNM,9) Q:$$SCF()
49 . . I '+$$GETPRTP(SCTP) D SCY(6,SCTPNM,15) Q:$$SCF()
50 . . S SCTPP0=^SCTM(404.57,SCTPP,0) ;preceptor team position node
51 . . S SCTPPNM=$P(SCTPP0,U)
52 . . I (+$P(SCTP0,U,4))&('+$P(SCTPP0,U,4)) D SCY(7,SCTPPNM,10) Q:$$SCF()
53 . . I $P(SCTP0,U,2)'=$P(SCTPP0,U,2) D SCY(7,SCTPPNM,11) Q:$$SCF()
54 . . I '+$$ACTTP(SCTPP) D SCY(7,SCTPPNM,12) Q:$$SCF()
55 . . I +$P(SCTPP0,U,10) D SCY(7,SCTPPNM,13) Q:$$SCF()
56 . . Q:$$AS(SCTPP,SCTPPNM,13)
57 . . I '+$P(SCTPP0,U,12) D SCY(7,SCTPPNM,14) Q:$$SCF()
58 . . I '+$$GETPRTP(SCTPP) D SCY(7,SCTPPNM,15) Q:$$SCF()
59 . . I 'SCF D Q
60 . . . I 'SCTPFLAG D SCY(6,$$LINK(),17)
61 . . . Q
62 . . K SCFDA,SCERR
63 . . S SCFDA(1,404.53,"+1,",.01)=SCTP
64 . . S SCFDA(1,404.53,"+1,",.02)=DT
65 . . S SCFDA(1,404.53,"+1,",.04)=1
66 . . S SCFDA(1,404.53,"+1,",.05)=SCREASON
67 . . S SCFDA(1,404.53,"+1,",.06)=SCTPP
68 . . D UPDATE^DIE("","SCFDA(1)","","SCERR")
69 . . I $D(SCERR) D SCY(7,$$LINK(),18)
70 . . E D SCY(7,$$LINK(),19)
71 . . Q
72 . Q
73 I SCZSTOP D BLDI(0),BLD(26)
74 ;
75MAIL N XMY,XMDUZ,XMSUB,XMTEXT
76 S XMDUZ=.5
77 S (XMY(DUZ),XMY(XMDUZ))=""
78 S XMSUB=$S(SCF=1:$$S(22),1:$$S(24))
79 S XMTEXT="^TMP(""SCMC"",$J,"
80 D ^XMD
81 K ^TMP("SCMC",$J)
82 Q
83 ;
84SCF() I +SCF Q 1
85 S SCTPFLAG=1 Q 0
86 ;
87ACTTP(SCTP) Q $$ACTTP^SCMCTPU(SCTP)
88 ;
89GETPRTP(SCTP) Q $$GETPRTP^SCAPMCU2(SCTP,DT)
90 ;
91LINK() Q SCTPNM_"|"_SCTPPNM
92 ;
93AS(SC1,SC2,SC3) ; test for existing entry on filing
94 ; input SC1 := tm pos ien
95 ; SC2 := tm pos name
96 ; SC3 := line reference
97 I 'SCF Q 0
98 I $D(^SCTM(404.53,"B",SC1)) D SCY($S(SC3=13:7,1:6),SC2,SC3) Q 1
99 Q 0
100 ;
101SCY(SC1,SC2,SC3) ;build msg array
102 ; input SC1=line reference or text string
103 ; SC2=name string
104 ; SC3=line reference or text string
105 ;
106 D SCII
107 ;I SC1=6,SCTM(0) D
108 I SCTM(0) D
109 . S SCTM(0)=0
110 . D BLDI("")
111 . D BLDI($$S(5)_SCTMNM)
112 . Q
113 I SC1=7,SCTP(0) D
114 . S SCTP(0)=0
115 . D BLDI($$S(6)_SCTPNM)
116 D BLD($S(+SC1:$$S(SC1),1:SC1)_SC2_$S(+SC3:$$S(SC3),1:SC3))
117 Q
118 ;
119BLDI(SCX) ; input = text string
120 D BLD(SCX)
121 D SCII
122 Q
123 ;
124BLD(SCX) ; input = text string
125 S ^TMP("SCMC",$J,SCI)=SCX
126 Q
127 ;
128SCII S SCI=SCI+1
129 Q
130 ;
131W(SCX) ;input = 1:177 KIDS post-init, 0:177 pre-patch
132 ;output = 1:KIDS record , 0:selected device
133 I SCX=21 D MES^XPDUTL(.SCY) Q
134 D EN^DDIOL(.SCY)
135 Q
136 ;
137DTU() N SCDTU200,SCDTU,SCDTUX
138 S SCDTU200=$G(DUZ,.5)
139 S SCDTUX=$$NEWPERSN^SCMCGU(SCDTU200,"SCDTU")
140 S SCDTUX=$S(SCDTUX>0:$P(SCDTU(SCDTU200),U),1:0)
141 Q $$FMTE^XLFDT($$NOW^XLFDT)_" (by: "_SCDTUX_")"
142 ;
143ENMAIN(SCX) ;
144 ; input = 21: sd*5.3*177 preceptor filer post init
145 ; = 23: sd*5.3*195 preceptor tester option
146 K SCY
147 S SCY(1)=""
148 S SCY(2)=$S(SCX=21:$$S(1),1:$$S(3))
149 S SCY(3)=$$DTU()
150 S SCY(4)=$S(SCX=21:$$S(2),1:$$S(4))
151 S SCY(5)=$$Q(SCX)
152 K ZTSK
153 S SCY(6)=""
154 D W(SCX)
155 Q
156 ;
157Q(SCX) ; run job in background
158 ; input = line reference
159 ; output = task #, report via mailman
160 N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSAVE
161 S ZTRTN=$S(SCX=21:$$S(21),1:$$S(23))
162 S ZTDESC=$S(SCX=21:$$S(22),1:$$S(24))
163 S ZTDTH=$H
164 S ZTIO=""
165 D ^%ZTLOAD
166 Q $S(+ZTSK:": Queued - Task# "_ZTSK,1:": Not Queued!")
167 ;
168S(SCX) ;input = line reference
169 ;output = text string
170 Q $P($T(T+SCX),";;",2)
171 ;
172T ;;
1731 ;;Move current preceptor assignments to Preceptor History file;;
174 ;;------------------------------------------------------------;;
175 ;;Validate preceptor assignments vs Preceptor History requirements;;
176 ;;----------------------------------------------------------------;;
1775 ;;--> Team: ;;
178 ;; --> Position: ;;
179 ;; --> Preceptor: ;;
180 ;;: 'Can Act As Preceptor' field must be 'NO'.;;
181 ;;: cannot precept itself.;;
18210 ;;: Preceptor must be PC if position is PC.;;
183 ;;: Preceptor must be on same team.;;
184 ;;: Preceptor must be active.;;
185 ;;: cannot have a preceptor.;;
186 ;;: 'Can Act As Preceptor' field must be 'YES'.;;
18715 ;;: must have Staff Assigned.;;
188 ;;Scheduling Reason file not updated... Process stopped... ;;
189 ;;: Preceptor Link OK.;;
190 ;;: Preceptor Link not filed << filer error >>.;;
191 ;;: Preceptor Link filed.;;
19220 ;;: No Preceptor Assignments.;;
193 ;;ENXPD^SCMCCV3;;
194 ;;PCMM Preceptor Migration Filer;;
195 ;;ENPRE^SCMCCV3;;
196 ;;PCMM Preceptor Migration Report;;
19725 ;; Link Already Seeded, filer stopped.;;
198 ;; << Background job stopped by request. >>;;
199 ;
Note: See TracBrowser for help on using the repository browser.