source: WorldVistAEHR/trunk/r/PAID-PRS/PRSATP8.m@ 975

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

initial load of WorldVistAEHR

File size: 5.5 KB
Line 
1PRSATP8 ;HISC/MGD-Timekeeper Post Absence ;01/27/06
2 ;;4.0;PAID;**102**;Sep 21, 1995
3 ;
4FNDHOL(PPIP,DFN,WDAY,HOL,QUIT) ;
5 ; Procedure to determine if there was a holiday in a PP
6 ; Will also check to see if there was any On-Call posted
7 ; as an exception that abuts the scheduled tour and if
8 ; the first/last 15 minutes of the On-call was worked
9 ;
10 ; Input:
11 ; PPIP - IEN of Pay Period to be checked
12 ; DFN - IEN of employee to be checked
13 ; WDAY - Day to start looping backwards from
14 ; HOL - null
15 ; QUIT - null
16 ;
17 ; Output:
18 ; HOL - IF not found = ""
19 ; IF found = PPIP^WDAY^SOH
20 ; PPIP - IEN of pay period containing the holiday
21 ; WDAY - the day number on which the holiday occurs
22 ; SOH - The status of the timecard containing the holiday
23 ; QUIT - Will be set to 1 if the holiday encapsulation
24 ; rules are broken
25 ;
26 N DADRFM,HTAFTER,HTPRIOR,HTSTRT,HTEND,NODE0,NODE1,NODE2,NODE4
27 N REGHRS1,REGHRS2,SOH,TOUR1,TOUR2,TPPIP,TWDAY
28 N HT,HE,HO,HC,NT,NE,NO,NC,PT,PE,PO,PC ; New ordered arrays
29 S NODE0=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
30 S SOH=$P($G(^PRST(458,PPIP,"E",DFN,0)),U,2)
31 S TPPIP=PPIP,TWDAY=WDAY
32 I NODE0="" S QUIT=1 Q ; Corrupted data
33 Q:$P(NODE0,U,2)=1 ; Scheduled day off
34 ;
35 ; Check for tours with no regular hours
36 S TOUR1=+$P(NODE0,U,2),TOUR2=+$P(NODE0,U,13)
37 S REGHRS1=$P($G(^PRST(457.1,TOUR1,0)),U,6)
38 S REGHRS2=$S(TOUR2:$P($G(^PRST(457.1,TOUR2,0)),U,6),1:"")
39 Q:$P(NODE0,U,2)'=2&($P(NODE0,U,2)'=3)&(REGHRS1+REGHRS2=0)
40 ;
41 ; Quit if day has a tour with regular hours and it is not
42 ; a holiday (#10.2)OBSERVED HOLIDAY
43 I REGHRS1,$P(NODE0,U,12)="" S QUIT=1 Q
44 ;
45 ; If the holiday has two tours, Timekeepers will post
46 I $P(NODE0,U,13)'="" S QUIT=1 Q
47 ;
48 ; Load Holiday exceptions and check for HW & HX
49 S NODE2=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
50 I NODE2["HW" S QUIT=1 Q ; worked was performed on a holiday
51 I NODE2'["HX" S QUIT=1 Q ; no HX to convert
52 ;
53 ; Checks for employees with DAILY tours
54 I $P(NODE0,U,2)=2!($P(NODE0,U,2)=3) S HOL=PPIP_U_WDAY_U_SOH Q
55 ;
56 ; Load nodes 1, 4
57 S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
58 S NODE4=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
59 ;
60 ; Convert Start/Stop times and create all
61 ; ordered arrays
62 S DADRFM=1
63 D CNV96^PRSATP5(.NODE1,3,"HT",NODE0,.DADRFM)
64 I NODE4'="" D CNV96^PRSATP5(.NODE4,3,"HT",NODE0,.DADRFM)
65 D CNV96^PRSATP5(.NODE2,4,"HE",NODE0,.DADRFM)
66 ;
67 ; Get start/end times of holiday tour
68 S HTSTRT="",HTSTRT=$O(HT(HTSTRT))
69 S HTEND="",HTEND=$O(HT(HTEND),-1)
70 I HTEND S HTEND=$P(HT(HTEND),U,2)
71 ;
72 ; Load prior days info
73 S WDAY=WDAY-1
74 I WDAY=0 D Q:QUIT
75 . N BACK S BACK=0
76 . D GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
77 S NODE0=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
78 S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
79 S DADRFM=1
80 D CNV96^PRSATP5(.NODE1,3,"PT",NODE0,.DADRFM)
81 S NODE4=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
82 I NODE4'="" D CNV96^PRSATP5(.NODE4,3,"PT",NODE0,.DADRFM)
83 S NODE2=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
84 D CNV96^PRSATP5(.NODE2,4,"PE",NODE0,.DADRFM)
85 ;
86 ; Load next day's info
87 S PPIP=TPPIP,WDAY=TWDAY+1
88 I WDAY=15 D Q:QUIT
89 . N NEXT S NEXT=0
90 . D GETNPP^PRSATP5(.PPIP,DFN,.WDAY,.NEXT,.QUIT)
91 S NODE0=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,0))
92 S NODE1=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,1))
93 S DADRFM=1
94 D CNV96^PRSATP5(.NODE1,3,"NT",NODE0,.DADRFM)
95 S NODE4=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,4))
96 I NODE4'="" D CNV96^PRSATP5(.NODE4,3,"NT",NODE0,.DADRFM)
97 S NODE2=$G(^PRST(458,PPIP,"E",DFN,"D",WDAY,2))
98 D CNV96^PRSATP5(.NODE2,4,"NE",NODE0,.DADRFM)
99 ;
100 ; init flags as 0 (false)
101 S HTPRIOR("OC")=0 ; time immediately prior to holiday tour was on-call
102 S HTPRIOR("WK")=0 ; time immediately prior to holiday tour was worked
103 S HTAFTER("OC")=0 ; time immediately after holiday tour was on-call
104 S HTAFTER("WK")=0 ; time immediately after holiday tour was worked
105 ;
106 ; check if on-call segments posted on prior day abut the holiday tour
107 I $$INCTM(HTSTRT-1+96,.PO) S HTPRIOR("OC")=1
108 I $$INCTM(HTEND+1+96,.PO) S HTAFTER("OC")=1
109 ;
110 ; check if on-call segments posted on holiday abut the holiday tour
111 I $$INCTM(HTSTRT-1,.HO) S HTPRIOR("OC")=1
112 I $$INCTM(HTEND+1,.HO) S HTAFTER("OC")=1
113 ;
114 ; check if on-call segments posted on next day abut the holiday tour
115 I $$INCTM(HTEND+1-96,.NO) S HTAFTER("OC")=1
116 ;
117 ; check if extra work segments posted on prior day abut the holiday tour
118 I $$INCTM(HTSTRT-1+96,.PC) S HTPRIOR("WK")=1
119 ;
120 ; check if extra work segments posted on holiday abut the holiday tour
121 I $$INCTM(HTSTRT-1,.HC) S HTPRIOR("WK")=1
122 I $$INCTM(HTEND+1,.HC) S HTAFTER("WK")=1
123 ;
124 ; check if extra work segments posted on next day abut the holiday tour
125 I $$INCTM(HTEND+1-96,.NC) S HTAFTER("WK")=1
126 ;
127 ; if call-back abuts the holiday tour then it is not considered encap.
128 I HTPRIOR("OC"),HTPRIOR("WK") S QUIT=1 Q ; call-back abuts beginning
129 I HTAFTER("OC"),HTAFTER("WK") S QUIT=1 Q ; call-back abuts end
130 ;
131 ; checks done so holiday excused is considered encapsulated by non-pay
132 S HOL=TPPIP_U_TWDAY_U_SOH
133 Q
134 ;
135INCTM(PRST,PRSARR) ; Includes Time Extrinsic Function
136 ; determines if a time is included within any time segments in array
137 ; input
138 ; PRST - number that represents a time segment (1-192)
139 ; PRSARR - array, passed by reference with following format
140 ; PRSARR(start)=start^stop^type of time
141 ; returns 1 if PRST included within a time segment or 0 if not
142 ;
143 N RET,START,STOP
144 S RET=0 ; initialize return value
145 ;
146 ; loop thru array
147 I PRST>0 S START="" F S START=$O(PRSARR(START)) Q:START="" D Q:RET
148 . S STOP=$P(PRSARR(START),U,2)
149 . I PRST'<START,PRST'>STOP S RET=1 ; check if time included in segment
150 ;
151 Q RET
Note: See TracBrowser for help on using the repository browser.