Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PRSATP8

PRSATP8.m

Go to the documentation of this file.
  1. PRSATP8 ;HISC/MGD-Timekeeper Post Absence ;01/27/06
  1. ;;4.0;PAID;**102**;Sep 21, 1995
  1. ;
  1. FNDHOL(PPIP,DFN,WDAY,HOL,QUIT) ;
  1. ; Procedure to determine if there was a holiday in a PP
  1. ; Will also check to see if there was any On-Call posted
  1. ; as an exception that abuts the scheduled tour and if
  1. ; the first/last 15 minutes of the On-call was worked
  1. ;
  1. ; Input:
  1. ; PPIP - IEN of Pay Period to be checked
  1. ; DFN - IEN of employee to be checked
  1. ; WDAY - Day to start looping backwards from
  1. ; HOL - null
  1. ; QUIT - null
  1. ;
  1. ; Output:
  1. ; HOL - IF not found = ""
  1. ; IF found = PPIP^WDAY^SOH
  1. ; PPIP - IEN of pay period containing the holiday
  1. ; WDAY - the day number on which the holiday occurs
  1. ; SOH - The status of the timecard containing the holiday
  1. ; QUIT - Will be set to 1 if the holiday encapsulation
  1. ; rules are broken
  1. ;
  1. N DADRFM,HTAFTER,HTPRIOR,HTSTRT,HTEND,NODE0,NODE1,NODE2,NODE4
  1. N REGHRS1,REGHRS2,SOH,TOUR1,TOUR2,TPPIP,TWDAY
  1. N HT,HE,HO,HC,NT,NE,NO,NC,PT,PE,PO,PC ; New ordered arrays
  1. S NODE0=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
  1. S SOH=$P($G(^PRST(458,PPIP,"E",DFN,0)),U,2)
  1. S TPPIP=PPIP,TWDAY=WDAY
  1. I NODE0="" S QUIT=1 Q ; Corrupted data
  1. Q:$P(NODE0,U,2)=1 ; Scheduled day off
  1. ;
  1. ; Check for tours with no regular hours
  1. S TOUR1=+$P(NODE0,U,2),TOUR2=+$P(NODE0,U,13)
  1. S REGHRS1=$P($G(^PRST(457.1,TOUR1,0)),U,6)
  1. S REGHRS2=$S(TOUR2:$P($G(^PRST(457.1,TOUR2,0)),U,6),1:"")
  1. Q:$P(NODE0,U,2)'=2&($P(NODE0,U,2)'=3)&(REGHRS1+REGHRS2=0)
  1. ;
  1. ; Quit if day has a tour with regular hours and it is not
  1. ; a holiday (#10.2)OBSERVED HOLIDAY
  1. I REGHRS1,$P(NODE0,U,12)="" S QUIT=1 Q
  1. ;
  1. ; If the holiday has two tours, Timekeepers will post
  1. I $P(NODE0,U,13)'="" S QUIT=1 Q
  1. ;
  1. ; Load Holiday exceptions and check for HW & HX
  1. S NODE2=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
  1. I NODE2["HW" S QUIT=1 Q ; worked was performed on a holiday
  1. I NODE2'["HX" S QUIT=1 Q ; no HX to convert
  1. ;
  1. ; Checks for employees with DAILY tours
  1. I $P(NODE0,U,2)=2!($P(NODE0,U,2)=3) S HOL=PPIP_U_WDAY_U_SOH Q
  1. ;
  1. ; Load nodes 1, 4
  1. S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
  1. S NODE4=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
  1. ;
  1. ; Convert Start/Stop times and create all
  1. ; ordered arrays
  1. S DADRFM=1
  1. D CNV96^PRSATP5(.NODE1,3,"HT",NODE0,.DADRFM)
  1. I NODE4'="" D CNV96^PRSATP5(.NODE4,3,"HT",NODE0,.DADRFM)
  1. D CNV96^PRSATP5(.NODE2,4,"HE",NODE0,.DADRFM)
  1. ;
  1. ; Get start/end times of holiday tour
  1. S HTSTRT="",HTSTRT=$O(HT(HTSTRT))
  1. S HTEND="",HTEND=$O(HT(HTEND),-1)
  1. I HTEND S HTEND=$P(HT(HTEND),U,2)
  1. ;
  1. ; Load prior days info
  1. S WDAY=WDAY-1
  1. I WDAY=0 D Q:QUIT
  1. . N BACK S BACK=0
  1. . D GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
  1. S NODE0=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
  1. S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
  1. S DADRFM=1
  1. D CNV96^PRSATP5(.NODE1,3,"PT",NODE0,.DADRFM)
  1. S NODE4=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
  1. I NODE4'="" D CNV96^PRSATP5(.NODE4,3,"PT",NODE0,.DADRFM)
  1. S NODE2=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
  1. D CNV96^PRSATP5(.NODE2,4,"PE",NODE0,.DADRFM)
  1. ;
  1. ; Load next day's info
  1. S PPIP=TPPIP,WDAY=TWDAY+1
  1. I WDAY=15 D Q:QUIT
  1. . N NEXT S NEXT=0
  1. . D GETNPP^PRSATP5(.PPIP,DFN,.WDAY,.NEXT,.QUIT)
  1. S NODE0=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
  1. S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
  1. S DADRFM=1
  1. D CNV96^PRSATP5(.NODE1,3,"NT",NODE0,.DADRFM)
  1. S NODE4=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
  1. I NODE4'="" D CNV96^PRSATP5(.NODE4,3,"NT",NODE0,.DADRFM)
  1. S NODE2=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
  1. D CNV96^PRSATP5(.NODE2,4,"NE",NODE0,.DADRFM)
  1. ;
  1. ; init flags as 0 (false)
  1. S HTPRIOR("OC")=0 ; time immediately prior to holiday tour was on-call
  1. S HTPRIOR("WK")=0 ; time immediately prior to holiday tour was worked
  1. S HTAFTER("OC")=0 ; time immediately after holiday tour was on-call
  1. S HTAFTER("WK")=0 ; time immediately after holiday tour was worked
  1. ;
  1. ; check if on-call segments posted on prior day abut the holiday tour
  1. I $$INCTM(HTSTRT-1+96,.PO) S HTPRIOR("OC")=1
  1. I $$INCTM(HTEND+1+96,.PO) S HTAFTER("OC")=1
  1. ;
  1. ; check if on-call segments posted on holiday abut the holiday tour
  1. I $$INCTM(HTSTRT-1,.HO) S HTPRIOR("OC")=1
  1. I $$INCTM(HTEND+1,.HO) S HTAFTER("OC")=1
  1. ;
  1. ; check if on-call segments posted on next day abut the holiday tour
  1. I $$INCTM(HTEND+1-96,.NO) S HTAFTER("OC")=1
  1. ;
  1. ; check if extra work segments posted on prior day abut the holiday tour
  1. I $$INCTM(HTSTRT-1+96,.PC) S HTPRIOR("WK")=1
  1. ;
  1. ; check if extra work segments posted on holiday abut the holiday tour
  1. I $$INCTM(HTSTRT-1,.HC) S HTPRIOR("WK")=1
  1. I $$INCTM(HTEND+1,.HC) S HTAFTER("WK")=1
  1. ;
  1. ; check if extra work segments posted on next day abut the holiday tour
  1. I $$INCTM(HTEND+1-96,.NC) S HTAFTER("WK")=1
  1. ;
  1. ; if call-back abuts the holiday tour then it is not considered encap.
  1. I HTPRIOR("OC"),HTPRIOR("WK") S QUIT=1 Q ; call-back abuts beginning
  1. I HTAFTER("OC"),HTAFTER("WK") S QUIT=1 Q ; call-back abuts end
  1. ;
  1. ; checks done so holiday excused is considered encapsulated by non-pay
  1. S HOL=TPPIP_U_TWDAY_U_SOH
  1. Q
  1. ;
  1. INCTM(PRST,PRSARR) ; Includes Time Extrinsic Function
  1. ; determines if a time is included within any time segments in array
  1. ; input
  1. ; PRST - number that represents a time segment (1-192)
  1. ; PRSARR - array, passed by reference with following format
  1. ; PRSARR(start)=start^stop^type of time
  1. ; returns 1 if PRST included within a time segment or 0 if not
  1. ;
  1. N RET,START,STOP
  1. S RET=0 ; initialize return value
  1. ;
  1. ; loop thru array
  1. I PRST>0 S START="" F S START=$O(PRSARR(START)) Q:START="" D Q:RET
  1. . S STOP=$P(PRSARR(START),U,2)
  1. . I PRST'<START,PRST'>STOP S RET=1 ; check if time included in segment
  1. ;
  1. Q RET