PSDLBL4 ;BIR/JPW-CS Label Print for CS Disp Drug ; 5 Oct 94
;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",10),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")=PSDEV D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END
I $D(IO("Q")) K IO("Q"),ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDLBL5",ZTDESC="Print Dispensing Labels for CS PHARM" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
U IO D ^PSDLBL5
END ;kill variables and exit
K %,%DT,%H,%I,%ZIS,ALL,ANS,C,CNT,DA,DIC,DIE,DIR,DIROUT,DIRUT,DR,DRUG,DTOUT,DUOUT,JJ,JLP1,LIQ,NAOU,NAOUN,NODE,OK
K POP,PSD,PSD1,PSD2,PSDA,PSDBAR0,PSDBAR1,PSDCNT,PSDEV,PSDG,PSDJ,PSDN,PSDPN,PSDOUT,PSDR,PSDRG,PSDPRT,PSDRN,PSDS,PSDSN,PSDT,PSDX1,PSDX2
K SEL,STAT,TEMP,TEST,TEXT,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
K ^TMP("PSDLBL",$J)
D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
Q
SAVE ;save queued variables
S:$D(ALL) ZTSAVE("ALL")=""
S:$D(PSDS) (ZTSAVE("PSDS"),ZTSAVE("PSDSN"))=""
S:$D(PSD1) ZTSAVE("PSD1(")="" S:$D(NAOU) ZTSAVE("NAOU(")="" S:$D(PSDG) ZTSAVE("PSDG(")="" S:$D(CNT) ZTSAVE("CNT")=""
S (ZTSAVE("ANS"),ZTSAVE("PSDSITE"))=""
Q
GROUP ;select group of naous
K DA,DIC F S DIC=58.2,DIC("A")="Select NAOU INVENTORY GROUP NAME: ",DIC(0)="QEA",DIC("S")="I $S($D(^PSI(58.2,""CS"",+Y)):1,1:0)" D ^DIC K DIC Q:Y<0 S PSDG(+Y)=""
Q
PSDLBL4 ;BIR/JPW-CS Label Print for CS Disp Drug ; 5 Oct 94
+1 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
+2 SET Y=$PIECE($GET(^PSD(58.8,+PSDS,2)),"^",10)
SET C=$PIECE(^DD(58.8,24,0),"^",2)
DO Y^DIQ
SET PSDEV=Y
+3 KILL %ZIS,IOP,IO("Q"),POP
SET %ZIS="QM"
SET %ZIS("B")=PSDEV
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!"
GOTO END
+4 IF $DATA(IO("Q"))
KILL IO("Q"),ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="START^PSDLBL5"
SET ZTDESC="Print Dispensing Labels for CS PHARM"
DO SAVE
DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
GOTO END
+5 USE IO
DO ^PSDLBL5
END ;kill variables and exit
+1 KILL %,%DT,%H,%I,%ZIS,ALL,ANS,C,CNT,DA,DIC,DIE,DIR,DIROUT,DIRUT,DR,DRUG,DTOUT,DUOUT,JJ,JLP1,LIQ,NAOU,NAOUN,NODE,OK
+2 KILL POP,PSD,PSD1,PSD2,PSDA,PSDBAR0,PSDBAR1,PSDCNT,PSDEV,PSDG,PSDJ,PSDN,PSDPN,PSDOUT,PSDR,PSDRG,PSDPRT,PSDRN,PSDS,PSDSN,PSDT,PSDX1,PSDX2
+3 KILL SEL,STAT,TEMP,TEST,TEXT,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
+4 KILL ^TMP("PSDLBL",$JOB)
+5 DO ^%ZISC
IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+6 QUIT
SAVE ;save queued variables
+1 IF $DATA(ALL)
SET ZTSAVE("ALL")=""
+2 IF $DATA(PSDS)
SET (ZTSAVE("PSDS"),ZTSAVE("PSDSN"))=""
+3 IF $DATA(PSD1)
SET ZTSAVE("PSD1(")=""
IF $DATA(NAOU)
SET ZTSAVE("NAOU(")=""
IF $DATA(PSDG)
SET ZTSAVE("PSDG(")=""
IF $DATA(CNT)
SET ZTSAVE("CNT")=""
+4 SET (ZTSAVE("ANS"),ZTSAVE("PSDSITE"))=""
+5 QUIT
GROUP ;select group of naous
+1 KILL DA,DIC
FOR
SET DIC=58.2
SET DIC("A")="Select NAOU INVENTORY GROUP NAME: "
SET DIC(0)="QEA"
SET DIC("S")="I $S($D(^PSI(58.2,""CS"",+Y)):1,1:0)"
DO ^DIC
KILL DIC
IF Y<0
QUIT
SET PSDG(+Y)=""
+2 QUIT