| 1 | PRS8WE2 ;WCIOFO/MGD-DECOMPOSITION, WEEKEND PREMIUM PART 2 ;3/23/07 | 
|---|
| 2 | ;;4.0;PAID;**90,92,96,112**;Sep 21, 1995;Build 54 | 
|---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | COUNT(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 | . . . ; CB - Premium T&L (#14) or OT/CT With Premiums (#17) to qualify for Premium pay. | 
|---|
| 45 | . . . I "^9^12^14^17^"'[("^"_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 | . . . ; CB - Premium T&L (#14) or OT/CT With Premiums to qualify for premium pay. | 
|---|
| 65 | . . . I "^9^12^14^17^"'[("^"_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 | ;Set shift 2 for 36/40 AWS nurses with premium time outside tour | 
|---|
| 88 | ;for this time segment  i.e. overtime(O), comp time(C) or called in from | 
|---|
| 89 | ;on-call(c) | 
|---|
| 90 | I +NAWS=36,"cOE"[$E(D(DAYN),SEG) S SHIFT=2 | 
|---|
| 91 | ; add to count | 
|---|
| 92 | S CNT(DAYN,SHIFT)=$G(CNT(DAYN,SHIFT))+1 | 
|---|
| 93 | Q | 
|---|
| 94 | ; | 
|---|
| 95 | SAVE ; Update WK array with final count for tour | 
|---|
| 96 | ; input | 
|---|
| 97 | ;   TP  - type of premium (SAT or SUN) | 
|---|
| 98 | ;   CNT(day,shift)=amount | 
|---|
| 99 | ; | 
|---|
| 100 | N AMT,DAYN,PC,SHIFT,WEEK | 
|---|
| 101 | S DAYN=0 F  S DAYN=$O(CNT(DAYN)) Q:DAYN=""  D | 
|---|
| 102 | . Q:DAYN<1!(DAYN>14) | 
|---|
| 103 | . S WEEK=$S(DAYN<8:1,1:2) | 
|---|
| 104 | . S SHIFT="" F  S SHIFT=$O(CNT(DAYN,SHIFT)) Q:SHIFT=""  D | 
|---|
| 105 | . . S AMT=CNT(DAYN,SHIFT) | 
|---|
| 106 | . . S PC=$S(TP="SAT":0,1:SHIFT)+12 | 
|---|
| 107 | . . ;Shift 2 used for 36/40 nurses premium time within tour using the 2080 divisor (40*52). | 
|---|
| 108 | . . ;Saturday Premium-AWS (SR/SS) and Sunday Premium-AWS (SD/SH) | 
|---|
| 109 | . . ;Paid at the AAC with the 1872 divisor for the hourly rate (36*52) | 
|---|
| 110 | . . ;for time outside the tour. | 
|---|
| 111 | . . S:+NAWS=36 PC=$S(SHIFT=2:$S(TP="SAT":12,1:13),TP="SAT":49,1:50) | 
|---|
| 112 | . . S $P(WK(WEEK),U,PC)=$P(WK(WEEK),U,PC)+AMT | 
|---|
| 113 | Q | 
|---|
| 114 | ; | 
|---|
| 115 | ;PRS8WE | 
|---|