source: WorldVistAEHR/trunk/r/AUTO_REPLENISHMENT_WARD_STOCK-PSGW/PSGWTR1.m@ 1093

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

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1PSGWTR1 ;BHAM ISC/PTD,CML-Transfer Stock Entries from One AOU to Another - CONTINUED ; 29 Dec 93 / 9:18 AM
2 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
3 ;AOUF - AOU INTERNAL, ENTRIES TRANSFER FROM THIS AOU
4 ;AOUT - STRING OF AOU INTERNALS, ENTRIES TRANSFERRED INTO THESE AOUS
5 ;TR=1 TRANSFER ONLY DRUG NAME, TR=2 TRANSFER DRUG NAME, STOCK LEVEL & LOCATION, TR=3 TRANSFER DRUG NAME, STOCK LEVEL, LOCATION, & TYPES
6 ;PSGWDUZ - USER TO WHOM MM MESSAGE WILL BE SENT
7 ;
8 ;REINDEX THE B CROSS REFERENCE OF ALL AOUS INVOLVED
9BXREF S AOU=AOUF D REINDEX F J=1:1:($L(AOUT,",")-1) S AOU=$P(AOUT,",",J) D REINDEX
10 ;
11AOUTO F J=1:1:($L(AOUT,",")-1) S AOU=$P(AOUT,",",J) D AOUFR
12MSG 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:"
13 F J=1:1:($L(AOUT,",")-1) S AOU=$P(AOUT,",",J),^TMP("PSGWMSG",$J,(J+1),0)=$P(^PSI(58.1,AOU,0),"^")
14 S XMTEXT="^TMP(""PSGWMSG"",$J," D ^XMD
15END 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
16 Q
17 ;
18AOUFR S DRGDA=0 I '$O(^PSI(58.1,AOU,0)) S ^PSI(58.1,AOU,1,0)="^58.11IP^^"
19TRANS S DRGDA=$O(^PSI(58.1,AOUF,1,DRGDA)) Q:'DRGDA S TRDRG=$P(^(DRGDA,0),"^")
20 I $P(^PSI(58.1,AOUF,1,DRGDA,0),"^",10)="Y",$P(^(0),"^",3)="" S $P(^(0),"^",10)=""
21 I $P(^PSI(58.1,AOUF,1,DRGDA,0),"^",3)'="" G TRANS
22 I $D(^PSI(58.1,AOU,1,"B",TRDRG)) G TRANS
23 ;IF IT GETS THIS FAR, WE HAVE A GOOD DRUG THAT SHOULD BE TRANSFERRED
24 I '$D(^PSI(58.1,AOU,1,0)) S $P(^(0),"^",2)="58.11IP"
25DIC 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
26 I TR=3,'$D(^PSI(58.1,AOU,1,ITMDA,2,0)) S $P(^(0),"^",2)="58.13PA"
27 I TR=3 S TYP=0 K DD,DO D TYPLP
28 G TRANS
29 ;
30REINDEX 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)=""
31 L -^PSI(58.1,AOU,1)
32 Q
33 ;
34TYPLP 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
35 S:JJ $P(^PSI(58.1,AOU,1,ITMDA,2,0),"^",3,4)=LL_"^"_JJ
36 K DD,DO Q
37 ;
Note: See TracBrowser for help on using the repository browser.