38 lines
2.3 KiB
Mathematica
38 lines
2.3 KiB
Mathematica
PSGWTR1 ;BHAM ISC/PTD,CML-Transfer Stock Entries from One AOU to Another - CONTINUED ; 29 Dec 93 / 9:18 AM
|
|
;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
|
|
;AOUF - AOU INTERNAL, ENTRIES TRANSFER FROM THIS AOU
|
|
;AOUT - STRING OF AOU INTERNALS, ENTRIES TRANSFERRED INTO THESE AOUS
|
|
;TR=1 TRANSFER ONLY DRUG NAME, TR=2 TRANSFER DRUG NAME, STOCK LEVEL & LOCATION, TR=3 TRANSFER DRUG NAME, STOCK LEVEL, LOCATION, & TYPES
|
|
;PSGWDUZ - USER TO WHOM MM MESSAGE WILL BE SENT
|
|
;
|
|
;REINDEX THE B CROSS REFERENCE OF ALL AOUS INVOLVED
|
|
BXREF S AOU=AOUF D REINDEX F J=1:1:($L(AOUT,",")-1) S AOU=$P(AOUT,",",J) D REINDEX
|
|
;
|
|
AOUTO F J=1:1:($L(AOUT,",")-1) S AOU=$P(AOUT,",",J) D AOUFR
|
|
MSG S XMDUZ="INPATIENT PHARMACY AR/WS",XMY(PSGWDUZ)="",XMSUB="AR/WS AOU ENTRY TRANSFER COMPLETED",^TMP("PSGWMSG",$J,1,0)="Stock items from "_$P(^PSI(58.1,AOUF,0),"^")_" have been transferred into:"
|
|
F J=1:1:($L(AOUT,",")-1) S AOU=$P(AOUT,",",J),^TMP("PSGWMSG",$J,(J+1),0)=$P(^PSI(58.1,AOU,0),"^")
|
|
S XMTEXT="^TMP(""PSGWMSG"",$J," D ^XMD
|
|
END K AOU,AOUF,JJ,K,AOUT,DRGDA,DR,TRDRG,STLEV,LOC,TR,TYP,ITMDA,XMDUZ,XMY(PSGWDUZ),PSGWDUZ,XMSUB,XMTEXT,DA,ZTIO,LL,X,Y,XMZ,XCNP,DIC,DIE,J,^TMP("PSGWMSG",$J),ZTSK
|
|
Q
|
|
;
|
|
AOUFR S DRGDA=0 I '$O(^PSI(58.1,AOU,0)) S ^PSI(58.1,AOU,1,0)="^58.11IP^^"
|
|
TRANS S DRGDA=$O(^PSI(58.1,AOUF,1,DRGDA)) Q:'DRGDA S TRDRG=$P(^(DRGDA,0),"^")
|
|
I $P(^PSI(58.1,AOUF,1,DRGDA,0),"^",10)="Y",$P(^(0),"^",3)="" S $P(^(0),"^",10)=""
|
|
I $P(^PSI(58.1,AOUF,1,DRGDA,0),"^",3)'="" G TRANS
|
|
I $D(^PSI(58.1,AOU,1,"B",TRDRG)) G TRANS
|
|
;IF IT GETS THIS FAR, WE HAVE A GOOD DRUG THAT SHOULD BE TRANSFERRED
|
|
I '$D(^PSI(58.1,AOU,1,0)) S $P(^(0),"^",2)="58.11IP"
|
|
DIC S (DIC,DIE)="^PSI(58.1,AOU,1,",DA(1)=AOU,DIC(0)="LM",X="`"_TRDRG D ^DIC K DIC G:Y<0 TRANS I TR'=1 S STLEV=$P(^PSI(58.1,AOUF,1,DRGDA,0),"^",2),LOC=$P(^(0),"^",8),(DA,ITMDA)=+Y,DA(1)=AOU,DR="1///"_STLEV_";10///"_LOC D ^DIE K DIE
|
|
I TR=3,'$D(^PSI(58.1,AOU,1,ITMDA,2,0)) S $P(^(0),"^",2)="58.13PA"
|
|
I TR=3 S TYP=0 K DD,DO D TYPLP
|
|
G TRANS
|
|
;
|
|
REINDEX L +^PSI(58.1,AOU,1) K ^PSI(58.1,AOU,1,"B") F K=0:0 S K=$O(^PSI(58.1,AOU,1,K)) Q:'K I $D(^(K,0)) S ^PSI(58.1,AOU,1,"B",+^(0),K)=""
|
|
L -^PSI(58.1,AOU,1)
|
|
Q
|
|
;
|
|
TYPLP F JJ=0:1 S TYP=$O(^PSI(58.1,AOUF,1,DRGDA,2,TYP)) Q:'TYP S LL=TYP,DIC="^PSI(58.1,"_AOU_",1,"_ITMDA_",2,",DIC(0)="L",(X,DINUM)=TYP,DLAYGO=58.1 K DD,DO D FILE^DICN K DLAYGO
|
|
S:JJ $P(^PSI(58.1,AOU,1,ITMDA,2,0),"^",3,4)=LL_"^"_JJ
|
|
K DD,DO Q
|
|
;
|