source: FOIAVistA/tag/r/PAID-PRS/PRS8PP.m@ 1495

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

WorldVistAEHR overlayed on FOIAVistA

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