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

PSGSETU.m

Go to the documentation of this file.
PSGSETU ;BIR/CML3-PACKAGE UTILITIES ;10 Mar 99 / 10:53 AM
 ;;5.0; INPATIENT MEDICATIONS ;**3,11,26,39,58,115,133,181**;16 DEC 97;Build 190
 ;
 ; Reference to TERM^VALM0 is supported by DBIA #2615.
 ; Reference to $$BROKER^XWBLIB is supported by DBIA #2198.
 ;
ENIVKV ; kill IV variables
 K CHK,PSIVPL,PSIVPR,PSIVSITE,PSIVSN,PSIVBR,PSIVENO
 ;
ENKV ; when exiting package
 K PSGP,PSJPAD,PSJPAGE,PSJPBID,PSJPCAF,PSJPDD,PSJPDOB,PSJPDX,PSJPFWD,PSJPHT,PSJPHTD,PSJPPID,PSJPPR,PSJPRB,PSJPSEX,PSJPSSN,PSJPTD,PSJPTS,PSJPTSP,PSJPWD,PSJPWDN,PSJPWT,PSJPWTD,PSJDCEXP
 I '$D(PSJNKF) K DFN,VA,VADM,VAERR,VAIN,VAIP
 K PSJNKF,%,%DT,%H,%I,%T,%X,%Y,%ZIS,D,D0,D1,D2,DA,DI,DIC,DICR,DIE,DIG,DIH,DIK,DIR,DIRUT,DIQ,DISYS,DIU,DIV,DIW,DLAYGO,DP,DR,DQ,DTOUT,DUOUT,DZ,IO("Q"),IOP,POP,X,X1,X2,Y,XX,ZTSK
 K PSGDT,PSGID,PSGION,PSGOD,Q,QQ,PSJSYSL,PSJSYSW0,PSJSYSW,PSJSYSP,PSJSYSP0,PSJSYSU,PSJOCNT,PSJRNF,PSJIRNF,PSJITECH,PSGPXDEV,PSGDDI,PSJORPVN,PSJPN
 Q
 ;
ENCV ; check for (and set) package variables
 K %DT,%ZIS,DIC,IOP D ^%ZISC,HOME^%ZIS
 I '$D(ZTQUEUED),'$D(VALMWD) D
 .S X="XWBLIB" X ^%ZOSF("TEST") I $T,($$BROKER^XWBLIB) Q
 .D TERM^VALM0
 D NOW^%DTC S PSGDT=+$E(%,1,12)
 I $D(^TMP("PSJUSER",$J,"PSG",0)),$D(^(1)),$D(PSJSYSU) D  K %,%H,%I,X Q
 .; naked ref below is from line above
 .S %=^(0),PSJSYSU=$P(%,"^"),PSJSYSP=$P(%,"^",2),PSJSYSP0=^(1),PSJSYSL=$P(PSJSYSP0,"^",7)]""_"^"_$P(PSJSYSP0,"^",7),%=$G(^VA(200,DUZ,"PS")),$P(PSJSYSU,";",2)=$S('%:"",'$P(%,"^",4):1,1:$P(%,"^",4)\1>DT)
 .I 'PSJSYSL,$G(PSJSYSW0) D SYSL
 S PSJSYSU="",%=$G(^VA(200,DUZ,"PS")) I %,$S('$P(%,"^",4):1,1:$P(%,"^",4)>DT) S $P(PSJSYSU,";",2)=1
 I $D(^XUSEC("PSJ RNURSE",DUZ)) D
 .S:$D(^XUSEC("PSJ RNFINISH",DUZ)) PSJRNF=1
 .S:$D(^XUSEC("PSJI RNFINISH",DUZ)) PSJIRNF=1
 S:$D(^XUSEC("PSJI PHARM TECH",DUZ)) PSJITECH=1
 S DIC="^PS(53.45,",DIC(0)="LNZ",DLAYGO=53.45,(DINUM,X)="`"_+DUZ D ^DIC
 S PSJSYSP=+Y,PSJSYSP0=Y(0) F X=3,1,2 I $D(^XUSEC("PSJ "_$P("RNURSE^PHARM TECH^RPHARM","^",X),DUZ)) S $P(PSJSYSU,";",3)=X Q
 I $P(PSJSYSU,";",3),"13"[$P(PSJSYSU,";",3) S $P(PSJSYSU,";")=$P(PSJSYSU,";",3)
 S $P(PSJSYSU,";",4)=+PSJSYSU=3!$P(PSJSYSP0,"^",2)!$D(^XUSEC("PSJ RNFINISH",DUZ)),PSJSYSL=$P(PSJSYSP0,"^",7)]""_"^"_$P(PSJSYSP0,"^",7)
 I 'PSJSYSL,$G(PSJSYSW0) D SYSL
 I PSJSYSU S $P(PSJSYSP0,"^",3)=1,$P(PSJSYSP0,"^",4)=1,$P(PSJSYSP0,"^",5)=1
 S ^TMP("PSJUSER",$J,"PSG",0)=PSJSYSU_"^"_PSJSYSP,^(1)=PSJSYSP0 K %,%H,%I,DA,DIC,DLAYGO,X,Y Q
 ;
ENDTC(Y) ; convert FM internal date/time to user readable format
 I Y S Y=Y_$E(".",Y'[".")_"0000",Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)_"  "_$E(Y,9,10)_":"_$E(Y,11,12)
 E  S Y="********"
 Q Y
 ;
SYSL ;
 Q:$G(PSJSYSL)!'$G(PSJSYSW0)
 S X=$P($G(PSJSYSU),";",3)>1 S PSJSYSL=$S(X=0:$P(PSJSYSW0,"^",12),1:$P(PSJSYSW0,"^",16)) I PSJSYSL D
 .S:X X='$P(PSJSYSP0,"^",10) S IOP=$S($P(PSJSYSP0,"^",13)]"":$P(PSJSYSP0,"^",13),$P(PSJSYSW0,"^",19+X)]"":$P(PSJSYSW0,"^",19+X),1:"") I IOP]"" D
 ..S IOP="`"_IOP K %ZIS S %ZIS="NQ" D ^%ZIS S:'POP $P(PSJSYSL,"^",2,3)=ION_"^"_IO D HOME^%ZIS
 Q