source: WorldVistAEHR/trunk/r/PAID-PRS/PRS8OTFF.m@ 949

Last change on this file since 949 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1PRS8OTFF ;WIRMFO/MGD-OVERTIME/UNSCH FOR CODE R,C FIREFIGHTERS ;10/24/2005
2 ;;4.0;PAID;**45,54,102**;Sep 21, 1995
3 ;
4 ; routine called from PRS8ST when a premium pay indicator for
5 ; a firefighter is R or C.
6 ;
7FFOTUN ;CALCULATE CODE R AND C FIREFIGHTERS OVERTIME AND UNSCHEDULED REGULAR
8 ;
9 N SCHWRK,XTRAWRK
10 ;
11 ;Count up scheduled and unscheduled work for week 1 and 2
12 ;
13 D WORKCNT(.SCHWRK,.XTRAWRK,.XWRK)
14 ;
15 ; Determine overtime and unscheduled based on 53/106 hour rule
16 ; and update the week array with OA/OE, RA/RE and UN/US.
17 ; Code C and R firefighters overtime calculation is the same
18 ; whether on compressed tour or not.
19 ;
20 D CALCOT(.SCHWRK,.XTRAWRK,.XWRK)
21 ;
22 Q
23 ;
24 ;==============================================================
25 ;
26WORKCNT(SCHWRK,XTRAWRK,XWRK) ;
27 ;
28 ;VARIABLE LIST
29 ; DAY: current day of pay period--1 through 14 and 1st day of next (15)
30 ; WEEK: Week 1 or 2 of pay period--days 1-7 are week 1, 8-14 week 2.
31 ; QHRCNT: Counter for a single Quarter Hour segment of day. There are
32 ; 96 quarter hours in a 24 hour day.
33 ; EXCSTR: 96 char day string with exceptions
34 ; WRKSTR: 96 char string with work codes.
35 ; AFFSTR: 96 char string with additional fire fighter hour segments
36 ; coded with 1's.
37 ; XWRK: string of extra work time
38 ; QHTCODE: Time code for a single quarter hour segment.
39 ; 1:scheduled work A:annual leave S:sick leave,
40 ; W:leave without pay n:non pay status U:comp used,
41 ; E:comp earned M:military leave X:training,
42 ; Y:travel O:overtime 4:unscheduled,
43 ; T:ot in travel B:standby C:on call,
44 ; N:non pay annual lv h:holiday worked F:Care and Bereavement
45 ; G:adoption D:donor leave R:restored annual leave
46 ; M:military leave J:jury duty n:non pay time
47 ; V:continuation of pay e:sched comp earn s:scheduled OT
48 ; Note: T:overtime for travel is counted elsewhere so it can not
49 ; also be recounted as overtime here.
50 ;
51 N DAY,WEEK,QHRCNT,QHRSEG,WRKSTR,QHTCODE,HOLIDAY
52 ;
53 ;Initialize scheduled work and xtra work counters
54 ;
55 F WEEK=1:1:2 S (SCHWRK(WEEK),XTRAWRK(WEEK))=0,XWRK(WEEK)=""
56 ;
57 ;Loop through Each day of the pay period
58 ;
59 F DAY=1:1:14 D
60 .S WEEK=$S(DAY>7:2,1:1)
61 .S WRKSTR=$G(^TMP($J,"PRS8",DAY,"W")) ; work node includes addt ff hrs.
62 .;
63 .; loop through each 15 min increment of the current day
64 .; totaling scheduled and unscheduled work
65 .;
66 .F QHRCNT=1:1:96 S QHTCODE=$E(WRKSTR,QHRCNT) Q:'$L(QHTCODE) D
67 . . ;
68 . . ; SET HOLIDAY TO 0,1,2 FOR NO HOLIDAY, HOL EXUSED, OR HOLIDAY WORKED
69 . . ;
70 . . S HOLIDAY=$$HOLIDAY(QHRCNT,DAY)
71 . . ;
72 . . ; INCREMENT SCHEDULED WORK IF ACCOUNTED FOR WITH APPROPRIATE CODE.
73 . . I "1SLWAUXYBCFGDJRMVn"[QHTCODE!(QHTCODE="O"&(HOLIDAY=2)) D
74 . . . S SCHWRK(WEEK)=SCHWRK(WEEK)+1
75 . . ;
76 . . ; Increment any unscheduled work or unscheduled CT or OT
77 . . I "4EeOs"[QHTCODE&(HOLIDAY<1) D
78 . . . S XTRAWRK(WEEK)=XTRAWRK(WEEK)+1
79 . . . S XWRK(WEEK)=XWRK(WEEK)_QHTCODE
80 ;
81 Q
82 ;
83 ;==============================================================
84 ;
85CALCOT(SW,XW,XWS) ;
86 ; Update the week array with overtime
87 ;
88 ;Possible permutations of Scheduled and Unscheduled
89 ; |
90 ; 53|HRS
91 ; |
92 ; 1. SSSSSSSSSSSSSSSSSSSSS|SSSSSSSSS
93 ; 2. SSSSSSSSSSSSSSSSSSSSS|SSSSSUUUUUUUUUUUU
94 ; 3. SSSSSSSSSSSSSSSSSSSSS|UUUUUUUUUUUUU
95 ; 4. SSSSSSSSSSSSSSSSUUUUU|UUUUUUUUUUU
96 ; 5. SSSSSSSSSSSSSSSSSS |
97 ; 6. SSSSSSSSSSSSUUU |
98 ;
99 ; |------------------------------------------|
100 ; | After Patch 85 |<= 212 |> 212 |
101 ; |------------------------------------------|
102 ; |Code| Type of Time | Piece | Piece |
103 ; |------------------------------------------|
104 ; | ** |All Scheduled Time | | 26 |
105 ; | 4 |Unscheduled Regular | 9 | 20 |
106 ; | E |Comp Time Earned | 9 | 7 |
107 ; | e |Scheduled Comp Time | 9 | 20 |
108 ; | O |Overtime | 9 | 20 |
109 ; | s |Scheduled Overtime | 9 | 20 |
110 ; |------------------------------------------|
111 ;
112 N I,P,WEEK,Y,Z
113 F WEEK=1:1:2 D
114 . ;
115 . ; Post Regular Scheduled Hours In Excess of 53 as RA/RE
116 . ; Scenarios 1 & 2
117 . I SW(WEEK)>212 D
118 . . S Y=SW(WEEK)-212,P=26 D SET
119 . ;
120 . ; Post Extra Hours per chart. Scenarios 2,3,4 & 6
121 . I $L(XWS(WEEK))>0 D
122 . . S Y=1
123 . . ;
124 . . ; step thru extra time segments
125 . . F I=1:1:$L(XWS(WEEK)) D
126 . . . S Z=$E(XWS(WEEK),I)
127 . . . S P=$S(SW(WEEK)+I'>212:9,Z="E":7,Z="e":20,Z="s":20,1:20)
128 . . . D SET
129 . . . ;
130 . . . ; If Scheduled OT or CT after 53 hours, also count as Unscheduled Regular
131 . . . I P=26 S P=9 D SET
132 Q
133 ;
134 ;==============================================================
135 ;
136SET ; Set sleep time into WK array
137 S $P(WK(WEEK),"^",P)=$P(WK(WEEK),"^",P)+Y
138 Q
139 ;
140 ;==============================================================
141 ;
142HOLIDAY(TIMESEG,DAY) ;
143 ;INPUT:
144 ; DAY--day of pay period 1 through 14 or 15 for 1st day of next pp
145 ; TIMESEG--position in 96 character day string (1 to 96)
146 ;OUTPUT:
147 ; code for holiday worked, holiday exused or neither from the
148 ; ^TMP($J,"PRS8",DAY,"HOL") global
149 ; holiday worked coded: 2
150 ; holiday exused coded: 1
151 ; neither coded: 0
152 ;
153 Q $E($G(^TMP($J,"PRS8",DAY,"HOL")),TIMESEG)
Note: See TracBrowser for help on using the repository browser.