Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (14 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/PAID-PRS/PRS8HRSV.m

    r613 r623  
    1 PRS8HRSV        ;WCIOFO/JAH-HOLIDAY FLAG, TIME CHECKER, WK() SET; 04/05/07
    2         ;;4.0;PAID;**29,52,102,108,112**;Sep 21, 1995;Build 54
    3         ;;Per VHA Directive 2004-038, this routine should not be modified.
    4         ;  Set up variable for holiday worked or holiday excused
    5         ;  Holiday worked coded 2 in DAY array
    6         ;  Holiday excused coded 1 in DAY array
    7         ;  A NON holiday is coded as all zero's in day array.
    8         ;
    9         ;  HOLIDAY WORKED
    10         S HOLWKD=$E(DAY(DAY,"HOL"),M)=2
    11         ;
    12         ;  HOLIDAY EXCUSED
    13         S HOLEX=$E(DAY(DAY,"HOL"),M)=1
    14         ;
    15         ;  HOLIDAY EXCUSED OR HOLIDAY WORKED
    16         S HOLWKEX=$E(DAY(DAY,"HOL"),M)
    17         Q
    18         ;
    19         ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    20         ;
    21 CHK     ; --- Check ENT for acceptable X value
    22         ;    Pieces of Y have values in locations corresponding to premium
    23         ;    times in value of X.  Values in Y string are locations
    24         ;    in entitlement string where associated time in X is
    25         ;    located.
    26         ;   --------------------------------------------------
    27         ;                 | Fixed      |  Premium
    28         ;     Piece       | Position in|  Type Of Time
    29         ;    Of Y-String  | Entitlement|
    30         ;    & **WK()     | String     |
    31         ;    -----------  | -----------|  --------------------
    32         ;        7        |    28      |  comp earned
    33         ;        9        |     2      |  unscheduled regular
    34         ;       16        |    19      |  hrs excess 8-d
    35         ;       17        |    20      |  hrs excess 8-d2
    36         ;       18        |    21      |  hrs excess 8 d3
    37         ;       20        |    12      |  OT total hrs d
    38         ;       21        |    13      |  OT total hrs d2
    39         ;       22        |    14      |  OT total hrs d3
    40         ;   ---------------------------------------------------
    41         ;
    42         N ZZ S Y="^^^^^^28^^2^^^^^^^19^20^21^^12^13^14^^^^3^4^^^^"
    43         ;
    44         ;   Set Y to a premium time in Y string, based on X
    45         ;   OR set Y to zero if X is a non premium time or parttime hours.
    46         ;
    47         I X'=32 S Y=+$P(Y,"^",X)
    48         ;
    49         ;   IF Y is premium time & not Unscheduled regular but employee not
    50         ;   ENTITLED to that type of time THEN set X to zero.
    51         ;
    52         I +Y,Y'=2,'$E(ENT,+Y) S X=0
    53         ;
    54         ;   Overtime & Not entitled set X & Y to unscheduled regular
    55         ;
    56         I "^12^13^14^"[("^"_Y_"^"),'X S X=9,Y=2
    57         ;
    58         ;   IF regular unscheduled (Y=2) & not hourly for regular unscheduled
    59         ;   THEN set X=0, unless Baylor then X gets regular unscheduled.
    60         ;
    61         I X,Y=2,$E(ENT,+Y)'="H" S X=$S(TYP'["B":0,1:9)
    62         ;
    63         ;   IF 36/40 AWS with WP determine eligibility for OT/CT
    64         ;   Skip this check if time is HW (X=29) or OT on Hol (X=24)
    65         ;   
    66         I "KM"[$E(AC,1),$E(AC,2)=1,$P(C0,U,16)=72,X'=32,X'=29,X'=24 D
    67         . I HT>32 S X=$S(VAL="O":TOUR+15,VAL="e":7,1:X)  Q
    68         . I TH(W)>160 S X=$S(VAL="O":TOUR+19,VAL="e":7,1:X)  Q
    69         . I HT'>32,TH(W)'>160 S X=9
    70         ;
    71         ;   If X is hours in excess of 8/day & > 40/week & type of time
    72         ;   is compensatory time X = 0
    73         ;
    74         I "^16^17^18^"[("^"_X_"^"),TH(WK)>160,"Ee"[VAL S X=0
    75         ;
    76         ;   ** Significance of checking "X" now as opposed to Y.
    77         ;
    78         K Y Q:'X
    79         ;
    80         ;   (Hours excess 8/day, OT hours, Reg hours @ OT rate, Holiday hours,
    81         ;   part time hours) OR unscheduled regular & Nurse or Nurse Hybrid.
    82         ; ### DO WE NEED TO ADD !HYBRID TO THIS CHECK ???
    83         I "^16^17^18^20^21^22^29^30^31^32^"[("^"_X_"^")!(X=9&(TYP["N"!(TYP["H"))) D
    84         .;
    85         .;     If today holiday or holiday benefit day for employee
    86         .;
    87         .I $$HOLIDAY^PRS8UT(PY,DFN,DAY) D  Q:'X
    88         ..;
    89         ..;     If part time hours & entitled to (Holiday [Shift day, 2 or 3])
    90         ..;
    91         ..I X=32,$E(ENT,TOUR+21),HOLWKD S ZZ=X,X=$S($G(DAY(DAY,"OFF"))'=1:TOUR+28,1:9) D SET S X=$S(TYP'["I":ZZ,1:9) Q
    92         ..;
    93         ..;     IF not part time hours & intermittent employee & employee
    94         ..;     entitled to holiday overtime & holiday worked THEN set TIME
    95         ..;     to OT on Holiday and credit that TIME in SET.
    96         ..;
    97         ..I X'=32,TYP["I",$E(ENT,25),HOLWKD S ZZ=X,X=24 D SET S X=0
    98         ..;
    99         ..;     IF conditions same as above except employee is NOT entitled
    100         ..;     to Holiday OT THEN use X as coded to credit TIME.
    101         ..;
    102         ..I X'=32,TYP["I",'$E(ENT,25),HOLWKD S ZZ=0 D SET S X=9
    103         ..;
    104         ..;     IF not part time hours & emp. is entitled to Holiday OT But
    105         ..;     they did not work the holiday THEN if emp. is part time or
    106         ..;     intermittent set type of time to Regular hrs @ OT rate 3
    107         ..;     otherwise OT @ Holiday rate & IF the original coded TIME
    108         ..;     NOT = reg hrs @ OT rate(shift D,2,3) THEN credit TIME at
    109         ..;     OT on holiday or Reg hours @ OT rate.  THEN also credit time
    110         ..;     as unscheduled regular.  ** why code time twice?
    111         ..;
    112         ..I X'=32,$E(ENT,25),'HOLWKD D
    113         ...S ZZ=X
    114         ...; for 36/40 AWS w/ WP or NP report OT on Holiday as (OK/OS)
    115         ...; For 9mo AWS w/ Recess report OT on Holiday as (OK/OS)
    116         ...I +NAWS,VAL["O",$E(DAY(DAY,"HOL"),M)=0 S X=24 D SET S X=0 Q
    117         ...;
    118         ...S X=$S(TYP["P"!(TYP["I"):TOUR+28,1:24) D SET
    119         ...I TYP["P"!(TYP["I") S X=9 D SET
    120         ...S X=0
    121         .;
    122         .;     IF type of time is part time hours for intermittent employee
    123         .;     THEN set TIME = unscheduled regular.
    124         .;
    125         .I X=32,TYP["I" S X=9
    126         .;
    127         .;    Part time hours or unscheduled regular.
    128         .;
    129         .Q:X=32!(X=9)
    130         .;
    131         .;     IF employee worked holiday THEN set TIME to zero & if original
    132         .;     coded type of time is NOT regular hours @ OT rate DO
    133         .;
    134         .I HOLWKD S ZZ=X,X=0 D
    135         ..;
    136         ..;     IF entitled to Holiday pay for this shift THEN set TIME
    137         ..;     to Holiday HRS (shift d, 2 or 3)
    138         ..;
    139         ..I $E(ENT,TOUR+21) S X=TOUR+28
    140         ;
    141         ;     IF employee is part time & either a nurse or nurse hybrid
    142         ;     & they worked the holiday
    143         ; ### SHOULD HYBRID BE ADDED TO THIS CHECK  HOW SHOULD THESE HYBRIDS
    144         ; ### TREATED ON A HOLIDAY
    145         I TYP["P",TYP["N"!(TYP["H"),HOLWKD,X=32 D
    146         .;
    147         .;     J gets start & stop times for employee's holiday tour.
    148         .;     Start/stop times are represented w/ natural numbers
    149         .;     from 0-96.  Each 15 minute segment of the 24 hour period
    150         .;     beginning & ending at midnight can be represented w/
    151         .;     a positive integer.  I.e.  1 = mid-12:15am,
    152         .;     2 = 12:15-12:30a ... 96 = 11:45pm-mid.
    153         .;
    154         .;     Loop thru each set of start & stop times.  IF the single
    155         .;     1/4 hr segment we're working w/ falls w/in any of the nurses
    156         .;     start & stop times THEN set TIME to Holiday Hours Day.
    157         .;
    158         .N I,J S J=$G(^TMP($J,"PRS8",DAY,"HWK")),ZZ=X
    159         .;
    160         .F I=1:2 Q:$P(J,U,I)=""  I M'<$P(J,U,I),M'>$P(J,U,I+1) S X=29
    161         .;
    162         .;     Holiday hrs-Day. reset X if 2 day tour.  Otherwise X = 0.
    163         .;
    164         .I X=29 D SET S X=$S($P(^PRST(457.1,$P(DAY(DAY-1,0),U,2),0),U,5)="Y":ZZ,1:0)
    165         ;
    166         ;
    167 SET     ; --- Set value into WK array
    168         ;
    169         ; Nurses on the 36/40 AWS are FT with Normal Hours of 72.  Nurses on the 9 month
    170         ; AWS are PT with Normal Hours of 80.  Neither will not have Part Time Hours
    171         ; counted in their 8B string.
    172         ;
    173         Q:$E(AC,2)=1&($P(C0,U,16)=72)&(X=32)  ; 36/40 AWS
    174         Q:$E(AC,2)=2&(NH=320)&(X=32)  ; 9month AWS before any Recess processed
    175         ;
    176         ;     Full time employee & part time hours & normal hours WK1 + WK2
    177         ;     = biweekly normal hours.
    178         ;
    179         I $P(C0,"^",10)=1,X=32,NH(1)+NH(2)=NH Q
    180         ;
    181         ;     For all types of TIME, increment the WK array.
    182         ;
    183         I +X D  Q
    184         . S $P(WK(W),"^",+X)=$P(WK(W),"^",+X)+1
    185         ;
    186         ;     When X is zero, reset to originally coded time.
    187         ;
    188         I 'X S X=ZZ Q
    189         Q
    190         ;
    191         ;
    192 TH      ; --- increment total hours & compensatory time hours.
    193         ; Posted RG/OT/CT that is >8/day but < 40/week and < 80/pp will not be
    194         ; counted in TH or TH(W)
    195         ;
    196         ; I $S(VAL=4:1,"osEe"[VAL!(VAL="O"&('HOLWKD)):1,1:0) S TH=TH+1,TH(W)=TH(W)+1
    197         ;
    198         I $S(VAL=4:1,"osEe"[VAL!(VAL="O"&('HOLWKD)):1,1:0) D
    199         . Q:(HT>32)&(TH(W)<160)&(NH<320)&($E(ENT,19)=1)
    200         . Q:(HT>32)&(TH(W)<160)&(NH=320)&($E(ENT,19)=1)&($E(AC,2)=2)  ; 9month AWS
    201         . S TH=TH+1,TH(W)=TH(W)+1
    202         Q
    203         ;
    204         ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    205         ;
    206 G8      ; --- Check for greater than 8 hours in day
    207         ;
    208         Q:HTP'>32!(VAL="E")
    209         ;
    210         ; Checks for Hours Excess 8/day (DA/DE)
    211         S X=TOUR+15 D CHK^PRS8HRSV
    212         I X,NH<320,CYA2806>0 S CYA2806=CYA2806-1
    213         Q:X
    214         ;
    215         ; Checks for OT Total Hours (OA/OE)
    216         I TYP["I"!(TYP["P"),TYP'["B",TH(W)>160 S X=TOUR+19 D CHK^PRS8HRSV
    217         Q
    218         ;
    219         ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     1PRS8HRSV ;WCIOFO/JAH-HOLIDAY FLAG, TIME CHECKER, WK() SET; 05/02/06
     2 ;;4.0;PAID;**29,52,102,108**;Sep 21, 1995
     3 ;  Set up variable for holiday worked or holiday exused
     4 ;  Holiday worked coded 2 in DAY array
     5 ;  Holiday exused coded 1 in DAY array
     6 ;  A NON holiday is coded as all zero's in day array.
     7 ;
     8 ;  HOLIDAY WORKED
     9 S HOLWKD=$E(DAY(DAY,"HOL"),M)=2
     10 ;
     11 ;  HOLIDAY EXCUSED
     12 S HOLEX=$E(DAY(DAY,"HOL"),M)=1
     13 ;
     14 ;  HOLIDAY EXCUSED OR HOLIDAY WORKED
     15 S HOLWKEX=$E(DAY(DAY,"HOL"),M)
     16 Q
     17 ;
     18 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     19 ;
     20CHK ; --- Check ENT for acceptable X value
     21 ;    Pieces of Y have values in locations corresponding to premium
     22 ;    times in value of X.  Values in Y string are locations
     23 ;    in entitlement string where associated time in X is
     24 ;    located.
     25 ;   --------------------------------------------------
     26 ;                 | Fixed      |  Premium
     27 ;     Piece       | Position in|  Type Of Time
     28 ;    Of Y-String  | Entitlement|
     29 ;    & **WK()     | String     |
     30 ;    -----------  | -----------|  --------------------
     31 ;        7        |    28      |  comp earned
     32 ;        9        |     2      |  unscheduled regular
     33 ;       16        |    19      |  hrs excess 8-d
     34 ;       17        |    20      |  hrs excess 8-d2
     35 ;       18        |    21      |  hrs excess 8 d3
     36 ;       20        |    12      |  OT total hrs d
     37 ;       21        |    13      |  OT total hrs d2
     38 ;       22        |    14      |  OT total hrs d3
     39 ;   ---------------------------------------------------
     40 ;
     41 N ZZ S Y="^^^^^^28^^2^^^^^^^19^20^21^^12^13^14^^^^3^4^^^^"
     42 ;
     43 ;   Set Y to a premium time in Y string, based on X
     44 ;   OR set Y to zero if X is a non premium time or parttime hours.
     45 ;
     46 I X'=32 S Y=+$P(Y,"^",X)
     47 ;
     48 ;   IF Y is premium time & not Unscheduled regular but employee not
     49 ;   ENTITLED to that type of time THEN set X to zero.
     50 ;
     51 I +Y,Y'=2,'$E(ENT,+Y) S X=0
     52 ;
     53 ;   Overtime & Not entitled set X & Y to unscheduled regular
     54 ;
     55 I "^12^13^14^"[("^"_Y_"^"),'X S X=9,Y=2
     56 ;
     57 ;   IF regular unscheduled (Y=2) & not hourly for regular unscheduled
     58 ;   THEN set X=0, unless Baylor then X gets regular unscheduled.
     59 ;
     60 I X,Y=2,$E(ENT,+Y)'="H" S X=$S(TYP'["B":0,1:9)
     61 ;
     62 ;   If X is hours in excess of 8/day & > 40/week & type of time
     63 ;   is compensatory time X = 0
     64 ;
     65 I "^16^17^18^"[("^"_X_"^"),TH(WK)>160,"Ee"[VAL S X=0
     66 ;
     67 ;   ** Significance of checking "X" now as opposed to Y.
     68 ;
     69 K Y Q:'X
     70 ;
     71 ;   (Hours excess 8/day, OT hours, Reg hours @ OT rate, Holiday hours,
     72 ;   part time hours) OR unscheduled regular & Nurse or Nurse Hybrid.
     73 ; ### DO WE NEED TO ADD !HYBRID TO THIS CHECK ???
     74 I "^16^17^18^20^21^22^29^30^31^32^"[("^"_X_"^")!(X=9&(TYP["N"!(TYP["H"))) D
     75 .;
     76 .;     If today holiday or holiday benefit day for employee
     77 .;
     78 .I $$HOLIDAY^PRS8UT(PY,DFN,DAY) D  Q:'X
     79 ..;
     80 ..;     If part time hours & entitled to (Holiday [Shift day, 2 or 3])
     81 ..;
     82 ..I X=32,$E(ENT,TOUR+21),HOLWKD S ZZ=X,X=$S($G(DAY(DAY,"OFF"))'=1:TOUR+28,1:9) D SET S X=$S(TYP'["I":ZZ,1:9) Q
     83 ..;
     84 ..;     IF not part time hours & intermittent employee & employee
     85 ..;     entitled to holiday overtime & holiday worked THEN set TIME
     86 ..;     to OT on Holiday and credit that TIME in SET.
     87 ..;
     88 ..I X'=32,TYP["I",$E(ENT,25),HOLWKD S ZZ=X,X=24 D SET S X=0
     89 ..;
     90 ..;     IF conditions same as above except employee is NOT entitled
     91 ..;     to Holiday OT THEN use X as coded to credit TIME.
     92 ..;
     93 ..I X'=32,TYP["I",'$E(ENT,25),HOLWKD S ZZ=0 D SET S X=9
     94 ..;
     95 ..;     IF not part time hours & emp. is entitled to Holiday OT But
     96 ..;     they did not work the holiday THEN if emp. is part time or
     97 ..;     intermittent set type of time to Regular hrs @ OT rate 3
     98 ..;     otherwise OT @ Holiday rate & IF the original coded TIME
     99 ..;     NOT = reg hrs @ OT rate(shift D,2,3) THEN credit TIME at
     100 ..;     OT on holiday or Reg hours @ OT rate.  THEN also credit time
     101 ..;     as unscheduled regular.  ** why code time twice?
     102 ..;
     103 ..I X'=32,$E(ENT,25),'HOLWKD D
     104 ...S ZZ=X
     105 ...S X=$S(TYP["P"!(TYP["I"):TOUR+28,1:24) D SET
     106 ...I TYP["P"!(TYP["I") S X=9 D SET
     107 ...S X=0
     108 .;
     109 .;     IF type of time is part time hours for intermittent employee
     110 .;     THEN set TIME = unscheduled regular.
     111 .;
     112 .I X=32,TYP["I" S X=9
     113 .;
     114 .;    Part time hours or unscheduled regular.
     115 .;
     116 .Q:X=32!(X=9)
     117 .;
     118 .;     IF employee worked holiday THEN set TIME to zero & if original
     119 .;     coded type of time is NOT regular hours @ OT rate DO
     120 .;
     121 .I HOLWKD S ZZ=X,X=0 D
     122 ..;
     123 ..;     IF entitled to Holiday pay for this shift THEN set TIME
     124 ..;     to Holiday HRS (shift d, 2 or 3)
     125 ..;
     126 ..I $E(ENT,TOUR+21) S X=TOUR+28
     127 ;
     128 ;     IF employee is part time & either a nurse or nurse hybrid
     129 ;     & they worked the holiday
     130 ; ### SHOULD HYBRID BE ADDED TO THIS CHECK  HOW SHOULD THESE HYBRIDS
     131 ; ### TREATED ON A HOLIDAY
     132 I TYP["P",TYP["N"!(TYP["H"),HOLWKD,X=32 D
     133 .;
     134 .;     J gets start & stop times for employee's holiday tour.
     135 .;     Start/stop times are represented w/ natural numbers
     136 .;     from 0-96.  Each 15 minute segment of the 24 hour period
     137 .;     beginning & ending at midnight can be represented w/
     138 .;     a positive integer.  I.e.  1 = mid-12:15am,
     139 .;     2 = 12:15-12:30a ... 96 = 11:45pm-mid.
     140 .;
     141 .;     Loop thru each set of start & stop times.  IF the single
     142 .;     1/4 hr segment we're working w/ falls w/in any of the nurses
     143 .;     start & stop times THEN set TIME to Holiday Hours Day.
     144 .;
     145 .N I,J S J=$G(^TMP($J,"PRS8",DAY,"HWK")),ZZ=X
     146 .;
     147 .F I=1:2 Q:$P(J,U,I)=""  I M'<$P(J,U,I),M'>$P(J,U,I+1) S X=29
     148 .;
     149 .;     Holiday hrs-Day. reset X if 2 day tour.  Otherwise X = 0.
     150 .;
     151 .I X=29 D SET S X=$S($P(^PRST(457.1,$P(DAY(DAY-1,0),U,2),0),U,5)="Y":ZZ,1:0)
     152 ;
     153 ;
     154SET ; --- Set value into WK array
     155 ;
     156 ;     Full time employee & part time hours & normal hours WK1 + WK2
     157 ;     = biweekly normal hours.
     158 ;
     159 I $P(C0,"^",10)=1,X=32,NH(1)+NH(2)=NH Q
     160 ;
     161 ;     For all types of TIME, increment the WK array.
     162 ;
     163 I +X D  Q
     164 . S $P(WK(W),"^",+X)=$P(WK(W),"^",+X)+1
     165 ;
     166 ;     When X is zero, reset to originally coded time.
     167 ;
     168 I 'X S X=ZZ Q
     169 Q
     170 ;
     171 ;
     172TH ; --- increment total hours & compensatory time hours.
     173 ; Posted RG/OT/CT that is >8/day but < 40/week and < 80/pp will not be
     174 ; counted in TH or TH(W)
     175 ;
     176 ; I $S(VAL=4:1,"osEe"[VAL!(VAL="O"&('HOLWKD)):1,1:0) S TH=TH+1,TH(W)=TH(W)+1
     177 ;
     178 I $S(VAL=4:1,"osEe"[VAL!(VAL="O"&('HOLWKD)):1,1:0) D
     179 . Q:(HT>32)&(TH(W)<160)&(NH<320)&($E(ENT,19)=1)
     180 . S TH=TH+1,TH(W)=TH(W)+1
     181 Q
     182 ;
     183 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     184 ;
     185G8 ; --- Check for greater than 8 hours in day
     186 ;
     187 Q:HTP'>32!(VAL="E")
     188 ;
     189 ; Checks for Hours Excess 8/day (DA/DE)
     190 S X=TOUR+15 D CHK^PRS8HRSV
     191 I X,NH<320,CYA2806>0 S CYA2806=CYA2806-1
     192 Q:X
     193 ;
     194 ; Checks for OT Total Hours (OA/OE)
     195 I TYP["I"!(TYP["P"),TYP'["B",TH(W)>160 S X=TOUR+19 D CHK^PRS8HRSV
     196 Q
     197 ;
     198 ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset for help on using the changeset viewer.