PSIVXU ;BIR/PR-SET MEDICATION SITES IN ^TMP("PSJUSER" ;15 May 98 / 9:27 AM
 ;;5.0;INPATIENT MEDICATIONS;**3,407**;16 DEC 97;Build 26
 N PSJNEW,PSGPTMP,PPAGE S PSJNEW=1
 S DONE=0  ;P407
 ;
 K XQUIT D ENCV^PSGSETU I $D(XQUIT) Q
 I $D(^TMP("PSJUSER",$J,"FLAG")) K ^TMP("PSJUSER",$J,"PSIV")  ;P407
 K ^TMP("PSJUSER",$J,"DSPFLAG")  ;P407
 S CHK=$S($D(^TMP("PSJUSER",$J,"PSIV")):1,1:"") S:CHK CHK=$S(^TMP("PSJUSER",$J,"PSIV")=DUZ:1,1:"") I 'CHK D ^PSIVSET Q:$D(XQUIT)!(DONE=1)  D SET Q   ;P407
 E  S PSIVSITE=^TMP("PSJUSER",$J,"PSIV","SITE"),PSIVPR=^TMP("PSJUSER",$J,"PSIV","PSIVPR"),PSIVPL=^TMP("PSJUSER",$J,"PSIV","PSIVPL"),PSIVSN=^TMP("PSJUSER",$J,"PSIV","PSIVSN")
 Q
SET ;Set TMP("PSJUSER" global
 S ^TMP("PSJUSER",$J,"PSIV")=DUZ,^TMP("PSJUSER",$J,"PSIV","SITE")=PSIVSITE,^TMP("PSJUSER",$J,"PSIV","PSIVPR")=PSIVPR,^TMP("PSJUSER",$J,"PSIV","PSIVPL")=PSIVPL,^TMP("PSJUSER",$J,"PSIV","PSIVSN")=PSIVSN
 Q
CHA ;Change site
 ; PSJ*407/RJH - Added KILL of TMP global node to line below in order for the
 ;               Change to Another IV Room functionality to work properly with
 ;               changes for PSJ*407
 ; K XQUIT D ^PSIVSET D:'$D(XQUIT) SET K %DT,XQUIT D ENIVKV^PSGSETU
 K XQUIT K ^TMP("PSJUSER",$J,"FLAG") D ^PSIVSET D:'$D(XQUIT) SET K %DT,XQUIT D ENIVKV^PSGSETU ; PSJ*407
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSIVXU   1306     printed  Sep 23, 2025@19:41:27                                                                                                                                                                                                      Page 2
PSIVXU    ;BIR/PR-SET MEDICATION SITES IN ^TMP("PSJUSER" ;15 May 98 / 9:27 AM
 +1       ;;5.0;INPATIENT MEDICATIONS;**3,407**;16 DEC 97;Build 26
 +2        NEW PSJNEW,PSGPTMP,PPAGE
           SET PSJNEW=1
 +3       ;P407
           SET DONE=0
 +4       ;
 +5        KILL XQUIT
           DO ENCV^PSGSETU
           IF $DATA(XQUIT)
               QUIT 
 +6       ;P407
           IF $DATA(^TMP("PSJUSER",$JOB,"FLAG"))
               KILL ^TMP("PSJUSER",$JOB,"PSIV")
 +7       ;P407
           KILL ^TMP("PSJUSER",$JOB,"DSPFLAG")
 +8       ;P407
           SET CHK=$SELECT($DATA(^TMP("PSJUSER",$JOB,"PSIV")):1,1:"")
           if CHK
               SET CHK=$SELECT(^TMP("PSJUSER",$JOB,"PSIV")=DUZ:1,1:"")
           IF 'CHK
               DO ^PSIVSET
               if $DATA(XQUIT)!(DONE=1)
                   QUIT 
               DO SET
               QUIT 
 +9       IF '$TEST
               SET PSIVSITE=^TMP("PSJUSER",$JOB,"PSIV","SITE")
               SET PSIVPR=^TMP("PSJUSER",$JOB,"PSIV","PSIVPR")
               SET PSIVPL=^TMP("PSJUSER",$JOB,"PSIV","PSIVPL")
               SET PSIVSN=^TMP("PSJUSER",$JOB,"PSIV","PSIVSN")
 +10       QUIT 
SET       ;Set TMP("PSJUSER" global
 +1        SET ^TMP("PSJUSER",$JOB,"PSIV")=DUZ
           SET ^TMP("PSJUSER",$JOB,"PSIV","SITE")=PSIVSITE
           SET ^TMP("PSJUSER",$JOB,"PSIV","PSIVPR")=PSIVPR
           SET ^TMP("PSJUSER",$JOB,"PSIV","PSIVPL")=PSIVPL
           SET ^TMP("PSJUSER",$JOB,"PSIV","PSIVSN")=PSIVSN
 +2        QUIT 
CHA       ;Change site
 +1       ; PSJ*407/RJH - Added KILL of TMP global node to line below in order for the
 +2       ;               Change to Another IV Room functionality to work properly with
 +3       ;               changes for PSJ*407
 +4       ; K XQUIT D ^PSIVSET D:'$D(XQUIT) SET K %DT,XQUIT D ENIVKV^PSGSETU
 +5       ; PSJ*407
           KILL XQUIT
           KILL ^TMP("PSJUSER",$JOB,"FLAG")
           DO ^PSIVSET
           if '$DATA(XQUIT)
               DO SET
           KILL %DT,XQUIT
           DO ENIVKV^PSGSETU
 +6        QUIT