PSDREPV ;BIR/LTL-Review PV 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
N C,D,DIC,DIR,DIRUT,DTOUT,DUOUT,PSD,PSDL,PSDEV,PSDOUT,X,Y
D DT^DICRW
S DIR(0)="Y",DIR("A")="Would you like to select a date range"
S DIR("B")="No",DIR("?")="If you select a date range, I'll show all invoices for that range." D ^DIR K DIR G:Y<0 END G:Y ^PSDREPD
S DIC="^PSD(58.81,",DIC(0)="AEQ",D="PV",DIC("A")="Please select Prime Vendor Invoice number: " W ! D IX^DIC K DIC S PSD=+Y,PSD(2)=$P($G(^PSD(58.81,+Y,8)),U) I Y<0 S PSDOUT=1 G END
I PSD(2)']"" W !!,"No Prime Vendor Invoice for this transaction." S PSDOUT=1 G END
DEV ;(PSD*3*18) Changed %ZIS( call to fileman - SQA.
;S PSDEV=$P($G(^%ZIS(1,+$P($G(^PSD(58.8,+$S($G(PSDLOC):PSDLOC,1:$P($G(^PSD(58.81,+Y,0)),U,3)),2)),U,9),0)),U)
S X="`"_+$P($G(^PSD(58.8,+$S($G(PSDLOC):PSDLOC,1:$P($G(^PSD(58.81,+Y,0)),"^",3)),2)),U,9)
S DIC=3.5,DIC(0)="" D ^DIC S PSDEV=$P($G(Y),"^",2) ; IA # 10114
;asks device and queueing info
K IO("Q") N %ZIS,IOP,POP S %ZIS="Q",%ZIS("B")=PSDEV D ^%ZIS I POP W !,"NO DEVICE SELECTED OR OUTPUT PRINTED!" S PSDOUT=1 G END
I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDREPV",ZTDESC="Invoice receipt review",ZTSAVE("PSD*")="" D ^%ZTLOAD,HOME^%ZIS S PSDOUT=1 G END
START ;compiles and prints output
N %DT,LN,PG,RPDT S (PG,PSDOUT,PSD(1))=0,Y=DT X ^DD("DD") S RPDT=Y
D HEADER
LOOP F S PSD(1)=$O(^PSD(58.81,"PV",PSD(2),PSD(1))) Q:'PSD(1) G:$G(PSDOUT) END D:$Y+5>IOSL HEADER G:PSDOUT END S PSD(3)=$G(^PSD(58.81,+PSD(1),0)) D
.I '$G(PSDLOC) S PSDLOC=$P(PSD(3),U,3) W !,"Receiving Site: ",$P($G(^PSD(58.8,+PSDLOC,0)),U),!
.I $G(PSDLOC)'=$P(PSD(3),U,3),$P(PSD(3),U,3) S PSDL(PSD(1))=PSD(3) Q
.S Y=+$E($P(PSD(3),U,4),1,12) X ^DD("DD") W !,Y," "
.W $E($P($G(^PSDRUG(+$P(PSD(3),U,5),0)),U),1,25)," -> "
.W $P(PSD(3),U,6)," rec'd by "
.W $E($P($G(^VA(200,+$P(PSD(3),U,7),0)),U),1,20),!
W:$O(PSDL(0)) !,"Receiving Site: ",$P($G(^PSD(58.8,+$P(PSD(3),U,3),0)),U),!
F S PSD(1)=$O(PSDL(PSD(1))) Q:'PSD(1) D:$Y+5>IOSL HEADER Q:PSDOUT D
.S PSD(3)=$G(PSDL(PSD(1)))
.S Y=$E($P(PSD(3),U,4),1,12) X ^DD("DD") W !,Y," "
.W $E($P($G(^PSDRUG(+$P(PSD(3),U,5),0)),U),1,25)," -> "
.W $P(PSD(3),U,6)," rec'd by "
.W $E($P($G(^VA(200,+$P(PSD(3),U,7),0)),U),1,20),!
END W:$E(IOST)'="C" @IOF
I $E(IOST)="C",'$G(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 !,"History of receipts for Invoice # ",PSD(2),?57,RPDT,?70,"PAGE: ",PG,!,LN,!
PSDREPV ;BIR/LTL-Review PV 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 NEW C,D,DIC,DIR,DIRUT,DTOUT,DUOUT,PSD,PSDL,PSDEV,PSDOUT,X,Y
+7 DO DT^DICRW
+8 SET DIR(0)="Y"
SET DIR("A")="Would you like to select a date range"
+9 SET DIR("B")="No"
SET DIR("?")="If you select a date range, I'll show all invoices for that range."
DO ^DIR
KILL DIR
IF Y<0
GOTO END
IF Y
GOTO ^PSDREPD
+10 SET DIC="^PSD(58.81,"
SET DIC(0)="AEQ"
SET D="PV"
SET DIC("A")="Please select Prime Vendor Invoice number: "
WRITE !
DO IX^DIC
KILL DIC
SET PSD=+Y
SET PSD(2)=$PIECE($GET(^PSD(58.81,+Y,8)),U)
IF Y<0
SET PSDOUT=1
GOTO END
+11 IF PSD(2)']""
WRITE !!,"No Prime Vendor Invoice for this transaction."
SET PSDOUT=1
GOTO END
DEV ;(PSD*3*18) Changed %ZIS( call to fileman - SQA.
+1 ;S PSDEV=$P($G(^%ZIS(1,+$P($G(^PSD(58.8,+$S($G(PSDLOC):PSDLOC,1:$P($G(^PSD(58.81,+Y,0)),U,3)),2)),U,9),0)),U)
+2 SET X="`"_+$PIECE($GET(^PSD(58.8,+$SELECT($GET(PSDLOC):PSDLOC,1:$PIECE($GET(^PSD(58.81,+Y,0)),"^",3)),2)),U,9)
+3 ; IA # 10114
SET DIC=3.5
SET DIC(0)=""
DO ^DIC
SET PSDEV=$PIECE($GET(Y),"^",2)
+4 ;asks device and queueing info
+5 KILL IO("Q")
NEW %ZIS,IOP,POP
SET %ZIS="Q"
SET %ZIS("B")=PSDEV
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR OUTPUT PRINTED!"
SET PSDOUT=1
GOTO END
+6 IF $DATA(IO("Q"))
NEW ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="START^PSDREPV"
SET ZTDESC="Invoice receipt review"
SET ZTSAVE("PSD*")=""
DO ^%ZTLOAD
DO HOME^%ZIS
SET PSDOUT=1
GOTO END
START ;compiles and prints output
+1 NEW %DT,LN,PG,RPDT
SET (PG,PSDOUT,PSD(1))=0
SET Y=DT
XECUTE ^DD("DD")
SET RPDT=Y
+2 DO HEADER
LOOP FOR
SET PSD(1)=$ORDER(^PSD(58.81,"PV",PSD(2),PSD(1)))
IF 'PSD(1)
QUIT
IF $GET(PSDOUT)
GOTO END
IF $Y+5>IOSL
DO HEADER
IF PSDOUT
GOTO END
SET PSD(3)=$GET(^PSD(58.81,+PSD(1),0))
Begin DoDot:1
+1 IF '$GET(PSDLOC)
SET PSDLOC=$PIECE(PSD(3),U,3)
WRITE !,"Receiving Site: ",$PIECE($GET(^PSD(58.8,+PSDLOC,0)),U),!
+2 IF $GET(PSDLOC)'=$PIECE(PSD(3),U,3)
IF $PIECE(PSD(3),U,3)
SET PSDL(PSD(1))=PSD(3)
QUIT
+3 SET Y=+$EXTRACT($PIECE(PSD(3),U,4),1,12)
XECUTE ^DD("DD")
WRITE !,Y," "
+4 WRITE $EXTRACT($PIECE($GET(^PSDRUG(+$PIECE(PSD(3),U,5),0)),U),1,25)," -> "
+5 WRITE $PIECE(PSD(3),U,6)," rec'd by "
+6 WRITE $EXTRACT($PIECE($GET(^VA(200,+$PIECE(PSD(3),U,7),0)),U),1,20),!
End DoDot:1
+7 IF $ORDER(PSDL(0))
WRITE !,"Receiving Site: ",$PIECE($GET(^PSD(58.8,+$PIECE(PSD(3),U,3),0)),U),!
+8 FOR
SET PSD(1)=$ORDER(PSDL(PSD(1)))
IF 'PSD(1)
QUIT
IF $Y+5>IOSL
DO HEADER
IF PSDOUT
QUIT
Begin DoDot:1
+9 SET PSD(3)=$GET(PSDL(PSD(1)))
+10 SET Y=$EXTRACT($PIECE(PSD(3),U,4),1,12)
XECUTE ^DD("DD")
WRITE !,Y," "
+11 WRITE $EXTRACT($PIECE($GET(^PSDRUG(+$PIECE(PSD(3),U,5),0)),U),1,25)," -> "
+12 WRITE $PIECE(PSD(3),U,6)," rec'd by "
+13 WRITE $EXTRACT($PIECE($GET(^VA(200,+$PIECE(PSD(3),U,7),0)),U),1,20),!
End DoDot:1
END IF $EXTRACT(IOST)'="C"
WRITE @IOF
+1 IF $EXTRACT(IOST)="C"
IF '$GET(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 !,"History of receipts for Invoice # ",PSD(2),?57,RPDT,?70,"PAGE: ",PG,!,LN,!