- PRSAOTTR ;WCIOFO/JAH-LIST OVERTIME REQUESTS-8/18/98
- ;;4.0;PAID;**43**;Sep 21, 1995
- HDR ;
- S VALMHDR(1)="PP "_PRSRPPE_" Week "_PRSRWK_" Overtime Requests for "_PRSRNM
- Q
- ;
- ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- ;
- OTRQVW ;OVERTIME REQUESTS VIEW
- ; -- main entry point for PRSA VIEW OT REQ which is called by
- ; the PRSA VIEW OT REQ protocol on the PRSA OVERTIME WARNINGS
- ; List Template protocol menu.
- S PRSOUT=0
- ;
- K ^TMP("PRSAOTR",$J)
- N PRSRREC,PRSRIEN
- ;
- ;ask user to select an overtime warning. The requests on file
- ;associated with that warning will be displayed
- ;
- D PICKWARN
- ;
- Q:PRSOUT
- ;
- ; Call to List Manager to run PRSA OT VIEW REQ template
- D EN^VALM("PRSA VIEW OT REQ")
- S VALMBCK="R"
- Q
- ;
- ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- ;
- PICKWARN ;procedure asks for one entry on ot warnings list
- ; and gets the warnings data from the ot warnings file.
- ;
- ;allow selection of only one (1) of the items on the list.
- ;call returns VALMY() array subscripted by list item number.
- D EN^VALM2("","S")
- ;
- S PRSRREC="",PRSRREC=$O(VALMY(0))
- I $G(PRSRREC) D
- . ;Get ien for 458.6 that matches the list item.
- . S PRSRIEN=$G(^TMP("PRSAOTW",$J,PRSRREC)) ; Selected ot warn list num
- . S PRSRREC=$G(^PRST(458.6,PRSRIEN,0)) ; Data on ot warnings list item
- . S PRSRPPI=$P(PRSRREC,U,3) ; Pay period ien
- . S PRSRPPE=$P($G(^PRST(458,PRSRPPI,0)),U) ; External pp format
- . S PRSREMP=$P(PRSRREC,U,2) ; Employee 450 ien
- . S PRSRWK=$P(PRSRREC,U,4) ; Week 1 or 2 of pp
- . S PRSRNM=$P($G(^PRSPC(PRSREMP,0)),U) ; External emp name
- E S PRSOUT=1
- Q
- ;
- ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- ;
- INIT(PPI,PPE,WK,EMP) ;BUILD LIST OF OT REQUESTS FOR EMPLOYEE
- ;Input: PPI,PPE - pay period of concern. internal and external YY-PP
- ; WK - week (1) or week (2) of pay period
- ; EMP - employees internal entry number in file 450.
- ;
- ;local vars: D1 - 1st day of payperiod-returned by NX^PRSAPPU
- ; OTREC - a record containing 1 overtime request.
- ; START,STOP - 1st & last FM days of week (Sun,Sat)
- ;
- ; quit returning 0 if anything is missing.
- Q:$G(PPE)=""!$G(WK)=""!$G(EMP)="" 0
- ;
- ; Loop thru OT/CT requests file x-ref on requested work date &
- ; add employees OT requests within week to the list array.
- ;
- N D1,TOTALOT,START,STOP,OTREC,REQCNT
- ;
- ;get start and stop FM days for one week of the pay period.
- D WEEKRNG^PRSAOTT(PPE,WK,.START,.STOP)
- S (REQCNT,TOTALOT,VALMCNT)=0
- S D1=START-.1
- F S D1=$O(^PRST(458.2,"AD",EMP,D1)) Q:D1>STOP!(D1="") D
- . S OTREC=""
- . F S OTREC=$O(^PRST(458.2,"AD",EMP,D1,OTREC)) Q:OTREC="" D
- .. I $$OTREQ^PRSAOTT(OTREC) D
- ... S REQCNT=REQCNT+1
- ... D LISITEM(OTREC,REQCNT,.TOTALOT)
- I REQCNT=0 D
- . D SET^VALM10(1," NO REQUESTS FOUND")
- . S VALMCNT=1
- D SET^VALM10(REQCNT+VALMCNT+1,"----------------------------------------------")
- D SET^VALM10(REQCNT+VALMCNT+2,"Current requested overtime total: "_TOTALOT_" hrs.")
- ;
- ; set list manager counter of number of items in list including
- ; lines containing requests, total, and ----'s
- ;
- S VALMCNT=REQCNT+2+VALMCNT
- Q
- ;
- ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- ;
- LISITEM(IEN,COUNT,OTTOTAL) ;ADD A SINGLE ITEM TO VIEW OT REQ LIST
- N PRSSTAT,PRSHRS,PRSRQDT,OTREC,X
- ;
- ;Get data from OT requests file to build one (1) line in the
- ;list of one employee's ot requests for the week.
- ;
- S OTREC=$G(^PRST(458.2,IEN,0)) ; Ot/ct/ch requests file rec
- S PRSRQDT=$P(OTREC,U,3) ; Requested work date
- S PRSRQDT=$E($$FDATE^VALM1(PRSRQDT),1,12) ; External date
- S PRSHRS=$P(OTREC,U,6) ; # of hours requested
- ; Status of requests
- S PRSSTAT=$$EXTERNAL^DILFD(458.2,10,,$P(OTREC,U,8),)
- ;S PRSTL=$P(OTREC,U,9)
- ;
- ;Build one line (X) for list manager with an ot request.
- ; 3rd parameter is name of field on List Template
- ;
- S X=$$SETFLD^VALM1(COUNT,"","NUMBER")
- S X=$$SETFLD^VALM1(PRSHRS,X,"HRSREQ")
- S X=$$SETFLD^VALM1(PRSSTAT,X,"STATUS")
- S X=$$SETFLD^VALM1(PRSRQDT,X,"WORKDATE")
- ;
- ;add line built in X to the list
- ;
- D SET^VALM10(COUNT,X,COUNT)
- ;
- ;add OT hrs from this line to total OT requests for this list
- ;
- S OTTOTAL=PRSHRS+OTTOTAL
- ;
- ; save the ien of the record in the list global for easier
- ; reference to the acutal data.
- ;
- S ^TMP("PRSAOTR",$J,COUNT)=OTREC
- Q
- ;
- ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRSAOTTR 4713 printed Feb 18, 2025@23:50:13 Page 2
- PRSAOTTR ;WCIOFO/JAH-LIST OVERTIME REQUESTS-8/18/98
- +1 ;;4.0;PAID;**43**;Sep 21, 1995
- HDR ;
- +1 SET VALMHDR(1)="PP "_PRSRPPE_" Week "_PRSRWK_" Overtime Requests for "_PRSRNM
- +2 QUIT
- +3 ;
- +4 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- +5 ;
- OTRQVW ;OVERTIME REQUESTS VIEW
- +1 ; -- main entry point for PRSA VIEW OT REQ which is called by
- +2 ; the PRSA VIEW OT REQ protocol on the PRSA OVERTIME WARNINGS
- +3 ; List Template protocol menu.
- +4 SET PRSOUT=0
- +5 ;
- +6 KILL ^TMP("PRSAOTR",$JOB)
- +7 NEW PRSRREC,PRSRIEN
- +8 ;
- +9 ;ask user to select an overtime warning. The requests on file
- +10 ;associated with that warning will be displayed
- +11 ;
- +12 DO PICKWARN
- +13 ;
- +14 if PRSOUT
- QUIT
- +15 ;
- +16 ; Call to List Manager to run PRSA OT VIEW REQ template
- +17 DO EN^VALM("PRSA VIEW OT REQ")
- +18 SET VALMBCK="R"
- +19 QUIT
- +20 ;
- +21 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- +22 ;
- PICKWARN ;procedure asks for one entry on ot warnings list
- +1 ; and gets the warnings data from the ot warnings file.
- +2 ;
- +3 ;allow selection of only one (1) of the items on the list.
- +4 ;call returns VALMY() array subscripted by list item number.
- +5 DO EN^VALM2("","S")
- +6 ;
- +7 SET PRSRREC=""
- SET PRSRREC=$ORDER(VALMY(0))
- +8 IF $GET(PRSRREC)
- Begin DoDot:1
- +9 ;Get ien for 458.6 that matches the list item.
- +10 ; Selected ot warn list num
- SET PRSRIEN=$GET(^TMP("PRSAOTW",$JOB,PRSRREC))
- +11 ; Data on ot warnings list item
- SET PRSRREC=$GET(^PRST(458.6,PRSRIEN,0))
- +12 ; Pay period ien
- SET PRSRPPI=$PIECE(PRSRREC,U,3)
- +13 ; External pp format
- SET PRSRPPE=$PIECE($GET(^PRST(458,PRSRPPI,0)),U)
- +14 ; Employee 450 ien
- SET PRSREMP=$PIECE(PRSRREC,U,2)
- +15 ; Week 1 or 2 of pp
- SET PRSRWK=$PIECE(PRSRREC,U,4)
- +16 ; External emp name
- SET PRSRNM=$PIECE($GET(^PRSPC(PRSREMP,0)),U)
- End DoDot:1
- +17 IF '$TEST
- SET PRSOUT=1
- +18 QUIT
- +19 ;
- +20 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- +21 ;
- INIT(PPI,PPE,WK,EMP) ;BUILD LIST OF OT REQUESTS FOR EMPLOYEE
- +1 ;Input: PPI,PPE - pay period of concern. internal and external YY-PP
- +2 ; WK - week (1) or week (2) of pay period
- +3 ; EMP - employees internal entry number in file 450.
- +4 ;
- +5 ;local vars: D1 - 1st day of payperiod-returned by NX^PRSAPPU
- +6 ; OTREC - a record containing 1 overtime request.
- +7 ; START,STOP - 1st & last FM days of week (Sun,Sat)
- +8 ;
- +9 ; quit returning 0 if anything is missing.
- +10 if $GET(PPE)=""!$GET(WK)=""!$GET(EMP)=""
- QUIT 0
- +11 ;
- +12 ; Loop thru OT/CT requests file x-ref on requested work date &
- +13 ; add employees OT requests within week to the list array.
- +14 ;
- +15 NEW D1,TOTALOT,START,STOP,OTREC,REQCNT
- +16 ;
- +17 ;get start and stop FM days for one week of the pay period.
- +18 DO WEEKRNG^PRSAOTT(PPE,WK,.START,.STOP)
- +19 SET (REQCNT,TOTALOT,VALMCNT)=0
- +20 SET D1=START-.1
- +21 FOR
- SET D1=$ORDER(^PRST(458.2,"AD",EMP,D1))
- if D1>STOP!(D1="")
- QUIT
- Begin DoDot:1
- +22 SET OTREC=""
- +23 FOR
- SET OTREC=$ORDER(^PRST(458.2,"AD",EMP,D1,OTREC))
- if OTREC=""
- QUIT
- Begin DoDot:2
- +24 IF $$OTREQ^PRSAOTT(OTREC)
- Begin DoDot:3
- +25 SET REQCNT=REQCNT+1
- +26 DO LISITEM(OTREC,REQCNT,.TOTALOT)
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +27 IF REQCNT=0
- Begin DoDot:1
- +28 DO SET^VALM10(1," NO REQUESTS FOUND")
- +29 SET VALMCNT=1
- End DoDot:1
- +30 DO SET^VALM10(REQCNT+VALMCNT+1,"----------------------------------------------")
- +31 DO SET^VALM10(REQCNT+VALMCNT+2,"Current requested overtime total: "_TOTALOT_" hrs.")
- +32 ;
- +33 ; set list manager counter of number of items in list including
- +34 ; lines containing requests, total, and ----'s
- +35 ;
- +36 SET VALMCNT=REQCNT+2+VALMCNT
- +37 QUIT
- +38 ;
- +39 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- +40 ;
- LISITEM(IEN,COUNT,OTTOTAL) ;ADD A SINGLE ITEM TO VIEW OT REQ LIST
- +1 NEW PRSSTAT,PRSHRS,PRSRQDT,OTREC,X
- +2 ;
- +3 ;Get data from OT requests file to build one (1) line in the
- +4 ;list of one employee's ot requests for the week.
- +5 ;
- +6 ; Ot/ct/ch requests file rec
- SET OTREC=$GET(^PRST(458.2,IEN,0))
- +7 ; Requested work date
- SET PRSRQDT=$PIECE(OTREC,U,3)
- +8 ; External date
- SET PRSRQDT=$EXTRACT($$FDATE^VALM1(PRSRQDT),1,12)
- +9 ; # of hours requested
- SET PRSHRS=$PIECE(OTREC,U,6)
- +10 ; Status of requests
- +11 SET PRSSTAT=$$EXTERNAL^DILFD(458.2,10,,$PIECE(OTREC,U,8),)
- +12 ;S PRSTL=$P(OTREC,U,9)
- +13 ;
- +14 ;Build one line (X) for list manager with an ot request.
- +15 ; 3rd parameter is name of field on List Template
- +16 ;
- +17 SET X=$$SETFLD^VALM1(COUNT,"","NUMBER")
- +18 SET X=$$SETFLD^VALM1(PRSHRS,X,"HRSREQ")
- +19 SET X=$$SETFLD^VALM1(PRSSTAT,X,"STATUS")
- +20 SET X=$$SETFLD^VALM1(PRSRQDT,X,"WORKDATE")
- +21 ;
- +22 ;add line built in X to the list
- +23 ;
- +24 DO SET^VALM10(COUNT,X,COUNT)
- +25 ;
- +26 ;add OT hrs from this line to total OT requests for this list
- +27 ;
- +28 SET OTTOTAL=PRSHRS+OTTOTAL
- +29 ;
- +30 ; save the ien of the record in the list global for easier
- +31 ; reference to the acutal data.
- +32 ;
- +33 SET ^TMP("PRSAOTR",$JOB,COUNT)=OTREC
- +34 QUIT
- +35 ;
- +36 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- +37 ;