PSDREV ;BIR/LTL-Review Receipt Transactions ; 29 Aug 94
;;3.0; CONTROLLED SUBSTANCES ;**18**;13 Feb 97
;
;References to ^PSD(58.8, covered by DBIA2711
;References to ^PSD(58.81 are covered by DBIA2808
;References to ^PSDRUG( are covered by DBIA221
;References to ^PRC(442 are covered by DBIA#682
N C,DIC,DIR,DTOUT,DUOUT,PSDEV,PSDLOC,PSDOUT,PSDPO,X,Y
S DIC="^PRC(442,",DIC(0)="AEMQZ",DIC("A")="Please Select Purchase Order Number: ",DIC("S")="I $P($G(^(0)),U,5)[822400",PSDOUT=1 D ^DIC K DIC G:$D(DTOUT)!($D(DUOUT))!(Y<1) END S PSDPO=+Y
I '$O(^PSD(58.81,"C",+Y,"")) W !!,"There have been no receipts for this Purchase Order.",!! G END
DEV ;asks device and queueing info
S Y=$P($G(^PSD(58.8,+$P($G(^PSD(58.81,+$O(^PSD(58.81,"C",+Y,0)),0)),U,3),2)),U,9),C=$P(^DD(58.8,24,0),U,2) D Y^DIQ S PSDEV=Y
K IO("Q"),PSDLOC N %ZIS,IOP,POP S %ZIS="Q",%ZIS("B")=PSDEV D ^%ZIS I POP W !,"NO DEVICE SELECTED OR OUTPUT PRINTED!" Q
I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDREV",ZTDESC="Receipt transaction review",ZTSAVE("PSDPO")="" D ^%ZTLOAD,HOME^%ZIS S PSDOUT=1 G END
START ;compiles and prints output
N %DT,LN,PSDR,PG,RPDT S (PG,PSDOUT)=0,Y=DT,PSDR="" X ^DD("DD") S RPDT=Y D HEADER
LOOP F S PSDR=$O(^PSD(58.81,"C",PSDPO,PSDR)) G:'PSDR END D:$Y+5>IOSL HEADER G:PSDOUT END D
.I '$D(PSDLOC) S PSDLOC=$P($G(^PSD(58.81,+PSDR,0)),U,3) W !,"Receiving Site: ",$P($G(^PSD(58.8,+PSDLOC,0)),U),!
.I $G(PSDLOC)'=$P($G(^PSD(58.81,+PSDR,0)),U,3) S PSDLOC=$P($G(^(0)),U,3) W !,"Receiving Site: ",$P($G(^PSD(58.8,+$P($G(^PSD(58.81,+PSDR,0)),U,3),0)),U),!
.S Y=$P($G(^PSD(58.81,+PSDR,0)),U,4) X ^DD("DD") W !,Y," ",$E($P($G(^PSDRUG(+$P($G(^PSD(58.81,PSDR,0)),U,5),0)),U),1,25)," -> "
.W $P($G(^PSD(58.81,+PSDR,0)),U,6)," rec'd by ",$E($P($G(^VA(200,+$P($G(^PSD(58.81,+PSDR,0)),U,7),0)),U),1,20),!
END W:$E(IOST)'="C" @IOF
I $E(IOST)="C",'PSDOUT 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-",PG S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSDOUT=1 Q
W:$Y @IOF S $P(LN,"-",81)="",PG=PG+1 W !?2,"History of receipts for P.O.# ",$P($G(^PRC(442,+PSDPO,0)),U),?50,RPDT,?70,"PAGE: ",PG,!,LN,!
PSDREV ;BIR/LTL-Review Receipt Transactions ; 29 Aug 94
+1 ;;3.0; CONTROLLED SUBSTANCES ;**18**;13 Feb 97
+2 ;
+3 ;References to ^PSD(58.8, covered by DBIA2711
+4 ;References to ^PSD(58.81 are covered by DBIA2808
+5 ;References to ^PSDRUG( are covered by DBIA221
+6 ;References to ^PRC(442 are covered by DBIA#682
+7 NEW C,DIC,DIR,DTOUT,DUOUT,PSDEV,PSDLOC,PSDOUT,PSDPO,X,Y
+8 SET DIC="^PRC(442,"
SET DIC(0)="AEMQZ"
SET DIC("A")="Please Select Purchase Order Number: "
SET DIC("S")="I $P($G(^(0)),U,5)[822400"
SET PSDOUT=1
DO ^DIC
KILL DIC
IF $DATA(DTOUT)!($DATA(DUOUT))!(Y<1)
GOTO END
SET PSDPO=+Y
+9 IF '$ORDER(^PSD(58.81,"C",+Y,""))
WRITE !!,"There have been no receipts for this Purchase Order.",!!
GOTO END
DEV ;asks device and queueing info
+1 SET Y=$PIECE($GET(^PSD(58.8,+$PIECE($GET(^PSD(58.81,+$ORDER(^PSD(58.81,"C",+Y,0)),0)),U,3),2)),U,9)
SET C=$PIECE(^DD(58.8,24,0),U,2)
DO Y^DIQ
SET PSDEV=Y
+2 KILL IO("Q"),PSDLOC
NEW %ZIS,IOP,POP
SET %ZIS="Q"
SET %ZIS("B")=PSDEV
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR OUTPUT PRINTED!"
QUIT
+3 IF $DATA(IO("Q"))
NEW ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="START^PSDREV"
SET ZTDESC="Receipt transaction review"
SET ZTSAVE("PSDPO")=""
DO ^%ZTLOAD
DO HOME^%ZIS
SET PSDOUT=1
GOTO END
START ;compiles and prints output
+1 NEW %DT,LN,PSDR,PG,RPDT
SET (PG,PSDOUT)=0
SET Y=DT
SET PSDR=""
XECUTE ^DD("DD")
SET RPDT=Y
DO HEADER
LOOP FOR
SET PSDR=$ORDER(^PSD(58.81,"C",PSDPO,PSDR))
IF 'PSDR
GOTO END
IF $Y+5>IOSL
DO HEADER
IF PSDOUT
GOTO END
Begin DoDot:1
+1 IF '$DATA(PSDLOC)
SET PSDLOC=$PIECE($GET(^PSD(58.81,+PSDR,0)),U,3)
WRITE !,"Receiving Site: ",$PIECE($GET(^PSD(58.8,+PSDLOC,0)),U),!
+2 IF $GET(PSDLOC)'=$PIECE($GET(^PSD(58.81,+PSDR,0)),U,3)
SET PSDLOC=$PIECE($GET(^(0)),U,3)
WRITE !,"Receiving Site: ",$PIECE($GET(^PSD(58.8,+$PIECE($GET(^PSD(58.81,+PSDR,0)),U,3),0)),U),!
+3 SET Y=$PIECE($GET(^PSD(58.81,+PSDR,0)),U,4)
XECUTE ^DD("DD")
WRITE !,Y," ",$EXTRACT($PIECE($GET(^PSDRUG(+$PIECE($GET(^PSD(58.81,PSDR,0)),U,5),0)),U),1,25)," -> "
+4 WRITE $PIECE($GET(^PSD(58.81,+PSDR,0)),U,6)," rec'd by ",$EXTRACT($PIECE($GET(^VA(200,+$PIECE($GET(^PSD(58.81,+PSDR,0)),U,7),0)),U),1,20),!
End DoDot:1
END IF $EXTRACT(IOST)'="C"
WRITE @IOF
+1 IF $EXTRACT(IOST)="C"
IF 'PSDOUT
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 PG
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSDOUT=1
QUIT
+2 IF $$S^%ZTLOAD
WRITE !!,"Task #",$GET(ZTSK),", ",$GET(ZTDESC)," was stopped by ",$PIECE($GET(^VA(200,+$GET(DUZ),0)),U),"."
SET PSDOUT=1
QUIT
+3 IF $Y
WRITE @IOF
SET $PIECE(LN,"-",81)=""
SET PG=PG+1
WRITE !?2,"History of receipts for P.O.# ",$PIECE($GET(^PRC(442,+PSDPO,0)),U),?50,RPDT,?70,"PAGE: ",PG,!,LN,!