source: WorldVistAEHR/trunk/r/PAID-PRS/PRSATP6.m@ 1261

Last change on this file since 1261 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.1 KB
RevLine 
[613]1PRSATP6 ;HISC/MGD-Timekeeper Post Absence ;04/18/06
2 ;;4.0;PAID;**102,108**;Sep 21, 1995
3 ;
4DBH(PPIP,DFN,WDAY,DBH,QUIT) ;
5 ; Find Day Before Holiday
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 TEND,TINDX,TOUR1,TOUR2,REGHRS1,REGHRS2
20 N PT,PE,PO,PC ; 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 the day has a tour that defines work and there are no exceptions
35 ; encapsulation is broken
36 I $P(NODE0,U,2)>1,NODE2'["NP",NODE2'["WP" S QUIT=1 Q
37 ;
38 ; Checks for employees with DAILY tours
39 I $P(NODE0,U,2)=2!($P(NODE0,U,2)=3) S DBH=PPIP_U_DFN_U_$P(NODE2,U,3) Q
40 ;
41 ; Load tours and convert to numeric equivalents
42 ; This creates the ordered arrays
43 S DADRFM=1
44 S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
45 D CNV96^PRSATP5(.NODE1,3,"PT",NODE0,.DADRFM)
46 S NODE4=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
47 I NODE4'="" D CNV96^PRSATP5(.NODE4,3,"PT",NODE0,.DADRFM)
48 D CNV96^PRSATP5(.NODE2,4,"PE",NODE0,.DADRFM)
49 ;
50 ; Identify end of tour
51 S TINDX="",TINDX=$O(PT(TINDX),-1)
52 S TEND=$P(PT(TINDX),U,2)
53 ;
54 ; Loop backwards through ordered exceptions to see if last 15
55 ; minutes of tour was non-pay
56 S (EINDX,EDATA)=""
57 F EIN=1:1:7 D Q:QUIT!(EINDX="")!(DBH'="")
58 . S EINDX=$O(PE(EINDX),-1)
59 . Q:EINDX=""
60 . S EDATA=PE(EINDX),EEND=$P(EDATA,U,2),ETOT=$P(EDATA,U,3)
61 . Q:EEND'=TEND ; not last 15 minutes
62 . I ETOT'="NP"&(ETOT'="WP") S QUIT=1 Q ; last 15 wasn't non-pay
63 . S DBH=PPIP_U_WDAY_U_ETOT
64 I DBH="" S QUIT=1
65 Q
Note: See TracBrowser for help on using the repository browser.