1 | PSGWADP ;BHAM ISC/PTD,CML-Print Data for AMIS Stats ; 06 Aug 93 / 2:20 PM
|
---|
2 | ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
|
---|
3 | D NOW^%DTC S PSGWDT=$P(%,".")
|
---|
4 | W !!!,"This report shows data stored for AR/WS AMIS statistics.",!,"Use Enter/Edit AMIS Data (Single Drug) to make corrections.",!!,"Right margin for this report is 132 columns.",!,"You may queue the report to print at a later time.",!!
|
---|
5 | I '$O(^PSI(58.1,0)) W !,"You MUST create AOUs before running this report!" K %,PSGWDT,%I,%H Q
|
---|
6 | DEV K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END^PSGWADP1
|
---|
7 | I $D(IO("Q")) K IO("Q") S PSGWIO=ION,ZTIO="" K ZTSAVE,ZTDTH,ZTSK S ZTRTN="ENQ^PSGWADP",ZTDESC="Compile Data for AMIS Stats",ZTSAVE("PSGWIO")="",ZTSAVE("PSGWDT")=""
|
---|
8 | I D ^%ZTLOAD,HOME^%ZIS K ZTSK G END^PSGWADP1
|
---|
9 | U IO
|
---|
10 | ;
|
---|
11 | ENQ ;ENTRY POINT WHEN QUEUED
|
---|
12 | AOU K ^TMP("PSGWADP",$J) F PSGWAOU=0:0 S PSGWAOU=$O(^PSI(58.1,PSGWAOU)) G:('PSGWAOU)&($D(ZTQUEUED)) PRTQUE G:'PSGWAOU PRINT^PSGWADP1 D XREF
|
---|
13 | ;
|
---|
14 | XREF F PSGWDR=0:0 S PSGWDR=$O(^PSI(58.1,PSGWAOU,1,"B",PSGWDR)) Q:'PSGWDR F PSGWITM=0:0 S PSGWITM=$O(^PSI(58.1,PSGWAOU,1,"B",PSGWDR,PSGWITM)) Q:'PSGWITM D BUILD
|
---|
15 | Q
|
---|
16 | ;
|
---|
17 | BUILD I $P(^PSI(58.1,PSGWAOU,1,PSGWITM,0),"^",10)="Y",$P(^(0),"^",3)="" S $P(^(0),"^",10)=""
|
---|
18 | I $P(^PSI(58.1,PSGWAOU,1,PSGWITM,0),"^",3)'="" Q:$P(^(0),"^",3)'>PSGWDT
|
---|
19 | I '$O(^PSI(58.1,PSGWAOU,1,PSGWITM,2,0)) S K=9999 D SETGL Q
|
---|
20 | F PSGWTY=0:0 S PSGWTY=$O(^PSI(58.1,PSGWAOU,1,PSGWITM,2,PSGWTY)) Q:'PSGWTY S K=PSGWTY D SETGL S ^TMP("PSGWADP",$J,"DN",PSGWNM)=""
|
---|
21 | Q
|
---|
22 | ;
|
---|
23 | SETGL I '$O(^PSDRUG(PSGWDR,0)) S DIK="^PSI(58.1,"_PSGWAOU_",1,",DA=PSGWITM,DA(1)=PSGWAOU D ^DIK K DIK Q
|
---|
24 | I $O(^PSDRUG(PSGWDR,0)) S PSGWNM=$S($P(^PSDRUG(PSGWDR,0),"^")'="":$P(^(0),"^"),1:"ZZNAME MISSING")
|
---|
25 | I $D(^PSDRUG(PSGWDR,660)) S LOC1=^(660)
|
---|
26 | I $D(^PSDRUG(PSGWDR,"PSG")) S LOC2=^("PSG")
|
---|
27 | I $D(LOC1),$D(LOC2) D ODUNIT S ^TMP("PSGWADP",$J,K,PSGWNM)=$P(LOC1,"^",2)_"^"_$P(LOC1,"^",3)_"^"_$P(LOC1,"^",5)_"^"_$P(LOC1,"^",6)_"^"_$P(LOC2,"^",2)_"^"_$P(LOC2,"^",3)
|
---|
28 | I $D(LOC1),'$D(LOC2) D ODUNIT S ^TMP("PSGWADP",$J,K,PSGWNM)=$P(LOC1,"^",2)_"^"_$P(LOC1,"^",3)_"^"_$P(LOC1,"^",5)_"^"_$P(LOC1,"^",6)_"^^"
|
---|
29 | I '$D(LOC1),$D(LOC2) S ^TMP("PSGWADP",$J,K,PSGWNM)="^^^^"_$P(LOC2,"^",2)_"^"_$P(LOC2,"^",3)
|
---|
30 | I '$D(LOC1),'$D(LOC2) S ^TMP("PSGWADP",$J,K,PSGWNM)="^^^^^"
|
---|
31 | K LOC1,LOC2
|
---|
32 | Q
|
---|
33 | ;
|
---|
34 | ODUNIT S OUPTR=$P(LOC1,"^",2) I OUPTR'="" S OUNIT=$S($D(^DIC(51.5,OUPTR,0)):$P(^DIC(51.5,OUPTR,0),"^"),1:""),$P(LOC1,"^",2)=OUNIT
|
---|
35 | Q
|
---|
36 | ;
|
---|
37 | PRTQUE ;AFTER DATA IS COMPILED, QUEUE THE PRINT
|
---|
38 | K ZTSAVE,ZTIO S ZTIO=PSGWIO,ZTRTN="PRINT^PSGWADP1",ZTDESC="Print Data for AMIS Stats",ZTDTH=$H,ZTSAVE("^TMP(""PSGWADP"",$J,")=""
|
---|
39 | D ^%ZTLOAD K ^TMP("PSGWADP",$J) G END^PSGWADP1
|
---|
40 | ;
|
---|