32 lines
2.6 KiB
Mathematica
32 lines
2.6 KiB
Mathematica
PSDAMIS2 ;BIR/JPW-Print NAOU AMIS Report by NAOU ; 1 Sept 94
|
|
;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
|
|
START ;entry point for report
|
|
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)
|
|
K ^TMP("PSDM",$J),^TMP("PSDAMISCVG",$J),^TMP("PSDAMISVG",$J)
|
|
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
|
|
.F KK=0:0 S KK=$O(^PSD(58.81,"ACT",JJ,JJ1,PSDR,2,KK)) Q:'KK D SET
|
|
CHK ;checks for zero cost data & sends e-mail from ^PSDCOSM
|
|
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)
|
|
G ^PSDAMIS3
|
|
SET ;sets data
|
|
Q:'$D(^PSD(58.81,KK,0)) S NODE=^PSD(58.81,KK,0),PSD=+$P(NODE,"^",18),PSDS=+$P(NODE,"^",3)
|
|
Q:'$D(LOC(PSD)) Q:$D(^PSD(58.81,KK,5))
|
|
S PSDRN=$S($P($G(^PSDRUG(PSDR,0)),"^")]"":$P(^(0),"^"),1:"DRUG NAME MISSING")
|
|
S NAOUN=$S($P($G(^PSD(58.8,PSD,0)),"^")]"":$P(^(0),"^"),1:"NAOU NAME MISSING")
|
|
S PSDSN=$S($P($G(^PSD(58.8,PSDS,0)),"^")]"":$P(^(0),"^"),1:"DISP. SITE NAME MISSING")
|
|
S PSDPN=$S($P(NODE,"^",17)]"":$P(NODE,"^",17),1:"DISP W/O GS"),QTY=+$P(NODE,"^",6)
|
|
S:+$P($G(^PSD(58.81,KK,4)),"^",3) QTY=+$P(^(4),"^",3)
|
|
S COST=+$P($G(^PSDRUG(PSDR,660)),"^",6),COST=COST*QTY
|
|
S:'COST ^TMP("PSDM",$J,PSDRN)=""
|
|
S ^TMP("PSDAMIS",$J,NAOUN,PSDRN,PSDPN,JJ)=QTY_"^"_COST
|
|
S:'$D(^TMP("PSDAMIST",$J,NAOUN)) ^TMP("PSDAMIST",$J,NAOUN)=0 S ^TMP("PSDAMIST",$J,NAOUN)=+^TMP("PSDAMIST",$J,NAOUN)+1
|
|
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
|
|
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
|
|
S:'$D(^TMP("PSDAMISG",$J)) ^TMP("PSDAMISG",$J)=0 S ^TMP("PSDAMISG",$J)=+^TMP("PSDAMISG",$J)+1
|
|
S:'$D(^TMP("PSDAMISVG",$J,PSDSN)) ^TMP("PSDAMISVG",$J,PSDSN)=0 S ^TMP("PSDAMISVG",$J,PSDSN)=+^TMP("PSDAMISVG",$J,PSDSN)+1
|
|
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
|
|
S:'$D(^TMP("PSDAMISCN",$J,NAOUN)) ^TMP("PSDAMISCN",$J,NAOUN)=0 S ^TMP("PSDAMISCN",$J,NAOUN)=+^TMP("PSDAMISCN",$J,NAOUN)+COST
|
|
S:'$D(^TMP("PSDAMISCG",$J)) ^TMP("PSDAMISCG",$J)=0 S ^TMP("PSDAMISCG",$J)=+^TMP("PSDAMISCG",$J)+COST
|
|
S:'$D(^TMP("PSDAMISCVG",$J,PSDSN)) ^TMP("PSDAMISCVG",$J,PSDSN)=0 S ^TMP("PSDAMISCVG",$J,PSDSN)=+^TMP("PSDAMISCVG",$J,PSDSN)+COST
|
|
Q
|