PSAREPV ;BIR/LTL,JMB-Invoice Review ;7/23/97
;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
;This routine reviews prime vendor receipt transactions in GIP.
;
;References to ^PSDRUG( are covered by IA #2095
;
N DIC,DIR,DTOUT,DUOUT,PSA,PSALOC,PSAOUT,X,Y
D DT^DICRW
S DIC="^PSD(58.81,",DIC(0)="AEQS",D="PV",DIC("A")="Please select Prime Vendor Invoice number: "
D IX^DIC K DIC S PSA=+Y,PSA(2)=$P($G(^PSD(58.81,+Y,8)),"^") I Y<0 S PSAOUT=1 G END
I $P($G(^PSD(58.81,+Y,8)),"^")']"" S PSAOUT=1 G END
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 OUTPUT PRINTED!" S PSAOUT=1 G END
I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSAREPV",ZTDESC="Invoice receipt review",ZTSAVE("PSA*")="" D ^%ZTLOAD,HOME^%ZIS S PSAOUT=1 G END
START ;compiles and prints output
N %DT,PSALN,PSAPG,PSARPDT S (PSAPG,PSAOUT)=0,Y=DT,PSA(1)="" X ^DD("DD") S PSARPDT=Y D HEADER
LOOP F S PSA(1)=$O(^PSD(58.81,"PV",PSA(2),PSA(1))) G:$G(PSAOUT)!('PSA(1)) END D:$Y+5>IOSL HEADER G:PSAOUT END D
.I '$D(PSALOC) S PSALOC=$P($G(^PSD(58.81,+PSA(1),0)),"^",3) W !,"Receiving Site: ",$P($G(^PSD(58.8,+PSALOC,0)),"^"),!
.I $G(PSALOC)'=$P($G(^PSD(58.81,+PSA(1),0)),"^",3) S PSALOC=$P($G(^(0)),"^",3) W !,"Receiving Site: ",$P($G(^PSD(58.8,+$P($G(^PSD(58.81,+PSA(1),0)),"^",3),0)),"^"),!
.S Y=$P($G(^PSD(58.81,+PSA(1),0)),"^",4) X ^DD("DD") W !,Y," ",$E($P($G(^PSDRUG(+$P($G(^PSD(58.81,+PSA(1),0)),"^",5),0)),"^"),1,25)," => "
.W $P($G(^PSD(58.81,+PSA(1),0)),"^",6)," rec'd by ",$E($P($G(^VA(200,+$P($G(^PSD(58.81,+PSA(1),0)),"^",7),0)),"^"),1,20),!
END W:$E(IOST)'="C" @IOF
I $E(IOST,1,2)="C-",'$G(PSAOUT) 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)),"^"),"." S PSAOUT=1 Q
W:$Y @IOF S $P(PSALN,"-",81)="",PSAPG=PSAPG+1 W !,"History of receipts for Invoice # ",PSA(2),?57,PSARPDT,?70,"PAGE: ",PSAPG,!,PSALN,!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSAREPV 2205 printed Dec 13, 2024@01:50:32 Page 2
PSAREPV ;BIR/LTL,JMB-Invoice Review ;7/23/97
+1 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
+2 ;This routine reviews prime vendor receipt transactions in GIP.
+3 ;
+4 ;References to ^PSDRUG( are covered by IA #2095
+5 ;
+6 NEW DIC,DIR,DTOUT,DUOUT,PSA,PSALOC,PSAOUT,X,Y
+7 DO DT^DICRW
+8 SET DIC="^PSD(58.81,"
SET DIC(0)="AEQS"
SET D="PV"
SET DIC("A")="Please select Prime Vendor Invoice number: "
+9 DO IX^DIC
KILL DIC
SET PSA=+Y
SET PSA(2)=$PIECE($GET(^PSD(58.81,+Y,8)),"^")
IF Y<0
SET PSAOUT=1
GOTO END
+10 IF $PIECE($GET(^PSD(58.81,+Y,8)),"^")']""
SET PSAOUT=1
GOTO END
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 OUTPUT PRINTED!"
SET PSAOUT=1
GOTO END
+2 IF $DATA(IO("Q"))
NEW ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="START^PSAREPV"
SET ZTDESC="Invoice receipt review"
SET ZTSAVE("PSA*")=""
DO ^%ZTLOAD
DO HOME^%ZIS
SET PSAOUT=1
GOTO END
START ;compiles and prints output
+1 NEW %DT,PSALN,PSAPG,PSARPDT
SET (PSAPG,PSAOUT)=0
SET Y=DT
SET PSA(1)=""
XECUTE ^DD("DD")
SET PSARPDT=Y
DO HEADER
LOOP FOR
SET PSA(1)=$ORDER(^PSD(58.81,"PV",PSA(2),PSA(1)))
if $GET(PSAOUT)!('PSA(1))
GOTO END
if $Y+5>IOSL
DO HEADER
if PSAOUT
GOTO END
Begin DoDot:1
+1 IF '$DATA(PSALOC)
SET PSALOC=$PIECE($GET(^PSD(58.81,+PSA(1),0)),"^",3)
WRITE !,"Receiving Site: ",$PIECE($GET(^PSD(58.8,+PSALOC,0)),"^"),!
+2 IF $GET(PSALOC)'=$PIECE($GET(^PSD(58.81,+PSA(1),0)),"^",3)
SET PSALOC=$PIECE($GET(^(0)),"^",3)
WRITE !,"Receiving Site: ",$PIECE($GET(^PSD(58.8,+$PIECE($GET(^PSD(58.81,+PSA(1),0)),"^",3),0)),"^"),!
+3 SET Y=$PIECE($GET(^PSD(58.81,+PSA(1),0)),"^",4)
XECUTE ^DD("DD")
WRITE !,Y," ",$EXTRACT($PIECE($GET(^PSDRUG(+$PIECE($GET(^PSD(58.81,+PSA(1),0)),"^",5),0)),"^"),1,25)," => "
+4 WRITE $PIECE($GET(^PSD(58.81,+PSA(1),0)),"^",6)," rec'd by ",$EXTRACT($PIECE($GET(^VA(200,+$PIECE($GET(^PSD(58.81,+PSA(1),0)),"^",7),0)),"^"),1,20),!
End DoDot:1
END if $EXTRACT(IOST)'="C"
WRITE @IOF
+1 IF $EXTRACT(IOST,1,2)="C-"
IF '$GET(PSAOUT)
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)),"^"),"."
SET PSAOUT=1
QUIT
+3 if $Y
WRITE @IOF
SET $PIECE(PSALN,"-",81)=""
SET PSAPG=PSAPG+1
WRITE !,"History of receipts for Invoice # ",PSA(2),?57,PSARPDT,?70,"PAGE: ",PSAPG,!,PSALN,!
+4 QUIT