[613] | 1 | PSDAMIS2 ;BIR/JPW-Print NAOU AMIS Report by NAOU ; 1 Sept 94
|
---|
| 2 | ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
|
---|
| 3 | START ;entry point for report
|
---|
| 4 | K ^TMP("PSDAMIS",$J),^TMP("PSDAMISS",$J),^TMP("PSDAMIST",$J),^TMP("PSDAMISG",$J),^TMP("PSDAMISQ",$J),^TMP("PSDAMISC",$J),^TMP("PSDAMISCG",$J),^TMP("PSDAMISCN",$J)
|
---|
| 5 | K ^TMP("PSDM",$J),^TMP("PSDAMISCVG",$J),^TMP("PSDAMISVG",$J)
|
---|
| 6 | F JJ=PSDSD:0 S JJ=$O(^PSD(58.81,"ACT",JJ)) Q:'JJ!(JJ>PSDED) F JJ1=0:0 S JJ1=$O(^PSD(58.81,"ACT",JJ,JJ1)) Q:'JJ1 F PSDR=0:0 S PSDR=$O(^PSD(58.81,"ACT",JJ,JJ1,PSDR)) Q:'PSDR D
|
---|
| 7 | .F KK=0:0 S KK=$O(^PSD(58.81,"ACT",JJ,JJ1,PSDR,2,KK)) Q:'KK D SET
|
---|
| 8 | CHK ;checks for zero cost data & sends e-mail from ^PSDCOSM
|
---|
| 9 | I $D(^TMP("PSDM",$J)) S PSDCHO(1)="AMIS Report by NAOU",Y=PSDT X ^DD("DD") S PSDT(1)=Y D ^PSDCOSM K PSDCHO,^TMP("PSDM",$J)
|
---|
| 10 | G ^PSDAMIS3
|
---|
| 11 | SET ;sets data
|
---|
| 12 | Q:'$D(^PSD(58.81,KK,0)) S NODE=^PSD(58.81,KK,0),PSD=+$P(NODE,"^",18),PSDS=+$P(NODE,"^",3)
|
---|
| 13 | Q:'$D(LOC(PSD)) Q:$D(^PSD(58.81,KK,5))
|
---|
| 14 | S PSDRN=$S($P($G(^PSDRUG(PSDR,0)),"^")]"":$P(^(0),"^"),1:"DRUG NAME MISSING")
|
---|
| 15 | S NAOUN=$S($P($G(^PSD(58.8,PSD,0)),"^")]"":$P(^(0),"^"),1:"NAOU NAME MISSING")
|
---|
| 16 | S PSDSN=$S($P($G(^PSD(58.8,PSDS,0)),"^")]"":$P(^(0),"^"),1:"DISP. SITE NAME MISSING")
|
---|
| 17 | S PSDPN=$S($P(NODE,"^",17)]"":$P(NODE,"^",17),1:"DISP W/O GS"),QTY=+$P(NODE,"^",6)
|
---|
| 18 | S:+$P($G(^PSD(58.81,KK,4)),"^",3) QTY=+$P(^(4),"^",3)
|
---|
| 19 | S COST=+$P($G(^PSDRUG(PSDR,660)),"^",6),COST=COST*QTY
|
---|
| 20 | S:'COST ^TMP("PSDM",$J,PSDRN)=""
|
---|
| 21 | S ^TMP("PSDAMIS",$J,NAOUN,PSDRN,PSDPN,JJ)=QTY_"^"_COST
|
---|
| 22 | S:'$D(^TMP("PSDAMIST",$J,NAOUN)) ^TMP("PSDAMIST",$J,NAOUN)=0 S ^TMP("PSDAMIST",$J,NAOUN)=+^TMP("PSDAMIST",$J,NAOUN)+1
|
---|
| 23 | S:'$D(^TMP("PSDAMISS",$J,NAOUN,PSDRN)) ^TMP("PSDAMISS",$J,NAOUN,PSDRN)=0 S ^TMP("PSDAMISS",$J,NAOUN,PSDRN)=+^TMP("PSDAMISS",$J,NAOUN,PSDRN)+1
|
---|
| 24 | S:'$D(^TMP("PSDAMISQ",$J,NAOUN,PSDRN)) ^TMP("PSDAMISQ",$J,NAOUN,PSDRN)=0 S ^TMP("PSDAMISQ",$J,NAOUN,PSDRN)=+^TMP("PSDAMISQ",$J,NAOUN,PSDRN)+QTY
|
---|
| 25 | S:'$D(^TMP("PSDAMISG",$J)) ^TMP("PSDAMISG",$J)=0 S ^TMP("PSDAMISG",$J)=+^TMP("PSDAMISG",$J)+1
|
---|
| 26 | S:'$D(^TMP("PSDAMISVG",$J,PSDSN)) ^TMP("PSDAMISVG",$J,PSDSN)=0 S ^TMP("PSDAMISVG",$J,PSDSN)=+^TMP("PSDAMISVG",$J,PSDSN)+1
|
---|
| 27 | S:'$D(^TMP("PSDAMISC",$J,NAOUN,PSDRN)) ^TMP("PSDAMISC",$J,NAOUN,PSDRN)=0 S ^TMP("PSDAMISC",$J,NAOUN,PSDRN)=+^TMP("PSDAMISC",$J,NAOUN,PSDRN)+COST
|
---|
| 28 | S:'$D(^TMP("PSDAMISCN",$J,NAOUN)) ^TMP("PSDAMISCN",$J,NAOUN)=0 S ^TMP("PSDAMISCN",$J,NAOUN)=+^TMP("PSDAMISCN",$J,NAOUN)+COST
|
---|
| 29 | S:'$D(^TMP("PSDAMISCG",$J)) ^TMP("PSDAMISCG",$J)=0 S ^TMP("PSDAMISCG",$J)=+^TMP("PSDAMISCG",$J)+COST
|
---|
| 30 | S:'$D(^TMP("PSDAMISCVG",$J,PSDSN)) ^TMP("PSDAMISCVG",$J,PSDSN)=0 S ^TMP("PSDAMISCVG",$J,PSDSN)=+^TMP("PSDAMISCVG",$J,PSDSN)+COST
|
---|
| 31 | Q
|
---|