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

PRSAOTTF.m

Go to the documentation of this file.
  1. PRSAOTTF ;WCIOFO/JAH-OVERTIME WARNINGS FILER--8/18/98
  1. ;;4.0;PAID;**43**;Sep 21, 1995
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. FILEOTW(PPI,DFN,WK,O8,OA) ;Add an overtime warning (OTW) to 458.6
  1. ; Input: PPI--pay period (pp) ien from 458
  1. ; DFN--employee ien in 450 who has more calc ot than approved
  1. ; WK--week 1 or 2 of pp
  1. ; O8--overtime (OT) in 8b string
  1. ; OA--ot in requests file w/ approved status
  1. ; (O8 and OA are totals for the range covered by PPI and WK)
  1. ;
  1. N IEN,DA,X,DIC,DLAYGO
  1. Q:(PPI'>0)!(DFN'>0)!(WK<1)!(WK>2)!(O8<0)!(O8>99)!(OA<0)!(OA>99)
  1. ;
  1. ;Overwrite existing warning.
  1. ;
  1. S IEN=$$WRNEXIST(PPI,DFN,WK)
  1. I IEN D
  1. . S DIE="^PRST(458.6,",DA=IEN,DR="7///^S X=O8;8///^S X=OA"
  1. . L +^PRST(458.6,IEN):5 D ^DIE L -^PRST(458.6,IEN)
  1. Q:IEN
  1. ;
  1. ;For new warnings, use next available entry.
  1. ;Lock header node so that 2 supervisors approving records
  1. ;with warnings will not get the same ien to use for the warning.
  1. ;
  1. L +^PRST(458.6,0):10 I $T S IEN=$$NEXTWRN()
  1. Q:'IEN
  1. ;
  1. ; unlock header and quit if can't lock record
  1. L +^PRST(458.6,IEN):0
  1. I '$T L -^PRST(458.6,0) Q
  1. ;
  1. S DIC="^PRST(458.6,",DIC(0)="L",DLAYGO=458.6,(DA,X)=IEN
  1. S DIC("DR")="1///^S X=DFN;2///^S X=PPI;3///^S X=WK;7///^S X=O8;8///^S X=OA"
  1. K DD,DO D FILE^DICN
  1. L -^PRST(458.6,IEN)
  1. L -^PRST(458.6,0)
  1. Q
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. WRNEXIST(PPI,DFN,WK) ;
  1. ;return ien from 458.6 if OTW exists 4 this employ, PP and week
  1. ;otherwise return false.
  1. ;
  1. N REC,TMPIEN,IEN
  1. S U="^"
  1. S (TMPIEN,IEN)=0
  1. F S TMPIEN=$O(^PRST(458.6,"C",PPI,TMPIEN)) Q:TMPIEN'>0!(IEN) D
  1. . S REC=$G(^PRST(458.6,TMPIEN,0))
  1. . I $P(REC,U,2)=DFN,$P(REC,U,4)=WK S IEN=TMPIEN
  1. Q IEN
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. NEXTWRN() ;
  1. ;find last entry in file and increment. if no entries start at 1.
  1. N IEN S IEN=+$P(^PRST(458.6,0),"^",3)+1
  1. ;
  1. ;ensure entry is valid. if not loop increments and checks until an
  1. ;available spot is found.
  1. F Q:'$D(^PRST(458.6,IEN,0)) S IEN=IEN+1
  1. Q IEN
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. STATCHNG(IEN,STAT) ;OTW STATUS CHANGE BOOLEAN FUNCTION
  1. ; WARNING: called from Mumps x-ref (AC) on STATUS field in 458.6
  1. ; Extrinsic function checks if status currently being set is different
  1. ; from existing status.
  1. ; INPUT: IEN - record # in OTW file.
  1. ; STAT - value that the STATUS field is being set to. (i.e
  1. ; X is defined in the calling x-ref. code.)
  1. ; OUTPUT: returns true if new and existing STATUS is different, false
  1. ; otherwise.
  1. ;
  1. N ACT,CLR,OLDSTAT
  1. S (RET,ACT,CLR)=0
  1. ;ensure we have a record # and a new status of active or cleared.
  1. Q:$G(IEN)'>0!(($G(STAT)'="A")&($G(STAT)'="C")) RET
  1. ;
  1. ; look at "E" x-ref of status field to determine if the OT warning is
  1. ; active or inactive.
  1. ;
  1. S ACT=$D(^PRST(458.6,"E","A",IEN))
  1. S CLR=$D(^PRST(458.6,"E","C",IEN))
  1. S OLDSTAT=$S(ACT:"A",CLR:"C",1:"")
  1. S RET=$S(OLDSTAT'=STAT:1,1:0)
  1. ;
  1. Q RET
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. CLRXREF(IEN) ;
  1. ; set LAST UPDATED BY field in file 458.6 when the status field is
  1. ; changed. Use global set since this function is being called from
  1. ; X-ref and potentially via DIE call in CLEAR^PRSAOTTF.
  1. ;
  1. ; ensure current users DUZ is defined and we have an OT warning.
  1. Q:($G(DUZ)'>0)!('$D(^PRST(458.6,$G(IEN),0)))
  1. ;
  1. S $P(^PRST(458.6,IEN,0),"^",6)=DUZ
  1. ;
  1. Q
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. EXIT ; -- exit code
  1. D CLEAR^VALM1 K ^TMP("PRSOTW",$J),^TMP("PRSOTR",$J)
  1. K PRSIEN,PRSOUT,PRSWPP,PRSWPPI,PRSWSTAT,PRSWSTAT
  1. K PRSRREC,PRSRPPI,PRSRPPE,PRSREMP,PRSRWK,PRSRNM
  1. K PRSCREC
  1. Q