- PRS8OC ;HISC/MGD-DECOMPOSITION, ON-CALL ;02/27/07
- ;;4.0;PAID;**63,92,112,117**;Sep 21, 1995;Build 32
- ;;Per VHA Directive 2004-038, this routine should not be modified.
- ;
- ;The following MUMPS code is used to credit the appropriate
- ;categories on the timecard for work performed while On-Call.
- ;All hours during which an individual is identified as being
- ;On-Call are credited to blocks YD and YH (On Call Hrs) on
- ;the timecard. Hours during an On-Call episode where an
- ;individual is actually called in to perform work are credited
- ;to blocks YA and YE (Sch CB OT) as appropriate. This credit
- ;is given under the 2-hour minimum rule. When OT work is
- ;performed during On-Call the actual On-Call Hours reported
- ;are reduced by the ACTUAL number of hours worked (not by the
- ;2-hour minimum).
- ;
- ;Called by Routines: PRS8ST
- ;
- ;C = On-Call
- ;c = OT during OC
- ;t = CT during OC
- ;
- S (I,D)=$S(T'>96:DAY,1:(DAY+1))
- S OC=$G(OC),OC(DAY)=$G(OC(DAY)),OC(DAY+1)=$G(OC(DAY+1)) ;oc variables
- S CC=$G(CC),CC(DAY)=$G(CC(DAY)),CC(DAY+1)=$G(CC(DAY+1)) ;CT on OC count
- S Y=35,Y(1)=1 D SET
- I VAR1="C" D:OC!(CC) OCS ;on-call episode (ot OR ct)
- S:"ct"[VAR1 OC=OC+1,OC(D)=OC(D)+1 S:VAR1="t" CC=CC+1,CC(D)=CC(D)+1
- I "ct"[VAR1,DAY>0,DAY<15 S CBCK(WK)=CBCK(WK)+1 ;count actual CB hrs
- Q:'OK!('$D(OC))
- I OC S Y=23 D OCS ;get rest of them
- K OC,CC,Y,D Q
- ;
- OCS ; --- set On-Call minimum hours
- ;set YA/YE for PPI="W" or "V" else set OT
- I +NAWS=0 S Y=$S(CC:7,'DOUB:TOUR+19,1:23)
- I +NAWS S Y=$S(CC:7,1:TOUR+19)
- ;
- N X,Z,DD,TT,CCCNT,NEXTT,OCCNT,TIMECNT
- S TT=$S(T>96:T-96,1:T),TIMECNT=0
- S X=$E(DAY($S(T>96:DAY+1,1:DAY),"W"),TT)
- ;
- ; If the current segment is the last of the On-Call OR the last of
- ; the On-Call Callback and the next time segment is Unavailable ("-")
- ; or not a type of work ("0") check to see if OT/reg sched is prior
- ; to on call worked.
- ;
- S NEXTT=$S(T+1>96:T-95,1:TT+1) ; Next time segment
- I "C"[X!(("ct"[X)&("-0"[$E($S(T+1>96:DAY(DAY+1,"W"),1:DAY(DAY,"W")),NEXTT))) D
- .K XH S X=0 F Z=1:1:8-(OC(DAY)+$G(OC(DAY+1))) D Q:"01"[X
- ..S DD=OC(DAY)+OC(DAY+1)+Z
- ..I TT-DD>0 S X=$E(DAY(DAY,"W"),TT-DD) S:X="O"&($E(DAY(DAY,"HOL"),TT-DD)=2) X="h"
- ..E S X=$E(DAY(DAY-1,"W"),96+T-DD) S:X="O"&($E(DAY(DAY-1,"HOL"),96+T-DD)=2) X="h"
- ..I "123nHMLSWNARXYFGDUZq"[X S X=1 Q ; on call abuts a reg sched TOD.
- ..E I "EOhoscteQ"[X D ; on call abuts time worked outside posted TOD.
- ...I "ct"'[X S TIMECNT=TIMECNT+1 ; Time already counted in WK().
- ...S XH=$S(X'="h":0,1:1),X=2
- ..E S X=0
- ..Q
- .Q
- E D ; Check to see if OT/reg sched is after on call worked
- .K XH S X=0 F Z=1:1:8-(OC(DAY)+$G(OC(DAY+1))) D Q:"01"[X
- ..S DD=OC(DAY)+OC(DAY+1)+Z
- ..I T+Z'>96 S X=$E(DAY(DAY,"W"),T+Z) S:X="O"&($E(DAY(DAY,"HOL"),T+Z)=2) X="h"
- ..E S X=$E(DAY(DAY+1,"W"),T-96+Z) S:X="O"&($E(DAY(DAY+1,"HOL"),T-96+Z)=2) X="h"
- ..I "123nHMLSWNARXYFGDUZq"[X S X=1 Q ; on call abuts a reg sched TOD.
- ..E I "EOhoscteQ"[X D
- ...I "ct"'[X S TIMECNT=TIMECNT+1 ; Time already counted in WK().
- ...S XH=$S(X'="h":0,1:1),X=2
- ..E S X=0
- ..Q
- .Q
- I $G(XH)'="" S:XH=1!'X Z=Z-1,X=2
- ;
- ; Check if Scheduled Call-Back OT crosses Midnight
- ;
- I '$D(CRSMID(D)),$E(DAY(DAY,"W"),1)="c",$E(DAY(DAY-1,"W"),96)="c" S FG=0 D Q:FG=1
- .S CRSMID(D)=1
- .I OC<7 D Q:FG=1
- ..; crosses midnight, check if its <2 hours, CRSMID variable set to
- ..; only do on segment that cross mid, not others
- ..S CNTR=0 F CX=1:1:8-OC S:$E(DAY(DAY-1,"W"),97-CX)="c" CNTR=CNTR+1
- ..I OC+CNTR'>8 D
- ...S Y(1)=$S(X=1:OC,1:8-CNTR)
- ...I +NAWS=0 D CHOL ; Process everyone but AWS nurses
- ...I +NAWS D CHOL1 ; Process AWS nurses
- ...S (OC,OC(D),CC,CC(D))=0,FG=1
- ..Q
- ;
- ; Check if Comp Time crosses Midnight
- ;
- I '$D(CRSMID(D)),$E(DAY(DAY,"W"),1)="t",$E(DAY(DAY-1,"W"),96)="t" S FG=0 D Q:FG=1
- .S CRSMID(D)=1
- .I OC<7 D Q:FG=1
- ..; crosses midnight, check if its <2 hours, CRSMID variable set to
- ..; only do on segment that cross mid, not others
- ..S CNTR=0 F CX=1:1:8-OC S:$E(DAY(DAY-1,"W"),97-CX)="t" CNTR=CNTR+1
- ..I OC+CNTR'>8 D
- ...S Y(1)=$S(X=1:OC,1:8-CNTR)
- ...I +NAWS=0 D CHOL ; Process everyone but AWS nurses
- ...I +NAWS D CHOL1 ; Process AWS nurses
- ...S (OC,OC(D),CC,CC(D))=0,FG=1
- ..Q
- ;
- I CC>0,CC<OC D ;SPLIT SEGMENT, MUST DO TWICE (FOR CT THEN FOR OT)
- .F I=DAY:1:(DAY+1) I OC(I) D
- ..S (OCCNT,CCCNT)=0
- ..I X=2,OC(I)+TIMECNT<8 D ; Add time if 2 hour minimum was not met.
- ...S TIMECNT=8-OC(I)-TIMECNT ; Amount of time short of the 2 hour min.
- ...;
- ...; If TIMECNT is an even number divide needed time equally among the
- ...; CT and OT.
- ...I TIMECNT#2=0 S CCCNT=TIMECNT/2,OCCNT=TIMECNT/2
- ...;
- ...; If TIMECNT is not an even number divide the time needed as equally
- ...; as possible among the CT and OT w/ remaining 15 minutes going to OC.
- ...I TIMECNT#2=1 S CCCNT=TIMECNT\2,OCCNT=(TIMECNT\2)+1
- ...;
- ..S Y(1)=$S(X=2:CC(I)+CCCNT,X:CC(I),OC(I)>7:CC(I),1:4),Y=7
- ..I +NAWS=0 D CHOL ; Process everyone but AWS nurses
- ..I +NAWS D CHOL1 ; Process AWS nurses
- ..S Y(1)=$S(X=2:OC(I)-CC(I)+OCCNT,X:OC(I)-CC(I),OC(I)>7:OC(I)-CC(I),1:4)
- ..S Y=$S('DOUB:TOUR+19,1:23)
- ..I +NAWS=0 D CHOL ; Process everyone but AWS nurses
- ..I +NAWS D CHOL1 ; Process AWS nurses
- ..Q
- .Q
- E D ;NOT SPLIT SEGMENT
- .F I=DAY:1:(DAY+1) I OC(I) D
- ..I OC(I)<8,X=2 D
- ...I T'=96 S OC(I)=8-TIMECNT
- ...I T=96,"ct"'[$E(DAY(DAY+1,"W"),1) S OC(I)=8-TIMECNT
- ..S Y(1)=$S(X:OC(I),OC(I)>7:OC(I),1:8)
- ..I +NAWS=0 D CHOL ; Process everyone but AWS nurses
- ..I +NAWS D CHOL1 ; Process AWS nurses
- ..Q
- .Q
- K OC,CC Q
- ;
- CHOL ; --- Check for Holiday Callback
- S TMP=Y,Y=0
- ; Don't convert Overtime to Comptime
- I TMP'=7,$E(ENT,25),$$HOLIDAY^PRS8UT(PY,DFN,+D) S Y=24 ;ot on actual hol
- I 'Y,$E($G(DAY(I,"HOL")),$S(T>96:(T-96),1:T)) S Y=TOUR+28 ;holiday callback
- I 'Y S Y=TMP
- D SET S Y=$S(CC:7,'DOUB:TOUR+19,1:23)
- Q
- ;
- SET ; --- set WK array
- S W=$S(I<8:1,1:2)
- I I<1!(I>14) Q
- I Y(1)>32,'DOUB,$P(C0,"^",12)="N",Y'=7 D
- .S $P(WK(W),"^",TOUR+15)=$P(WK(W),"^",TOUR+15)+(Y(1)-32)
- .S $P(WK(W),"^",Y)=$P(WK(W),"^",Y)+32 ;if FLSA=N set >8 = DA
- E S $P(WK(W),"^",Y)=$P(WK(W),"^",Y)+Y(1)
- Q
- ;
- CHOL1 ; Checks for AWS nurses
- N HT,J,K,T2ADD
- S K=0,TMP=Y,Y=0
- S T2ADD=$S(CC:Y(1)-CC,1:Y(1)-OC-CC)
- ; Apply normal checks for OT on Hol and Hol Callback
- I TMP'=7,$E(ENT,25),$$HOLIDAY^PRS8UT(PY,DFN,+D) S Y=24 ;ot on actual hol
- I 'Y,$E($G(DAY(I,"HOL")),$S(T>96:(T-96),1:T)) S Y=TOUR+28 ;holiday callback
- I 'Y S Y=TMP
- I Y=24!(Y=(TOUR+28)) D SET Q
- ; If not OT on Hol or Hol Callback Determine if we are setting OT or CT
- S K=$S(Y=7:CC,1:OC)
- F J=1:1:K D AWSWK ; Update actual time worked
- F J=1:1:T2ADD D AWSWK ; Update time added to reach 2 hour min
- Q
- ;
- AWSWK ; Determine what type of time to add based on 8/day and 40/wk
- S HT=+$G(^TMP($J,"PRS8",D,"HT"))
- I HT'<32 S Y=$S(Y'=7:TOUR+15,1:Y) D SET1 Q
- I TH(W)'<160 S Y=$S(Y'=7:TOUR+19,1:Y) D SET1 Q
- I HT<32,TH(W)<160 S Y=9 D SET1
- Q
- ;
- SET1 ; Set WK array for AWS nurses
- S $P(WK(W),"^",Y)=$P(WK(W),"^",Y)+1
- Q:HT'<32
- S TH=TH+1,TH(WK)=TH(WK)+1
- S ^TMP($J,"PRS8",DAY,"HT")=HT+1
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRS8OC 7155 printed Mar 13, 2025@21:27:58 Page 2
- PRS8OC ;HISC/MGD-DECOMPOSITION, ON-CALL ;02/27/07
- +1 ;;4.0;PAID;**63,92,112,117**;Sep 21, 1995;Build 32
- +2 ;;Per VHA Directive 2004-038, this routine should not be modified.
- +3 ;
- +4 ;The following MUMPS code is used to credit the appropriate
- +5 ;categories on the timecard for work performed while On-Call.
- +6 ;All hours during which an individual is identified as being
- +7 ;On-Call are credited to blocks YD and YH (On Call Hrs) on
- +8 ;the timecard. Hours during an On-Call episode where an
- +9 ;individual is actually called in to perform work are credited
- +10 ;to blocks YA and YE (Sch CB OT) as appropriate. This credit
- +11 ;is given under the 2-hour minimum rule. When OT work is
- +12 ;performed during On-Call the actual On-Call Hours reported
- +13 ;are reduced by the ACTUAL number of hours worked (not by the
- +14 ;2-hour minimum).
- +15 ;
- +16 ;Called by Routines: PRS8ST
- +17 ;
- +18 ;C = On-Call
- +19 ;c = OT during OC
- +20 ;t = CT during OC
- +21 ;
- +22 SET (I,D)=$SELECT(T'>96:DAY,1:(DAY+1))
- +23 ;oc variables
- SET OC=$GET(OC)
- SET OC(DAY)=$GET(OC(DAY))
- SET OC(DAY+1)=$GET(OC(DAY+1))
- +24 ;CT on OC count
- SET CC=$GET(CC)
- SET CC(DAY)=$GET(CC(DAY))
- SET CC(DAY+1)=$GET(CC(DAY+1))
- +25 SET Y=35
- SET Y(1)=1
- DO SET
- +26 ;on-call episode (ot OR ct)
- IF VAR1="C"
- if OC!(CC)
- DO OCS
- +27 if "ct"[VAR1
- SET OC=OC+1
- SET OC(D)=OC(D)+1
- if VAR1="t"
- SET CC=CC+1
- SET CC(D)=CC(D)+1
- +28 ;count actual CB hrs
- IF "ct"[VAR1
- IF DAY>0
- IF DAY<15
- SET CBCK(WK)=CBCK(WK)+1
- +29 if 'OK!('$DATA(OC))
- QUIT
- +30 ;get rest of them
- IF OC
- SET Y=23
- DO OCS
- +31 KILL OC,CC,Y,D
- QUIT
- +32 ;
- OCS ; --- set On-Call minimum hours
- +1 ;set YA/YE for PPI="W" or "V" else set OT
- +2 IF +NAWS=0
- SET Y=$SELECT(CC:7,'DOUB:TOUR+19,1:23)
- +3 IF +NAWS
- SET Y=$SELECT(CC:7,1:TOUR+19)
- +4 ;
- +5 NEW X,Z,DD,TT,CCCNT,NEXTT,OCCNT,TIMECNT
- +6 SET TT=$SELECT(T>96:T-96,1:T)
- SET TIMECNT=0
- +7 SET X=$EXTRACT(DAY($SELECT(T>96:DAY+1,1:DAY),"W"),TT)
- +8 ;
- +9 ; If the current segment is the last of the On-Call OR the last of
- +10 ; the On-Call Callback and the next time segment is Unavailable ("-")
- +11 ; or not a type of work ("0") check to see if OT/reg sched is prior
- +12 ; to on call worked.
- +13 ;
- +14 ; Next time segment
- SET NEXTT=$SELECT(T+1>96:T-95,1:TT+1)
- +15 IF "C"[X!(("ct"[X)&("-0"[$EXTRACT($SELECT(T+1>96:DAY(DAY+1,"W"),1:DAY(DAY,"W")),NEXTT)))
- Begin DoDot:1
- +16 KILL XH
- SET X=0
- FOR Z=1:1:8-(OC(DAY)+$GET(OC(DAY+1)))
- Begin DoDot:2
- +17 SET DD=OC(DAY)+OC(DAY+1)+Z
- +18 IF TT-DD>0
- SET X=$EXTRACT(DAY(DAY,"W"),TT-DD)
- if X="O"&($EXTRACT(DAY(DAY,"HOL"),TT-DD)=2)
- SET X="h"
- +19 IF '$TEST
- SET X=$EXTRACT(DAY(DAY-1,"W"),96+T-DD)
- if X="O"&($EXTRACT(DAY(DAY-1,"HOL"),96+T-DD)=2)
- SET X="h"
- +20 ; on call abuts a reg sched TOD.
- IF "123nHMLSWNARXYFGDUZq"[X
- SET X=1
- QUIT
- +21 ; on call abuts time worked outside posted TOD.
- IF '$TEST
- IF "EOhoscteQ"[X
- Begin DoDot:3
- +22 ; Time already counted in WK().
- IF "ct"'[X
- SET TIMECNT=TIMECNT+1
- +23 SET XH=$SELECT(X'="h":0,1:1)
- SET X=2
- End DoDot:3
- +24 IF '$TEST
- SET X=0
- +25 QUIT
- End DoDot:2
- if "01"[X
- QUIT
- +26 QUIT
- End DoDot:1
- +27 ; Check to see if OT/reg sched is after on call worked
- IF '$TEST
- Begin DoDot:1
- +28 KILL XH
- SET X=0
- FOR Z=1:1:8-(OC(DAY)+$GET(OC(DAY+1)))
- Begin DoDot:2
- +29 SET DD=OC(DAY)+OC(DAY+1)+Z
- +30 IF T+Z'>96
- SET X=$EXTRACT(DAY(DAY,"W"),T+Z)
- if X="O"&($EXTRACT(DAY(DAY,"HOL"),T+Z)=2)
- SET X="h"
- +31 IF '$TEST
- SET X=$EXTRACT(DAY(DAY+1,"W"),T-96+Z)
- if X="O"&($EXTRACT(DAY(DAY+1,"HOL"),T-96+Z)=2)
- SET X="h"
- +32 ; on call abuts a reg sched TOD.
- IF "123nHMLSWNARXYFGDUZq"[X
- SET X=1
- QUIT
- +33 IF '$TEST
- IF "EOhoscteQ"[X
- Begin DoDot:3
- +34 ; Time already counted in WK().
- IF "ct"'[X
- SET TIMECNT=TIMECNT+1
- +35 SET XH=$SELECT(X'="h":0,1:1)
- SET X=2
- End DoDot:3
- +36 IF '$TEST
- SET X=0
- +37 QUIT
- End DoDot:2
- if "01"[X
- QUIT
- +38 QUIT
- End DoDot:1
- +39 IF $GET(XH)'=""
- if XH=1!'X
- SET Z=Z-1
- SET X=2
- +40 ;
- +41 ; Check if Scheduled Call-Back OT crosses Midnight
- +42 ;
- +43 IF '$DATA(CRSMID(D))
- IF $EXTRACT(DAY(DAY,"W"),1)="c"
- IF $EXTRACT(DAY(DAY-1,"W"),96)="c"
- SET FG=0
- Begin DoDot:1
- +44 SET CRSMID(D)=1
- +45 IF OC<7
- Begin DoDot:2
- +46 ; crosses midnight, check if its <2 hours, CRSMID variable set to
- +47 ; only do on segment that cross mid, not others
- +48 SET CNTR=0
- FOR CX=1:1:8-OC
- if $EXTRACT(DAY(DAY-1,"W"),97-CX)="c"
- SET CNTR=CNTR+1
- +49 IF OC+CNTR'>8
- Begin DoDot:3
- +50 SET Y(1)=$SELECT(X=1:OC,1:8-CNTR)
- +51 ; Process everyone but AWS nurses
- IF +NAWS=0
- DO CHOL
- +52 ; Process AWS nurses
- IF +NAWS
- DO CHOL1
- +53 SET (OC,OC(D),CC,CC(D))=0
- SET FG=1
- End DoDot:3
- +54 QUIT
- End DoDot:2
- if FG=1
- QUIT
- End DoDot:1
- if FG=1
- QUIT
- +55 ;
- +56 ; Check if Comp Time crosses Midnight
- +57 ;
- +58 IF '$DATA(CRSMID(D))
- IF $EXTRACT(DAY(DAY,"W"),1)="t"
- IF $EXTRACT(DAY(DAY-1,"W"),96)="t"
- SET FG=0
- Begin DoDot:1
- +59 SET CRSMID(D)=1
- +60 IF OC<7
- Begin DoDot:2
- +61 ; crosses midnight, check if its <2 hours, CRSMID variable set to
- +62 ; only do on segment that cross mid, not others
- +63 SET CNTR=0
- FOR CX=1:1:8-OC
- if $EXTRACT(DAY(DAY-1,"W"),97-CX)="t"
- SET CNTR=CNTR+1
- +64 IF OC+CNTR'>8
- Begin DoDot:3
- +65 SET Y(1)=$SELECT(X=1:OC,1:8-CNTR)
- +66 ; Process everyone but AWS nurses
- IF +NAWS=0
- DO CHOL
- +67 ; Process AWS nurses
- IF +NAWS
- DO CHOL1
- +68 SET (OC,OC(D),CC,CC(D))=0
- SET FG=1
- End DoDot:3
- +69 QUIT
- End DoDot:2
- if FG=1
- QUIT
- End DoDot:1
- if FG=1
- QUIT
- +70 ;
- +71 ;SPLIT SEGMENT, MUST DO TWICE (FOR CT THEN FOR OT)
- IF CC>0
- IF CC<OC
- Begin DoDot:1
- +72 FOR I=DAY:1:(DAY+1)
- IF OC(I)
- Begin DoDot:2
- +73 SET (OCCNT,CCCNT)=0
- +74 ; Add time if 2 hour minimum was not met.
- IF X=2
- IF OC(I)+TIMECNT<8
- Begin DoDot:3
- +75 ; Amount of time short of the 2 hour min.
- SET TIMECNT=8-OC(I)-TIMECNT
- +76 ;
- +77 ; If TIMECNT is an even number divide needed time equally among the
- +78 ; CT and OT.
- +79 IF TIMECNT#2=0
- SET CCCNT=TIMECNT/2
- SET OCCNT=TIMECNT/2
- +80 ;
- +81 ; If TIMECNT is not an even number divide the time needed as equally
- +82 ; as possible among the CT and OT w/ remaining 15 minutes going to OC.
- +83 IF TIMECNT#2=1
- SET CCCNT=TIMECNT\2
- SET OCCNT=(TIMECNT\2)+1
- +84 ;
- End DoDot:3
- +85 SET Y(1)=$SELECT(X=2:CC(I)+CCCNT,X:CC(I),OC(I)>7:CC(I),1:4)
- SET Y=7
- +86 ; Process everyone but AWS nurses
- IF +NAWS=0
- DO CHOL
- +87 ; Process AWS nurses
- IF +NAWS
- DO CHOL1
- +88 SET Y(1)=$SELECT(X=2:OC(I)-CC(I)+OCCNT,X:OC(I)-CC(I),OC(I)>7:OC(I)-CC(I),1:4)
- +89 SET Y=$SELECT('DOUB:TOUR+19,1:23)
- +90 ; Process everyone but AWS nurses
- IF +NAWS=0
- DO CHOL
- +91 ; Process AWS nurses
- IF +NAWS
- DO CHOL1
- +92 QUIT
- End DoDot:2
- +93 QUIT
- End DoDot:1
- +94 ;NOT SPLIT SEGMENT
- IF '$TEST
- Begin DoDot:1
- +95 FOR I=DAY:1:(DAY+1)
- IF OC(I)
- Begin DoDot:2
- +96 IF OC(I)<8
- IF X=2
- Begin DoDot:3
- +97 IF T'=96
- SET OC(I)=8-TIMECNT
- +98 IF T=96
- IF "ct"'[$EXTRACT(DAY(DAY+1,"W"),1)
- SET OC(I)=8-TIMECNT
- End DoDot:3
- +99 SET Y(1)=$SELECT(X:OC(I),OC(I)>7:OC(I),1:8)
- +100 ; Process everyone but AWS nurses
- IF +NAWS=0
- DO CHOL
- +101 ; Process AWS nurses
- IF +NAWS
- DO CHOL1
- +102 QUIT
- End DoDot:2
- +103 QUIT
- End DoDot:1
- +104 KILL OC,CC
- QUIT
- +105 ;
- CHOL ; --- Check for Holiday Callback
- +1 SET TMP=Y
- SET Y=0
- +2 ; Don't convert Overtime to Comptime
- +3 ;ot on actual hol
- IF TMP'=7
- IF $EXTRACT(ENT,25)
- IF $$HOLIDAY^PRS8UT(PY,DFN,+D)
- SET Y=24
- +4 ;holiday callback
- IF 'Y
- IF $EXTRACT($GET(DAY(I,"HOL")),$SELECT(T>96:(T-96),1:T))
- SET Y=TOUR+28
- +5 IF 'Y
- SET Y=TMP
- +6 DO SET
- SET Y=$SELECT(CC:7,'DOUB:TOUR+19,1:23)
- +7 QUIT
- +8 ;
- SET ; --- set WK array
- +1 SET W=$SELECT(I<8:1,1:2)
- +2 IF I<1!(I>14)
- QUIT
- +3 IF Y(1)>32
- IF 'DOUB
- IF $PIECE(C0,"^",12)="N"
- IF Y'=7
- Begin DoDot:1
- +4 SET $PIECE(WK(W),"^",TOUR+15)=$PIECE(WK(W),"^",TOUR+15)+(Y(1)-32)
- +5 ;if FLSA=N set >8 = DA
- SET $PIECE(WK(W),"^",Y)=$PIECE(WK(W),"^",Y)+32
- End DoDot:1
- +6 IF '$TEST
- SET $PIECE(WK(W),"^",Y)=$PIECE(WK(W),"^",Y)+Y(1)
- +7 QUIT
- +8 ;
- CHOL1 ; Checks for AWS nurses
- +1 NEW HT,J,K,T2ADD
- +2 SET K=0
- SET TMP=Y
- SET Y=0
- +3 SET T2ADD=$SELECT(CC:Y(1)-CC,1:Y(1)-OC-CC)
- +4 ; Apply normal checks for OT on Hol and Hol Callback
- +5 ;ot on actual hol
- IF TMP'=7
- IF $EXTRACT(ENT,25)
- IF $$HOLIDAY^PRS8UT(PY,DFN,+D)
- SET Y=24
- +6 ;holiday callback
- IF 'Y
- IF $EXTRACT($GET(DAY(I,"HOL")),$SELECT(T>96:(T-96),1:T))
- SET Y=TOUR+28
- +7 IF 'Y
- SET Y=TMP
- +8 IF Y=24!(Y=(TOUR+28))
- DO SET
- QUIT
- +9 ; If not OT on Hol or Hol Callback Determine if we are setting OT or CT
- +10 SET K=$SELECT(Y=7:CC,1:OC)
- +11 ; Update actual time worked
- FOR J=1:1:K
- DO AWSWK
- +12 ; Update time added to reach 2 hour min
- FOR J=1:1:T2ADD
- DO AWSWK
- +13 QUIT
- +14 ;
- AWSWK ; Determine what type of time to add based on 8/day and 40/wk
- +1 SET HT=+$GET(^TMP($JOB,"PRS8",D,"HT"))
- +2 IF HT'<32
- SET Y=$SELECT(Y'=7:TOUR+15,1:Y)
- DO SET1
- QUIT
- +3 IF TH(W)'<160
- SET Y=$SELECT(Y'=7:TOUR+19,1:Y)
- DO SET1
- QUIT
- +4 IF HT<32
- IF TH(W)<160
- SET Y=9
- DO SET1
- +5 QUIT
- +6 ;
- SET1 ; Set WK array for AWS nurses
- +1 SET $PIECE(WK(W),"^",Y)=$PIECE(WK(W),"^",Y)+1
- +2 if HT'<32
- QUIT
- +3 SET TH=TH+1
- SET TH(WK)=TH(WK)+1
- +4 SET ^TMP($JOB,"PRS8",DAY,"HT")=HT+1
- +5 QUIT