PRSATP7 ;HISC/MGD-Timekeeper Post Absence ;04/18/06
;;4.0;PAID;**102,108**;Sep 21, 1995
;
DAH(PPIP,DFN,WDAY,DAH,QUIT) ;
; Find Day After Holiday - Called from PRSASR
; Input:
; PPIP - IEN of pay period to check
; DFN - IEN of employee to check
; WDAY - Day to start looping from
; DAH - Null
; QUIT - Null
;
; Output:
; DAH - PPIP^WDAY^Type of non-pay
; QUIT - Will be set to 1 if the holiday encapsulation
; rules are broken
;
N DADRFM,EDATA,EEND,EIN,EINDX,ETOT,NODE0,NODE1,NODE2,NODE4
N TINDX,TOUR1,TOUR2,REGHRS1,REGHRS2
N NT,NE,NO,NC ; New ordered arrays
S NODE0=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
I NODE0="" S QUIT=1 Q ; Corrupted data
S NODE2=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
;
; Skip Days off
Q:$P(NODE0,U,2)=1
;
; Check for tours with no regular hours
S TOUR1=+$P(NODE0,U,2),TOUR2=+$P(NODE0,U,13)
S REGHRS1=$P($G(^PRST(457.1,TOUR1,0)),U,6)
S REGHRS2=$S(TOUR2:$P($G(^PRST(457.1,TOUR2,0)),U,6),1:"")
Q:$P(NODE0,U,2)'=2&($P(NODE0,U,2)'=3)&(REGHRS1+REGHRS2=0)
;
; If scheduled work day w/o any non-pay, set QUIT
I $P(NODE0,U,2)>1,NODE2'["NP",NODE2'["WP" S QUIT=1 Q
;
; Checks for employees with DAILY tours
I $P(NODE0,U,2)=2!($P(NODE0,U,2)=3) S DAH=PPIP_U_DFN_U_$P(NODE2,U,3) Q
;
; Load tours and convert to numeric equivalents
; This creates the ordered arrays
;
S DADRFM=1
S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
D CNV96^PRSATP5(.NODE1,3,"NT",NODE0,.DADRFM)
S NODE4=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
I NODE4'="" D CNV96^PRSATP5(.NODE4,3,"NT",NODE0,.DADRFM)
D CNV96^PRSATP5(.NODE2,4,"NE",NODE0,.DADRFM)
;
; Identify beginning of tour
S TINDX="",TINDX=$O(NT(TINDX))
;
; Loop through ordered exceptions to see if the first 15 minutes
; of the tour was non-pay
S (EINDX,EDATA)=""
F EIN=1:1:7 D Q:QUIT!(EINDX="")!(DAH'="")
. S EINDX=$O(NE(EINDX))
. Q:EINDX=""
. S EDATA=NE(EINDX),EEND=$P(EDATA,U,2),ETOT=$P(EDATA,U,3)
. Q:EINDX'=TINDX ; not first 15 minutes
. I ETOT'="NP"&(ETOT'="WP") S QUIT=1 Q ; first 15 wasn't non-pay
. S DAH=PPIP_U_WDAY_U_ETOT
I DAH="" S QUIT=1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRSATP7 2161 printed Nov 22, 2024@17:34:48 Page 2
PRSATP7 ;HISC/MGD-Timekeeper Post Absence ;04/18/06
+1 ;;4.0;PAID;**102,108**;Sep 21, 1995
+2 ;
DAH(PPIP,DFN,WDAY,DAH,QUIT) ;
+1 ; Find Day After Holiday - Called from PRSASR
+2 ; Input:
+3 ; PPIP - IEN of pay period to check
+4 ; DFN - IEN of employee to check
+5 ; WDAY - Day to start looping from
+6 ; DAH - Null
+7 ; QUIT - Null
+8 ;
+9 ; Output:
+10 ; DAH - PPIP^WDAY^Type of non-pay
+11 ; QUIT - Will be set to 1 if the holiday encapsulation
+12 ; rules are broken
+13 ;
+14 NEW DADRFM,EDATA,EEND,EIN,EINDX,ETOT,NODE0,NODE1,NODE2,NODE4
+15 NEW TINDX,TOUR1,TOUR2,REGHRS1,REGHRS2
+16 ; New ordered arrays
NEW NT,NE,NO,NC
+17 SET NODE0=$GET(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
+18 ; Corrupted data
IF NODE0=""
SET QUIT=1
QUIT
+19 SET NODE2=$GET(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
+20 ;
+21 ; Skip Days off
+22 if $PIECE(NODE0,U,2)=1
QUIT
+23 ;
+24 ; Check for tours with no regular hours
+25 SET TOUR1=+$PIECE(NODE0,U,2)
SET TOUR2=+$PIECE(NODE0,U,13)
+26 SET REGHRS1=$PIECE($GET(^PRST(457.1,TOUR1,0)),U,6)
+27 SET REGHRS2=$SELECT(TOUR2:$PIECE($GET(^PRST(457.1,TOUR2,0)),U,6),1:"")
+28 if $PIECE(NODE0,U,2)'=2&($PIECE(NODE0,U,2)'=3)&(REGHRS1+REGHRS2=0)
QUIT
+29 ;
+30 ; If scheduled work day w/o any non-pay, set QUIT
+31 IF $PIECE(NODE0,U,2)>1
IF NODE2'["NP"
IF NODE2'["WP"
SET QUIT=1
QUIT
+32 ;
+33 ; Checks for employees with DAILY tours
+34 IF $PIECE(NODE0,U,2)=2!($PIECE(NODE0,U,2)=3)
SET DAH=PPIP_U_DFN_U_$PIECE(NODE2,U,3)
QUIT
+35 ;
+36 ; Load tours and convert to numeric equivalents
+37 ; This creates the ordered arrays
+38 ;
+39 SET DADRFM=1
+40 SET NODE1=$GET(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
+41 DO CNV96^PRSATP5(.NODE1,3,"NT",NODE0,.DADRFM)
+42 SET NODE4=$GET(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
+43 IF NODE4'=""
DO CNV96^PRSATP5(.NODE4,3,"NT",NODE0,.DADRFM)
+44 DO CNV96^PRSATP5(.NODE2,4,"NE",NODE0,.DADRFM)
+45 ;
+46 ; Identify beginning of tour
+47 SET TINDX=""
SET TINDX=$ORDER(NT(TINDX))
+48 ;
+49 ; Loop through ordered exceptions to see if the first 15 minutes
+50 ; of the tour was non-pay
+51 SET (EINDX,EDATA)=""
+52 FOR EIN=1:1:7
Begin DoDot:1
+53 SET EINDX=$ORDER(NE(EINDX))
+54 if EINDX=""
QUIT
+55 SET EDATA=NE(EINDX)
SET EEND=$PIECE(EDATA,U,2)
SET ETOT=$PIECE(EDATA,U,3)
+56 ; not first 15 minutes
if EINDX'=TINDX
QUIT
+57 ; first 15 wasn't non-pay
IF ETOT'="NP"&(ETOT'="WP")
SET QUIT=1
QUIT
+58 SET DAH=PPIP_U_WDAY_U_ETOT
End DoDot:1
if QUIT!(EINDX="")!(DAH'="")
QUIT
+59 IF DAH=""
SET QUIT=1
+60 QUIT