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

PRSATP6.m

Go to the documentation of this file.
  1. PRSATP6 ;HISC/MGD-Timekeeper Post Absence ;04/18/06
  1. ;;4.0;PAID;**102,108**;Sep 21, 1995
  1. ;
  1. DBH(PPIP,DFN,WDAY,DBH,QUIT) ;
  1. ; Find Day Before Holiday
  1. ; Input:
  1. ; PPIP - IEN of pay period to check
  1. ; DFN - IEN of employee to check
  1. ; WDAY - Day to start looping from
  1. ; DAH - Null
  1. ; QUIT - Null
  1. ;
  1. ; Output:
  1. ; DAH - PPIP^WDAY^Type of non-pay
  1. ; QUIT - Will be set to 1 if the holiday encapsulation
  1. ; rules are broken
  1. ;
  1. N DADRFM,EDATA,EEND,EIN,EINDX,ETOT,NODE0,NODE1,NODE2,NODE4
  1. N TEND,TINDX,TOUR1,TOUR2,REGHRS1,REGHRS2
  1. N PT,PE,PO,PC ; New ordered arrays
  1. S NODE0=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
  1. I NODE0="" S QUIT=1 Q ; Corrupted data
  1. S NODE2=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
  1. ;
  1. ; Skip Days off
  1. Q:$P(NODE0,U,2)=1
  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. ; If the day has a tour that defines work and there are no exceptions
  1. ; encapsulation is broken
  1. I $P(NODE0,U,2)>1,NODE2'["NP",NODE2'["WP" S QUIT=1 Q
  1. ;
  1. ; Checks for employees with DAILY tours
  1. I $P(NODE0,U,2)=2!($P(NODE0,U,2)=3) S DBH=PPIP_U_DFN_U_$P(NODE2,U,3) Q
  1. ;
  1. ; Load tours and convert to numeric equivalents
  1. ; This creates the ordered arrays
  1. S DADRFM=1
  1. S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,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. D CNV96^PRSATP5(.NODE2,4,"PE",NODE0,.DADRFM)
  1. ;
  1. ; Identify end of tour
  1. S TINDX="",TINDX=$O(PT(TINDX),-1)
  1. S TEND=$P(PT(TINDX),U,2)
  1. ;
  1. ; Loop backwards through ordered exceptions to see if last 15
  1. ; minutes of tour was non-pay
  1. S (EINDX,EDATA)=""
  1. F EIN=1:1:7 D Q:QUIT!(EINDX="")!(DBH'="")
  1. . S EINDX=$O(PE(EINDX),-1)
  1. . Q:EINDX=""
  1. . S EDATA=PE(EINDX),EEND=$P(EDATA,U,2),ETOT=$P(EDATA,U,3)
  1. . Q:EEND'=TEND ; not last 15 minutes
  1. . I ETOT'="NP"&(ETOT'="WP") S QUIT=1 Q ; last 15 wasn't non-pay
  1. . S DBH=PPIP_U_WDAY_U_ETOT
  1. I DBH="" S QUIT=1
  1. Q