source: WorldVistAEHR/trunk/r/PAID-PRS/PRSAOTTW.m@ 1096

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

initial load of WorldVistAEHR

File size: 7.9 KB
Line 
1PRSAOTTW ;WCIOFO/JAH-OVERTIME WARNINGS (OTW) LISTER--8/18/98
2 ;;4.0;PAID;**43**;Sep 21, 1995
3 ; = = = = = = = = = = = = = = = = =
4 ;
5LISTEN ; -- main entry point for OTW LIST--called by list manager
6 ;
7 S PRSOUT=0
8 D LISPARAM(.PRSWPP,.PRSWPPI,.PRSWSTAT,.PRSOUT)
9 Q:PRSOUT
10 ;convert status to internal value in ot warnings file
11 ; A = active i = inactive (b for both is not an internal status)
12 S PRSWSTAT=$S(PRSWSTAT=1:"A",PRSWSTAT=2:"C",1:"B")
13 ;
14 ; Call to List Manager to run PRSA OVERTIME WARNINGS template
15 D EN^VALM("PRSA OVERTIME WARNINGS")
16 Q
17 ;
18 ; = = = = = = = = = = = = = = = = =
19 ;
20LISPARAM(PP,PPI,STAT,USEROUT) ;
21 ;Ask the user if they want the list to contain 1 or all pay peroids
22 ;and whether they want to see cleared, active or all warnings.
23 N DIR,DIRUT,X,Y
24 S USEROUT=0
25 S DIR(0)="S^1:select a pay period;2:all pay periods"
26 D ^DIR S PP=Y
27 I $D(DIRUT) S USEROUT=1 Q
28 ;
29 ; get pp if user chose a single pp
30 I PP=1 D
31 . S DIC="^PRST(458,",DIC(0)="AEMNQ" D ^DIC
32 . S PPI=+Y
33 ;
34 ;Prompt user for type of warnings to display
35 I Y'>0 S USEROUT=1 Q
36 N DIR,X,Y,DIRUT
37 S DIR(0)="S^1:Active Warnings;2:Cleared Warnings;3:Active & Cleared"
38 D BLDHLP,^DIR
39 I $D(DIRUT) S USEROUT=1 Q
40 S STAT=Y
41 Q
42 ;
43 ; = = = = = = = = = = = = = = = = =
44 ;
45BLDHLP ;
46 N I,TXT
47 S DIR("?")=" Enter 1, 2, 3 or '^' to exit."
48 F I=1:1 S TXT=$P($T(HLPTXT+I),";;",2) Q:TXT="" S DIR("?",I)=TXT
49 Q
50HLPTXT ;
51 ;; Overtime Warnings occur when an employee has more
52 ;; overtime in their TT8B string than approved overtime in the
53 ;; overtime requests file. Normally, a warning becomes ACTIVE when a
54 ;; timecard is certified that will result in unapproved overtime
55 ;; being paid. If corrective action is taken payroll may then
56 ;; CLEAR the overtime warning. Although CLEARED warnings may be
57 ;; viewed through this option they WILL NO LONGER appear on the Pay
58 ;; Period Exceptions report. ACTIVE warnings will appear on the
59 ;; exceptions report.
60 ;;
61 Q
62 ;
63 ; = = = = = = = = = = = = = = = = =
64 ;
65HDR ; -- header code
66 ; All pperiods.
67 I PRSWPP=2 D
68 . I PRSWSTAT="C" S VALMHDR(1)="Cleared for all pay periods"
69 . I PRSWSTAT="A" S VALMHDR(1)="Active for all pay periods"
70 . I PRSWSTAT="B" S VALMHDR(1)="Active & cleared for all pay periods."
71 ;
72 I PRSWPP=1 D
73 . I PRSWSTAT="C" S VALMHDR(1)="Cleared for single pay period"
74 . I PRSWSTAT="A" S VALMHDR(1)="Active for single pay period"
75 . I PRSWSTAT="B" S VALMHDR(1)="Active & cleared for a single pay period"
76 Q
77 ;
78 ; = = = = = = = = = = = = = = = = =
79 ;
80INIT ; -- init variables and list array
81 ; This entry point is called from list manager
82 ;
83 N IEN,PPE,WK,OT8B,OTAP,COUNT
84 S U="^"
85 K ^TMP("PRSAOTW",$J)
86 S LIST=0,NUMBER=0
87 D CLEAN^VALM10
88 S COUNT=0,NUMBER=""
89 ;
90 ;loop adds list items if user chose active OR inactive & all pperiods.
91 I PRSWPP=2,PRSWSTAT'="B" D
92 .F S NUMBER=$O(^PRST(458.6,"E",PRSWSTAT,NUMBER)) Q:NUMBER="" D
93 .. D LISITEM(NUMBER,.COUNT)
94 ;
95 ;loop adds list items if user chose active OR inactive & 1 pperiod
96 ;
97 I PRSWPP=1,PRSWSTAT'="B" D
98 .S NUMBER=0
99 .F S NUMBER=$O(^PRST(458.6,"C",PRSWPPI,NUMBER)) Q:NUMBER="" D
100 .. I $D(^PRST(458.6,"E",PRSWSTAT,NUMBER)) D LISITEM(NUMBER,.COUNT)
101 ;
102 ;loop adds list items if user chose active & inactive & 1 pperiod
103 ;
104 I PRSWPP=1,PRSWSTAT="B" D
105 .S NUMBER=0
106 .F S NUMBER=$O(^PRST(458.6,"C",PRSWPPI,NUMBER)) Q:NUMBER="" D
107 .. D LISITEM(NUMBER,.COUNT)
108 ;
109 ;loop adds list items if user chose active & inactive & all pperiods.
110 ;
111 I PRSWPP=2,PRSWSTAT="B" D
112 .;1st loop through 4 digit year pp x-ref
113 .S PRSWPPI=""
114 .F S PRSWPPI=$O(^PRST(458.6,"D",PRSWPPI)) Q:PRSWPPI']"" D
115 .. S NUMBER=0
116 .. F S NUMBER=$O(^PRST(458.6,"D",PRSWPPI,NUMBER)) Q:NUMBER'>0 D
117 ... D LISITEM(NUMBER,.COUNT)
118 ;
119 S VALMCNT=COUNT
120 Q
121 ;
122 ; = = = = = = = = = = = = = = = = =
123 ;
124LISITEM(IEN,COUNT) ;ADD A SINGLE ITEM TO OT WARNINGS LIST
125 N PPI,PPE,EMP,WK,OT8B,OTAP,STAT,TL,CLEARER
126 S COUNT=COUNT+1
127 ;
128 ;get fields from a record in the ot warnings file
129 ;
130 S PPI=$P($G(^PRST(458.6,IEN,0)),U,3) ; Pay per ien
131 S PPE=$P($G(^PRST(458,PPI,0)),U) ; pay per ext format
132 S EMP=$P($G(^PRST(458.6,IEN,0)),U,2) ; employee ien in 450
133 S EMP=$P($G(^PRSPC(EMP,0)),U),TL=$P(^(0),U,8) ; name and t&l unit
134 S WK=$P($G(^PRST(458.6,IEN,0)),U,4) ; week 1 or 2 of pay per
135 S OT8B=" "_$P($G(^PRST(458.6,IEN,0)),U,8) ; all ot in 8b string
136 S OTAP=" "_$P($G(^PRST(458.6,IEN,0)),U,9) ; all ot in request file
137 S STAT=$P($G(^PRST(458.6,IEN,0)),U,5) ; status of warning
138 S STAT=$S(STAT="A":"Active",1:"Cleared")
139 S CLEARER=$P($G(^PRST(458.6,IEN,0)),U,6) ; clearer 450 IEN
140 I CLEARER S CLEARER=$P($G(^VA(200,CLEARER,0)),U) ; clearer 450 name
141 ;
142 ;Build one line (X) for list manager containing a warning.
143 ; 3rd parameter is name of field on List Template
144 ;
145 S X=$$SETFLD^VALM1(COUNT,"","NUMBER")
146 S X=$$SETFLD^VALM1(PPE,X,"PAY PERIOD")
147 S X=$$SETFLD^VALM1(WK,X,"WEEK")
148 S X=$$SETFLD^VALM1(EMP,X,"EMPLOYEE")
149 S X=$$SETFLD^VALM1(TL,X,"TL")
150 S X=$$SETFLD^VALM1(STAT,X,"STATUS")
151 S X=$$SETFLD^VALM1(OT8B,X,"OT8B")
152 S X=$$SETFLD^VALM1(OTAP,X,"OTAP")
153 S X=$$SETFLD^VALM1(CLEARER,X,"UPDATER")
154 D SET^VALM10(COUNT,X,COUNT)
155 ;
156 ; save the ien of the record in the list global for easier
157 ; reference to the acutal data.
158 ;
159 S ^TMP("PRSAOTW",$J,COUNT)=IEN
160 Q
161 ;
162 ; = = = = = = = = = = = = = = = = =
163 ;
164PRSIEN() ;RETURN PAID IEN FROM 450 BASED ON DUZ.
165 N SSN
166 ;
167 S PRSIEN=""
168 Q:'DUZ PRSIEN
169 ;
170 S SSN=$P($G(^VA(200,DUZ,1)),"^",9)
171 I SSN'="" S PRSIEN=$O(^PRSPC("SSN",SSN,0)) S:PRSIEN'>0 PRSIEN=""
172 Q PRSIEN
173 ;
174 ; = = = = = = = = = = = = = = = = =
175 ;
176CLEAR ; Clear an OT warning. This code called when a user running the
177 ; OT warnings option selects clear OT warnings protocol.
178 ;
179 N PRSCREC,PRSCLCNT,PRSELECT,PRSNOCL,DIE,DIR,DIRUT,PLURAL
180 ;
181 ;allow selection of list items in the display region.
182 ;
183 D EN^VALM2("","")
184 Q:$O(VALMY(0))'>0
185 ;
186 S PRSCLCNT=0,DIE="^PRST(458.6,"
187 S (PRSCREC,PRSELECT,PRSNOCL)=""
188 F S PRSCREC=$O(VALMY(PRSCREC)) Q:PRSCREC="" D
189 . ;
190 . ;Get ien for 458.6 that matches the list item.
191 . S PRSCIEN=$G(^TMP("PRSAOTW",$J,PRSCREC))
192 . ;
193 . ;Get status of ot warning
194 . S PRSCSTAT=$P($G(^PRST(458.6,PRSCIEN,0)),U,5)
195 . ;
196 . ;increment clearable warning count
197 . ;& build variable of items that will be cleared
198 . ;& highlight selected items
199 . I PRSCSTAT="A" D
200 .. S PRSCLCNT=PRSCLCNT+1,PRSELECT=PRSELECT_","_PRSCREC
201 .. ;
202 .. D CNTRL^VALM10(PRSCREC,2,$L(PRSCREC),IORVON,IORVOFF)
203 .. D CNTRL^VALM10(PRSCREC,5,74,IOINHI,IOINORM),WRITE^VALM10(PRSCREC)
204 ;
205 ;strip off leading comma from clear list
206 S PRSELECT=$P(PRSELECT,",",2,999)
207 ;
208 ;return to list if no active warnings selected.
209 ;
210 I PRSELECT="" S VALMSG="No ACTIVE warnings selected." S VALMBCK="R" Q
211 ;
212 ; If user wants to clear items then clear all selected. Skip any
213 ; that r already clear & keep track of any that are locked (PRSNOCL).
214 ; Build ListMan message w/ all unclearable records due to locks.
215 ;
216 S DIR(0)="YA"
217 S PLURAL=$S($L(PRSELECT,",")<2:"entry",1:"entries")
218 S DIR("A")="Clear "_PLURAL_" "_PRSELECT_" ?"
219 D ^DIR
220 I Y D
221 . S PRSCREC=0
222 . F S PRSCREC=$O(VALMY(PRSCREC)) Q:PRSCREC="" D
223 .. S PRSCIEN=$G(^TMP("PRSAOTW",$J,PRSCREC))
224 .. S PRSCSTAT=$P($G(^PRST(458.6,PRSCIEN,0)),U,5)
225 .. I PRSCSTAT="A" D
226 ... S PRSCSTAT="C"
227 ... S DR="4///^S X=PRSCSTAT",DA=PRSCIEN
228 ... L +^PRST(458.6,PRSCIEN):0
229 ... I $T D
230 .... D ^DIE L -^PRST(458.6,PRSCIEN)
231 ... E S PRSNOCL=PRSNOCL_" "_PRSCREC
232 S:PRSNOCL'="" VALMSG=PRSNOCL_" NOT CLEARED. EDIT BY ANOTHER USER"
233 ;
234 ;whether list items cleared or not rebuild list and return
235 ;
236 D INIT
237 S VALMBCK="R"
238 Q
239HELP ;Help for the PRSA OVERTIME WARNINGS list template
240 D FULL^VALM1
241 W !!,?2,"At the Action prompt you may enter CL or VI.",!
242 W !,?4,"Enter CL to select any of the active overtime warnings on the"
243 W !,?4,"screen that you wish to clear.",!
244 W !,?4,"Enter VI to select one of the displayed warnings to view requests"
245 W !,?4,"on file that correlate to the week and pay period of the warning."
246 D PAUSE^VALM1
247 D RE^VALM4
248 Q
Note: See TracBrowser for help on using the repository browser.