PSAVIN ;BIR/LTL-Report of Inventory items' link to DRUG FILE ;7/23/97
;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
;
;References to $$DESCR^PRCPUX1 are covered by IA #259
;References to $$INVNAME^PRCPUX1 are covered by IA #259
;References to ^PSDRUG( are covered by IA #2095
;References to ^PSDRUG("AB" are covered by IA #2095
;References to ^PRCP( are covered by IA #214
;
D DT^DICRW N DIR,DIRUT,X,Y,PSALOC,PSAOUT,DIC,DTOUT,DUOUT,PSAINV,PSAIT
LOOK ;Select Inventory point
S DIC="^PRCP(445,",DIC(0)="AEMQ",DIC("S")="I $P($G(^(0)),U,20)=""D""",PRCPPRIV=1 D ^DIC K DIC,PRCPPRIV S PSAINV=+Y,PSAIT=0 I Y<0 S PSAOUT=1 G QUIT
I '$O(^PSD(58.8,"P",+PSAINV,0)) W !!,$$INVNAME^PRCPUX1(PSAINV)_" is NOT linked to a Drug Accountability Location.",!!
S PSALOC=$O(^PSD(58.8,"P",+PSAINV,0)) W:PSALOC !!,$$INVNAME^PRCPUX1(PSAINV)_" is linked to",!!,$P($G(^PSD(58.8,+PSALOC,0)),U),!!
DEV ;asks device and queueing info
K IO("Q") N %ZIS,IOP,POP S %ZIS="Q" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" S PSAOUT=1 G QUIT
I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSAVIN",ZTDESC="Inventory items link to DRUG FILE Report",ZTSAVE("PSA*")="" D ^%ZTLOAD,HOME^%ZIS S PSAOUT=1 G QUIT
START N %DT,DIR,DIRUT,PSALN,PSAD,PSAPG,PSAOUT,PSARPDT,X,Y S (PSAPG,PSAOUT)=0,Y=DT D DD^%DT S PSARPDT=Y
D HEADER
LOOP F S PSAIT=$O(^PRCP(445,PSAINV,1,PSAIT)) Q:'PSAIT D:$Y+4>IOSL HEADER Q:PSAOUT D
.W !!,PSAIT,?10,$E($$DESCR^PRCPUX1(PSAINV,PSAIT),1,33),?45,$E($S($P($G(^PSDRUG(+$O(^PSDRUG("AB",+PSAIT,0)),0)),U)]"":$P($G(^(0)),U),1:"NONE"),1,34)
QUIT I $E(IOST)'="C" W @IOF
I $E(IOST,1,2)="C-",'$G(PSAOUT) W !! S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR
D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q")
Q
I $E(IOST,1,2)'="P-",PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSAOUT=1 Q
W:$Y @IOF S $P(PSALN,"-",81)="",PSAPG=PSAPG+1 W !,$E($$INVNAME^PRCPUX1(PSAINV),1,23)_" Items' Link to DRUG file",?50,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN,!,"ITEM",?10,"DESCRIPTION",?45,"DRUG FILE LINK"
Q
PSAVIN ;BIR/LTL-Report of Inventory items' link to DRUG FILE ;7/23/97
+1 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
+2 ;
+3 ;References to $$DESCR^PRCPUX1 are covered by IA #259
+4 ;References to $$INVNAME^PRCPUX1 are covered by IA #259
+5 ;References to ^PSDRUG( are covered by IA #2095
+6 ;References to ^PSDRUG("AB" are covered by IA #2095
+7 ;References to ^PRCP( are covered by IA #214
+8 ;
+9 DO DT^DICRW
NEW DIR,DIRUT,X,Y,PSALOC,PSAOUT,DIC,DTOUT,DUOUT,PSAINV,PSAIT
LOOK ;Select Inventory point
+1 SET DIC="^PRCP(445,"
SET DIC(0)="AEMQ"
SET DIC("S")="I $P($G(^(0)),U,20)=""D"""
SET PRCPPRIV=1
DO ^DIC
KILL DIC,PRCPPRIV
SET PSAINV=+Y
SET PSAIT=0
IF Y<0
SET PSAOUT=1
GOTO QUIT
+2 IF '$ORDER(^PSD(58.8,"P",+PSAINV,0))
WRITE !!,$$INVNAME^PRCPUX1(PSAINV)_" is NOT linked to a Drug Accountability Location.",!!
+3 SET PSALOC=$ORDER(^PSD(58.8,"P",+PSAINV,0))
IF PSALOC
WRITE !!,$$INVNAME^PRCPUX1(PSAINV)_" is linked to",!!,$PIECE($GET(^PSD(58.8,+PSALOC,0)),U),!!
DEV ;asks device and queueing info
+1 KILL IO("Q")
NEW %ZIS,IOP,POP
SET %ZIS="Q"
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!"
SET PSAOUT=1
GOTO QUIT
+2 IF $DATA(IO("Q"))
NEW ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="START^PSAVIN"
SET ZTDESC="Inventory items link to DRUG FILE Report"
SET ZTSAVE("PSA*")=""
DO ^%ZTLOAD
DO HOME^%ZIS
SET PSAOUT=1
GOTO QUIT
START NEW %DT,DIR,DIRUT,PSALN,PSAD,PSAPG,PSAOUT,PSARPDT,X,Y
SET (PSAPG,PSAOUT)=0
SET Y=DT
DO DD^%DT
SET PSARPDT=Y
+1 DO HEADER
LOOP FOR
SET PSAIT=$ORDER(^PRCP(445,PSAINV,1,PSAIT))
IF 'PSAIT
QUIT
IF $Y+4>IOSL
DO HEADER
IF PSAOUT
QUIT
Begin DoDot:1
+1 WRITE !!,PSAIT,?10,$EXTRACT($$DESCR^PRCPUX1(PSAINV,PSAIT),1,33),?45,$EXTRACT($SELECT($PIECE($GET(^PSDRUG(+$ORDER(^PSDRUG("AB",+PSAIT,0)),0)),U)]"":$PIECE($GET(^(0)),U),1:"NONE"),1,34)
End DoDot:1
QUIT IF $EXTRACT(IOST)'="C"
WRITE @IOF
+1 IF $EXTRACT(IOST,1,2)="C-"
IF '$GET(PSAOUT)
WRITE !!
SET DIR(0)="EA"
SET DIR("A")="END OF REPORT! Press <RET> to return to the menu."
DO ^DIR
+2 DO ^%ZISC
IF $DATA(ZTQUEUED)
SET ZTREQ="@"
KILL IO("Q")
+3 QUIT
+1 IF $EXTRACT(IOST,1,2)'="P-"
IF PSAPG
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSAOUT=1
QUIT
+2 IF $$S^%ZTLOAD
WRITE !!,"Task #",$GET(ZTSK),", ",$GET(ZTDESC)," was stopped by ",$PIECE($GET(^VA(200,+$GET(DUZ),0)),U),"."
SET PSAOUT=1
QUIT
+3 IF $Y
WRITE @IOF
SET $PIECE(PSALN,"-",81)=""
SET PSAPG=PSAPG+1
WRITE !,$EXTRACT($$INVNAME^PRCPUX1(PSAINV),1,23)_" Items' Link to DRUG file",?50,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN,!,"ITEM",?10,"DESCRIPTION",?45,"DRUG FILE LINK"
+4 QUIT