Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (15 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/PRS8HR.m

    r613 r623  
    1 PRS8HR  ;HISC/MRL,WCIOFO/JAH-DECOMPOSITION, HOURS ;06/25/07
    2         ;;4.0;PAID;**2,22,29,42,52,102,108,112**;Sep 21, 1995;Build 54
    3         ;;Per VHA Directive 2004-038, this routine should not be modified.
    4         ;
    5         ;This routine is called by ^PRS8PP (premium pay calculator)
    6         ;=====================================================================
    7         ; ** indicates incompleted comments
    8         ;
    9         ;VARIABLE DEFINITION
    10         ;
    11         ; TYP   =  contains codes representing type of employee.
    12         ;          It's a composite code string w/ characters that
    13         ;          represent pay plan, duty basis, & normal hours.
    14         ;    CODE  REPRESENTS      CODE   REPRESENTS
    15         ;     D     daily            f     firefighter
    16         ;     W     wagegrade        P     part-time
    17         ;     N     nurse            d     doctor
    18         ;     B     baylor plan      dR    doctor/resident or intern
    19         ;     H     Nurse Hybrid     ""    *
    20         ;     I     intermittent
    21         ; VAL   =  Single char code represents employee's work status for
    22         ;          current 15 min increment.
    23         ; FLX   =  Flex tour indicator.
    24         ; TH(W) =  Tour Hours for week 1, TH(1) & week 2, TH(2)
    25         ; TH    =  Tour Hours
    26         ; HTP   =  PAYABLE hours worked today.
    27         ; HT    =  Hours worked today.
    28         ; AV    =  String w/ most normal types of time (see bottom of PRS8EX)
    29         ;          does NOT contain premium times or unscheduled time (OoEes4)
    30         ;====================================================================
    31         ;
    32         S AV="1235nHMLSWNARUXYVJFGD"
    33         ;
    34         ;   Loop thru each quarter hour segment of day.
    35         ;   Check for times in AV array.
    36         ;   Proceed w/ calculation if Overtime worked on Holiday.
    37         ;
    38         F M=1:1:96 D
    39         .  S VAL=$E(D,M)
    40         .;
    41         .;    If non premium type of time or (overtime on holiday)
    42         .;
    43         .  I AV[VAL!(VAL="O"&($E(DAY(DAY,"HOL"),M)=2)) D CALC
    44         Q
    45         ;
    46         ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    47         ;
    48 CALC    ; --- Entry point for calculating placement of time
    49         ;
    50         ;     Set up variables for calculations and comparisons in this routine
    51         ;
    52         N HOLWKD,HOLEX,HOLWKEX
    53         D ^PRS8HRSV
    54         ;
    55         ;     IF intermittent employee on continuation of pay OR overtime on
    56         ;     holiday THEN increment Pay Period tour hours and current weeks
    57         ;     tour hours.
    58         ;
    59         I TYP["I",VAL["V"!(VAL="O"&(HOLWKD)) S TH=TH+1,TH(W)=TH(W)+1
    60         ;
    61         ;     IF part time doctor & total hours = 80 & type of
    62         ;     time is unscheduled, overtime, comptime THEN quit
    63         ;
    64         I TYP["d",TYP["P",TH=320,"4OosEe"[VAL Q
    65         ;
    66         ;     IF INT doctor & total hours = 80 THEN quit
    67         ;
    68         I TYP["I",$E(AC,1)="L",TH=320,"4OosEe"[VAL Q
    69         ;
    70         ;     IF type of time is anything but Leave Without Pay "W" or Non-Pay "n"
    71         ;     THEN increment total hrs HT & increment HTP.  Also update
    72         ;     ^TMP global for reference during the processing of On-Call (PRS8OC).
    73         ;
    74         I "Wn"'[VAL S HT=HT+1,HTP=HTP+1,^TMP($J,"PRS8",DAY,"HT")=HT
    75         ;
    76         ;---------------------------------------------------------
    77         ;     IF entitled to VCS commission sales & normal time(1) ??(2,3)
    78         ;     & holiday excused set X to type of time=Piece Worker Hol excused.
    79         ;     Then IF part time set X to part time hours code.
    80         ;
    81         I $E(ENT,38),"123"[VAL,HOLEX S X=36 D CHK^PRS8HRSV D  Q:X
    82         .  I TYP["P" S X=32 D CHK^PRS8HRSV
    83         ;
    84         ;---------------------------------------------------------------
    85         ;
    86         ;     Don't mess w/ fire fighters
    87         ;
    88         Q:"Ff"[TYP
    89         ;
    90         S GO=0
    91         ;     IF compressed tour & parttime & tour hours are over 80
    92         ;     OR tour hours = 80 & it's overtime, comptime, or unscheduled reg.
    93         ;
    94         ; Check for FT Compressed
    95         I $E(AC,2)=1,NH>319,FLX="C",("OoseE4"[VAL) S GO=1
    96         ;
    97         ; Check for week
    98         I (TH(W)>160&("OoseE4"[VAL))!(TH(W)=160&("OosEe4"[VAL)) S GO=1
    99         ;
    100         ; Check for day
    101         I HT>32,"OoseE4"[VAL S GO=1
    102         ;
    103         ;     Following segment is concerned w/ variations of part time
    104         ;     employees (TYP["P"), & 1 baylor (TYP["B").
    105         ;-------------------------------------------------------------------
    106         ;
    107         ;     Doctor over 8 hours
    108         ;
    109         I TYP["Pd",HT>32 S GO=0 ; part-time doctors PT + PH must = NH
    110         ;
    111         I TYP["P",HOLWKD S GO=0
    112         ;
    113         ;     Baylor plan & ct/ot/s
    114         ;
    115         I TYP["B","EeOos"[VAL S GO=1
    116         ;
    117         ;-------------------------------------------------------------------
    118         ;     GO set in cases where employee maybe eligible for OT
    119         ;     due to over > 8/day OR > 40/week.
    120         ;
    121         S X=0 I GO D TH^PRS8HRSV D OVER840^PRS8HROT Q
    122         ;
    123         ;-------------------------------------------------------------------
    124         ;-------------------------------------------------------------------
    125         ;     GO not set for compressed schedule of at least 80 hrs.
    126         ;     GO not set for non compressed schedule of over 40 hrs.
    127         ;     IF GO is set and we are evaluating normal hours or
    128         ;     HOLIDAY OVERTIME use NORMHRS to increment TIME
    129         ;     in week array.  THEN QUIT.
    130         ;
    131         S GO=1
    132         I FLX="C",NH>319 S GO=0
    133         I FLX'="C",NH(WK)>160,TYP'["Pd" S GO=0 ;IF pt-doctor don't set GO=0
    134         I GO,"1235nHMLSWNARUXYVJFGD"[VAL!(VAL="O"&(HOLWKD)) D NORMHRS^PRS8HROT Q
    135         ;
    136         ;--------------------------------------------------------------------
    137         ;   Check employees with Normal hours less than 80. (Baylor NH=320)
    138         ;
    139         I NH'>319!(($E(AC,2)=2)&(NH=320)) D TH^PRS8HRSV D  Q
    140         .I FLX="C" D  Q:X
    141         ..;
    142         ..; For PT employees review hours worked to determine X
    143         ..I "OosEe4"'[VAL S X=32  ; All tour time = PT/PH
    144         ..;
    145         ..; Checks for CT
    146         ..I "Ee"[VAL D
    147         ...; <8/DAY & <40/WK  = UN/US
    148         ...I HT'>32,TH(W)'>160 S X=9 Q
    149         ...S X=7 ; CE/CT
    150         ..;
    151         ..; Checks for all other types of time
    152         ..I "Oos4"[VAL D
    153         ...I HT>32 S X=TOUR+15 Q  ; DA/DE
    154         ...I TH(W)>160 S X=TOUR+19 Q  ; OA/OE
    155         ...S X=9 ; UN/US
    156         ..D CHK^PRS8HRSV
    157         .;
    158         .;     Under 8/day, 40/week, and not coded as overtime or comptime
    159         .;     or overtime on holiday.
    160         .;
    161         .; Checks for non-compressed employees
    162         .I HT'>32,TH(W)'>160,"OoseE"'[VAL!(VAL="O"&(HOLWKD)) S X=0 D  Q:X
    163         ..;
    164         ..;    Not intermittent, normal hours and not unscheduled reg.
    165         ..;    TIME gets parttime hours.
    166         ..;
    167         ..I TYP'["I",AV[VAL,VAL'=4 S X=32 D CHK^PRS8HRSV Q
    168         ..;
    169         ..;    All else fails - TIME gets unscheduled regular.
    170         ..;
    171         ..S X=9 D CHK^PRS8HRSV Q
    172         .;
    173         .;     Part time doctor w/ unscheduled reg. TIME gets unscheduled reg.
    174         .;
    175         .I TYP["P",TYP["d",VAL=4 S X=9 D CHK^PRS8HRSV Q
    176         .;
    177         .;     Over 8/day
    178         .;
    179         .I HT>32 D G8^PRS8HRSV Q:X
    180         .;
    181         .;     For all time left except comptime set TIME to appropriate OT
    182         .;     unless comptime has been worked earlier in the week making
    183         .;     the total hours less than 40, then TIME gets unscheduled reg.
    184         .;     COMPTIME OVER 8/DAY WILL BE CREDITED HERE
    185         .;
    186         .S X=$S("Ee"'[VAL:TOUR+19,(TH(W)'>160)&(HT'>32):9,1:7)
    187         .I TYP["P",VAL[4,TH(W)'>160,HT'>32 S X=9
    188         .I TYP["P",VAL="O",TH(W)'>160,HT'>32 S X=9
    189         .D CHK^PRS8HRSV
    190         Q
     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 TracChangeset for help on using the changeset viewer.