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

PRSPSAP.m

Go to the documentation of this file.
  1. PRSPSAP ;WOIFO/JAH - part time physician, supervisory approvals ;10/22/04
  1. ;;4.0;PAID;**93,151**;Sep 21, 1995;Build 2
  1. ;Per VA Directive 6402, this routine should not be modified
  1. Q
  1. ; T&A supervisor of PTP employee is required to review and take
  1. ; one of the following actions on each signed day of the PTP's ESR:
  1. ; 1. approve, 2. request resubmission or 3. bypass.
  1. ; When the T&A Supervisor approves a signed day we attempt to
  1. ; update the PTP's timecard for that day. Updates to the
  1. ; timecard will be screened based on the status of the timecard
  1. ; and the effect of any potential update.
  1. ;
  1. ; MAIN entry point called from option Approve Signed ESRs.
  1. ;
  1. MAIN ;
  1. K ^TMP($J,"PRSPSAP")
  1. N PRSTLV,TLI,TLE,PRSIEN,ANYACT,AVAIL,OUT,DCNT,APRWHO
  1. ; Make sure we have a signature code before continuing
  1. I '$$ESIGC^PRSPUT2(1) W !! S OUT=$$ASK^PRSLIB00(1) Q
  1. D HDROPT^PRSPSAP1
  1. ; Prompt supervisor to pick one T&L unit for which they are assigned.
  1. S PRSTLV=3
  1. D ^PRSAUTL
  1. Q:TLI<1
  1. ;
  1. ; Check if they only want to look at one employee
  1. S APRWHO=$$ONEPTP^PRSPSAPU(TLE)
  1. Q:APRWHO<0
  1. ; ---------------------------------------------------
  1. I APRWHO>0 D
  1. . S NN=$P($G(^PRSPC(APRWHO,0)),U)
  1. . D BLDLST(.OUT,TLE,NN)
  1. E D
  1. .; Loop thru supervisor's selected T&L
  1. . S NN=""
  1. . F S NN=$O(^PRSPC("ATL"_TLE,NN)) Q:NN=""!($G(OUT)>0) D
  1. .. D BLDLST(.OUT,TLE,NN)
  1. ;
  1. ; display all the ASA records for action.
  1. S OUT=0
  1. D ASALIST^PRSPSAP1(.OUT)
  1. ; check if there are any updates and then prompt for signature
  1. ;
  1. D ANYACT^PRSPSAP1(.ANYACT)
  1. I ANYACT>0 D
  1. . D SUMMARY(.ANYACT)
  1. . D SIG^XUSESIG
  1. .; update the timecard and ESR status for all actions when
  1. .; a valid signature is applied
  1. . I X1="" D
  1. .. W @IOF,!!!,?10,"TIMECARD AND ESR WERE NOT UPDATED."
  1. .E D
  1. .. D TRANSACT^PRSPSAP2
  1. ; remove any remaining PTP timecard locks held in this option
  1. ; D EX^PRSASR
  1. K ^TMP($J,"PRSPSAP")
  1. Q
  1. ;
  1. BLDLST(OUT,TLE,NN) ; BUILD LIST OF ALL APPROVAL ACTIONS FOR SINGLE EMPLOYEE
  1. N PRSIEN,PPE,PPI,AVAIL,DCNT,PRSD,GLOB,DFN
  1. S PRSIEN=0
  1. F S PRSIEN=$O(^PRSPC("ATL"_TLE,NN,PRSIEN)) Q:PRSIEN<1!($G(OUT)>0) D ;Loop through IENs for a single name, PRS*4.0*151
  1. . S PPE=""
  1. . F S PPE=$O(^PRST(458,"ASA",PRSIEN,PPE)) Q:PPE=""!($G(OUT)>0) D
  1. .. S PPI=$O(^PRST(458,"B",PPE,0))
  1. ..; get lock for PTP's entire PP, then add record (PUSH) that
  1. ..; requires supervisor action to the list
  1. .. S DFN=PRSIEN
  1. ..;
  1. ..; $$availrec() locks PTP ESR node.
  1. ..; unlock if supervisor bybasses unlock otherwise they
  1. ..; are not unlocked until they are processed thru temp global
  1. ..; & their status' are updated.
  1. .. S AVAIL=$$AVAILREC^PRSLIB00("",.GLOB,.OUT)
  1. .. Q:'AVAIL
  1. .. ;
  1. ..; add item to list and set up a day cross ref with count of days
  1. .. S (DCNT,PRSD)=0
  1. .. F S PRSD=$O(^PRST(458,"ASA",PRSIEN,PPE,PRSD)) Q:PRSD'>0 D
  1. ... S DCNT=DCNT+1
  1. ... D PUSH^PRSPSAP1(PPI,PRSIEN,PRSD,DCNT)
  1. ;
  1. Q
  1. ;
  1. SUMMARY(AA) ;
  1. W @IOF,!!!,"Supervisory Action Summary"
  1. W !!,$J(AA,6)," actions require your electronic signature before being"
  1. W !,?(6-$L(AA))," committed to the database."
  1. I AA("A")>0 W !,$J(AA("A"),6)," ESR record marked for approval. (signature required)"
  1. I AA("R")>0 W !,$J(AA("R"),6)," ESR records marked for resubmission. (signature required)"
  1. I AA("B")>0 W !,$J(AA("B"),6)," ESR records explicitly bypassed."
  1. I AA("N")>0 W !,$J(AA("N"),6)," ESR records with no action."
  1. Q
  1. GETACT(ESRDTS,PRSIEN,PPI) ; return user choice of # (1-ACTCNT) or action
  1. ; return 0 for ^ at first action prompt
  1. ; return null for no response (user hit return)
  1. ; return -1 if ^ at 2nd prompt (action on single day prompt)
  1. N DIR,DIRUT,ACT,CT,NUMS
  1. ;
  1. ; get total items + marked items CT CT(1)
  1. D MARKCNT^PRSPSAP1(.CT,PRSIEN,PPI)
  1. I CT>1 D
  1. . S NUMS=";"
  1. . F I=1:1:CT D
  1. .. S NUMS=NUMS_I_":"_$P(ESRDTS(I),U,2)_";"
  1. ;
  1. ; status already marked on all days
  1. I (CT>1)&(CT=CT(1)) D
  1. . S DIR(0)="SAO^"_NUMS
  1. . S DIR("A")="Select an item #: "
  1. . S DIR("?",1)="Enter an item from the left column to change status for that day"
  1. E D
  1. .; if all days don't have a superV action (marked) then prompt for
  1. .; action on remaining days or pick a day (item)
  1. . I CT>1 D
  1. .. S DIR(0)="SAO^A:Approve;B:Bypass;R:Resubmit"_NUMS
  1. .. S DIR("A")="(A)pprove, (B)ypass, (R)esubmit or enter an item #: "
  1. .. S DIR("?",1)="Enter an action for all records without a status or enter an item #"
  1. .. S DIR("?",2)="to then pick an action for that day."
  1. .. S DIR("?",3)=" Type R for Resubmit when the part-time physician needs to correct an ESR day."
  1. .. S DIR("?",4)=" Type B for Bypass to skip the day(s) for now and approve at a later time."
  1. .. S DIR("?",5)=" Type A for Approve when the ESR day(s) appears correct."
  1. .E D
  1. ..; if only one item to pick, don't ask for item #
  1. .. S DIR(0)="SAO^A:Approve;B:Bypass;R:Resubmit"
  1. .. S DIR("A")="(A)pprove, (B)ypass, (R)esubmit: "
  1. .. S DIR("?",1)="Enter an action for all records without a status"
  1. .. S DIR("?",2)=" Type R for Resubmit when the part-time physician needs to correct an ESR day."
  1. .. S DIR("?",3)=" Type B for Bypass to skip the day(s) for now and approve at a later time."
  1. .. S DIR("?",4)=" Type A for Approve when the ESR day(s) appears correct."
  1. ;
  1. S DIR("?")=" Press [enter] to move to the next part time physician."
  1. D ^DIR
  1. S PICK=$G(Y)
  1. I $G(Y)="" Q ""
  1. ; if there was only one item then set pick to 1 plus action
  1. I CT=1 S PICK=PICK_"^1"
  1. I $G(DIRUT) S PICK=0
  1. ;
  1. ; item was picked
  1. I PICK>0,(PICK<(CT+1)) D
  1. . N DAYLNS,DIR,DIRUT,ESR,HPL
  1. . D GETESR^PRSPSAP1(.ESR,PPI,PRSIEN,+ESRDTS(PICK))
  1. . N COUNT S COUNT=PICK,COUNT(1)=0
  1. . W ! D DAY^PRSPSAPU(.DAYLNS,ESRDTS(COUNT),.ESR,PRSIEN,PPI)
  1. . S ACT=PICK
  1. . S DIR(0)="SA^A:Approve;B:Bypass;R:Resubmit"
  1. . S DIR("A")="(A)pprove, (B)ypass, (R)esubmit: "
  1. . S DIR("?")="Select an action for the ESR day above."
  1. . S DIR("?",1)=" Type R for Resubmit when the part-time physician needs to correct an ESR day."
  1. . S DIR("?",2)=" Type B for Bypass to skip the day(s) for now and approve at a later time."
  1. . S DIR("?",3)=" Type A for Approve when the ESR day(s) appears correct."
  1. . S DIR("?",4)=" Type ^ to redisplay the current part time physician."
  1. . D GETDAY^PRSPSAPU(.DAYLNS,.ESRDTS,.ESR,PICK,PRSIEN,PPI)
  1. . S HPL=0
  1. . F S HPL=$O(DAYLNS(HPL)) Q:HPL'>0 D
  1. .. S DIR("?",HPL+4)=$G(DAYLNS(HPL))
  1. . D ^DIR
  1. . S PICK=$G(Y)_"^"_ACT
  1. . I $G(DIRUT) S PICK=-1
  1. Q PICK
  1. ;