PSDLSTK ;BIR/JPW-List Active Stock Items for NAOUs ; 6 July 94
;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
W !!,?5,"You may select a single NAOU, several NAOUs,",!,?5,"or enter ^ALL to select all NAOUs.",!!
ASKN ;ask NAOU(s)
D NOW^%DTC S PSDT=X K DA,DIC
F S DIC=58.8,DIC("A")="Select NAOU: ",DIC(0)="QEA",DIC("S")="I $S('$D(^(""I"")):1,'^(""I""):1,+^(""I"")>PSDT:1,1:0),$P(^(0),""^"",2)'=""P"",$P(^(0),""^"",3)=+PSDSITE" D ^DIC K DIC Q:Y<0 S NAOU(+Y)=""
I '$D(NAOU)&(X'="^ALL") G END
I X="^ALL" F PSD=0:0 S PSD=$O(^PSD(58.8,PSD)) Q:'PSD I $S('$D(^PSD(58.8,PSD,"I")):1,'^("I"):1,+^("I")>PSDT:1,1:0),$P($G(^(0)),"^",2)'="P",$P($G(^(0)),"^",3)=+PSDSITE S NAOU(PSD)=""
K DA,DIR,DIRUT S DIR(0)="SO^T:TYPE/LOCATION/DRUG;A:ALPHABETICALLY BY DRUG",DIR("A",1)="You may print by either of these sorting methods."
S DIR("?",1)="Enter 'T' if you wish to print the NAOU stock list sorted by TYPE",DIR("?",2)=" and within TYPE by LOCATION.",DIR("?")="Enter 'A' to print the NAOU stock list alphabetically."
S DIR("A")="Select SORT ORDER for Report" D ^DIR K DIR G:$D(DIRUT) END S ANS=Y
W !!,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
DEV ;asks device and queueing information
K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END
I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN=$S(ANS="T":"START^PSDLSTK1",1:"START^PSDLSTK2"),ZTDESC="CS PHARM List Stock Drugs" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
U IO G:ANS="T" START^PSDLSTK1 G:ANS="A" START^PSDLSTK2
END ;
K %,%H,%I,%ZIS,ANS,DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,IO("Q"),NAOU,POP,PSD,PSDT,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE D ^%ZISC
S:$D(ZTQUEUED) ZTREQ="@"
Q
SAVE ;save variables for queueing
S ZTSAVE("ANS")="",ZTSAVE=("PSDSITE")="",ZTSAVE("PSD")="",ZTSAVE("PSDT")="" S:$D(NAOU) ZTSAVE("NAOU(")=""
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSDLSTK 1951 printed Dec 13, 2024@01:46:41 Page 2
PSDLSTK ;BIR/JPW-List Active Stock Items for NAOUs ; 6 July 94
+1 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
+2 IF '$DATA(PSDSITE)
DO ^PSDSET
if '$DATA(PSDSITE)
QUIT
+3 WRITE !!,?5,"You may select a single NAOU, several NAOUs,",!,?5,"or enter ^ALL to select all NAOUs.",!!
ASKN ;ask NAOU(s)
+1 DO NOW^%DTC
SET PSDT=X
KILL DA,DIC
+2 FOR
SET DIC=58.8
SET DIC("A")="Select NAOU: "
SET DIC(0)="QEA"
SET DIC("S")="I $S('$D(^(""I"")):1,'^(""I""):1,+^(""I"")>PSDT:1,1:0),$P(^(0),""^"",2)'=""P"",$P(^(0),""^"",3)=+PSDSITE"
DO ^DIC
KILL DIC
if Y<0
QUIT
SET NAOU(+Y)=""
+3 IF '$DATA(NAOU)&(X'="^ALL")
GOTO END
+4 IF X="^ALL"
FOR PSD=0:0
SET PSD=$ORDER(^PSD(58.8,PSD))
if 'PSD
QUIT
IF $SELECT('$DATA(^PSD(58.8,PSD,"I")):1,'^("I"):1,+^("I")>PSDT:1,1:0)
IF $PIECE($GET(^(0)),"^",2)'="P"
IF $PIECE($GET(^(0)),"^",3)=+PSDSITE
SET NAOU(PSD)=""
+5 KILL DA,DIR,DIRUT
SET DIR(0)="SO^T:TYPE/LOCATION/DRUG;A:ALPHABETICALLY BY DRUG"
SET DIR("A",1)="You may print by either of these sorting methods."
+6 SET DIR("?",1)="Enter 'T' if you wish to print the NAOU stock list sorted by TYPE"
SET DIR("?",2)=" and within TYPE by LOCATION."
SET DIR("?")="Enter 'A' to print the NAOU stock list alphabetically."
+7 SET DIR("A")="Select SORT ORDER for Report"
DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO END
SET ANS=Y
+8 WRITE !!,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
DEV ;asks device and queueing information
+1 KILL %ZIS,IOP,IO("Q"),POP
SET %ZIS="QM"
SET %ZIS("B")=""
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!"
GOTO END
+2 IF $DATA(IO("Q"))
KILL IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN=$SELECT(ANS="T":"START^PSDLSTK1",1:"START^PSDLSTK2")
SET ZTDESC="CS PHARM List Stock Drugs"
DO SAVE
DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
GOTO END
+3 USE IO
if ANS="T"
GOTO START^PSDLSTK1
if ANS="A"
GOTO START^PSDLSTK2
END ;
+1 KILL %,%H,%I,%ZIS,ANS,DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,IO("Q"),NAOU,POP,PSD,PSDT,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE
DO ^%ZISC
+2 if $DATA(ZTQUEUED)
SET ZTREQ="@"
+3 QUIT
SAVE ;save variables for queueing
+1 SET ZTSAVE("ANS")=""
SET ZTSAVE=("PSDSITE")=""
SET ZTSAVE("PSD")=""
SET ZTSAVE("PSDT")=""
if $DATA(NAOU)
SET ZTSAVE("NAOU(")=""
+2 QUIT