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

PRSAOTTW.m

Go to the documentation of this file.
  1. PRSAOTTW ;WCIOFO/JAH-OVERTIME WARNINGS (OTW) LISTER--8/18/98
  1. ;;4.0;PAID;**43**;Sep 21, 1995
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. LISTEN ; -- main entry point for OTW LIST--called by list manager
  1. ;
  1. S PRSOUT=0
  1. D LISPARAM(.PRSWPP,.PRSWPPI,.PRSWSTAT,.PRSOUT)
  1. Q:PRSOUT
  1. ;convert status to internal value in ot warnings file
  1. ; A = active i = inactive (b for both is not an internal status)
  1. S PRSWSTAT=$S(PRSWSTAT=1:"A",PRSWSTAT=2:"C",1:"B")
  1. ;
  1. ; Call to List Manager to run PRSA OVERTIME WARNINGS template
  1. D EN^VALM("PRSA OVERTIME WARNINGS")
  1. Q
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. LISPARAM(PP,PPI,STAT,USEROUT) ;
  1. ;Ask the user if they want the list to contain 1 or all pay peroids
  1. ;and whether they want to see cleared, active or all warnings.
  1. N DIR,DIRUT,X,Y
  1. S USEROUT=0
  1. S DIR(0)="S^1:select a pay period;2:all pay periods"
  1. D ^DIR S PP=Y
  1. I $D(DIRUT) S USEROUT=1 Q
  1. ;
  1. ; get pp if user chose a single pp
  1. I PP=1 D
  1. . S DIC="^PRST(458,",DIC(0)="AEMNQ" D ^DIC
  1. . S PPI=+Y
  1. ;
  1. ;Prompt user for type of warnings to display
  1. I Y'>0 S USEROUT=1 Q
  1. N DIR,X,Y,DIRUT
  1. S DIR(0)="S^1:Active Warnings;2:Cleared Warnings;3:Active & Cleared"
  1. D BLDHLP,^DIR
  1. I $D(DIRUT) S USEROUT=1 Q
  1. S STAT=Y
  1. Q
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. BLDHLP ;
  1. N I,TXT
  1. S DIR("?")=" Enter 1, 2, 3 or '^' to exit."
  1. F I=1:1 S TXT=$P($T(HLPTXT+I),";;",2) Q:TXT="" S DIR("?",I)=TXT
  1. Q
  1. HLPTXT ;
  1. ;; Overtime Warnings occur when an employee has more
  1. ;; overtime in their TT8B string than approved overtime in the
  1. ;; overtime requests file. Normally, a warning becomes ACTIVE when a
  1. ;; timecard is certified that will result in unapproved overtime
  1. ;; being paid. If corrective action is taken payroll may then
  1. ;; CLEAR the overtime warning. Although CLEARED warnings may be
  1. ;; viewed through this option they WILL NO LONGER appear on the Pay
  1. ;; Period Exceptions report. ACTIVE warnings will appear on the
  1. ;; exceptions report.
  1. ;;
  1. Q
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. HDR ; -- header code
  1. ; All pperiods.
  1. I PRSWPP=2 D
  1. . I PRSWSTAT="C" S VALMHDR(1)="Cleared for all pay periods"
  1. . I PRSWSTAT="A" S VALMHDR(1)="Active for all pay periods"
  1. . I PRSWSTAT="B" S VALMHDR(1)="Active & cleared for all pay periods."
  1. ;
  1. I PRSWPP=1 D
  1. . I PRSWSTAT="C" S VALMHDR(1)="Cleared for single pay period"
  1. . I PRSWSTAT="A" S VALMHDR(1)="Active for single pay period"
  1. . I PRSWSTAT="B" S VALMHDR(1)="Active & cleared for a single pay period"
  1. Q
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. INIT ; -- init variables and list array
  1. ; This entry point is called from list manager
  1. ;
  1. N IEN,PPE,WK,OT8B,OTAP,COUNT
  1. S U="^"
  1. K ^TMP("PRSAOTW",$J)
  1. S LIST=0,NUMBER=0
  1. D CLEAN^VALM10
  1. S COUNT=0,NUMBER=""
  1. ;
  1. ;loop adds list items if user chose active OR inactive & all pperiods.
  1. I PRSWPP=2,PRSWSTAT'="B" D
  1. .F S NUMBER=$O(^PRST(458.6,"E",PRSWSTAT,NUMBER)) Q:NUMBER="" D
  1. .. D LISITEM(NUMBER,.COUNT)
  1. ;
  1. ;loop adds list items if user chose active OR inactive & 1 pperiod
  1. ;
  1. I PRSWPP=1,PRSWSTAT'="B" D
  1. .S NUMBER=0
  1. .F S NUMBER=$O(^PRST(458.6,"C",PRSWPPI,NUMBER)) Q:NUMBER="" D
  1. .. I $D(^PRST(458.6,"E",PRSWSTAT,NUMBER)) D LISITEM(NUMBER,.COUNT)
  1. ;
  1. ;loop adds list items if user chose active & inactive & 1 pperiod
  1. ;
  1. I PRSWPP=1,PRSWSTAT="B" D
  1. .S NUMBER=0
  1. .F S NUMBER=$O(^PRST(458.6,"C",PRSWPPI,NUMBER)) Q:NUMBER="" D
  1. .. D LISITEM(NUMBER,.COUNT)
  1. ;
  1. ;loop adds list items if user chose active & inactive & all pperiods.
  1. ;
  1. I PRSWPP=2,PRSWSTAT="B" D
  1. .;1st loop through 4 digit year pp x-ref
  1. .S PRSWPPI=""
  1. .F S PRSWPPI=$O(^PRST(458.6,"D",PRSWPPI)) Q:PRSWPPI']"" D
  1. .. S NUMBER=0
  1. .. F S NUMBER=$O(^PRST(458.6,"D",PRSWPPI,NUMBER)) Q:NUMBER'>0 D
  1. ... D LISITEM(NUMBER,.COUNT)
  1. ;
  1. S VALMCNT=COUNT
  1. Q
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. LISITEM(IEN,COUNT) ;ADD A SINGLE ITEM TO OT WARNINGS LIST
  1. N PPI,PPE,EMP,WK,OT8B,OTAP,STAT,TL,CLEARER
  1. S COUNT=COUNT+1
  1. ;
  1. ;get fields from a record in the ot warnings file
  1. ;
  1. S PPI=$P($G(^PRST(458.6,IEN,0)),U,3) ; Pay per ien
  1. S PPE=$P($G(^PRST(458,PPI,0)),U) ; pay per ext format
  1. S EMP=$P($G(^PRST(458.6,IEN,0)),U,2) ; employee ien in 450
  1. S EMP=$P($G(^PRSPC(EMP,0)),U),TL=$P(^(0),U,8) ; name and t&l unit
  1. S WK=$P($G(^PRST(458.6,IEN,0)),U,4) ; week 1 or 2 of pay per
  1. S OT8B=" "_$P($G(^PRST(458.6,IEN,0)),U,8) ; all ot in 8b string
  1. S OTAP=" "_$P($G(^PRST(458.6,IEN,0)),U,9) ; all ot in request file
  1. S STAT=$P($G(^PRST(458.6,IEN,0)),U,5) ; status of warning
  1. S STAT=$S(STAT="A":"Active",1:"Cleared")
  1. S CLEARER=$P($G(^PRST(458.6,IEN,0)),U,6) ; clearer 450 IEN
  1. I CLEARER S CLEARER=$P($G(^VA(200,CLEARER,0)),U) ; clearer 450 name
  1. ;
  1. ;Build one line (X) for list manager containing a warning.
  1. ; 3rd parameter is name of field on List Template
  1. ;
  1. S X=$$SETFLD^VALM1(COUNT,"","NUMBER")
  1. S X=$$SETFLD^VALM1(PPE,X,"PAY PERIOD")
  1. S X=$$SETFLD^VALM1(WK,X,"WEEK")
  1. S X=$$SETFLD^VALM1(EMP,X,"EMPLOYEE")
  1. S X=$$SETFLD^VALM1(TL,X,"TL")
  1. S X=$$SETFLD^VALM1(STAT,X,"STATUS")
  1. S X=$$SETFLD^VALM1(OT8B,X,"OT8B")
  1. S X=$$SETFLD^VALM1(OTAP,X,"OTAP")
  1. S X=$$SETFLD^VALM1(CLEARER,X,"UPDATER")
  1. D SET^VALM10(COUNT,X,COUNT)
  1. ;
  1. ; save the ien of the record in the list global for easier
  1. ; reference to the acutal data.
  1. ;
  1. S ^TMP("PRSAOTW",$J,COUNT)=IEN
  1. Q
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. PRSIEN() ;RETURN PAID IEN FROM 450 BASED ON DUZ.
  1. N SSN
  1. ;
  1. S PRSIEN=""
  1. Q:'DUZ PRSIEN
  1. ;
  1. S SSN=$P($G(^VA(200,DUZ,1)),"^",9)
  1. I SSN'="" S PRSIEN=$O(^PRSPC("SSN",SSN,0)) S:PRSIEN'>0 PRSIEN=""
  1. Q PRSIEN
  1. ;
  1. ; = = = = = = = = = = = = = = = = =
  1. ;
  1. CLEAR ; Clear an OT warning. This code called when a user running the
  1. ; OT warnings option selects clear OT warnings protocol.
  1. ;
  1. N PRSCREC,PRSCLCNT,PRSELECT,PRSNOCL,DIE,DIR,DIRUT,PLURAL
  1. ;
  1. ;allow selection of list items in the display region.
  1. ;
  1. D EN^VALM2("","")
  1. Q:$O(VALMY(0))'>0
  1. ;
  1. S PRSCLCNT=0,DIE="^PRST(458.6,"
  1. S (PRSCREC,PRSELECT,PRSNOCL)=""
  1. F S PRSCREC=$O(VALMY(PRSCREC)) Q:PRSCREC="" D
  1. . ;
  1. . ;Get ien for 458.6 that matches the list item.
  1. . S PRSCIEN=$G(^TMP("PRSAOTW",$J,PRSCREC))
  1. . ;
  1. . ;Get status of ot warning
  1. . S PRSCSTAT=$P($G(^PRST(458.6,PRSCIEN,0)),U,5)
  1. . ;
  1. . ;increment clearable warning count
  1. . ;& build variable of items that will be cleared
  1. . ;& highlight selected items
  1. . I PRSCSTAT="A" D
  1. .. S PRSCLCNT=PRSCLCNT+1,PRSELECT=PRSELECT_","_PRSCREC
  1. .. ;
  1. .. D CNTRL^VALM10(PRSCREC,2,$L(PRSCREC),IORVON,IORVOFF)
  1. .. D CNTRL^VALM10(PRSCREC,5,74,IOINHI,IOINORM),WRITE^VALM10(PRSCREC)
  1. ;
  1. ;strip off leading comma from clear list
  1. S PRSELECT=$P(PRSELECT,",",2,999)
  1. ;
  1. ;return to list if no active warnings selected.
  1. ;
  1. I PRSELECT="" S VALMSG="No ACTIVE warnings selected." S VALMBCK="R" Q
  1. ;
  1. ; If user wants to clear items then clear all selected. Skip any
  1. ; that r already clear & keep track of any that are locked (PRSNOCL).
  1. ; Build ListMan message w/ all unclearable records due to locks.
  1. ;
  1. S DIR(0)="YA"
  1. S PLURAL=$S($L(PRSELECT,",")<2:"entry",1:"entries")
  1. S DIR("A")="Clear "_PLURAL_" "_PRSELECT_" ?"
  1. D ^DIR
  1. I Y D
  1. . S PRSCREC=0
  1. . F S PRSCREC=$O(VALMY(PRSCREC)) Q:PRSCREC="" D
  1. .. S PRSCIEN=$G(^TMP("PRSAOTW",$J,PRSCREC))
  1. .. S PRSCSTAT=$P($G(^PRST(458.6,PRSCIEN,0)),U,5)
  1. .. I PRSCSTAT="A" D
  1. ... S PRSCSTAT="C"
  1. ... S DR="4///^S X=PRSCSTAT",DA=PRSCIEN
  1. ... L +^PRST(458.6,PRSCIEN):0
  1. ... I $T D
  1. .... D ^DIE L -^PRST(458.6,PRSCIEN)
  1. ... E S PRSNOCL=PRSNOCL_" "_PRSCREC
  1. S:PRSNOCL'="" VALMSG=PRSNOCL_" NOT CLEARED. EDIT BY ANOTHER USER"
  1. ;
  1. ;whether list items cleared or not rebuild list and return
  1. ;
  1. D INIT
  1. S VALMBCK="R"
  1. Q
  1. HELP ;Help for the PRSA OVERTIME WARNINGS list template
  1. D FULL^VALM1
  1. W !!,?2,"At the Action prompt you may enter CL or VI.",!
  1. W !,?4,"Enter CL to select any of the active overtime warnings on the"
  1. W !,?4,"screen that you wish to clear.",!
  1. W !,?4,"Enter VI to select one of the displayed warnings to view requests"
  1. W !,?4,"on file that correlate to the week and pay period of the warning."
  1. D PAUSE^VALM1
  1. D RE^VALM4
  1. Q