source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGSETU.m@ 1177

Last change on this file since 1177 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.9 KB
RevLine 
[613]1PSGSETU ;BIR/CML3-PACKAGE UTILITIES ;10 Mar 99 / 10:53 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**3,11,26,39,58,115,133**;16 DEC 97
3 ;
4 ; Reference to TERM^VALM0 is supported by DBIA #2615.
5 ; Reference to $$BROKER^XWBLIB is supported by DBIA #2198.
6 ;
7ENIVKV ; kill IV variables
8 K CHK,PSIVPL,PSIVPR,PSIVSITE,PSIVSN,PSIVBR,PSIVENO
9 ;
10ENKV ; when exiting package
11 K PSGP,PSJPAD,PSJPAGE,PSJPBID,PSJPCAF,PSJPDD,PSJPDOB,PSJPDX,PSJPFWD,PSJPHT,PSJPHTD,PSJPPID,PSJPPR,PSJPRB,PSJPSEX,PSJPSSN,PSJPTD,PSJPTS,PSJPTSP,PSJPWD,PSJPWDN,PSJPWT,PSJPWTD
12 I '$D(PSJNKF) K DFN,VA,VADM,VAERR,VAIN,VAIP
13 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
14 K PSGDT,PSGID,PSGION,PSGOD,Q,QQ,PSJSYSL,PSJSYSW0,PSJSYSW,PSJSYSP,PSJSYSP0,PSJSYSU,PSJOCNT,PSJRNF,PSJIRNF,PSJITECH,PSGPXDEV,PSGDDI,PSJORPVN,PSJPN
15 Q
16 ;
17ENCV ; check for (and set) package variables
18 K %DT,%ZIS,DIC,IOP D ^%ZISC,HOME^%ZIS
19 I '$D(ZTQUEUED),'$D(VALMWD) D
20 .S X="XWBLIB" X ^%ZOSF("TEST") I $T,($$BROKER^XWBLIB) Q
21 .D TERM^VALM0
22 D NOW^%DTC S PSGDT=+$E(%,1,12)
23 I $D(^TMP("PSJUSER",$J,"PSG",0)),$D(^(1)),$D(PSJSYSU) D K %,%H,%I,X Q
24 .; naked ref below is from line above
25 .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)
26 .I 'PSJSYSL,$G(PSJSYSW0) D SYSL
27 S PSJSYSU="",%=$G(^VA(200,DUZ,"PS")) I %,$S('$P(%,"^",4):1,1:$P(%,"^",4)>DT) S $P(PSJSYSU,";",2)=1
28 I $D(^XUSEC("PSJ RNURSE",DUZ)) D
29 .S:$D(^XUSEC("PSJ RNFINISH",DUZ)) PSJRNF=1
30 .S:$D(^XUSEC("PSJI RNFINISH",DUZ)) PSJIRNF=1
31 S:$D(^XUSEC("PSJI PHARM TECH",DUZ)) PSJITECH=1
32 S DIC="^PS(53.45,",DIC(0)="LNZ",DLAYGO=53.45,(DINUM,X)="`"_+DUZ D ^DIC
33 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
34 I $P(PSJSYSU,";",3),"13"[$P(PSJSYSU,";",3) S $P(PSJSYSU,";")=$P(PSJSYSU,";",3)
35 S $P(PSJSYSU,";",4)=+PSJSYSU=3!$P(PSJSYSP0,"^",2)!$D(^XUSEC("PSJ RNFINISH",DUZ)),PSJSYSL=$P(PSJSYSP0,"^",7)]""_"^"_$P(PSJSYSP0,"^",7)
36 I 'PSJSYSL,$G(PSJSYSW0) D SYSL
37 I PSJSYSU S $P(PSJSYSP0,"^",3)=1,$P(PSJSYSP0,"^",4)=1,$P(PSJSYSP0,"^",5)=1
38 S ^TMP("PSJUSER",$J,"PSG",0)=PSJSYSU_"^"_PSJSYSP,^(1)=PSJSYSP0 K %,%H,%I,DA,DIC,DLAYGO,X,Y Q
39 ;
40ENDTC(Y) ; convert FM internal date/time to user readable format
41 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)
42 E S Y="********"
43 Q Y
44 ;
45SYSL ;
46 Q:$G(PSJSYSL)!'$G(PSJSYSW0)
47 S X=$P($G(PSJSYSU),";",3)>1 S PSJSYSL=$S(X=0:$P(PSJSYSW0,"^",12),1:$P(PSJSYSW0,"^",16)) I PSJSYSL D
48 .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
49 ..S IOP="`"_IOP K %ZIS S %ZIS="NQ" D ^%ZIS S:'POP $P(PSJSYSL,"^",2,3)=ION_"^"_IO D HOME^%ZIS
50 Q
Note: See TracBrowser for help on using the repository browser.