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

PRS8OTFF.m

Go to the documentation of this file.
  1. PRS8OTFF ;WCIOFO/MGD-OVERTIME/UNSCH FOR CODE R,C FIREFIGHTERS ;01/11/08
  1. ;;4.0;PAID;**45,54,102,117**;Sep 21, 1995;Build 32
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ; routine called from PRS8ST when a premium pay indicator for
  1. ; a firefighter is R or C.
  1. ;
  1. FFOTUN ;CALCULATE CODE R AND C FIREFIGHTERS OVERTIME AND UNSCHEDULED REGULAR
  1. ;
  1. N SCHWRK,XTRAWRK
  1. ;
  1. ;Count up scheduled and unscheduled work for week 1 and 2
  1. ;
  1. D WORKCNT(.SCHWRK,.XTRAWRK,.XWRK)
  1. ;
  1. ; Determine overtime and unscheduled based on 53/106 hour rule
  1. ; and update the week array with OA/OE, RA/RE and UN/US.
  1. ; Code C and R firefighters overtime calculation is the same
  1. ; whether on compressed tour or not.
  1. ;
  1. D CALCOT(.SCHWRK,.XTRAWRK,.XWRK)
  1. ;
  1. Q
  1. ;
  1. ;==============================================================
  1. ;
  1. WORKCNT(SCHWRK,XTRAWRK,XWRK) ;
  1. ;
  1. ;VARIABLE LIST
  1. ; DAY: current day of pay period--1 through 14 and 1st day of next (15)
  1. ; WEEK: Week 1 or 2 of pay period--days 1-7 are week 1, 8-14 week 2.
  1. ; QHRCNT: Counter for a single Quarter Hour segment of day. There are
  1. ; 96 quarter hours in a 24 hour day.
  1. ; EXCSTR: 96 char day string with exceptions
  1. ; WRKSTR: 96 char string with work codes.
  1. ; AFFSTR: 96 char string with additional fire fighter hour segments
  1. ; coded with 1's.
  1. ; XWRK: string of extra work time
  1. ; QHTCODE: Time code for a single quarter hour segment.
  1. ; 1:scheduled work A:annual leave S:sick leave,
  1. ; W:leave without pay n:non pay status U:comp used,
  1. ; E:comp earned M:military leave X:training,
  1. ; Y:travel O:overtime 4:unscheduled,
  1. ; T:ot in travel B:standby C:on call,
  1. ; N:non pay annual lv h:holiday worked F:Care and Bereavement
  1. ; G:adoption D:donor leave R:restored annual leave
  1. ; M:military leave J:jury duty n:non pay time
  1. ; V:continuation of pay e:sched comp earn s:scheduled OT
  1. ; Note: T:overtime for travel is counted elsewhere so it can not
  1. ; also be recounted as overtime here.
  1. ;
  1. N DAY,WEEK,QHRCNT,QHRSEG,WRKSTR,QHTCODE,HOLIDAY
  1. ;
  1. ;Initialize scheduled work and xtra work counters
  1. ;
  1. F WEEK=1:1:2 S (SCHWRK(WEEK),XTRAWRK(WEEK))=0,XWRK(WEEK)=""
  1. ;
  1. ;Loop through Each day of the pay period
  1. ;
  1. F DAY=1:1:14 D
  1. .S WEEK=$S(DAY>7:2,1:1)
  1. .S WRKSTR=$G(^TMP($J,"PRS8",DAY,"W")) ; work node includes addt ff hrs.
  1. .;
  1. .; loop through each 15 min increment of the current day
  1. .; totaling scheduled and unscheduled work
  1. .;
  1. .F QHRCNT=1:1:96 S QHTCODE=$E(WRKSTR,QHRCNT) Q:'$L(QHTCODE) D
  1. . . ;
  1. . . ; SET HOLIDAY TO 0,1,2 FOR NO HOLIDAY, HOL EXUSED, OR HOLIDAY WORKED
  1. . . ;
  1. . . S HOLIDAY=$$HOLIDAY(QHRCNT,DAY)
  1. . . ;
  1. . . ; INCREMENT SCHEDULED WORK IF ACCOUNTED FOR WITH APPROPRIATE CODE.
  1. . . I "1SLWAUXYBCFGDJRMVnZq"[QHTCODE!(QHTCODE="O"&(HOLIDAY=2)) D
  1. . . . S SCHWRK(WEEK)=SCHWRK(WEEK)+1
  1. . . ;
  1. . . ; Increment any unscheduled work or unscheduled CT or OT
  1. . . I "4EeOs"[QHTCODE&(HOLIDAY<1) D
  1. . . . S XTRAWRK(WEEK)=XTRAWRK(WEEK)+1
  1. . . . S XWRK(WEEK)=XWRK(WEEK)_QHTCODE
  1. ;
  1. Q
  1. ;
  1. ;==============================================================
  1. ;
  1. CALCOT(SW,XW,XWS) ;
  1. ; Update the week array with overtime
  1. ;
  1. ;Possible permutations of Scheduled and Unscheduled
  1. ; |
  1. ; 53|HRS
  1. ; |
  1. ; 1. SSSSSSSSSSSSSSSSSSSSS|SSSSSSSSS
  1. ; 2. SSSSSSSSSSSSSSSSSSSSS|SSSSSUUUUUUUUUUUU
  1. ; 3. SSSSSSSSSSSSSSSSSSSSS|UUUUUUUUUUUUU
  1. ; 4. SSSSSSSSSSSSSSSSUUUUU|UUUUUUUUUUU
  1. ; 5. SSSSSSSSSSSSSSSSSS |
  1. ; 6. SSSSSSSSSSSSUUU |
  1. ;
  1. ; |------------------------------------------|
  1. ; | After Patch 85 |<= 212 |> 212 |
  1. ; |------------------------------------------|
  1. ; |Code| Type of Time | Piece | Piece |
  1. ; |------------------------------------------|
  1. ; | ** |All Scheduled Time | | 26 |
  1. ; | 4 |Unscheduled Regular | 9 | 20 |
  1. ; | E |Comp Time Earned | 9 | 7 |
  1. ; | e |Scheduled Comp Time | 9 | 20 |
  1. ; | O |Overtime | 9 | 20 |
  1. ; | s |Scheduled Overtime | 9 | 20 |
  1. ; |------------------------------------------|
  1. ;
  1. N I,P,WEEK,Y,Z
  1. F WEEK=1:1:2 D
  1. . ;
  1. . ; Post Regular Scheduled Hours In Excess of 53 as RA/RE
  1. . ; Scenarios 1 & 2
  1. . I SW(WEEK)>212 D
  1. . . S Y=SW(WEEK)-212,P=26 D SET
  1. . ;
  1. . ; Post Extra Hours per chart. Scenarios 2,3,4 & 6
  1. . I $L(XWS(WEEK))>0 D
  1. . . S Y=1
  1. . . ;
  1. . . ; step thru extra time segments
  1. . . F I=1:1:$L(XWS(WEEK)) D
  1. . . . S Z=$E(XWS(WEEK),I)
  1. . . . S P=$S(SW(WEEK)+I'>212:9,Z="E":7,Z="e":20,Z="s":20,1:20)
  1. . . . D SET
  1. . . . ;
  1. . . . ; If Scheduled OT or CT after 53 hours, also count as Unscheduled Regular
  1. . . . I P=26 S P=9 D SET
  1. Q
  1. ;
  1. ;==============================================================
  1. ;
  1. SET ; Set sleep time into WK array
  1. S $P(WK(WEEK),"^",P)=$P(WK(WEEK),"^",P)+Y
  1. Q
  1. ;
  1. ;==============================================================
  1. ;
  1. HOLIDAY(TIMESEG,DAY) ;
  1. ;INPUT:
  1. ; DAY--day of pay period 1 through 14 or 15 for 1st day of next pp
  1. ; TIMESEG--position in 96 character day string (1 to 96)
  1. ;OUTPUT:
  1. ; code for holiday worked, holiday exused or neither from the
  1. ; ^TMP($J,"PRS8",DAY,"HOL") global
  1. ; holiday worked coded: 2
  1. ; holiday exused coded: 1
  1. ; neither coded: 0
  1. ;
  1. Q $E($G(^TMP($J,"PRS8",DAY,"HOL")),TIMESEG)