Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PRSATP3

PRSATP3.m

Go to the documentation of this file.
  1. PRSATP3 ;HISC/MGD-Timekeeper Post Absence ;01/03/06
  1. ;;4.0;PAID;**102**;Sep 21, 1995
  1. ;
  1. HENCAP(PPI,DFN,WDAY,DBH,HOL,DAH,QUIT) ;
  1. ; Check to see if there is a Holiday encapsulated by some form of non-pay.
  1. ; Called from Timekeeper Posting routine ^PRSATP
  1. ;
  1. ; Test #1 | DBH HOL DAH
  1. ; Test #2 DBH | HOL DAH
  1. ; Test #3 DBH HOL | DAH
  1. ; Test #4 DBH | HOL | DAH
  1. ;
  1. ; Input:
  1. ; PPI - IEN of current pay period
  1. ; DFN - IEN of employee
  1. ; WDAY - Day to begin testing
  1. ; DBH - null
  1. ; HOL - null
  1. ; DAH - null
  1. ; QUIT - null
  1. ;
  1. ; Output: If set these variables will contain the following
  1. ; DAH - PPI^DAY^type of non-pay
  1. ; DBH - PPI^DAY^type of non-pay
  1. ; HOL - PPI^DAY^Status of timecard that contains holiday
  1. ; QUIT - Will be set to 1 when holiday encapsulation test fails
  1. ; and no additional checks need to be made.
  1. N BACK,PPIP
  1. S PPIP=PPI
  1. ;
  1. ; Check Day After Holiday
  1. D DAH^PRSATP7(PPIP,DFN,WDAY,.DAH,.QUIT)
  1. I DAH="" S QUIT=1
  1. Q:QUIT
  1. ;
  1. ; Find Holiday
  1. S BACK=0
  1. F D Q:QUIT!(HOL'="")!(HOL=""&BACK=2)
  1. . S WDAY=WDAY-1
  1. . I WDAY=0 D GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
  1. . I BACK=2 S QUIT=1 Q
  1. . D FNDHOL^PRSATP8(PPIP,DFN,WDAY,.HOL,.QUIT)
  1. Q:QUIT
  1. ;
  1. ; Find Previous Work Day
  1. S PPIP=$P(HOL,U,1),WDAY=$P(HOL,U,2),BACK=0
  1. F D Q:QUIT!(DBH'="")!(DBH=""&BACK=2)
  1. . S WDAY=WDAY-1
  1. . I WDAY=0 D GETPPP^PRSATP5(.PPIP,DFN,.WDAY,.BACK,.QUIT)
  1. . I BACK=2 S QUIT=1 Q
  1. . D DBH^PRSATP6(PPIP,DFN,WDAY,.DBH,.QUIT)
  1. Q
  1. ;
  1. UPDT(DFN,DBH,HOL,DAH) ; Perform final checks
  1. ; Input:
  1. ; DFN - IEN of employee
  1. ; DBH - PPI^DAY^type of non-pay
  1. ; HOL - PPI^DAY^Status of timecard that contains holiday
  1. ; DAH - PPI^DAY^type of non-pay
  1. ;
  1. ; Output:
  1. ; Displays Holiday encapsulation message to Timekeeper and whether
  1. ; or not it was able to chance the HX postings to the apppriate
  1. ; form of non-pay
  1. ;
  1. ; Holiday was encapsulated by non-pay. Perform final checks.
  1. N HDAY,HIEN,HPPI,HOLEX,HOLIN,IEN4585,LSTAT,PPI,PRSIEN,SEG,TOT
  1. N TSTAT,PRSFDA,SEG,SOH
  1. S HPPI=$P(HOL,U,1),HDAY=$P(HOL,U,2),PPI=$P(DAH,U,1)
  1. S HOLEX=$P(^PRST(458,HPPI,2),U,HDAY) ; External date
  1. S HOLIN=$P(^PRST(458,HPPI,1),U,HDAY) ; Internal date
  1. ;
  1. ; Compare types of non-pay before and after
  1. S TOT=$S($P(DBH,U,3)'=$P(DAH,U,3):"NP",1:$P(DAH,U,3))
  1. ;
  1. ; If holiday is in the current PP, employee timecard will already
  1. ; be locked. If holiday is in prior pay period try to lock it.
  1. ; LSTAT = 1 - Holiday in current PP and was already locked
  1. ; = 2 - Holiday in prior PP and lock was obtained
  1. ; = 3 - Holiday in prior PP and lock was not obtained
  1. ;
  1. I PPI=HPPI S LSTAT=1
  1. I PPI'=HPPI D
  1. . L +^PRST(458,HPPI,"E",DFN):2
  1. . S LSTAT=$S($T:2,1:3)
  1. S SOH=$P(^PRST(458,HPPI,"E",DFN,0),U,2) ; Get current status of holiday
  1. ;
  1. ; Change HX to appropriate form of non-pay
  1. S HIEN=HDAY_","_DFN_","_HPPI_","
  1. F SEG=43:4:67 D
  1. . I $$GET1^DIQ(458.02,HIEN,SEG)="HX" D
  1. . . S PRSIEN(458.02,HIEN,SEG)=TOT
  1. I $D(PRSIEN),LSTAT<3,SOH="T" D UPDATE^DIE("","PRSIEN","HIEN"),MSG^DIALOG()
  1. ;
  1. ; Display appropriate message based on Lock and timecard status
  1. W !!,"Due to the non-pay posting on this day the holiday occurring on ",HOLEX
  1. W !,"was encapsulated with non-pay. "
  1. ;
  1. ; If we could autopost non-pay
  1. I LSTAT<3,SOH="T" D
  1. . W "The HX postings were automatically updated to"
  1. . W !,"the appropriate form of non-pay."
  1. ;
  1. ; If we could not autopost non-pay because timecard was in a status other
  1. ; than T (Timekeeper)
  1. I SOH'="T" D
  1. . W "The HX postings could not be automatically"
  1. . W !,"updated to the appropriate form of non-pay because the status of the holiday"
  1. . W !,"was not TIMEKEEPER. You will need to manually address this issue."
  1. . D SET
  1. ;
  1. ; If we could not autopost non-pay because the timecard was currently locked
  1. ; by another user
  1. I LSTAT=3,SOH="T" D
  1. . W "The HX postings could not be automatically"
  1. . W !,"updated to the appropriate form of non-pay because the timecard was locked"
  1. . W !,"by another user. You will need to manually address this issue."
  1. . D SET
  1. Q
  1. ;
  1. SET ; Add entry to #458.5
  1. S PRSFDA(458.5,"+1,",.01)=DFN ; Employee
  1. S PRSFDA(458.5,"+1,",1)=DFN ; Employee
  1. S PRSFDA(458.5,"+1,",2)=HOLIN ; Date of exception
  1. S PRSFDA(458.5,"+1,",4)="HX was encapsulated by non-pay" ; Type of Exception
  1. D UPDATE^DIE("","PRSFDA","IEN4585"),MSG^DIALOG()
  1. ;
  1. ; Reset .01 field to sequence number
  1. S IEN4585=IEN4585(1)_","
  1. S PRSFDA(458.5,IEN4585,.01)=IEN4585(1) ; Sequence #
  1. D UPDATE^DIE("","PRSFDA","IEN4585"),MSG^DIALOG()
  1. Q