| 1 | PSDRFM ;BIR/JPW-File/Adj Mail Msg ; 29 Aug 94 | 
|---|
| 2 | ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97 | 
|---|
| 3 | MSG ;send mailman message with count correction adj info | 
|---|
| 4 | S PHARMN1=$S($P($G(^VA(200,+PHARM1,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN"),PSDRN=$S($P($G(^PSDRUG(+PSDR,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN") | 
|---|
| 5 | K XMY,^TMP("PSDTAMSG",$J) S Y=PSDT X ^DD("DD") S RDT=Y S ^TMP("PSDTAMSG",$J,1,0)="Controlled Substances count correction has been filed." | 
|---|
| 6 | S (^TMP("PSDTAMSG",$J,1.5,0),^TMP("PSDTAMSG",$J,1.7,0))="" | 
|---|
| 7 | S ^TMP("PSDTAMSG",$J,1.6,0)="Option used: "_$P($G(XQY0),U,2) | 
|---|
| 8 | S ^TMP("PSDTAMSG",$J,2,0)="Correction Date/Time: "_RDT,^TMP("PSDTAMSG",$J,3,0)="" | 
|---|
| 9 | S ^TMP("PSDTAMSG",$J,4,0)="Ward signed out from: "_$G(NAOUN) | 
|---|
| 10 | S:$G(PAT) ^TMP("PSDTAMSG",$J,4.5,0)="Patient: "_$P($G(^DPT(+PAT,0)),U) | 
|---|
| 11 | S ^TMP("PSDTAMSG",$J,5,0)="Drug: "_PSDRN | 
|---|
| 12 | S ^TMP("PSDTAMSG",$J,6,0)="Quantity adjusted: "_-QTY | 
|---|
| 13 | S ^TMP("PSDTAMSG",$J,7,0)="Adjusted by: "_PHARMN1 | 
|---|
| 14 | S ^TMP("PSDTAMSG",$J,8,0)="Witnessed by: "_$P($G(^VA(200,+$G(NUR2),0)),U) | 
|---|
| 15 | S ^TMP("PSDTAMSG",$J,9,0)="Reason: "_$G(PSDRE) | 
|---|
| 16 | S XMSUB="CONTROLLED SUBS ADJUSTMENT",XMTEXT="^TMP(""PSDTAMSG"",$J,",XMDUZ="CONTROLLED SUBSTANCES MONITOR" | 
|---|
| 17 | F JJ=0:0 S JJ=$O(^XUSEC("PSD ERROR",JJ)) Q:'JJ  S XMY(JJ)="" | 
|---|
| 18 | I $P($G(^PSD(58.8,+$G(NAOU),6)),U) S XMY("G."_$P($G(^XMB(3.8,+$P($G(^PSD(58.8,+$G(NAOU),6)),U),0)),U))="" W !!,"Notifying " | 
|---|
| 19 | S:'$D(XMY) XMY(.5)="" D ^XMD K XMY,^TMP("PSDTAMSG",$J) | 
|---|
| 20 | K JJ,PHARMN1,PSDRN,RDT,X,XMDUZ,XMSUB,XMTEXT,XMY,Y | 
|---|
| 21 | Q | 
|---|