Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PRS8AC

PRS8AC.m

Go to the documentation of this file.
  1. PRS8AC ;HISC/MRL-DECOMPOSITION, ACTIVITY STRING ;03/26/08
  1. ;;4.0;PAID;**40,45,54,52,69,75,90,96,112,117,125**;Sep 21, 1995;Build 6
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ;The primary purpose of this routine is to create the activity
  1. ;string [the "W" node] for each day of activity. While creating
  1. ;this string certain counts will also be tallied. These include
  1. ;Standby, On-Call and the various absence categories. Actual
  1. ;Call Back hrs are also counted in this routine for the purpose
  1. ;of reducing the OC later on in the process.
  1. ;
  1. ;Called by Routines: PRS8EX, PRS8ST.
  1. ;
  1. Q:VAR=""
  1. I $S($P(V,"^",1)="":1,$P(V,"^",2)="":1,1:0) Q ;no times
  1. S Q=0
  1. I DY>0,DY<15 D G END:Q
  1. .I DAY(DY,"OFF"),"LSWARUHFGDrZq"[VAR S Q=1 ;exc invalid day off VAR
  1. K OC,FLAG
  1. ;
  1. S DAYZ=DAY(DY,"W")_$G(DAY(DY,"N")),MTM=0
  1. S DAYH=$G(DAY(DY,"HOL"))_$G(DAY(DY+1,"HOL")) ;holiday node
  1. N DAYR
  1. S DAYR=DAY(DY,"r")_$G(DAY(DY,"rN")) ; Recess
  1. ;
  1. ;P 45 FIREFIGHTERS F NODE TO TRACK ADDITIONAL FF HRS
  1. S DAYF=$G(DAY(DY,"F"))
  1. ;
  1. F T=+V:1:+$P(V,"^",2) D
  1. .I +VAR,$E(DAYH,T),$E(DAYZ,T)?1A Q ;no override holiday
  1. .; Don't override Recess but allow Unscheduled Regular (VAR=4)
  1. .I +VAR,VAR'=4,$E(DAYR,T)="r" Q ; don't override Recess
  1. .I VAR="A"&(JURY=1) S VAR="J"
  1. .S VAR1=VAR Q:VAR1="" S DAYZ(1)=$E(DAYZ,T)
  1. .I "HhJLSARWMNUnVXYTFGDZq"[VAR1,$E(DAYZ,T)="m" Q
  1. .I T=+V,"12345E"[VAR1 S DAY(DY,"DWK")=1 ;count days worked
  1. .I T=+V,"Vh"[VAR1,TYP["I" S DAY(DY,"DWK")=1 ;count days worked for cop
  1. .I "JLSWNnARUXYFGDZq"[VAR1,T'>96,'$E(DAYZ,T) Q ;invalid outside tour
  1. .; Regular employees can't earn ct/use ot during work
  1. .I +NAWS'=9,"EOPQT4"[VAR1,T'>96,$E(DAYZ,T) Q
  1. .; 9mo AWS checks
  1. .I +NAWS=9,"PQT"[VAR1,T'>96,$E(DAYZ,T) Q ;can't earn ct/use ot during work
  1. .; Allow CT/OT/UN/ON if posted over Recess otherwise don't allow
  1. .I +NAWS=9,"4OECQ"[VAR1,T'>96,$E(DAYZ,T),$E(DAYR,T)'="r" S $E(DAYR,T)=VAR1 Q
  1. .I "OE"[VAR1,"BC"[DAYZ(1),$L(DAYZ(1)) D ; Change OT or CT to CB/SB OT
  1. ..S VAR1=$C($A($E(DAYZ,T))+32)
  1. ..I $E(DAYZ,T)="C",VAR="E" S VAR1="t" ; Comp time on on-call = "t"
  1. .I "BC"[VAR1,DAYZ(1)="O",$L(DAYZ(1)) D ; Change CB/SB to CB/SB OT
  1. ..S VAR1=$C($A($E(VAR1))+32)
  1. .I "Hh"[VAR1 D Q:VAR1="H"
  1. ..S DAYH=$E(DAYH,0,T-1)_$S(VAR1="H":1,$E(DAYZ,T)&($E(DAYZ,T)'=4)!(TYP["I")!(TYP["P"&(TYP["N"!(TYP["H")))!(VAR1="h"):2,1:0)_$E(DAYH,T+1,999) ;holiday node
  1. ..I VAR1="h" S VAR1="O" ;convert HW to OT
  1. ..I VAR="h",$E(DAYZ,T)=5 S FLAG=5
  1. .I $E(DAYZ,T)=5,"ALSRUFGDZq"[VAR1 S VAR1=$E(DAYZ,T)
  1. .I $E(DAYZ,T)="-","BbCctes"[VAR1 Q ;unavail for oc/sb or sch ot/ct
  1. .;
  1. .I VAR'="r" D
  1. ..S DAYZ=$E(DAYZ,0,T-1)_VAR1_$E(DAYZ,T+1,999)
  1. ..I $E($G(DAY(DY-1,"N")),T)'="",VAR1'=$E($G(DAY(DY-1,"N")),T) D
  1. ...S DAY(DY-1,"N")=$E(DAY(DY-1,"N"),0,T-1)_VAR1_$E(DAY(DY-1,"N"),T+1,999) ;save VAR
  1. ..; When processing tour time also copy tour into DAYR
  1. ..I "1235"[VAR1 D
  1. ...S DAYR=$E(DAYZ,0,T-1)_VAR1_$E(DAYZ,T+1,999)
  1. ...I $E($G(DAY(DY-1,"N")),T)'="",VAR1'=$E($G(DAY(DY-1,"N")),T) D
  1. ....S DAY(DY-1,"rN")=$E(DAY(DY-1,"rN"),0,T-1)_VAR1_$E(DAY(DY-1,"rN"),T+1,999)
  1. .;
  1. .; The following check will record Recess and will then update VAR1 to 0 which
  1. .; will result in the normally scheduled tour being marked as being no tour.
  1. .; This will allow Unscheduled Regular, OT and CT to be posted over the tour.
  1. .I VAR="r" D
  1. ..S DAYR=$E(DAYR,0,T-1)_VAR1_$E(DAYR,T+1,999)
  1. ..S DAYZ=$E(DAYZ,0,T-1)_0_$E(DAYZ,T+1,999) ; Overwrite tour
  1. ..I $E($G(DAY(DY-1,"rN")),T)'="",VAR1'=$E($G(DAY(DY-1,"rN")),T) D
  1. ...S DAY(DY-1,"rN")=$E(DAY(DY-1,"rN"),0,T-1)_VAR1_$E(DAY(DY-1,"rN"),T+1,999)
  1. ...S DAY(DY-1,"N")=$E(DAY(DY-1,"N"),0,T-1)_0_$E(DAY(DY-1,"N"),T+1,999)
  1. ..S Y=48 D SET ; Count Recess
  1. .;
  1. .I VAR1="J" S Y=5 D SET ;set authorized absence for jury duty
  1. .I VAR1="M" S Y=5 D SET ; authorized absence for ML
  1. .;ot on non-premium T&L
  1. .I ("Eocb"[VAR1!(VAR1="O"&'$E(DAYH,T)))&("^^10^11^12^13^15^16^17^"[("^"_$P(V,"^",4)_"^"))!(VAR1=5&("ALSRUFGDZq"[VAR))!(VAR1=4&(TYP["P"!(TYP["I"&(TYP["N"!(TYP["H"!($$HYBRID^PRSAENT1($G(DFN)))))))&("^7^9^11^12^14^17^"[("^"_$P(V,"^",4)_"^"))) D
  1. ..Q:$E(DAY(DY,"P"),T)=5&("ALSRUFGDZq"'[VAR)
  1. ..I $D(FLAG) S FLAG=VAR1,VAR1=5
  1. ..N CODE D
  1. ...I "^7^8^12^"[("^"_$P(V,"^",4)_"^")&(TYP["N"!(TYP["H")!($$HYBRID^PRSAENT1($G(DFN)))) S CODE="N" Q
  1. ...I "^7^8^12^"[("^"_$P(V,"^",4)_"^")&(PMP'="")&("^S^T^U^V^"[(U_PMP_U)) S CODE="N" Q
  1. ...I $P(V,"^",4)=11,($$HYBRID^PRSAENT1($G(DFN))) S CODE="N" Q
  1. ...I $P(V,"^",4)=11&(PMP'="")&("^S^T^U^V^"[(U_PMP_U)) S CODE="N" Q
  1. ...I "^7^8^9^11^"[("^"_$P(V,"^",4)_"^")&(TYP'["N")&(TYP'["H")&('$$HYBRID^PRSAENT1($G(DFN))) S CODE="n" Q
  1. ...I "^7^8^9^11^"[("^"_$P(V,"^",4)_"^")&("^S^T^U^V^"'[(U_PMP_U)) S CODE="n" Q
  1. ...I $P(V,"^",4)=17 S CODE="N" Q ; Code 17 - OT/CT with premiums
  1. ...I VAR1=5 S CODE=VAR Q
  1. ...S CODE=1
  1. ..S DAY(DY,"P")=$E(DAY(DY,"P"),0,T-1)_CODE_$E(DAY(DY,"P"),T+1,999)
  1. .I "ALSRUFGDZq"[VAR,VAR1=5 S VAR1=VAR
  1. .I $D(FLAG) S VAR1=FLAG K FLAG
  1. .;
  1. FOPTHR .; part time hrs (PT/PH 8b codes) for CODE O firefighters
  1. .I +VAR1,"Ff"[TYP,PMP="O",(NH=448!(NH>320&(NH(1)'=NH(2)))) S Y=32 D SET
  1. .;
  1. FRCPTHR .; part time hrs (PT/PH 8b codes) for code R & C firefighters
  1. .; don't include UNSCHEDULED REGULAR (var1=4)
  1. .I +VAR1,VAR1'=4,"Ff"[TYP,"RC"[PMP S Y=32 D SET
  1. .;
  1. .;patch 45 & 54
  1. .; Set non pay hrs in the basic tour for firefighters with premium
  1. .;pay indicator of C.
  1. .I "nW"[VAR1,"Ff"[TYP,"C"=PMP D
  1. ..;
  1. ..; Y designates location in WK array where NT/NH will be stored.
  1. ..; F node was set to 1 for periods of addtl ff hrs during 1st pass
  1. ..; thru scheduled ToD. Count NT/NH if this is not addtl ff hrs.
  1. ..;
  1. ..I '$E(DAY(DY,"F"),T) S Y=47 D SET
  1. .S S="LSWnAREUP HYXOVQTFGDZq" I S[VAR1&(DY>0&(DY<15)!(DY=0&(T>96))) D ;save in WK array
  1. ..S S(1)=$F(S,VAR1)-1
  1. ..S S=$P("1^2^3^4^5^6^0^8^0^9^24^42^43^0^33^54^19^44^45^46^53^55","^",S(1)) ;WK location
  1. ..Q:S=0
  1. ..; Patch *40 removed A (authorized absence) from leave counted in LU.
  1. ..; Patch *125 added LWOP as valid leave counted in LU
  1. ..; LU is only used to determine if night differential granted for
  1. ..; leave should be backed out.
  1. ..I TYP'["D","LSWRUFGDZq"[VAR1 S LU=LU+1 ;increment leave counter
  1. ..; p117 decrement total leave count for leave outside of pp
  1. ..I TYP'["D","LSWRUFGDZq"[VAR1,((DY=0)&(T<97))!((DY=14)&(T>96)),LU>0 S LU=LU-1
  1. ..S Y=S D SET S:TYP["D" Q=1
  1. ..K S,VAR1
  1. ;
  1. S DAY(DY,"W")=$E(DAYZ,1,96) ;todays activity
  1. S DAY(DY,"N")=$E(DAYZ,97,999) ;tomorrows activity from today/if any
  1. S DAY(DY,"r")=$E(DAYR,1,96) ; Today's Recess
  1. S DAY(DY,"rN")=$E(DAYR,97,999) ; Tomorrow's Recess/if any
  1. S:$E(DAY(DY,"P"),97,999)'="" DAY(DY,"P1")=$E(DAY(DY,"P"),97,999) ;non-prem ot for next day
  1. S DAY(DY,"P")=$E(DAY(DY,"P"),1,96) ;non-prem ot for today
  1. I DAY(DY,"N")?1"0"."0",DAY(DY,"rN")'["r" S DAY(DY,"N")=""
  1. S DAY(DY,"HOL")=$E(DAYH,1,96)
  1. ;
  1. ;P 45 FIREFIGHTER ADDITIONAL FIREFIGHTER HRS NODE FOR THIS DAY
  1. I $G(PRS8AFFH) D
  1. . N PRSFFHR,PRSF1,PRSF2,PRSF3,SEG1,SEG2
  1. .;
  1. .;GET THE POSITIONAL START AND STOPS FOR THIS SEGMENT
  1. . S SEG1=$P(V,U,1),SEG2=$P(V,U,2)
  1. .;EXISTING PORTION OF F NODE UP TO CURRENT SEGMENT
  1. . S PRSF1=$E(DAYF,1,SEG1-1)
  1. .;CURRENT SEGMENT UP TO END OF DAY
  1. . S PRSF2=$E(DAYZ,SEG1,SEG2)
  1. .;CURRENT F NODE PAST CURRENT SEGMENT TO END OF THE TOUR WHICH
  1. .;MAY FALL IN TODAY OR NEXT DAY.
  1. .S PRSF3=$E(DAYF,SEG2+1,999)
  1. .;
  1. .;UPDATE THE DAY ARRAY AND THE TMP GLOBAL WITH WORK STRING.
  1. .;EACH CHAR THAT IS SET TO 1 REPRESENTS A 15 MIN SEGMENT THAT
  1. .;THE FIREFIGHTER WAS SCHEDULED FOR ADDITIONAL FF HRS.
  1. .;FOR TOURS CROSSING MIDNIGHT THIS STRING WILL BE LONGER THAN 96
  1. .;CHARACTERS. CHARACTERS IN POSITIONS PAST 96 REPRESENT TIMES PAST
  1. .;MIDNIGHT OF THE CURRENT DAY (TOMORROW).
  1. .S PRSFFHR=PRSF1_PRSF2_PRSF3
  1. .S DAY(DY,"F")=PRSFFHR
  1. .S ^TMP($J,"PRS8",DY,"F")=PRSFFHR
  1. ;
  1. I DY<15 S X=$E(DAYH,97,999) I X'?."0" S ^TMP($J,"PRS8",DY+1,"HOL")=X_$E($G(^TMP($J,"PRS8",DY+1,"HOL")),$L(X)+1,999),DAY(DY+1,"HOL")=X
  1. ;
  1. MOVE ; --- entry point for just moving previous days hrs to today
  1. I $D(DAY(DY-1,"N")),$L(DAY(DY-1,"N")) D
  1. .S X=DAY(DY-1,"N")_$E(DAY(DY,"W"),$L(DAY(DY-1,"N"))+1,96)
  1. .S DAY(DY,"W")=X
  1. I $D(DAY(DY-1,"P1")),$L(DAY(DY-1,"P1")) D
  1. .S X=DAY(DY-1,"P1")_$E(DAY(DY,"P"),$L(DAY(DY-1,"P1"))+1,96)
  1. .S DAY(DY,"P")=X
  1. I $D(DAY(DY-1,"rN")),$L(DAY(DY-1,"rN")) D
  1. .S X=DAY(DY-1,"rN")_$E(DAY(DY,"r"),$L(DAY(DY-1,"rN"))+1,96)
  1. .S DAY(DY,"r")=X
  1. ;
  1. END ; --- all done here
  1. K CNT,OC,Q,S,SB,SL,SLP,T,VAR1,X,Y Q
  1. ;
  1. SET ; --- set WK variable
  1. I (DY=0&(T<97))!(DY=14&(T>96))!(DY>14) Q
  1. S ZZ=WK,WK=$S(DY>7:2,1:1)
  1. I TYP'["D",DY=7,T>96 S WK=2
  1. S $P(WK(WK),"^",Y)=$P(WK(WK),"^",Y)+1
  1. ;
  1. ; The passing of Public Law 106-554 allows taking ML in hours.
  1. ; ML will now be recorded in 15 minute segments in the WK(3) array
  1. ; for employees entitled to take ML in hours. PRS*4.0*69
  1. ;
  1. I VAR1="M",$$MLINHRS^PRSAENT(DFN) D
  1. . S WK=3,Y=11
  1. . S $P(WK(WK),"^",Y)=$P(WK(WK),"^",Y)+1
  1. ;
  1. ; IF a part-time employee and they have either LWOP or Non-Pay
  1. ; THEN decrement total hours for the week and the pay period.
  1. ; PRS*4.0*52.
  1. ;
  1. I "Wn"[VAR1,TYP["P" S TH=TH-1,TH(WK)=TH(WK)-1
  1. S WK=ZZ Q