PRSATP3 ;HISC/MGD-Timekeeper Post Absence ;01/03/06
;;4.0;PAID;**102**;Sep 21, 1995
;
HENCAP(PPI,DFN,WDAY,DBH,HOL,DAH,QUIT) ;
; Check to see if there is a Holiday encapsulated by some form of non-pay.
; Called from Timekeeper Posting routine ^PRSATP
;
; Test #1 | DBH HOL DAH
; Test #2 DBH | HOL DAH
; Test #3 DBH HOL | DAH
; Test #4 DBH | HOL | DAH
;
; Input:
; PPI - IEN of current pay period
; DFN - IEN of employee
; WDAY - Day to begin testing
; DBH - null
; HOL - null
; DAH - null
; QUIT - null
;
; Output: If set these variables will contain the following
; DAH - PPI^DAY^type of non-pay
; DBH - PPI^DAY^type of non-pay
; HOL - PPI^DAY^Status of timecard that contains holiday
; QUIT - Will be set to 1 when holiday encapsulation test fails
; and no additional checks need to be made.
N BACK,PPIP
S PPIP=PPI
;
; Check Day After Holiday
D DAH^PRSATP7(PPIP,DFN,WDAY,.DAH,.QUIT)
I DAH="" S QUIT=1
Q:QUIT
;
; Find Holiday
S BACK=0
F D Q:QUIT!(HOL'="")!(HOL=""&BACK=2)
. S WDAY=WDAY-1
. I WDAY=0 D GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
. I BACK=2 S QUIT=1 Q
. D FNDHOL^PRSATP8(PPIP,DFN,WDAY,.HOL,.QUIT)
Q:QUIT
;
; Find Previous Work Day
S PPIP=$P(HOL,U,1),WDAY=$P(HOL,U,2),BACK=0
F D Q:QUIT!(DBH'="")!(DBH=""&BACK=2)
. S WDAY=WDAY-1
. I WDAY=0 D GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
. I BACK=2 S QUIT=1 Q
. D DBH^PRSATP6(PPIP,DFN,WDAY,.DBH,.QUIT)
Q
;
UPDT(DFN,DBH,HOL,DAH) ; Perform final checks
; Input:
; DFN - IEN of employee
; DBH - PPI^DAY^type of non-pay
; HOL - PPI^DAY^Status of timecard that contains holiday
; DAH - PPI^DAY^type of non-pay
;
; Output:
; Displays Holiday encapsulation message to Timekeeper and whether
; or not it was able to chance the HX postings to the apppriate
; form of non-pay
;
; Holiday was encapsulated by non-pay. Perform final checks.
N HDAY,HIEN,HPPI,HOLEX,HOLIN,IEN4585,LSTAT,PPI,PRSIEN,SEG,TOT
N TSTAT,PRSFDA,SEG,SOH
S HPPI=$P(HOL,U,1),HDAY=$P(HOL,U,2),PPI=$P(DAH,U,1)
S HOLEX=$P(^PRST(458,HPPI,2),U,HDAY) ; External date
S HOLIN=$P(^PRST(458,HPPI,1),U,HDAY) ; Internal date
;
; Compare types of non-pay before and after
S TOT=$S($P(DBH,U,3)'=$P(DAH,U,3):"NP",1:$P(DAH,U,3))
;
; If holiday is in the current PP, employee timecard will already
; be locked. If holiday is in prior pay period try to lock it.
; LSTAT = 1 - Holiday in current PP and was already locked
; = 2 - Holiday in prior PP and lock was obtained
; = 3 - Holiday in prior PP and lock was not obtained
;
I PPI=HPPI S LSTAT=1
I PPI'=HPPI D
. L +^PRST(458,HPPI,"E",DFN):2
. S LSTAT=$S($T:2,1:3)
S SOH=$P(^PRST(458,HPPI,"E",DFN,0),U,2) ; Get current status of holiday
;
; Change HX to appropriate form of non-pay
S HIEN=HDAY_","_DFN_","_HPPI_","
F SEG=43:4:67 D
. I $$GET1^DIQ(458.02,HIEN,SEG)="HX" D
. . S PRSIEN(458.02,HIEN,SEG)=TOT
I $D(PRSIEN),LSTAT<3,SOH="T" D UPDATE^DIE("","PRSIEN","HIEN"),MSG^DIALOG()
;
; Display appropriate message based on Lock and timecard status
W !!,"Due to the non-pay posting on this day the holiday occurring on ",HOLEX
W !,"was encapsulated with non-pay. "
;
; If we could autopost non-pay
I LSTAT<3,SOH="T" D
. W "The HX postings were automatically updated to"
. W !,"the appropriate form of non-pay."
;
; If we could not autopost non-pay because timecard was in a status other
; than T (Timekeeper)
I SOH'="T" D
. W "The HX postings could not be automatically"
. W !,"updated to the appropriate form of non-pay because the status of the holiday"
. W !,"was not TIMEKEEPER. You will need to manually address this issue."
. D SET
;
; If we could not autopost non-pay because the timecard was currently locked
; by another user
I LSTAT=3,SOH="T" D
. W "The HX postings could not be automatically"
. W !,"updated to the appropriate form of non-pay because the timecard was locked"
. W !,"by another user. You will need to manually address this issue."
. D SET
Q
;
SET ; Add entry to #458.5
S PRSFDA(458.5,"+1,",.01)=DFN ; Employee
S PRSFDA(458.5,"+1,",1)=DFN ; Employee
S PRSFDA(458.5,"+1,",2)=HOLIN ; Date of exception
S PRSFDA(458.5,"+1,",4)="HX was encapsulated by non-pay" ; Type of Exception
D UPDATE^DIE("","PRSFDA","IEN4585"),MSG^DIALOG()
;
; Reset .01 field to sequence number
S IEN4585=IEN4585(1)_","
S PRSFDA(458.5,IEN4585,.01)=IEN4585(1) ; Sequence #
D UPDATE^DIE("","PRSFDA","IEN4585"),MSG^DIALOG()
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRSATP3 4655 printed Oct 16, 2024@18:25:26 Page 2
PRSATP3 ;HISC/MGD-Timekeeper Post Absence ;01/03/06
+1 ;;4.0;PAID;**102**;Sep 21, 1995
+2 ;
HENCAP(PPI,DFN,WDAY,DBH,HOL,DAH,QUIT) ;
+1 ; Check to see if there is a Holiday encapsulated by some form of non-pay.
+2 ; Called from Timekeeper Posting routine ^PRSATP
+3 ;
+4 ; Test #1 | DBH HOL DAH
+5 ; Test #2 DBH | HOL DAH
+6 ; Test #3 DBH HOL | DAH
+7 ; Test #4 DBH | HOL | DAH
+8 ;
+9 ; Input:
+10 ; PPI - IEN of current pay period
+11 ; DFN - IEN of employee
+12 ; WDAY - Day to begin testing
+13 ; DBH - null
+14 ; HOL - null
+15 ; DAH - null
+16 ; QUIT - null
+17 ;
+18 ; Output: If set these variables will contain the following
+19 ; DAH - PPI^DAY^type of non-pay
+20 ; DBH - PPI^DAY^type of non-pay
+21 ; HOL - PPI^DAY^Status of timecard that contains holiday
+22 ; QUIT - Will be set to 1 when holiday encapsulation test fails
+23 ; and no additional checks need to be made.
+24 NEW BACK,PPIP
+25 SET PPIP=PPI
+26 ;
+27 ; Check Day After Holiday
+28 DO DAH^PRSATP7(PPIP,DFN,WDAY,.DAH,.QUIT)
+29 IF DAH=""
SET QUIT=1
+30 if QUIT
QUIT
+31 ;
+32 ; Find Holiday
+33 SET BACK=0
+34 FOR
Begin DoDot:1
+35 SET WDAY=WDAY-1
+36 IF WDAY=0
DO GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
+37 IF BACK=2
SET QUIT=1
QUIT
+38 DO FNDHOL^PRSATP8(PPIP,DFN,WDAY,.HOL,.QUIT)
End DoDot:1
if QUIT!(HOL'="")!(HOL=""&BACK=2)
QUIT
+39 if QUIT
QUIT
+40 ;
+41 ; Find Previous Work Day
+42 SET PPIP=$PIECE(HOL,U,1)
SET WDAY=$PIECE(HOL,U,2)
SET BACK=0
+43 FOR
Begin DoDot:1
+44 SET WDAY=WDAY-1
+45 IF WDAY=0
DO GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
+46 IF BACK=2
SET QUIT=1
QUIT
+47 DO DBH^PRSATP6(PPIP,DFN,WDAY,.DBH,.QUIT)
End DoDot:1
if QUIT!(DBH'="")!(DBH=""&BACK=2)
QUIT
+48 QUIT
+49 ;
UPDT(DFN,DBH,HOL,DAH) ; Perform final checks
+1 ; Input:
+2 ; DFN - IEN of employee
+3 ; DBH - PPI^DAY^type of non-pay
+4 ; HOL - PPI^DAY^Status of timecard that contains holiday
+5 ; DAH - PPI^DAY^type of non-pay
+6 ;
+7 ; Output:
+8 ; Displays Holiday encapsulation message to Timekeeper and whether
+9 ; or not it was able to chance the HX postings to the apppriate
+10 ; form of non-pay
+11 ;
+12 ; Holiday was encapsulated by non-pay. Perform final checks.
+13 NEW HDAY,HIEN,HPPI,HOLEX,HOLIN,IEN4585,LSTAT,PPI,PRSIEN,SEG,TOT
+14 NEW TSTAT,PRSFDA,SEG,SOH
+15 SET HPPI=$PIECE(HOL,U,1)
SET HDAY=$PIECE(HOL,U,2)
SET PPI=$PIECE(DAH,U,1)
+16 ; External date
SET HOLEX=$PIECE(^PRST(458,HPPI,2),U,HDAY)
+17 ; Internal date
SET HOLIN=$PIECE(^PRST(458,HPPI,1),U,HDAY)
+18 ;
+19 ; Compare types of non-pay before and after
+20 SET TOT=$SELECT($PIECE(DBH,U,3)'=$PIECE(DAH,U,3):"NP",1:$PIECE(DAH,U,3))
+21 ;
+22 ; If holiday is in the current PP, employee timecard will already
+23 ; be locked. If holiday is in prior pay period try to lock it.
+24 ; LSTAT = 1 - Holiday in current PP and was already locked
+25 ; = 2 - Holiday in prior PP and lock was obtained
+26 ; = 3 - Holiday in prior PP and lock was not obtained
+27 ;
+28 IF PPI=HPPI
SET LSTAT=1
+29 IF PPI'=HPPI
Begin DoDot:1
+30 LOCK +^PRST(458,HPPI,"E",DFN):2
+31 SET LSTAT=$SELECT($TEST:2,1:3)
End DoDot:1
+32 ; Get current status of holiday
SET SOH=$PIECE(^PRST(458,HPPI,"E",DFN,0),U,2)
+33 ;
+34 ; Change HX to appropriate form of non-pay
+35 SET HIEN=HDAY_","_DFN_","_HPPI_","
+36 FOR SEG=43:4:67
Begin DoDot:1
+37 IF $$GET1^DIQ(458.02,HIEN,SEG)="HX"
Begin DoDot:2
+38 SET PRSIEN(458.02,HIEN,SEG)=TOT
End DoDot:2
End DoDot:1
+39 IF $DATA(PRSIEN)
IF LSTAT<3
IF SOH="T"
DO UPDATE^DIE("","PRSIEN","HIEN")
DO MSG^DIALOG()
+40 ;
+41 ; Display appropriate message based on Lock and timecard status
+42 WRITE !!,"Due to the non-pay posting on this day the holiday occurring on ",HOLEX
+43 WRITE !,"was encapsulated with non-pay. "
+44 ;
+45 ; If we could autopost non-pay
+46 IF LSTAT<3
IF SOH="T"
Begin DoDot:1
+47 WRITE "The HX postings were automatically updated to"
+48 WRITE !,"the appropriate form of non-pay."
End DoDot:1
+49 ;
+50 ; If we could not autopost non-pay because timecard was in a status other
+51 ; than T (Timekeeper)
+52 IF SOH'="T"
Begin DoDot:1
+53 WRITE "The HX postings could not be automatically"
+54 WRITE !,"updated to the appropriate form of non-pay because the status of the holiday"
+55 WRITE !,"was not TIMEKEEPER. You will need to manually address this issue."
+56 DO SET
End DoDot:1
+57 ;
+58 ; If we could not autopost non-pay because the timecard was currently locked
+59 ; by another user
+60 IF LSTAT=3
IF SOH="T"
Begin DoDot:1
+61 WRITE "The HX postings could not be automatically"
+62 WRITE !,"updated to the appropriate form of non-pay because the timecard was locked"
+63 WRITE !,"by another user. You will need to manually address this issue."
+64 DO SET
End DoDot:1
+65 QUIT
+66 ;
SET ; Add entry to #458.5
+1 ; Employee
SET PRSFDA(458.5,"+1,",.01)=DFN
+2 ; Employee
SET PRSFDA(458.5,"+1,",1)=DFN
+3 ; Date of exception
SET PRSFDA(458.5,"+1,",2)=HOLIN
+4 ; Type of Exception
SET PRSFDA(458.5,"+1,",4)="HX was encapsulated by non-pay"
+5 DO UPDATE^DIE("","PRSFDA","IEN4585")
DO MSG^DIALOG()
+6 ;
+7 ; Reset .01 field to sequence number
+8 SET IEN4585=IEN4585(1)_","
+9 ; Sequence #
SET PRSFDA(458.5,IEN4585,.01)=IEN4585(1)
+10 DO UPDATE^DIE("","PRSFDA","IEN4585")
DO MSG^DIALOG()
+11 QUIT