source: WorldVistAEHR/trunk/r/PAID-PRS/PRSATP3.m@ 1036

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1PRSATP3 ;HISC/MGD-Timekeeper Post Absence ;01/03/06
2 ;;4.0;PAID;**102**;Sep 21, 1995
3 ;
4HENCAP(PPI,DFN,WDAY,DBH,HOL,DAH,QUIT) ;
5 ; Check to see if there is a Holiday encapsulated by some form of non-pay.
6 ; Called from Timekeeper Posting routine ^PRSATP
7 ;
8 ; Test #1 | DBH HOL DAH
9 ; Test #2 DBH | HOL DAH
10 ; Test #3 DBH HOL | DAH
11 ; Test #4 DBH | HOL | DAH
12 ;
13 ; Input:
14 ; PPI - IEN of current pay period
15 ; DFN - IEN of employee
16 ; WDAY - Day to begin testing
17 ; DBH - null
18 ; HOL - null
19 ; DAH - null
20 ; QUIT - null
21 ;
22 ; Output: If set these variables will contain the following
23 ; DAH - PPI^DAY^type of non-pay
24 ; DBH - PPI^DAY^type of non-pay
25 ; HOL - PPI^DAY^Status of timecard that contains holiday
26 ; QUIT - Will be set to 1 when holiday encapsulation test fails
27 ; and no additional checks need to be made.
28 N BACK,PPIP
29 S PPIP=PPI
30 ;
31 ; Check Day After Holiday
32 D DAH^PRSATP7(PPIP,DFN,WDAY,.DAH,.QUIT)
33 I DAH="" S QUIT=1
34 Q:QUIT
35 ;
36 ; Find Holiday
37 S BACK=0
38 F D Q:QUIT!(HOL'="")!(HOL=""&BACK=2)
39 . S WDAY=WDAY-1
40 . I WDAY=0 D GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
41 . I BACK=2 S QUIT=1 Q
42 . D FNDHOL^PRSATP8(PPIP,DFN,WDAY,.HOL,.QUIT)
43 Q:QUIT
44 ;
45 ; Find Previous Work Day
46 S PPIP=$P(HOL,U,1),WDAY=$P(HOL,U,2),BACK=0
47 F D Q:QUIT!(DBH'="")!(DBH=""&BACK=2)
48 . S WDAY=WDAY-1
49 . I WDAY=0 D GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
50 . I BACK=2 S QUIT=1 Q
51 . D DBH^PRSATP6(PPIP,DFN,WDAY,.DBH,.QUIT)
52 Q
53 ;
54UPDT(DFN,DBH,HOL,DAH) ; Perform final checks
55 ; Input:
56 ; DFN - IEN of employee
57 ; DBH - PPI^DAY^type of non-pay
58 ; HOL - PPI^DAY^Status of timecard that contains holiday
59 ; DAH - PPI^DAY^type of non-pay
60 ;
61 ; Output:
62 ; Displays Holiday encapsulation message to Timekeeper and whether
63 ; or not it was able to chance the HX postings to the apppriate
64 ; form of non-pay
65 ;
66 ; Holiday was encapsulated by non-pay. Perform final checks.
67 N HDAY,HIEN,HPPI,HOLEX,HOLIN,IEN4585,LSTAT,PPI,PRSIEN,SEG,TOT
68 N TSTAT,PRSFDA,SEG,SOH
69 S HPPI=$P(HOL,U,1),HDAY=$P(HOL,U,2),PPI=$P(DAH,U,1)
70 S HOLEX=$P(^PRST(458,HPPI,2),U,HDAY) ; External date
71 S HOLIN=$P(^PRST(458,HPPI,1),U,HDAY) ; Internal date
72 ;
73 ; Compare types of non-pay before and after
74 S TOT=$S($P(DBH,U,3)'=$P(DAH,U,3):"NP",1:$P(DAH,U,3))
75 ;
76 ; If holiday is in the current PP, employee timecard will already
77 ; be locked. If holiday is in prior pay period try to lock it.
78 ; LSTAT = 1 - Holiday in current PP and was already locked
79 ; = 2 - Holiday in prior PP and lock was obtained
80 ; = 3 - Holiday in prior PP and lock was not obtained
81 ;
82 I PPI=HPPI S LSTAT=1
83 I PPI'=HPPI D
84 . L +^PRST(458,HPPI,"E",DFN):2
85 . S LSTAT=$S($T:2,1:3)
86 S SOH=$P(^PRST(458,HPPI,"E",DFN,0),U,2) ; Get current status of holiday
87 ;
88 ; Change HX to appropriate form of non-pay
89 S HIEN=HDAY_","_DFN_","_HPPI_","
90 F SEG=43:4:67 D
91 . I $$GET1^DIQ(458.02,HIEN,SEG)="HX" D
92 . . S PRSIEN(458.02,HIEN,SEG)=TOT
93 I $D(PRSIEN),LSTAT<3,SOH="T" D UPDATE^DIE("","PRSIEN","HIEN"),MSG^DIALOG()
94 ;
95 ; Display appropriate message based on Lock and timecard status
96 W !!,"Due to the non-pay posting on this day the holiday occurring on ",HOLEX
97 W !,"was encapsulated with non-pay. "
98 ;
99 ; If we could autopost non-pay
100 I LSTAT<3,SOH="T" D
101 . W "The HX postings were automatically updated to"
102 . W !,"the appropriate form of non-pay."
103 ;
104 ; If we could not autopost non-pay because timecard was in a status other
105 ; than T (Timekeeper)
106 I SOH'="T" D
107 . W "The HX postings could not be automatically"
108 . W !,"updated to the appropriate form of non-pay because the status of the holiday"
109 . W !,"was not TIMEKEEPER. You will need to manually address this issue."
110 . D SET
111 ;
112 ; If we could not autopost non-pay because the timecard was currently locked
113 ; by another user
114 I LSTAT=3,SOH="T" D
115 . W "The HX postings could not be automatically"
116 . W !,"updated to the appropriate form of non-pay because the timecard was locked"
117 . W !,"by another user. You will need to manually address this issue."
118 . D SET
119 Q
120 ;
121SET ; Add entry to #458.5
122 S PRSFDA(458.5,"+1,",.01)=DFN ; Employee
123 S PRSFDA(458.5,"+1,",1)=DFN ; Employee
124 S PRSFDA(458.5,"+1,",2)=HOLIN ; Date of exception
125 S PRSFDA(458.5,"+1,",4)="HX was encapsulated by non-pay" ; Type of Exception
126 D UPDATE^DIE("","PRSFDA","IEN4585"),MSG^DIALOG()
127 ;
128 ; Reset .01 field to sequence number
129 S IEN4585=IEN4585(1)_","
130 S PRSFDA(458.5,IEN4585,.01)=IEN4585(1) ; Sequence #
131 D UPDATE^DIE("","PRSFDA","IEN4585"),MSG^DIALOG()
132 Q
Note: See TracBrowser for help on using the repository browser.