PRCPRSUB ;WISC/RFJ-substitute listing for whse ;08 Jun 93
;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
D ^PRCPUSEL Q:'$G(PRCP("I"))
I PRCP("DPTYPE")'="W" W !,"THIS REPORT CAN ONLY BE USED BY THE WAREHOUSE." Q
N PRCPEND,PRCPSTRT,X
K X S X(1)="The Substitute Listing Report will display inventory items which have at least one substitute item stored. The report will sort Warehouse inventory items by the NSN." D DISPLAY^PRCPUX2(40,79,.X)
K X S X(1)="Select the range of NSNs to display." D DISPLAY^PRCPUX2(2,40,.X)
D NSNSEL^PRCPURS0 I '$D(PRCPSTRT) Q
W ! S %ZIS="Q" D ^%ZIS Q:POP I $D(IO("Q")) D D ^%ZTLOAD K IO("Q"),ZTSK Q
. S ZTDESC="Substitute Listing",ZTRTN="DQ^PRCPRSUB"
. S ZTSAVE("PRCP*")="",ZTSAVE("ZTREQ")="@"
W !!,"<*> please wait <*>"
DQ ; queue starts here
N %,%H,%I,ITEMDA,ITEMDATA,NOW,NSN,PAGE,PRCPFLAG,SCREEN,SUBST,Y
K ^TMP($J,"PRCPRSUB")
S ITEMDA=0 F S ITEMDA=$O(^PRCP(445,PRCP("I"),1,ITEMDA)) Q:'ITEMDA I +$O(^(ITEMDA,4,0)) D
. S NSN=$$NSN^PRCPUX1(ITEMDA) S:NSN="" NSN=" "
. I $E(NSN,1,$L(PRCPSTRT))'=PRCPSTRT,$E(NSN,1,$L(PRCPEND))'=PRCPEND I NSN']PRCPSTRT!(PRCPEND']NSN) Q
. S %=0 F S %=$O(^PRCP(445,PRCP("I"),1,ITEMDA,4,%)) Q:'% S ^TMP($J,"PRCPRSUB",NSN,ITEMDA,%)=""
; print report
D NOW^%DTC S Y=% D DD^%DT S NOW=Y,PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
S NSN="" F S NSN=$O(^TMP($J,"PRCPRSUB",NSN)) Q:'NSN!($G(PRCPFLAG)) S ITEMDA=0 F S ITEMDA=$O(^TMP($J,"PRCPRSUB",NSN,ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG)) D
. I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>" Q
. I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
. S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
. W !!,$TR(NSN,"-"),?19,$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,30),?52,$J(ITEMDA,6),$J($$UNIT^PRCPUX1(PRCP("I"),ITEMDA,"/"),10),$J(+$P(ITEMDATA,"^",7),12)
. S SUBST=0 F S SUBST=$O(^TMP($J,"PRCPRSUB",NSN,ITEMDA,SUBST)) Q:'SUBST!($G(PRCPFLAG)) D
. . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
. . S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,SUBST,0))
. . W !?4,$TR(NSN,"-"),?19,$E($$DESCR^PRCPUX1(PRCP("I"),SUBST),1,30),?52,$J(SUBST,6),$J($$UNIT^PRCPUX1(PRCP("I"),SUBST,"/"),10),$J(+$P(ITEMDATA,"^",7),12)
I '$G(PRCPFLAG) D END^PRCPUREP
D ^%ZISC K ^TMP($J,"PRCPRSUB")
Q
;
H S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
W $C(13),"SUBSTITUTE ITEM LISTING FOR: ",$E(PRCP("IN"),1,20),?(80-$L(%)),%
S %="",$P(%,"-",81)="" W !,"NSN",?19,"DESCRIPTION",?56,"MI",$J("UNIT/IS",10),$J("ONHAND QTY",12),!?4,"SUBSTITUTE ITEM(S)",!,%
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRCPRSUB 2659 printed Nov 22, 2024@17:25:40 Page 2
PRCPRSUB ;WISC/RFJ-substitute listing for whse ;08 Jun 93
+1 ;;5.1;IFCAP;;Oct 20, 2000
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 DO ^PRCPUSEL
if '$GET(PRCP("I"))
QUIT
+4 IF PRCP("DPTYPE")'="W"
WRITE !,"THIS REPORT CAN ONLY BE USED BY THE WAREHOUSE."
QUIT
+5 NEW PRCPEND,PRCPSTRT,X
+6 KILL X
SET X(1)="The Substitute Listing Report will display inventory items which have at least one substitute item stored. The report will sort Warehouse inventory items by the NSN."
DO DISPLAY^PRCPUX2(40,79,.X)
+7 KILL X
SET X(1)="Select the range of NSNs to display."
DO DISPLAY^PRCPUX2(2,40,.X)
+8 DO NSNSEL^PRCPURS0
IF '$DATA(PRCPSTRT)
QUIT
+9 WRITE !
SET %ZIS="Q"
DO ^%ZIS
if POP
QUIT
IF $DATA(IO("Q"))
Begin DoDot:1
+10 SET ZTDESC="Substitute Listing"
SET ZTRTN="DQ^PRCPRSUB"
+11 SET ZTSAVE("PRCP*")=""
SET ZTSAVE("ZTREQ")="@"
End DoDot:1
DO ^%ZTLOAD
KILL IO("Q"),ZTSK
QUIT
+12 WRITE !!,"<*> please wait <*>"
DQ ; queue starts here
+1 NEW %,%H,%I,ITEMDA,ITEMDATA,NOW,NSN,PAGE,PRCPFLAG,SCREEN,SUBST,Y
+2 KILL ^TMP($JOB,"PRCPRSUB")
+3 SET ITEMDA=0
FOR
SET ITEMDA=$ORDER(^PRCP(445,PRCP("I"),1,ITEMDA))
if 'ITEMDA
QUIT
IF +$ORDER(^(ITEMDA,4,0))
Begin DoDot:1
+4 SET NSN=$$NSN^PRCPUX1(ITEMDA)
if NSN=""
SET NSN=" "
+5 IF $EXTRACT(NSN,1,$LENGTH(PRCPSTRT))'=PRCPSTRT
IF $EXTRACT(NSN,1,$LENGTH(PRCPEND))'=PRCPEND
IF NSN']PRCPSTRT!(PRCPEND']NSN)
QUIT
+6 SET %=0
FOR
SET %=$ORDER(^PRCP(445,PRCP("I"),1,ITEMDA,4,%))
if '%
QUIT
SET ^TMP($JOB,"PRCPRSUB",NSN,ITEMDA,%)=""
End DoDot:1
+7 ; print report
+8 DO NOW^%DTC
SET Y=%
DO DD^%DT
SET NOW=Y
SET PAGE=1
SET SCREEN=$$SCRPAUSE^PRCPUREP
USE IO
DO H
+9 SET NSN=""
FOR
SET NSN=$ORDER(^TMP($JOB,"PRCPRSUB",NSN))
if 'NSN!($GET(PRCPFLAG))
QUIT
SET ITEMDA=0
FOR
SET ITEMDA=$ORDER(^TMP($JOB,"PRCPRSUB",NSN,ITEMDA))
if 'ITEMDA!($GET(PRCPFLAG))
QUIT
Begin DoDot:1
+10 IF $GET(ZTQUEUED)
IF $$S^%ZTLOAD
SET PRCPFLAG=1
WRITE !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>"
QUIT
+11 IF $Y>(IOSL-6)
if SCREEN
DO P^PRCPUREP
if $DATA(PRCPFLAG)
QUIT
DO H
+12 SET ITEMDATA=$GET(^PRCP(445,PRCP("I"),1,ITEMDA,0))
+13 WRITE !!,$TRANSLATE(NSN,"-"),?19,$EXTRACT($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,30),?52,$JUSTIFY(ITEMDA,6),$JUSTIFY($$UNIT^PRCPUX1(PRCP("I"),ITEMDA,"/"),10),$JUSTIFY(+$PIECE(ITEMDATA,"^",7),12)
+14 SET SUBST=0
FOR
SET SUBST=$ORDER(^TMP($JOB,"PRCPRSUB",NSN,ITEMDA,SUBST))
if 'SUBST!($GET(PRCPFLAG))
QUIT
Begin DoDot:2
+15 IF $Y>(IOSL-6)
if SCREEN
DO P^PRCPUREP
if $DATA(PRCPFLAG)
QUIT
DO H
+16 SET ITEMDATA=$GET(^PRCP(445,PRCP("I"),1,SUBST,0))
+17 WRITE !?4,$TRANSLATE(NSN,"-"),?19,$EXTRACT($$DESCR^PRCPUX1(PRCP("I"),SUBST),1,30),?52,$JUSTIFY(SUBST,6),$JUSTIFY($$UNIT^PRCPUX1(PRCP("I"),SUBST,"/"),10),$JUSTIFY(+$PIECE(ITEMDATA,"^",7),12)
End DoDot:2
End DoDot:1
+18 IF '$GET(PRCPFLAG)
DO END^PRCPUREP
+19 DO ^%ZISC
KILL ^TMP($JOB,"PRCPRSUB")
+20 QUIT
+21 ;
H SET %=NOW_" PAGE "_PAGE
SET PAGE=PAGE+1
IF PAGE'=2!(SCREEN)
WRITE @IOF
+1 WRITE $CHAR(13),"SUBSTITUTE ITEM LISTING FOR: ",$EXTRACT(PRCP("IN"),1,20),?(80-$LENGTH(%)),%
+2 SET %=""
SET $PIECE(%,"-",81)=""
WRITE !,"NSN",?19,"DESCRIPTION",?56,"MI",$JUSTIFY("UNIT/IS",10),$JUSTIFY("ONHAND QTY",12),!?4,"SUBSTITUTE ITEM(S)",!,%
+3 QUIT