| 1 | PRS8HR ;HISC/MRL,WCIOFO/JAH-DECOMPOSITION, HOURS ;06/25/07 | 
|---|
| 2 | ;;4.0;PAID;**2,22,29,42,52,102,108,112**;Sep 21, 1995;Build 54 | 
|---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | ; | 
|---|
| 5 | ;This routine is called by ^PRS8PP (premium pay calculator) | 
|---|
| 6 | ;===================================================================== | 
|---|
| 7 | ; ** indicates incompleted comments | 
|---|
| 8 | ; | 
|---|
| 9 | ;VARIABLE DEFINITION | 
|---|
| 10 | ; | 
|---|
| 11 | ; TYP   =  contains codes representing type of employee. | 
|---|
| 12 | ;          It's a composite code string w/ characters that | 
|---|
| 13 | ;          represent pay plan, duty basis, & normal hours. | 
|---|
| 14 | ;    CODE  REPRESENTS      CODE   REPRESENTS | 
|---|
| 15 | ;     D     daily            f     firefighter | 
|---|
| 16 | ;     W     wagegrade        P     part-time | 
|---|
| 17 | ;     N     nurse            d     doctor | 
|---|
| 18 | ;     B     baylor plan      dR    doctor/resident or intern | 
|---|
| 19 | ;     H     Nurse Hybrid     ""    * | 
|---|
| 20 | ;     I     intermittent | 
|---|
| 21 | ; VAL   =  Single char code represents employee's work status for | 
|---|
| 22 | ;          current 15 min increment. | 
|---|
| 23 | ; FLX   =  Flex tour indicator. | 
|---|
| 24 | ; TH(W) =  Tour Hours for week 1, TH(1) & week 2, TH(2) | 
|---|
| 25 | ; TH    =  Tour Hours | 
|---|
| 26 | ; HTP   =  PAYABLE hours worked today. | 
|---|
| 27 | ; HT    =  Hours worked today. | 
|---|
| 28 | ; AV    =  String w/ most normal types of time (see bottom of PRS8EX) | 
|---|
| 29 | ;          does NOT contain premium times or unscheduled time (OoEes4) | 
|---|
| 30 | ;==================================================================== | 
|---|
| 31 | ; | 
|---|
| 32 | S AV="1235nHMLSWNARUXYVJFGD" | 
|---|
| 33 | ; | 
|---|
| 34 | ;   Loop thru each quarter hour segment of day. | 
|---|
| 35 | ;   Check for times in AV array. | 
|---|
| 36 | ;   Proceed w/ calculation if Overtime worked on Holiday. | 
|---|
| 37 | ; | 
|---|
| 38 | F M=1:1:96 D | 
|---|
| 39 | .  S VAL=$E(D,M) | 
|---|
| 40 | .; | 
|---|
| 41 | .;    If non premium type of time or (overtime on holiday) | 
|---|
| 42 | .; | 
|---|
| 43 | .  I AV[VAL!(VAL="O"&($E(DAY(DAY,"HOL"),M)=2)) D CALC | 
|---|
| 44 | Q | 
|---|
| 45 | ; | 
|---|
| 46 | ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|---|
| 47 | ; | 
|---|
| 48 | CALC ; --- Entry point for calculating placement of time | 
|---|
| 49 | ; | 
|---|
| 50 | ;     Set up variables for calculations and comparisons in this routine | 
|---|
| 51 | ; | 
|---|
| 52 | N HOLWKD,HOLEX,HOLWKEX | 
|---|
| 53 | D ^PRS8HRSV | 
|---|
| 54 | ; | 
|---|
| 55 | ;     IF intermittent employee on continuation of pay OR overtime on | 
|---|
| 56 | ;     holiday THEN increment Pay Period tour hours and current weeks | 
|---|
| 57 | ;     tour hours. | 
|---|
| 58 | ; | 
|---|
| 59 | I TYP["I",VAL["V"!(VAL="O"&(HOLWKD)) S TH=TH+1,TH(W)=TH(W)+1 | 
|---|
| 60 | ; | 
|---|
| 61 | ;     IF part time doctor & total hours = 80 & type of | 
|---|
| 62 | ;     time is unscheduled, overtime, comptime THEN quit | 
|---|
| 63 | ; | 
|---|
| 64 | I TYP["d",TYP["P",TH=320,"4OosEe"[VAL Q | 
|---|
| 65 | ; | 
|---|
| 66 | ;     IF INT doctor & total hours = 80 THEN quit | 
|---|
| 67 | ; | 
|---|
| 68 | I TYP["I",$E(AC,1)="L",TH=320,"4OosEe"[VAL Q | 
|---|
| 69 | ; | 
|---|
| 70 | ;     IF type of time is anything but Leave Without Pay "W" or Non-Pay "n" | 
|---|
| 71 | ;     THEN increment total hrs HT & increment HTP.  Also update | 
|---|
| 72 | ;     ^TMP global for reference during the processing of On-Call (PRS8OC). | 
|---|
| 73 | ; | 
|---|
| 74 | I "Wn"'[VAL S HT=HT+1,HTP=HTP+1,^TMP($J,"PRS8",DAY,"HT")=HT | 
|---|
| 75 | ; | 
|---|
| 76 | ;--------------------------------------------------------- | 
|---|
| 77 | ;     IF entitled to VCS commission sales & normal time(1) ??(2,3) | 
|---|
| 78 | ;     & holiday excused set X to type of time=Piece Worker Hol excused. | 
|---|
| 79 | ;     Then IF part time set X to part time hours code. | 
|---|
| 80 | ; | 
|---|
| 81 | I $E(ENT,38),"123"[VAL,HOLEX S X=36 D CHK^PRS8HRSV D  Q:X | 
|---|
| 82 | .  I TYP["P" S X=32 D CHK^PRS8HRSV | 
|---|
| 83 | ; | 
|---|
| 84 | ;--------------------------------------------------------------- | 
|---|
| 85 | ; | 
|---|
| 86 | ;     Don't mess w/ fire fighters | 
|---|
| 87 | ; | 
|---|
| 88 | Q:"Ff"[TYP | 
|---|
| 89 | ; | 
|---|
| 90 | S GO=0 | 
|---|
| 91 | ;     IF compressed tour & parttime & tour hours are over 80 | 
|---|
| 92 | ;     OR tour hours = 80 & it's overtime, comptime, or unscheduled reg. | 
|---|
| 93 | ; | 
|---|
| 94 | ; Check for FT Compressed | 
|---|
| 95 | I $E(AC,2)=1,NH>319,FLX="C",("OoseE4"[VAL) S GO=1 | 
|---|
| 96 | ; | 
|---|
| 97 | ; Check for week | 
|---|
| 98 | I (TH(W)>160&("OoseE4"[VAL))!(TH(W)=160&("OosEe4"[VAL)) S GO=1 | 
|---|
| 99 | ; | 
|---|
| 100 | ; Check for day | 
|---|
| 101 | I HT>32,"OoseE4"[VAL S GO=1 | 
|---|
| 102 | ; | 
|---|
| 103 | ;     Following segment is concerned w/ variations of part time | 
|---|
| 104 | ;     employees (TYP["P"), & 1 baylor (TYP["B"). | 
|---|
| 105 | ;------------------------------------------------------------------- | 
|---|
| 106 | ; | 
|---|
| 107 | ;     Doctor over 8 hours | 
|---|
| 108 | ; | 
|---|
| 109 | I TYP["Pd",HT>32 S GO=0 ; part-time doctors PT + PH must = NH | 
|---|
| 110 | ; | 
|---|
| 111 | I TYP["P",HOLWKD S GO=0 | 
|---|
| 112 | ; | 
|---|
| 113 | ;     Baylor plan & ct/ot/s | 
|---|
| 114 | ; | 
|---|
| 115 | I TYP["B","EeOos"[VAL S GO=1 | 
|---|
| 116 | ; | 
|---|
| 117 | ;------------------------------------------------------------------- | 
|---|
| 118 | ;     GO set in cases where employee maybe eligible for OT | 
|---|
| 119 | ;     due to over > 8/day OR > 40/week. | 
|---|
| 120 | ; | 
|---|
| 121 | S X=0 I GO D TH^PRS8HRSV D OVER840^PRS8HROT Q | 
|---|
| 122 | ; | 
|---|
| 123 | ;------------------------------------------------------------------- | 
|---|
| 124 | ;------------------------------------------------------------------- | 
|---|
| 125 | ;     GO not set for compressed schedule of at least 80 hrs. | 
|---|
| 126 | ;     GO not set for non compressed schedule of over 40 hrs. | 
|---|
| 127 | ;     IF GO is set and we are evaluating normal hours or | 
|---|
| 128 | ;     HOLIDAY OVERTIME use NORMHRS to increment TIME | 
|---|
| 129 | ;     in week array.  THEN QUIT. | 
|---|
| 130 | ; | 
|---|
| 131 | S GO=1 | 
|---|
| 132 | I FLX="C",NH>319 S GO=0 | 
|---|
| 133 | I FLX'="C",NH(WK)>160,TYP'["Pd" S GO=0 ;IF pt-doctor don't set GO=0 | 
|---|
| 134 | I GO,"1235nHMLSWNARUXYVJFGD"[VAL!(VAL="O"&(HOLWKD)) D NORMHRS^PRS8HROT Q | 
|---|
| 135 | ; | 
|---|
| 136 | ;-------------------------------------------------------------------- | 
|---|
| 137 | ;   Check employees with Normal hours less than 80. (Baylor NH=320) | 
|---|
| 138 | ; | 
|---|
| 139 | I NH'>319!(($E(AC,2)=2)&(NH=320)) D TH^PRS8HRSV D  Q | 
|---|
| 140 | .I FLX="C" D  Q:X | 
|---|
| 141 | ..; | 
|---|
| 142 | ..; For PT employees review hours worked to determine X | 
|---|
| 143 | ..I "OosEe4"'[VAL S X=32  ; All tour time = PT/PH | 
|---|
| 144 | ..; | 
|---|
| 145 | ..; Checks for CT | 
|---|
| 146 | ..I "Ee"[VAL D | 
|---|
| 147 | ...; <8/DAY & <40/WK  = UN/US | 
|---|
| 148 | ...I HT'>32,TH(W)'>160 S X=9 Q | 
|---|
| 149 | ...S X=7 ; CE/CT | 
|---|
| 150 | ..; | 
|---|
| 151 | ..; Checks for all other types of time | 
|---|
| 152 | ..I "Oos4"[VAL D | 
|---|
| 153 | ...I HT>32 S X=TOUR+15 Q  ; DA/DE | 
|---|
| 154 | ...I TH(W)>160 S X=TOUR+19 Q  ; OA/OE | 
|---|
| 155 | ...S X=9 ; UN/US | 
|---|
| 156 | ..D CHK^PRS8HRSV | 
|---|
| 157 | .; | 
|---|
| 158 | .;     Under 8/day, 40/week, and not coded as overtime or comptime | 
|---|
| 159 | .;     or overtime on holiday. | 
|---|
| 160 | .; | 
|---|
| 161 | .; Checks for non-compressed employees | 
|---|
| 162 | .I HT'>32,TH(W)'>160,"OoseE"'[VAL!(VAL="O"&(HOLWKD)) S X=0 D  Q:X | 
|---|
| 163 | ..; | 
|---|
| 164 | ..;    Not intermittent, normal hours and not unscheduled reg. | 
|---|
| 165 | ..;    TIME gets parttime hours. | 
|---|
| 166 | ..; | 
|---|
| 167 | ..I TYP'["I",AV[VAL,VAL'=4 S X=32 D CHK^PRS8HRSV Q | 
|---|
| 168 | ..; | 
|---|
| 169 | ..;    All else fails - TIME gets unscheduled regular. | 
|---|
| 170 | ..; | 
|---|
| 171 | ..S X=9 D CHK^PRS8HRSV Q | 
|---|
| 172 | .; | 
|---|
| 173 | .;     Part time doctor w/ unscheduled reg. TIME gets unscheduled reg. | 
|---|
| 174 | .; | 
|---|
| 175 | .I TYP["P",TYP["d",VAL=4 S X=9 D CHK^PRS8HRSV Q | 
|---|
| 176 | .; | 
|---|
| 177 | .;     Over 8/day | 
|---|
| 178 | .; | 
|---|
| 179 | .I HT>32 D G8^PRS8HRSV Q:X | 
|---|
| 180 | .; | 
|---|
| 181 | .;     For all time left except comptime set TIME to appropriate OT | 
|---|
| 182 | .;     unless comptime has been worked earlier in the week making | 
|---|
| 183 | .;     the total hours less than 40, then TIME gets unscheduled reg. | 
|---|
| 184 | .;     COMPTIME OVER 8/DAY WILL BE CREDITED HERE | 
|---|
| 185 | .; | 
|---|
| 186 | .S X=$S("Ee"'[VAL:TOUR+19,(TH(W)'>160)&(HT'>32):9,1:7) | 
|---|
| 187 | .I TYP["P",VAL[4,TH(W)'>160,HT'>32 S X=9 | 
|---|
| 188 | .I TYP["P",VAL="O",TH(W)'>160,HT'>32 S X=9 | 
|---|
| 189 | .D CHK^PRS8HRSV | 
|---|
| 190 | Q | 
|---|