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