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