source: FOIAVistA/trunk/r/PAID-PRS/PRS8PP.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 9.1 KB
Line 
1PRS8PP ;HISC/MRL,WIRMFO/MGD-DECOMP, PREMIUM PAYS ;05/10/07
2 ;;4.0;PAID;**22,40,75,92,96,112**;Sep 21, 1995;Build 54
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 ;This routine is the entry point for determining certain premium
6 ;pays for an employee. Included are overtime (OT),
7 ;night differential (ND), unscheduled hours (UH), etc.
8 ;
9 ;Called by Routines: PRS8ST
10 ;
11 S D=DAY(DAY,"W") ; Daily activity string.
12 S W=$S(DAY<8:1,1:2) ; Week.
13 I D?1"0"."0" Q ; No activity this date.
14 S NDC=1,(HT,HTP,HTFFOT)=0 ; Counter for hrs worked this
15 ; day (HT=Hours total).
16 N HYBRID ; HYBRID under P.L 107-135
17 S HYBRID=$$HYBRID^PRSAENT1($G(DFN))
18 D ^PRS8HR ; calculate Norm hrs first
19 F M=1:1:96 S VAL=$E(D,M) I VAL'=0 D ;loop thru minutes of day
20 .S DH=DAY(DAY,"DH1")
21 .I TWO,M'<+$P(DAY(DAY,"TWO"),"^",2) S DH=DAY(DAY,"DH2") ; Daily hrs.
22 .I NDC,"CWB"'[VAL D ND ; Get ND.
23 .I TYP["B",+VAL Q ; Baylor get no premium during tod.
24 .I "1234OosEe"'[VAL Q ; Don't chk for non-work status.
25 .S X=$E(D,M,96) ; Remainder of day.
26 .I X?1N.N,X'[4 Q ; No hrs left other than normal.
27 .I "J123MLSWNARXYOFGD"'[VAL!(VAL="O"&($E(DAY(DAY,"HOL"),M)'=2)) S AV="OosEe" D CALC^PRS8HR
28 K AV,D,GO,M,NDC,X,X1,J1,J2 Q
29 ;
30ND ; --- compute ND
31 ; Process wagegrade
32 I TYP["W" D Q
33 . ; process WG scheduled time
34 . I "J23LSARMXYUVFGD"[VAL!(VAL="O"&($E(DAY(DAY,"HOL"),M)=2)) D
35 . . N DAT,DAYN,FND,M1,NODE,SC,TS
36 . . ; find tour segment that contains the time and get it's special code
37 . . S FND=0,SC="" ; FND true if found in schedule, SC = special code
38 . . ; look in schedule of current day for M and previous day for M+96
39 . . ; (in 2day tour, previous day's schedules >96 are Today's activity)
40 . . F DAYN=DAY,DAY-1 D Q:FND
41 . . . S M1=$S(DAYN=DAY:M,1:M+96)
42 . . . ; loop thru both tours in day
43 . . . F NODE=1,4 S DAT=$G(^TMP($J,"PRS8",DAYN,NODE)) Q:DAT="" D Q:FND
44 . . . . ; loop thru tour segments in tour
45 . . . . F TS=1:1:7 Q:$P(DAT,U,(TS-1)*3+1)="" D Q:FND
46 . . . . . ; check if time contained in tour segment
47 . . . . . I M1'<$P(DAT,U,(TS-1)*3+1),M1'>$P(DAT,U,(TS-1)*3+2) S FND=1,SC=$P(DAT,U,(TS-1)*3+3)
48 . . ;
49 . . ; if time not found in any schedule, base SC on value of variable
50 . . ; TOUR for Today (or previous day when no scheduled tour Today).
51 . . I 'FND S SC=$S($G(^TMP($J,"PRS8",DAY,1))=""&(DAY(DAY-1,"TOUR")>1):DAY(DAY-1,"TOUR")+4,1:TOUR+4)
52 . . Q:"^6^7^"'[(U_SC_U) ; tour segment not coded for shift 2 or 3
53 . . S X=(SC-4)+8 ; determine where to store in WK array
54 . . I $E(ENT,X-4) D SET ; if employee entitled then store result
55 . ;
56 . ; process WG unscheduled time
57 . I VAL=4!(VAL="O") D
58 . . N T,SD
59 . . ; unscheduled regular tours for 'shift coverage' that are eligible
60 . . ; for shift 2 or 3 differential were saved in "SD" by PRS8EX.
61 . . S SD=$G(^TMP($J,"PRS8",DAY,"SD"))
62 . . Q:SD=""
63 . . ; see if time belongs to a tour saved in "SD" and if so use the
64 . . ; associated shift (2 or 3)
65 . . S SD(1)=0 ; init shift
66 . . F T=1:3 S SD(0)=$P(SD,U,T,T+2) Q:SD(0)=""!(SD(0)?1."^") D Q:SD(1)
67 . . . I M'<+SD(0),M'>$P(SD(0),"^",2) S SD(1)=$P(SD(0),"^",3)
68 . . I SD(1) S X=SD(1)+8 I $E(ENT,X-4) D SET
69 ;
70 ; Process Other Employees (non-Wage Grade)
71 ;
72 ; Not entitled to ND
73 I '$E(ENT,6) Q
74 ;
75 ; not entitled to ND if No Premium Pay tour
76 I $P(DAY(DAY,1),"^",3)=8 Q
77 ;
78 ; check if time segment could be eligible for ND
79 I $$NOTND(TYP,DAY,M) Q
80 ;
81 S AV="J1234ALSRMUEOosecbVXYFGD"
82 ;
83 ; Grant ND for time before 6a/after 6p or anytime when nurse/hybrid
84 ; works tour coverage
85 I M<25!(M>72)!($E(DAY(DAY,"P"),M)="N"&(TYP["N"!(TYP["H")!(HYBRID))),AV[VAL D
86 . ; The Hybrids defined in Public Law 107-135 will only receive Night
87 . ; Differential time for OT and CT worked between 6 p.m. and 6 a.m.
88 . Q:HYBRID!(PMP'=""&("^S^T^U^V^"[(U_PMP_U)))&(M'<25&(M'>72))
89 . ; Tour time between 6 p.m. and 6 a.m. counts toward ND
90 . N DAT,DAYN,FND,M1,NODE,SC,TS,TOT
91 . ; find tour segment that contains the time and get it's special code
92 . S FND=0,SC="" ; FND true if found in schedule, SC = special code
93 . S TOT="" ; Type Of Time
94 . ; look in schedule of current day for M and previous day for M+96
95 . ; (in 2day tour, previous day's schedules >96 are Today's activity)
96 . F DAYN=DAY,DAY-1 D Q:FND
97 . . S M1=$S(DAYN=DAY:M,1:M+96)
98 . . S DAT=$G(^TMP($J,"PRS8",DAYN,2)) D Q:FND
99 . . . ; loop thru tour segments in exceptions
100 . . . F TS=1:1:7 Q:$P(DAT,U,(TS-1)*4+1)="" D Q:FND
101 . . . . ; check if time contained in exception segment
102 . . . . I M1'<$P(DAT,U,(TS-1)*4+1),M1'>$P(DAT,U,(TS-1)*4+2) D
103 . . . . . S TOT=$P(DAT,U,(TS-1)*4+3)
104 . . . . . ; On-Call and Recess are the only types of exceptions
105 . . . . . ; where OT, CT and RG can be posted for the same 15 minute
106 . . . . . ; segment of time, so don't stop searching if you find these.
107 . . . . . I TOT="ON"!(TOT="RS") S TOT="" Q
108 . . . . . S FND=1,SC=$P(DAT,U,(TS-1)*4+4)
109 . . . . . Q
110 . Q:TOT="OT"&("^11^12^17^"'[(U_SC_U)) ; Pre-Scheduled & Tour Coverage & OT/CT With Premiums
111 . Q:TOT="CT"&("^12^17^"'[(U_SC_U)) ; Tour Coverage & OT/CT With Premiums
112 . ; Code 17 - OT/CT with premiums only get ND for 6p-6a
113 . Q:TOT="OT"!(TOT="CT")!(TOT="RG")&(SC=17)&((M'<25)&(M'>72))
114 . Q:TOT="RG"&(SC'=7)&(SC'=17) ; Shift Coverage & OT/CT With Premiums
115 . S X=10
116 . ; for 36/40 AWS, premium time resulting from their tour
117 . ; will be mapped to Night Differential-AWS (ND/NU) and
118 . ; Paid at the AAC with the 1872 divisor for the hourly rate (36*52)
119 . I +NAWS=36,("OEc"'[VAL!(TOT="HW")) S X=51
120 . D SET
121 . ; keep leave count since it may need to be backed out by PRS8MSC0
122 . I "LSRUFGD"[VAL S WKL(WK)=WKL(WK)+1
123 ;
124 ; Nurse can get ND for 6a-6p time when part of tour with 4+ hrs in 6p-6a
125 ; check is made when M=24 (just before 6am) or M=73 (just after 6pm).
126 ; if tour eligible (4+ hours in 'night' time) then ND is granted for
127 ; the portion of the tour that falls within the 'day' time.
128 I TYP["N"!(TYP["H"),M=73!(M=24),AV_"m"[VAL D
129 . N C,J,Q,X,X1,X2,XD
130 . ;
131 . ; quit if 'day' time is for tour coverage since already counted
132 . I $E(DAY(DAY,"P"),$S(M=73:72,1:25))="N" Q
133 . ;
134 . ; first check if tour has at least 4 hours of 'night' (6pm-6am) time
135 . S XD=$S(M=24:-1,1:1) ; loop direction, [6am back, 6pm forward]
136 . S X1=M,X2=X1+(XD*15) ; start and stop of 4 hour range
137 . ; loop thru tour 'night' time - stop if tour ends or after 4 hours
138 . S C=1 ; init flag, false when tour has less than 4 hours of 'night'
139 . F J=X1:XD:X2 D Q:'C
140 . . I AV_"m"'[$E(D,J) S C=0 Q ; inappropriate type of time
141 . . I $$NOTND(TYP,DAY,J) S C=0 Q
142 . . ; scheduled TOD considered as separate from covered TOD
143 . . I $E(DAY(DAY,"P"),M)'=$E(DAY(DAY,"P"),J) S C=0 Q
144 . ;
145 . Q:'C ; tour not eligible (less than 4 hours of 'night')
146 . ;
147 . ; loop thru day time (6am-6pm) portion of tour and grant ND
148 . ; don't pay ND for meal-time (m) but continue loop
149 . S XD=$S(M=24:1,1:-1) ; loop direction [6am forward, 6pm back]
150 . S X1=M+XD,X2=X1+(47*XD) ; start and stop for day time (12 hours)
151 . S Q=0 ; init flag, true when end of tour reached
152 . F J=X1:XD:X2 D Q:Q
153 . . I AV_"m"'[$E(D,J) S Q=1 Q ; inappropriate time
154 . . I $$NOTND(TYP,DAY,J) S Q=1 Q
155 . . ; scheduled TOD considered as separate from covered TOD
156 . . I $E(DAY(DAY,"P"),M)'=$E(DAY(DAY,"P"),J) S Q=1 Q
157 . . ; grant ND (unless meal-time, etc.), keep count of leave since it
158 . . ; may need to be backed out by PRS8MSC0
159 . . I AV[$E(D,J) D
160 . . . S X=10
161 . . . ; For 36/46 AWS nurses ND for Holiday Worked (HA/HL) and normal
162 . . . ; tour time will be reported as Night Differential-AWS (ND/NU)
163 . . . I +NAWS=36 D
164 . . . . I $E(DAY(DAY,"HOL"),J)=2 S X=51 Q ; Holiday Worked
165 . . . . I "OEc"'[VAL S X=51 ; Tour time
166 . . . D SET
167 . . . S:"LSRUFGD"[$E(D,J) WKL(WK)=WKL(WK)+1
168 ;
169 Q
170 ;
171SETJ ; --- set week node (J variable defined)
172 Q:$E(D,J)="m"
173 ;
174SET ; --- actually set the piece
175 S $P(WK(WK),"^",X)=$P(WK(WK),"^",X)+1
176 Q
177 ;
178NOTND(PRSTY,PRSDY,PRSTM) ; Not Eligible Night Differential
179 ; in PRSTY type of employee
180 ; PRSDY day (1-14)
181 ; PRSTM time segment (1-96)
182 ; returns 0 or 1 (True when not eligible for ND)
183 ;
184 N VAL
185 S VAL=$E(DAY(PRSDY,"W"),PRSTM)
186 ;
187 ; not entitled to ND
188 I ($E(DAY(PRSDY,"P"),PRSTM)=5) Q 1
189 ;
190 ; OT on non-premium T&L
191 I "EOosecb"[VAL,$E(DAY(PRSDY,"P"),PRSTM),VAL'="O"!(VAL="O"&($E(DAY(PRSDY,"HOL"),PRSTM)'=2)) Q 1
192 ;
193 ; Nurses do not get ND for OT that is not for ND Tour Coverage
194 I "Ecb"[VAL!(VAL="O"&'$E(DAY(PRSDY,"HOL"),PRSTM)),PRSTY["N"!(PRSTY["H")!(HYBRID)!("^S^T^U^V^"[(U_PMP_U)),$E(DAY(PRSDY,"P"),PRSTM)'="N" Q 1
195 ;
196 ; Baylor gets no ND for work time on regularly scheduled day
197 I TYP["B","^1^7^8^14^"[("^"_DAY_"^"),"1234ALSRMUNVXYFGD"[VAL Q 1
198 ;
199 ; GS Employees do not get ND for OT that is not Pre-Scheduled
200 I "Ecb"[VAL!(VAL="O"&'$E(DAY(PRSDY,"HOL"),PRSTM)),PRSTY'["N",PRSTY'["H",'HYBRID,("^S^T^U^V^"'[(U_PMP_U)),$E(DAY(PRSDY,"P"),PRSTM)'="n" Q 1
201 ;
202 ; Unsch Reg time needs to be Pre-scheduled to get ND
203 I VAL=4,PRSTY["P"!(PRSTY["I"&(PRSTY["N"!(PRSTY["H"))),"Nn"'[$E(DAY(PRSDY,"P"),PRSTM) Q 1
204 Q 0 ; did not fail any of the checks
Note: See TracBrowser for help on using the repository browser.