source: WorldVistAEHR/trunk/r/PAID-PRS/PRSEEMP4.m@ 1147

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

initial load of WorldVistAEHR

File size: 8.1 KB
Line 
1PRSEEMP4 ;WIRMFO/JAH-STUDENT TRAINING REPORT BY SERVICE ;7/2/97
2 ;;4.0;PAID;**25**;Sep 21, 1995
3 ;
4 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5SORT(PRDA) ;
6 ;
7 ;PRDA = ptr 2 file 200 from PAID EMPLOYEE file, (new person field).
8 ;
9 I $E(IOST,1,2)="C-" S CLOCK=$$HUMDRUM^PRSLIB00(CLOCK,1)
10 ;
11 ;convert PRDA 2 name in file 200
12 S N1=$P($G(^VA(200,PRDA,0)),"^")
13 I N1="" D
14 .S N1="*"_EMPNAME,^TMP("EORM",$J,1)="* Names missing resolution from PAID EMPLOYEE file to the NEW PERSON file."
15 ;
16 ;create 0 node 4 everyone whether they have data or not
17 S ^TMP($J,SERVIEN,CCORG,EMPIEN,0)="0^^"_N1
18 S SSN=$P($G(^VA(200,+PRDA,1)),U,9)
19 I SSN="" S $P(^TMP($J,SERVIEN,CCORG,EMPIEN,0),"^",2)=0
20 Q:SSN=""
21 S PRDA(1)=+$O(^PRSPC("SSN",SSN,0))
22 ;
23 ;get job code & find it's readable 4mat.
24 S PRSETL=""
25 ;job code = piece 17 of emp record or = 0 if no code is found.
26 S JOBCODE=$S($P($G(^PRSPC(PRDA(1),0)),U,17)'="":$P($G(^(0)),U,17),1:0)
27 ;store job code & readable 4mat 4 later output
28 S PRSETL=$$EN12^PRSEUTL2(JOBCODE)
29 S $P(^TMP($J,SERVIEN,CCORG,EMPIEN,0),"^",2)=JOBCODE
30 I JOBCODE S ^TMP("JOBS",$J,JOBCODE)=PRSETL
31 ;
32 ;sort thru X-ref corresponding 2 training user asked 2 c.
33 ;
34 I PRSESEL="L" F PRSE="C","O","W" D SORT1(PRSE) ;all but mandatory
35 ;all but hospital wide OR all
36 I PRSESEL="H"!(PRSESEL="A") F PRSE="C","O","W","M" D SORT1(PRSE)
37 I PRSESEL'="A",PRSESEL'="L",PRSESEL'="H" D
38 . S PRSE=PRSESEL D SORT1(PRSE) ;single type
39 Q
40 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41HWLIST ;build list of classes that are hospital wide
42 ;
43 N SERV,MIIEN,CLSPTR,CLSMLT
44 ;VARIABLES
45 ; HWIDE() - RETURNED:
46 ; = Subscripted by name of the class. Value is entry #s.
47 ; SERV = service name in file 454.1
48 ; MIEN = IEN in Mandatory Training Group file
49 ; CLSPTR = Pointer to class file.
50 ; CLSMLT = IENs in mandatory class multiple.
51 ;
52 S MIEN=0
53 F S MIEN=$O(^PRSE(452.3,MIEN)) Q:MIEN'>0 D
54 . S SERV=$P($G(^PRSE(452.3,MIEN,0)),"^",2)
55 . I SERV'="",$P($G(^PRSP(454.1,SERV,0)),"^",1)="MISCELLANEOUS" D
56 .. S CLSMLT=0
57 .. F S CLSMLT=$O(^PRSE(452.3,MIEN,1,CLSMLT)) Q:CLSMLT'>0 D
58 ... S CLSPTR=$G(^PRSE(452.3,MIEN,1,CLSMLT,0))
59 ... I CLSPTR'="" S HWIDE(CLSPTR)=$P($G(^PRSE(452.1,CLSPTR,0)),"^",1)
60 Q
61 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62HASHLIST ;Reverse array list 4 faster hashing in sort routine.
63 ; i.e. change HWIDE(3)="DIVERSITY IN WP"... HWIDE("DIVERSITY IN WP")=3
64 ;
65 S NODE=""
66 F S NODE=$O(HWIDE(NODE)) Q:NODE'>0 D
67 . I HWIDE(NODE)'="" S HWIDE(HWIDE(NODE))=NODE
68 . K HWIDE(NODE)
69 Q
70 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71SORT1(PRSE) ;Loop thru training data in AA x-ref & sort in2 ^TMP
72 ;
73 ; VARIABLES
74 ; COUNT = # of classes, current type
75 ; CRS = Course Title
76 ; CURR = Current subtotl, all classes taken by employee
77 ; NCD = Regular FM date
78 ; NCD1 = Inverse FileMan date
79 ; PRDA = Employee's IEN in file 200. (built into AA x-ref)
80 ; PRSE = Type of training (mandatory, cont. educ)
81 ; PRSECLS(0) = Ien of course in the PROGRAM CLASS file
82 ; YRST,YREND = Start,end date range returned from DATSEL^PRSEUTL call.
83 ;
84 N CRS,COUNT,CURR S COUNT=0
85 ;
86 ;outer loop thru courses (CRS) of type PRSE taken by employee (PRDA)
87 S CRS=""
88 F S CRS=$O(^PRSE(452,"AA",PRSE,PRDA,CRS)) Q:CRS="" D
89 . Q:'$D(^PRSE(452,"AA",PRSE,PRDA,CRS))
90 .;
91 . ;screen out hospital wide classes if user selected "H"
92 . I PRSESEL="H",$G(HWIDE(CRS))'="" Q
93 .;
94 .; loop thru dates that student took this class
95 . F NCD1=0:0 S NCD1=$O(^PRSE(452,"AA",PRSE,PRDA,CRS,NCD1)) Q:NCD1'>0 D
96 ..; convert inverse FM date of class 2 FM date
97 .. S NCD=(9999999.0000-NCD1)
98 ..;
99 ..; get ien of the entry in the student education file.
100 .. S DA(2)=$O(^PRSE(452,"AA",PRSE,PRDA,CRS,NCD1,0))
101 .. Q:DA(2)'>0
102 .. S:$G(NSORT)="" NSORT=1
103 ..;
104 ..; quit if the class is outside selected date range
105 .. I (NCD>YREND)!(NCD<YRST) Q
106 ..;
107 .. N X
108 .. S PRDATA=$G(^PRSE(452,DA(2),0))
109 .. S X=$G(^TMP($J,SERVIEN,CCORG,EMPIEN,"L",CRS))
110 .. I X="" D
111 ... S X=NSORT,NSORT=NSORT+1
112 ... S ^TMP($J,SERVIEN,CCORG,EMPIEN,"L",CRS)=X
113 ..;
114 ..; get ien of course in the PROGRAM CLASS file
115 .. S PRSECLS(0)=+$O(^PRSE(452.1,"B",CRS,0))
116 ..;
117 ..;
118 .. S ^TMP($J,SERVIEN,CCORG,EMPIEN,"L1",X,N1,NCD,DA(2))=$S(+$G(PRSECLS(0))>0:$P($G(^PRSE(452.1,PRSECLS(0),0)),U,3),1:$P(PRDATA,U,16))_U_$P(PRDATA,U,6)_U_$P(PRDATA,U,10)_U_$P(PRDATA,U,21)
119 ..;
120 ..;incremnt employee 0 node. Check later 2 c if no training occured.
121 ..S COUNT=COUNT+1
122 ;
123 ;add class count to employees node
124 S CURR=$P(^TMP($J,SERVIEN,CCORG,EMPIEN,0),"^")
125 S $P(^TMP($J,SERVIEN,CCORG,EMPIEN,0),"^",1)=CURR+COUNT
126 Q
127 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
128 ;
129OUTPUT(PRDA,POUT,JOBCODE,EMPNAME) ;
130 ;routine loops thru tmp global, prints classes 4 1 employee.
131 N PRHLOC S POUT=0
132 ;
133 ;If class counter for employee is 0, write message and quit
134 I $P(^TMP($J,SERVIEN,CCORG,EMPIEN,0),"^",1)=0 D Q
135 . D NHDR^PRSEEMP4(JOBCODE,.POUT)
136 . W !,"NO DATA FOR EMPLOYEE: ",EMPNAME
137 . W:$G(PRSECLS)]"" !,"CLASS: ",PRSECLS
138 ;
139 D NHDR^PRSEEMP4(JOBCODE,.POUT)
140 ;
141 S NIC=""
142 F S NIC=$O(^TMP($J,SERVIEN,CCORG,EMPIEN,"L",NIC)) Q:NIC=""!POUT S NSORT=$G(^TMP($J,SERVIEN,CCORG,EMPIEN,"L",NIC)),HOLD=1 D:NSORT
143 .;
144 . S N1=""
145 . F S N1=$O(^TMP($J,SERVIEN,CCORG,EMPIEN,"L1",NSORT,N1)) Q:N1=""!POUT D
146 .. S NCD=""
147 .. F S NCD=$O(^TMP($J,SERVIEN,CCORG,EMPIEN,"L1",NSORT,N1,NCD)) Q:NCD=""!POUT D
148 ... S DA=$O(^TMP($J,SERVIEN,CCORG,EMPIEN,"L1",NSORT,N1,NCD,0))
149 ... Q:DA'>0
150 ... I ('(NSW1>0)!($Y>(IOSL-7))) D NHDR(JOBCODE,.POUT) Q:POUT
151 ... S PCOUNT=PCOUNT+1
152 ... S PRDATA=$G(^TMP($J,SERVIEN,CCORG,EMPIEN,"L1",NSORT,N1,NCD,DA))
153 ... S PHRS=(PHRS+$P(PRDATA,U))
154 ... I $P(PRDATA,U,4)="C" D
155 .... S PHRS("CEU")=(PHRS("CEU")+$P(PRDATA,U,2))
156 .... S PHRS("CON")=(PHRS("CON")+$P(PRDATA,U,3))
157 ... I HOLD=1 D
158 .... W !,$S(PRSE132:NIC,1:$E(NIC,1,25))
159 .... W:$P($G(^PRSE(452,DA,6)),U,2)'="" ?$S(PRSE132:55,1:27),$E($P(^(6),U,2),1,25)
160 .... W ?$S(PRSE132:93,1:47),"Length: "
161 .... W $S($P(PRDATA,U)>0:$J($P(PRDATA,U),4,2),1:"")
162 .... S HOLD=0
163 ... S Y=$E(NCD,1,7) D:+Y D^DIQ W ?$S(PRSE132:114,1:67),$P(Y,"@"),!
164 ... I $P(PRDATA,U,4)="C" W ?1,"CEUs: ",+$P(PRDATA,U,2),?$S(PRSE132:88,1:42),"Contact HRS: ",$J($P(PRDATA,U,3),4,2)
165 ... Q
166 . S HOLD=1 Q
167 ;
168 Q:POUT
169 W !,$$REPEAT^XLFSTR("-",$G(IOM))
170 ;
171 ;Output totals 4 1 employee.
172 W !,?1,"Total Classes: ",PCOUNT,?$S(PRSE132:78,1:35)
173 W "Total Length/Hours:",$J(PHRS,7,2)
174 ;
175 ;Display CEU totals if type of training sort criteria
176 ;contains CEU classes.
177 I CEU D
178 . W !,?4,"Total CEUs:",$J(PHRS("CEU"),6,2),?$S(PRSE132:77,1:34)
179 . W "Total Contact Hours:",$J(PHRS("CON"),7,2)
180 ;
181 W !,$$REPEAT^XLFSTR("-",$G(IOM))
182 ;
183 Q
184 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
185NHDR(JOBCODE,POUT) ;
186 ;
187 ; NPC = page counter.
188 ;
189 S POUT=0
190 N Z S Z=PRSESEL
191 ;start a new page and a full header.
192 I $E(IOST,1,2)="C-" S POUT=$$ASK^PRSLIB00() Q:POUT
193 W @IOF S NPC=NPC+1
194 S PTAB=IOM-9
195 W $S(Z="L":"ALL BUT MANDATORY",Z="H":"ALL BUT HOSPITAL WIDE MANDATORY",Z="C":"C.E.",Z="M":"M.I.",Z="O":"OTHER",Z="W":"WARD",1:"COMPLETE")
196 W " TRAINING REPORT FOR "
197 W $S(TYP="C":"CY ",TYP="F":"FY ",1:" ")
198 W $S(TYP="C"!(TYP="F"):$G(PYR),1:$G(YRST(1))_" - "_$G(YREND(1)))
199 W ?PTAB,"PAGE: ",NPC
200 W !
201 W "Service: ",$S(PRSE132:SERVICE,1:$E(SERVICE,1,16))
202 W " Cost Ctr./Org.: ",$E(CCORG,1,4),":",$E(CCORG,5,8)
203 S Y=REPDT D:+Y D^DIQ W ?(IOM-13),Y
204 ;
205 ;print employees name and title portion of header
206 W !,"Name: ",$S(PRSE132:EMPNAME,1:$E(EMPNAME,1,20))
207 W " Title: "
208 ;decipher job code from temporary table
209 S PRSETL=$G(^TMP("JOBS",$J,JOBCODE))
210 W $S(PRSETL="":"<Unknown>",1:$S(PRSE132:$E(PRSETL,1,40),1:$E(PRSETL,1,20)))
211 I PRSE132 D
212 .W !,"Class Name",?55,"Class Presenter",?114,"Date"
213 E D
214 .W !,"Class Name",?30,"Class Presenter",?67,"Date"
215 S NI="",$P(NI,"-",$S(PRSE132:133,1:81))=""
216 W !,NI
217 Q:$O(^TMP($J,SERVIEN,CCORG,EMPIEN,"L",""))=""
218 S (HOLD,NSW1)=1
219 Q
220 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
221EXIT K ^TMP($J),^TMP("JOBS",$J),^TMP("EORM",$J) D CLOSE^PRSEUTL,^PRSEKILL
222 Q
223 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the repository browser.