1 | PSDLBLR0 ;BIR/JPW-CS Label Reprt for CS Disp Drug (cont'd) ; 17 May 94
|
---|
2 | ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
|
---|
3 | START ;entry for compile and print labels
|
---|
4 | K ^TMP("PSDLBLR",$J),PSDPRT D NOW^%DTC S PSDT=+$E(%,1,12)
|
---|
5 | F JJ=0,1 S @("PSDBAR"_JJ)="" I $D(^%ZIS(2,^%ZIS(1,IOS,"SUBTYPE"),"BAR"_JJ)) S @("PSDBAR"_JJ)=^("BAR"_JJ)
|
---|
6 | I PSDBAR1]"",PSDBAR0]"" S PSDPRT=1
|
---|
7 | S PSDCNT=1,PSD1="" F S PSD1=$O(PSD1(PSD1)) Q:PSD1="" D LOOP
|
---|
8 | PRINT ;print labels
|
---|
9 | S (PSDCNT,PSDOUT)=0,PSDX2=1
|
---|
10 | S PSD="" F S PSD=$O(^TMP("PSDLBLR",$J,PSD)) Q:PSD=""!(PSDOUT) S PSDCNT=PSDCNT+1,TEMP(PSDCNT)=$E($P(^TMP("PSDLBLR",$J,PSD),"^",2),1,28),TEST(PSDCNT)=$P(^TMP("PSDLBLR",$J,PSD),"^")_" "_$P(^TMP("PSDLBLR",$J,PSD),"^",3) D:PSDCNT=3 PRINT1
|
---|
11 | I PSDCNT,PSDCNT<3 D PRINT1
|
---|
12 | DONE I $E(IOST)'="C" W @IOF
|
---|
13 | I $E(IOST,1,2)="C-",'PSDOUT W ! K DIR,DIRUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu" D ^DIR K DIR
|
---|
14 | END ;kill variables and exit
|
---|
15 | K %,%DT,%H,%I,%ZIS,DA,DIC,DIE,DIR,DIROUT,DIRUT,DR,DRUG,DTOUT,DUOUT,JJ,JLP1,LIQ,NAOU,NAOUN,NODE,OK
|
---|
16 | K POP,PSD,PSD1,PSDA,PSDBAR0,PSDBAR1,PSDCNT,PSDEV,PSDJ,PSDN,PSDPN,PSDOUT,PSDR,PSDRG,PSDPRT,PSDRN,PSDS,PSDSN,PSDT,PSDX1,PSDX2
|
---|
17 | K QTY,STAT,TEMP,TEST,TEXT,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
|
---|
18 | K ^TMP("PSDLBLR",$J)
|
---|
19 | D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
|
---|
20 | Q
|
---|
21 | PRINT1 ;prints labels
|
---|
22 | W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*33+1,$E(TEMP(PSDX1+1),1,30)
|
---|
23 | I $D(PSDPRT) W !! F PSDX1=1:1:PSDCNT W @PSDBAR1,$P(TEST(PSDX1)," "),@PSDBAR0
|
---|
24 | W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*32+3,TEST(PSDX1+1)
|
---|
25 | W !!
|
---|
26 | S PSDCNT=0,PSDX2=PSDX2+1 S:PSDX2=11 PSDX2=1
|
---|
27 | Q
|
---|
28 | LOOP S PSD=$P(PSD1(PSD1),",",PSDCNT),PSDCNT=PSDCNT+1 I PSD="" S PSDCNT=1 Q
|
---|
29 | F PSDJ=0:0 S PSDJ=$O(^PSD(58.81,"D",PSD,PSDJ)) Q:'PSDJ D SET1
|
---|
30 | G LOOP
|
---|
31 | Q
|
---|
32 | SET1 ;sets disp info
|
---|
33 | Q:'$D(^PSD(58.81,PSDJ,0)) S NODE=^PSD(58.81,PSDJ,0) Q:+$P(NODE,"^",3)'=+PSDS
|
---|
34 | S STAT=+$P(NODE,"^",11) S OK=$S(STAT=3:1,STAT=4:1,1:0) Q:'OK
|
---|
35 | S PSDPN=$P(NODE,"^",17) Q:PSDPN']""
|
---|
36 | S NAOU=+$P(NODE,"^",18) Q:'NAOU S NAOUN=$P($G(^PSD(58.8,+NAOU,0)),"^")
|
---|
37 | S PSDR=+$P(NODE,"^",5) Q:'PSDR
|
---|
38 | S PSDA=+$P(NODE,"^",20) Q:'PSDA
|
---|
39 | S PSDN=$P($G(^PSDRUG(+PSDR,0)),"^"),QTY=$P($G(^PSD(58.8,+NAOU,1,+PSDR,0)),"^",4)
|
---|
40 | S TEXT(PSDR)=PSDN_"^"_NAOUN
|
---|
41 | SET ;sets ^tmp
|
---|
42 | ;K LIQ S:+$G(^PSD(58.8,+NAOU,1,+PSDR,7)) LIQ="L"
|
---|
43 | S ^TMP("PSDLBLR",$J,PSDPN)=PSDPN_"^"_$P(TEXT(PSDR),"^")_"^"_$E($P(TEXT(PSDR),"^",2),1,12)
|
---|
44 | DIE ;update label printed
|
---|
45 | K DA,DIE,DR S DA=+PSDJ,DIE=58.81,DR="104////"_PSDT D ^DIE K DA,DIE,DR
|
---|
46 | Q
|
---|