source: WorldVistAEHR/trunk/r/PAID-PRS/PRS8WE2.m@ 1361

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

revised back to 6/30/08 version

File size: 3.9 KB
RevLine 
[623]1PRS8WE2 ;WCIOFO/MGD-DECOMPOSITION, WEEKEND PREMIUM PART 2 ;10/22/04
2 ;;4.0;PAID;**90,92,96**;Sep 21, 1995
3 ;
4COUNT(DAYN,SEG) ; Increase count of premium for tour
5 ; input
6 ; DAYN = day # (0-15) being counted
7 ; SEG = segment # (1-96) in DAYN being counted
8 ; D(DAYN)
9 ; P(DAYN)
10 ; H(DAYN)
11 ; CNT(DAYN,shift) - optional
12 ; output
13 ; CNT(DAYN,shift) = current count for tour being processed
14 ;
15 N DAT,FND,M1,NODE,NOTELG,POST,PREVDAY,RC,SC,SHIFT,TDAY,TOUR,TOURS,TS
16 ; perform final checks
17 I ("EetOscbT"[$E(D(DAYN),SEG)),$E(H(DAYN),SEG)'=2,$E(P(DAYN),SEG) Q
18 I TYP["P","4"[$E(D(DAYN),SEG),$E(H(DAYN),SEG)'=2,$E(P(DAYN),SEG)=0 Q
19 ;
20 ; If Hybrid employee as defined by Public Law P.L. 107-135, check
21 ; to see if the time was on a tour of duty or an exception. Tours
22 ; worked on Sat or Sun qualify for Premium time. If the time was
23 ; an exception, check the Remarks Code to see if the segment can be
24 ; counted as Premium time.
25 ;
26 S (FND,NOTELG)=0
27 ; Quit if Sunday and employee is not entitled to Sun Prem Pay
28 Q:SATNOSUN&("^1^8^15^"[(U_DAY_U))&(TP="SUN")
29 I HYBRID!(PMP'=""&("^S^T^U^V^"[(U_PMP_U))) D Q:NOTELG
30 . ; Check to see if the time was on a tour or an exception
31 . N INC,END
32 . F TOURS=1,4,2 D Q:NOTELG!(FND)
33 . . S TOUR=$G(^TMP($J,"PRS8",DAYN,TOURS))
34 . . Q:TOUR=""
35 . . S INC=$S(TOURS=2:4,1:3)
36 . . S END=$S(TOURS=2:25,1:19)
37 . . F POST=1:INC:END I $P(TOUR,"^",POST)'="" D Q:NOTELG!(FND)
38 . . . ; Quit if SEG is not within the start/stop time
39 . . . Q:SEG<$P(TOUR,"^",POST)!(SEG>$P(TOUR,"^",POST+1))
40 . . . S FND=1
41 . . . Q:TOURS=1!(TOURS=4) ; If on a Tour it counts as Premium
42 . . . S RC=$P(TOUR,"^",POST+3)
43 . . . ; Remarks Code must be OT/CT on Premium (#9), Tour Coverage (#12)
44 . . . ; or CB - Premium T&L (#14) to qualify for Premium pay.
45 . . . I "^9^12^14^"'[("^"_RC_"^") S NOTELG=1
46 . Q:FND
47 . ;
48 . ; If we didn't find SEG in either of the two tours or the
49 . ; exceptions then check to see if it crossed over into this day.
50 . S PREVDAY=DAYN-1
51 . N INC,END
52 . F TOURS=1,4,2 D Q:NOTELG
53 . . S TOUR=$G(^TMP($J,"PRS8",PREVDAY,TOURS))
54 . . Q:TOUR=""
55 . . S INC=$S(TOURS=2:4,1:3)
56 . . S END=$S(TOURS=2:25,1:19)
57 . . F POST=1:4:25 I $P(TOUR,"^",POST)'="" D Q:NOTELG!(FND)
58 . . . ; Quit if SEG is not within the start/stop time
59 . . . Q:(SEG+96)<$P(TOUR,"^",POST)!((SEG+96)>$P(TOUR,"^",POST+1))
60 . . . S FND=1
61 . . . Q:TOURS=1!(TOURS=4) ; If on a Tour it counts as Premium
62 . . . S RC=$P(TOUR,"^",POST+3)
63 . . . ; Remarks Code must be OT/CT on Premium (#9), Tour Coverage (#12)
64 . . . ; or CB - Premium T&L (#14) to qualify for premium pay.
65 . . . I "^9^12^14^"'[("^"_RC_"^") S NOTELG=1
66 ;
67 I $E(H(DAYN),SEG)=1!($E(P(DAYN),SEG)=5) Q
68 ; determine special code
69 S SHIFT=1
70 I TP="SUN",TYP["W" D
71 . ; Check to see if shift 2 or 3 is recorded for the segment worked
72 . I "^2^3^"[(U_$E(D(DAYN),SEG)_U) S SHIFT=$E(D(DAYN),SEG) Q
73 . S FND=0,SC=""
74 . ; Check for Holiday Worked on a Holiday
75 . I $E(D(DAYN),SEG)="O",$E(H(DAYN),SEG)=2 D
76 . . F TDAY=DAYN,DAYN-1 D Q:FND
77 . . . S M1=$S(TDAY=DAYN:SEG,1:SEG+96)
78 . . . ; loop through both tours in day
79 . . . F NODE=1,4 S DAT=$G(^TMP($J,"PRS8",TDAY,NODE)) Q:DAT="" D Q:FND
80 . . . . ; loop through tour segments in tour
81 . . . . F TS=1:1:7 Q:$P(DAT,U,(TS-1)*3+1)="" D Q:FND
82 . . . . . ; check if time is contained in tour segment
83 . . . . . I M1'<$P(DAT,U,(TS-1)*3+1),M1'>$P(DAT,U,(TS-1)*3+2) D
84 . . . . . . S SC=$P(DAT,U,(TS-1)*3+3),SHIFT=$S(SC=6:2,SC=7:3,1:1)
85 . . . . . . I "^2^3^"[(U_SHIFT_U) S FND=1
86 ;
87 ; add to count
88 S CNT(DAYN,SHIFT)=$G(CNT(DAYN,SHIFT))+1
89 Q
90 ;
91SAVE ; Update WK array with final count for tour
92 ; input
93 ; TP - type of premium (SAT or SUN)
94 ; CNT(day,shift)=amount
95 ;
96 N AMT,DAYN,PC,SHIFT,WEEK
97 S DAYN=0 F S DAYN=$O(CNT(DAYN)) Q:DAYN="" D
98 . Q:DAYN<1!(DAYN>14)
99 . S WEEK=$S(DAYN<8:1,1:2)
100 . S SHIFT="" F S SHIFT=$O(CNT(DAYN,SHIFT)) Q:SHIFT="" D
101 . . S AMT=CNT(DAYN,SHIFT)
102 . . S PC=$S(TP="SAT":0,1:SHIFT)+12
103 . . S $P(WK(WEEK),U,PC)=$P(WK(WEEK),U,PC)+AMT
104 Q
105 ;
106 ;PRS8WE
Note: See TracBrowser for help on using the repository browser.