PSADRU ;BIR/LTL-Drugs Not Found in Linked Inventory ;7/23/97
;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
;This routine reports the inventory/DA items.
;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 ^PRCP( are covered by IA #214
;
SETUP N D0,D1,DA,DIE,DIC,DIR,DIRUT,DLAYGO,DR,DTOUT,DUOUT,PSA,PSADRUG,PSAINV,PSAOUT,X,Y
;LOOK UP LOCATION
LOOK D ^PSADA I '$G(PSALOC) S PSAOUT=1 G QUIT
I '$O(^PSD(58.8,+PSALOC,1,0)) W !!,"There are no drugs in ",PSALOCN S PSAOUT=1 G QUIT
NOINV I '$O(^PSD(58.8,PSALOC,4,0)) W !,$G(PSALOCN)_" is not linked to an Inventory Point.",! D G:$G(PSAOUT) QUIT
.S DIR(0)="Y",DIR("A")="Would you like to attempt a link now",DIR("B")="Yes" D ^DIR K DIR S:Y'=1 PSAOUT=1 Q:Y'=1 D I $D(Y) S PSAOUT=1 Q
INV ..S DIE=58.8,DA=PSALOC,DR="[PSAGIP]" D ^DIE K DIE
DEV 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^PSADRU",ZTDESC="DA Location items not found in Inventory",ZTSAVE("PSA*")="" D ^%ZTLOAD,HOME^%ZIS S PSAOUT=1 G QUIT
START N %DT,PSALN,PSAIT,PSAL,PSAD,PSAPG,PSARPDT,X,Y S (PSAPG,PSAOUT)=0,Y=DT D DD^%DT S PSARPDT=Y,PSAIT=0
S PSA=0
D HEADER
LOOP F S PSA=$O(^PSD(58.8,+PSALOC,1,PSA)) Q:'PSA D:$Y+6>IOSL HEADER Q:PSAOUT D Q:PSAOUT
.W !!,$P($G(^PSDRUG(+PSA,0)),U)
.S PSA(1)=$O(^PSDRUG(+PSA,441,0))
.I 'PSA(1) W !!,"NOT CONNECTED TO THE ITEM MASTER FILE",!,PSALN Q
.S PSA(2)=$G(^PSDRUG(+PSA,441,+PSA(1),0)),PSAINV=0
.I '$O(^PSDRUG(+PSA,441,+PSA(1))) D Q
..W !!,"CONNECTED TO: (",PSA(2),") ",$$DESCR^PRCPUX1(0,PSA(2))
..I '$O(^PRCP(445,"AE",+PSA(2),0)) W !!,"BUT NOT STOCKED BY AN INVENTORY POINT.",!,PSALN Q
..F S PSAINV=$O(^PRCP(445,"AE",+PSA(2),PSAINV)) Q:'PSAINV W !!,"AND STOCKED BY ",$$INVNAME^PRCPUX1(PSAINV),!,PSALN
.W !!,"CONNECTED TO THE FOLLOWING ITEMS:"
.S PSA(1)=0
.F S PSA(1)=$O(^PSDRUG(+PSA,441,PSA(1))) Q:'PSA(1) D:$Y+6>IOSL HEADER Q:PSAOUT D
..S PSA(2)=$G(^PSDRUG(+PSA,441,+PSA(1),0)),PSAINV=0
..W !!,"(",PSA(2),") ",$$DESCR^PRCPUX1(0,PSA(2))
..I '$O(^PRCP(445,"AE",+PSA(2),0)) W !!,"BUT NOT STOCKED BY AN INVENTORY POINT.",!,PSALN Q
..F S PSAINV=$O(^PRCP(445,"AE",+PSA(2),PSAINV)) Q:'PSAINV W !!,"AND STOCKED BY ",$$INVNAME^PRCPUX1(PSAINV),!,PSALN
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")
K PSAIT 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
;DAVE B found bug in next line while making changes for
;PSA*3*25 because the value is a pointer not free text.
D OPSITE^PSAUTL1 S PSAINV(2)=PSAOSITN
;S:$E(PSAINV(2),10)="(" PSAINV(2)=$E(PSAINV(2),1,8)
W:$Y @IOF S $P(PSALN,"-",81)="",PSAPG=PSAPG+1 W !,PSAINV(2)_"'S Items Relationship to an Inventory Point",?56,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSADRU 3206 printed Dec 13, 2024@01:49:12 Page 2
PSADRU ;BIR/LTL-Drugs Not Found in Linked Inventory ;7/23/97
+1 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
+2 ;This routine reports the inventory/DA items.
+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 ^PRCP( are covered by IA #214
+7 ;
SETUP NEW D0,D1,DA,DIE,DIC,DIR,DIRUT,DLAYGO,DR,DTOUT,DUOUT,PSA,PSADRUG,PSAINV,PSAOUT,X,Y
+1 ;LOOK UP LOCATION
LOOK DO ^PSADA
IF '$GET(PSALOC)
SET PSAOUT=1
GOTO QUIT
+1 IF '$ORDER(^PSD(58.8,+PSALOC,1,0))
WRITE !!,"There are no drugs in ",PSALOCN
SET PSAOUT=1
GOTO QUIT
NOINV IF '$ORDER(^PSD(58.8,PSALOC,4,0))
WRITE !,$GET(PSALOCN)_" is not linked to an Inventory Point.",!
Begin DoDot:1
+1 SET DIR(0)="Y"
SET DIR("A")="Would you like to attempt a link now"
SET DIR("B")="Yes"
DO ^DIR
KILL DIR
if Y'=1
SET PSAOUT=1
if Y'=1
QUIT
Begin DoDot:2
INV SET DIE=58.8
SET DA=PSALOC
SET DR="[PSAGIP]"
DO ^DIE
KILL DIE
End DoDot:2
IF $DATA(Y)
SET PSAOUT=1
QUIT
End DoDot:1
if $GET(PSAOUT)
GOTO QUIT
DEV 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
+1 IF $DATA(IO("Q"))
NEW ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="START^PSADRU"
SET ZTDESC="DA Location items not found in Inventory"
SET ZTSAVE("PSA*")=""
DO ^%ZTLOAD
DO HOME^%ZIS
SET PSAOUT=1
GOTO QUIT
START NEW %DT,PSALN,PSAIT,PSAL,PSAD,PSAPG,PSARPDT,X,Y
SET (PSAPG,PSAOUT)=0
SET Y=DT
DO DD^%DT
SET PSARPDT=Y
SET PSAIT=0
+1 SET PSA=0
+2 DO HEADER
LOOP FOR
SET PSA=$ORDER(^PSD(58.8,+PSALOC,1,PSA))
if 'PSA
QUIT
if $Y+6>IOSL
DO HEADER
if PSAOUT
QUIT
Begin DoDot:1
+1 WRITE !!,$PIECE($GET(^PSDRUG(+PSA,0)),U)
+2 SET PSA(1)=$ORDER(^PSDRUG(+PSA,441,0))
+3 IF 'PSA(1)
WRITE !!,"NOT CONNECTED TO THE ITEM MASTER FILE",!,PSALN
QUIT
+4 SET PSA(2)=$GET(^PSDRUG(+PSA,441,+PSA(1),0))
SET PSAINV=0
+5 IF '$ORDER(^PSDRUG(+PSA,441,+PSA(1)))
Begin DoDot:2
+6 WRITE !!,"CONNECTED TO: (",PSA(2),") ",$$DESCR^PRCPUX1(0,PSA(2))
+7 IF '$ORDER(^PRCP(445,"AE",+PSA(2),0))
WRITE !!,"BUT NOT STOCKED BY AN INVENTORY POINT.",!,PSALN
QUIT
+8 FOR
SET PSAINV=$ORDER(^PRCP(445,"AE",+PSA(2),PSAINV))
if 'PSAINV
QUIT
WRITE !!,"AND STOCKED BY ",$$INVNAME^PRCPUX1(PSAINV),!,PSALN
End DoDot:2
QUIT
+9 WRITE !!,"CONNECTED TO THE FOLLOWING ITEMS:"
+10 SET PSA(1)=0
+11 FOR
SET PSA(1)=$ORDER(^PSDRUG(+PSA,441,PSA(1)))
if 'PSA(1)
QUIT
if $Y+6>IOSL
DO HEADER
if PSAOUT
QUIT
Begin DoDot:2
+12 SET PSA(2)=$GET(^PSDRUG(+PSA,441,+PSA(1),0))
SET PSAINV=0
+13 WRITE !!,"(",PSA(2),") ",$$DESCR^PRCPUX1(0,PSA(2))
+14 IF '$ORDER(^PRCP(445,"AE",+PSA(2),0))
WRITE !!,"BUT NOT STOCKED BY AN INVENTORY POINT.",!,PSALN
QUIT
+15 FOR
SET PSAINV=$ORDER(^PRCP(445,"AE",+PSA(2),PSAINV))
if 'PSAINV
QUIT
WRITE !!,"AND STOCKED BY ",$$INVNAME^PRCPUX1(PSAINV),!,PSALN
End DoDot:2
End DoDot:1
if PSAOUT
QUIT
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 KILL PSAIT
QUIT
IF PSAPG
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSAOUT=1
QUIT
+1 IF $$S^%ZTLOAD
WRITE !!,"Task #",$GET(ZTSK),", ",$GET(ZTDESC)," was stopped by ",$PIECE($GET(^VA(200,+$GET(DUZ),0)),U),"."
SET PSAOUT=1
QUIT
+2 ;DAVE B found bug in next line while making changes for
+3 ;PSA*3*25 because the value is a pointer not free text.
+4 DO OPSITE^PSAUTL1
SET PSAINV(2)=PSAOSITN
+5 ;S:$E(PSAINV(2),10)="(" PSAINV(2)=$E(PSAINV(2),1,8)
+6 if $Y
WRITE @IOF
SET $PIECE(PSALN,"-",81)=""
SET PSAPG=PSAPG+1
WRITE !,PSAINV(2)_"'S Items Relationship to an Inventory Point",?56,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN
+7 QUIT