source: WorldVistAEHR/trunk/r/PAID-PRS/PRSRL4.m@ 1710

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

initial load of WorldVistAEHR

File size: 7.9 KB
RevLine 
[613]1PRSRL4 ;WIRMFO/JAH-INDIVIDUAL EMPLOYEE LEAVE USE PATTERN ;22-JAN-1998
2 ;;4.0;PAID;**2,16,19,21,35,103**;Sep 21, 1995
3SUP ;
4 N SSN,PRSTLV,PRSAI,PRSR,TLE,TLI,SW,PRSRDUZ,USR,XX,YY
5 N ALOO,FR,TO,TOP,FRP,EMPNAM
6 ;
7 ; DA(2)= stores pay periods in Year-pay period # format
8 ;
9 ; set flags for supervisor entry point
10 S PRSTLV=3,(PRSAI,PRSR)=1
11 ;
12 ; Select 1 T&L unit.
13 ; Defined after TLESEL call
14 ; PRSRDUZ, USR = user IEN in PAID EMPLOYEE (450)
15 ; SSN = users SSN
16 ; SW
17 ; TLE = selected T&L unit code
18 ; TLI = selected T&L unit IEN in T&L unit file (455.5)
19 ; TLE(1) = "T&L unit code ^ T&L unit name"
20 ; TLE(1,n) = "T&L unit member IEN in file (450) ^ member name"
21 D TLESEL^PRSRUT0 G Q:$G(TLE)=""!(SSN="") W !
22 ;
23 ; TLI = T&L unit of User
24 S TLI=$S(PRSRDUZ:$P($G(^(0)),"^",8),1:"000")
25 ;
26EN1 ; User look up 4 employee under T&L x-ref in 450
27 S DIC="^PRSPC(",DIC(0)="AEQZ"
28 S D="ATL"_$P(TLE(1),"^",1)
29 S DIC("S")="I $$INXR^PRSRL1($P(TLE(1),U),Y)"
30 S DIC("A")="Enter employee name: "
31 D IX^DIC
32 G Q1:$D(DUOUT)!$D(DTOUT)!(Y=-1)
33 ; Save IEN (450) of selected employee in PRSRY. PRSRY1 = 0 node.
34 ; D0 = selected employee name. PRSRSSN = SSN from 0 node of 450.
35 S PRSRY=Y
36 S PRSRY1=$S($D(Y(0)):Y(0),1:"") ; 0 node of selected emp from 450
37 S D0=$P(PRSRY,"^") ; Selected employee IEN from 450
38 S EMPNAM=$P(PRSRY,"^",2) ; employee Name from 450
39 S PRSRSSN=$P(PRSRY1,"^",9) ; employee SSN
40 S SSN=$E(PRSRSSN,1,3)_"-"_$E(PRSRSSN,4,5)_"-"_$E(PRSRSSN,6,9)
41 S TLUNIT=$P(PRSRY1,"^",7) ; employee Station Number
42 S TLE=$P(^PRSPC(D0,0),"^",8) ; employ T&L unit
43 ;
44 ; Get cost center/org code (ccoc) description from selected
45 ; employee record. If no description send a bulletin to G.PAD
46 ; & continue using numeric codes instead.
47 S ORG=$$CCORG^PRSRUTL(PRSRY1)
48 I +ORG>0 D CCORGBUL^PRSRUTL(ORG,PRSRDUZ,0,EMPNAM)
49 ;
50 ;SW should always get set to zero.
51 S SW=$S(PRSRY'=-1:0,1:1)
52 ;
53 D CHKTLE^PRSRUTL G EN1:'STFSW W !
54 ;
55ASK ; ask begin date 4 report
56 S %DT("A")="Enter Beginning Date "
57 S %DT(0)=-DT ; date must be <= to today
58 S %DT("B")="T" ; default response of today
59 S %DT="AEX" ; ask user, echo, must include day & month
60 D ^%DT
61 S FR=Y ; FR = FileMan 4mat of begin date
62 G Q1:$D(DTOUT)!(X="")!(X="^"),MSG2:FR=-1
63 ;
64 ; ask end date 4 report
65 S %DT("A")="Enter Ending Date "
66 S %DT("B")="T" ; default date of today
67 S %DT(0)=FR ; end date must be > begin date
68 S %DT="AEX" ; ask, echo, day & month
69 D ^%DT
70 S TO=Y
71 G Q1:$D(DTOUT)!(X="")!(X="^"),MSG2:TO=-1
72 ;
73 ; Get external representation of begin & end date 4 display
74 ; XX = begin date
75 ; YY = end date
76 S Y=FR D DD^%DT S XX=Y
77 S Y=TO D DD^%DT S YY=Y
78 ;
79 ; Get pay periods (FRP & TOP) that begin & end dates fall in.
80 ; Vars returned from PP call are DAY & PPE
81 N PPE,D1 S D1=FR D PP^PRSAPPU S FRP=PPE
82 N PPE,D1 S D1=TO D PP^PRSAPPU S TOP=PP4Y
83 ;
84 ; Ask user if they want to see all leave, including days off &
85 ; Holidays or if they want to see only leave taken immediately
86 ; be4 or after Holidays & days off.
87 ; ALOO = users choice ALL, Only or Uparrow (A or O or ^)
88 S ALOO=$$ASKDSPLY^PRSRL41()
89 Q:ALOO["^"
90 ;
91 ;
92 S ZTRTN="START^PRSRL4",ZTDESC="EMPLOYEE LEAVE USAGE PATTERN" D ST^PRSRUTL,LOOP,QUE1^PRSRUT0 G Q1:POP!($D(ZTSK))
93 ;
94 ;
95START ;
96 ; Set up variable 4 Leave check call CKTOUR^PRSUT0 in subroutine LEV
97 S LVT=";AL:Annual Leave;SL:Sick Leave;WP:Leave Without Pay;ML:Military Leave;TV:Travel;HX:Holiday Excuse;CB:Family Care;"
98 S LVT=LVT_"AA:Authorized Absence;AD:Adoption;CU:Comp Time/Credit Hrs.;DL:Donor Leave;NL:Non-Pay Annual Leave;RL:Restored Annual Leave;"
99 S (CNT,POUT,DAT(1))=0
100 K ^TMP($J)
101 S ^TMP($J,"USE")="EMPLOYEE LEAVE PATTERN"
102 S ^TMP($J,"US",0)="COMMENTS"
103 ;
104 ;loop thru Time & Attendance file, 4 digit yr "AB" Pay Period X-ref.
105 ; Start loop w/ payperiod previous begin date
106 ; Quit loop when pay per. is past end date
107 ;
108 S DA(2)=$$PREP^PRSAPPU(FRP) ;call to get previous pay period
109 ;
110 F II=0:0 S DA(2)=$O(^PRST(458,"AB",DA(2))) Q:DA(2)=""!(DA(2)]TOP) D
111 .; get pay period IEN
112 . S DA(1)=$O(^PRST(458,"AB",DA(2),0))
113 .;
114 .; FM dates string 4 curr pay per
115 . S DATES=$G(^PRST(458,DA(1),1))
116 .;
117 .; get days of week 4 current pay period (Sun 9-Jan-94^...^)
118 .S DAYSOFWK=$G(^PRST(458,DA(1),2))
119 .;
120 .; loop thru days of employee's pay period
121 . S DA=0
122 . F I=0:0 S DA=$O(^PRST(458,DA(1),"E",D0,"D",DA)) Q:DA'>0 D
123 ..;
124 ..; quit if outside date range
125 .. Q:$P(DATES,"^",DA)<FR!($P(DATES,"^",DA)>TO)
126 ..;
127 ..; tour of duty 4 current day
128 .. S TOD=$P($G(^PRST(458,DA(1),"E",D0,"D",DA,0)),"^",2)
129 ..;
130 ..; tour of duty 4 next day
131 .. S TOD(1)=$P($G(^PRST(458,DA(1),"E",D0,"D",DA+1,0)),"^",2) Q:TOD=""
132 ..;
133 .. D LEV
134 .. Q
135 . Q
136 S DAT=$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3)
137 U IO I 'CNT D HDR1^PRSRL41 W !,"|",?10,"No leave Usage on File within this Date Range.",?79,"|" S POUT=1 D NONE G Q1
138 D ^PRSRL41
139 G Q1:POUT I CNT D VLIDSH0^PRSRL41 S CODE="L005",FOOT="VA TIME & ATTENDANCE SYSTEM" D FOOT2^PRSRUT0
140 ;
141 ;
142Q I $E(IOST)="C"!($G(IOT)="VTRM") R !!,"Press Return/Enter to continue. ",X:DTIME
143Q1 K %9,%DT,%RET,%TG,C,CNT,CODE,COM,COS,COSORG,D0,D1,DA,DAT,DATE,DATES,DATT,DAY,DDH,DIC,EDT,FOOT,FR,FRP,I,II,INX,K,LEV,LVT,NAM,ORG,POP,POUT,PP,PPE,PPI,PRSPRSR,PRSRY,PRSRY1
144 K RG,SSN,STFSW,SW,TC,TIM,TL,TLE,TLEV,TLI,TLUNIT,TO,TOD,TOP,TOUR,TOUR1,TYL,X,X1,X2,XX,Y,YY,Z,Z1,ZTDESC,ZTRTN,ZTSAVE,^TMP($J) D ^%ZISC S:$D(ZTSK) ZTREQ="@" K ZTSK W:$E(IOST)="C"!($G(IOT)="VTRM") @IOF
145 Q
146LEV ;
147 S DAY=$P($P(DAYSOFWK,"^",DA)," ") ; current day of week (SUN, MON...)
148 S DAY(1)=$P($P(DAYSOFWK,"^",DA+1)," ") ; next day of week
149 ;
150 ; TOUR = ((day off) or (NODE with either
151 ; (start and stop times) or (null for worked entire tour))
152 S TOUR=$S(TOD'=1:$G(^PRST(458,DA(1),"E",D0,"D",DA,2)),1:"DO")
153 ;
154 ;Check 4 leave in LVT variable (SL,AL,ML,TV,HX)
155 ;if today not a day off
156 ;Quit if employee worked entire tour (tour="")
157 D CKTOUR^PRSRUT0(.TOUR):TOD'=1 Q:TOUR=""
158 ;
159 ;TOUR(1) = same as TOUR exept next day.
160 S TOUR1=$S(TOD(1)'=1:$G(^PRST(458,DA(1),"E",D0,"D",DA+1,2)),1:"DO")
161 ;
162 ;Check 4 leave in LVT variable (SL,AL,ML,TV,HX)
163 ;if today not a day off
164 ;Quit if employee worked entire tour, unless they've selected ALL
165 D CKTOUR^PRSRUT0(.TOUR1):TOD(1)'=1 Q:((TOUR1="")&(ALOO'="A"))
166 ;
167 ;Test whether leave should be saved for display
168 Q:'$$SHOWLEAV()
169 ;
170 ;
171 ;If we've made it this far store the leave or day off in the temp
172 ;global for display, unless it's already there.
173 I $G(DAY)'="",$G(^TMP($J,"USE",CNT,DA(2),$P(DATES,"^",DA),DAY))'=TOUR D
174 . S CNT=CNT+1
175 . S ^TMP($J,"USE",CNT,DA(2),$P(DATES,"^",DA),DAY)=TOUR
176 . S ^TMP($J,"US",CNT)=$G(^PRST(458,DA(1),"E",D0,"D",DA,3))
177 ;
178 W:'$D(ZTSK)&($E(IOST)'="P")!($G(IOT)="VTRM")&($R(30)) "."
179 ;
180 I $G(DAY(1))'="",$G(^TMP($J,"USE",CNT,DA(2),$P(DATES,"^",DA+1),DAY(1)))'=TOUR1 D
181 . S CNT=CNT+1
182 . S ^TMP($J,"USE",CNT,DA(2),$P(DATES,"^",DA+1),DAY(1))=TOUR1
183 . S ^TMP($J,"US",CNT)=$G(^PRST(458,DA(1),"E",D0,"D",DA+1,3))
184 ;
185 W:'$D(ZTSK)&($E(IOST)'="P")!($G(IOT)="VTRM")&($R(30)) "."
186 ;
187 ;
188 S DAT(1)=$P(DATES,"^",DA+1),DAY(2)=DAY
189 Q
190NONE I IOSL<66 F I=$Y:1:IOSL-5 D VLIN0^PRSRL41
191 D HDR^PRSRL41
192 Q
193MSG1 W !!,*7,"*** Employee name not found." G EN1
194MSG2 W !!,*7,"The Date was invalid." G ASK
195 ;
196 ;Save all variables 4 tasked job
197LOOP F X="ALOO","FR","FRP","TLE","TLI","TO","TOP","DT","NAM","SSN","SW","LOC","POS","PRSRDUZ","PRSRY","PRSRY1","COS","^TMP($J,""USE"",","ORG","D0","TLUNIT","XX","YY","PRSRSSN" S ZTSAVE(X)=""
198 Q
199 ;=====================================================================
200SHOWLEAV() ;
201 ;If user has selected 'All', then show leave (return true)
202 ;
203 ;Otherwise, don't store leave 4 display IF:
204 ; (next day tour = day off) & (current day tour = Holiday) or
205 ; (todays tour = day off) & (next days tour = day off) or
206 ; user has selected only leave around days off &
207 ; (todays tour is not = day off) & (next day is not day off)
208 ;
209 Q:ALOO="A" 1
210 S RTN=1
211 I ((TOD=1&(TOUR1["HX"))!(TOD(1)=1&(TOUR["HX"))!(TOUR="DO"&(TOUR1="DO"))!((ALOO="O")&(TOUR'="DO"&(TOUR1'="DO")))) S RTN=0
212 Q RTN
Note: See TracBrowser for help on using the repository browser.