source: WorldVistAEHR/trunk/r/PAID-PRS/PRS8HR.m@ 1361

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

revised back to 6/30/08 version

File size: 6.9 KB
RevLine 
[623]1PRS8HR ;HISC/MRL,WCIOFO/JAH-DECOMPOSITION, HOURS ;05/05/06
2 ;;4.0;PAID;**2,22,29,42,52,102,108**;Sep 21, 1995
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 S AV="1235nHMLSWNARUXYVJFGD"
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 F M=1:1:96 D
38 . S VAL=$E(D,M)
39 .;
40 .; If non premium type of time or (overtime on holiday)
41 .;
42 . I AV[VAL!(VAL="O"&($E(DAY(DAY,"HOL"),M)=2)) D CALC
43 Q
44 ;
45 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 ;
47CALC ; --- Entry point for calculating placement of time
48 ;
49 ; Set up variables for calculations and comparisons in this routine
50 ;
51 N HOLWKD,HOLEX,HOLWKEX
52 D ^PRS8HRSV
53 ;
54 ; IF intermittent employee on continuation of pay OR overtime on
55 ; holiday THEN increment Pay Period tour hours and current weeks
56 ; tour hours.
57 ;
58 I TYP["I",VAL["V"!(VAL="O"&(HOLWKD)) S TH=TH+1,TH(W)=TH(W)+1
59 ;
60 ; IF part time doctor & total hours = 80 & type of
61 ; time is unscheduled, overtime, comptime THEN quit
62 ;
63 I TYP["d",TYP["P",TH=320,"4OosEe"[VAL Q
64 ;
65 ; IF INT doctor & total hours = 80 THEN quit
66 ;
67 I TYP["I",$E(AC,1)="L",TH=320,"4OosEe"[VAL Q
68 ;
69 ; IF type of time is anything but (leave w/out pay, comp time)
70 ; THEN increment total hrs(HT) & increment HTP if type of
71 ; time not non pay or leave w/out pay.
72 ;
73 ; Update daily counter - *102 added non-pay back into daily count
74 ;
75 S HT=HT+1,HTP=HTP+1
76 ;
77 ;---------------------------------------------------------
78 ; IF entitled to VCS commission sales & normal time(1) ??(2,3)
79 ; & holiday excused set X to type of time=Piece Worker Hol excused.
80 ; Then IF part time set X to part time hours code.
81 ;
82 I $E(ENT,38),"123"[VAL,HOLEX S X=36 D CHK^PRS8HRSV D Q:X
83 . I TYP["P" S X=32 D CHK^PRS8HRSV
84 ;
85 ;---------------------------------------------------------------
86 ;
87 ; Don't mess w/ fire fighters
88 ;
89 Q:"Ff"[TYP
90 ;
91 S GO=0
92 ; IF compressed tour & parttime & tour hours are over 80
93 ; OR tour hours = 80 & it's overtime, comptime, or unscheduled reg.
94 ;
95 ; Check for FT Compressed
96 I NH>319,FLX="C",("OoseE4"[VAL) S GO=1
97 ;
98 ; Check for week
99 I (TH(W)>160&("OoseE4"[VAL))!(TH(W)=160&("OosEe4"[VAL)) S GO=1
100 ;
101 ; Check for day
102 I HT>32,"OoseE4"[VAL S GO=1
103 ;
104 ; Following segment is concerned w/ variations of part time
105 ; employees (TYP["P"), & 1 baylor (TYP["B").
106 ;-------------------------------------------------------------------
107 ;
108 ; Doctor over 8 hours
109 ;
110 I TYP["Pd",HT>32 S GO=0 ; part-time doctors PT + PH must = NH
111 ;
112 I TYP["P",HOLWKD S GO=0
113 ;
114 ; Baylor plan & ct/ot/s
115 ;
116 I TYP["B","EeOos"[VAL S GO=1
117 ;
118 ;-------------------------------------------------------------------
119 ; GO set in cases where employee maybe eligible for OT
120 ; due to over > 8/day OR > 40/week.
121 ;
122 S X=0 I GO D TH^PRS8HRSV D OVER840^PRS8HROT Q
123 ;
124 ;-------------------------------------------------------------------
125 ;-------------------------------------------------------------------
126 ; GO not set for compressed schedule of at least 80 hrs.
127 ; GO not set for non compressed schedule of over 40 hrs.
128 ; IF GO is set and we are evaluating normal hours or
129 ; HOLIDAY OVERTIME use NORMHRS to increment TIME
130 ; in week array. THEN QUIT.
131 ;
132 S GO=1
133 I FLX="C",NH>319 S GO=0
134 I FLX'="C",NH(WK)>160,TYP'["Pd" S GO=0 ;IF pt-doctor don't set GO=0
135 I GO,"1235nHMLSWNARUXYVJFGD"[VAL!(VAL="O"&(HOLWKD)) D NORMHRS^PRS8HROT Q
136 ;
137 ;--------------------------------------------------------------------
138 ; Check employees with Normal hours less than 80. (Baylor NH=320)
139 ;
140 I NH'>319 D TH^PRS8HRSV D Q
141 .I FLX="C" D Q:X
142 ..;
143 ..; For PT employees review hours worked to determine X
144 ..I "OosEe4"'[VAL S X=32 ; All tour time = PT/PH
145 ..;
146 ..; Checks for CT
147 ..I "Ee"[VAL D
148 ...; <8/DAY & <40/WK = UN/US
149 ...I HT'>32,TH(W)'>160 S X=9 Q
150 ...S X=7 ; CE/CT
151 ..;
152 ..; Checks for all other types of time
153 ..I "Oos4"[VAL D
154 ...I HT>32 S X=TOUR+15 Q ; DA/DE
155 ...I TH(W)>160 S X=TOUR+19 Q ; OA/OE
156 ...S X=9 ; UN/US
157 ..D CHK^PRS8HRSV
158 .;
159 .; Under 8/day, 40/week, and not coded as overtime or comptime
160 .; or overtime on holiday.
161 .;
162 .; Checks for non-compressed employees
163 .I HT'>32,TH(W)'>160,"OoseE"'[VAL!(VAL="O"&(HOLWKD)) S X=0 D Q:X
164 ..;
165 ..; Not intermittent, normal hours and not unscheduled reg.
166 ..; TIME gets parttime hours.
167 ..;
168 ..I TYP'["I",AV[VAL,VAL'=4 S X=32 D CHK^PRS8HRSV Q
169 ..;
170 ..; All else fails - TIME gets unscheduled regular.
171 ..;
172 ..S X=9 D CHK^PRS8HRSV Q
173 .;
174 .; Part time doctor w/ unscheduled reg. TIME gets unscheduled reg.
175 .;
176 .I TYP["P",TYP["d",VAL=4 S X=9 D CHK^PRS8HRSV Q
177 .;
178 .; Over 8/day
179 .;
180 .I HT>32 D G8^PRS8HRSV Q:X
181 .;
182 .; For all time left except comptime set TIME to appropriate OT
183 .; unless comptime has been worked earlier in the week making
184 .; the total hours less than 40, then TIME gets unscheduled reg.
185 .; COMPTIME OVER 8/DAY WILL BE CREDITED HERE
186 .;
187 .S X=$S("Ee"'[VAL:TOUR+19,(TH(W)'>160)&(HT'>32):9,1:7)
188 .I TYP["P",VAL[4,TH(W)'>160,HT'>32 S X=9
189 .D CHK^PRS8HRSV
190 Q
191 ;
192 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193 ; ### DELETE UNLESS EARLIER CHECK WAS RESTORED
194CT2DAY() ;Determine if comptime eligible including 2 day tour.
195 ;
196 N TOUREC,TWODAY
197 S (RTN,TWODAY)=0
198 ;
199 ; IF time segment contains Scheduled or unscheduled comptime
200 ; or overtime and there is some time in tour hours worked THEN
201 ; check if it's a 2 day tour. For 2 day tours some of time worked
202 ; won't be in HT variable since it occured on other day of two
203 ; day tour, it's not valid to simply check the HT variable for
204 ; 8 hours of work. (patch PRS*4*22)
205 ;
206 I "OosEe4"[VAL,(HT>0),(NH>319) D
207 .S TOUREC=$P($G(DAY(DAY,0)),"^",2)
208 .I TOUREC>0 S TWODAY=$P($G(^PRST(457.1,TOUREC,0)),"^",5)
209 .I TWODAY="Y" S RTN=1
210 Q RTN
Note: See TracBrowser for help on using the repository browser.