PRCPUSEL ;WISC/RFJ/DAP-utilities: setup inventory variables ;14 Feb 91
V ;;5.1;IFCAP;**1,83,110,118,185**;Oct 20, 2000;Build 3
;Per VHA Directive 2004-038, this routine should not be modified.
; enter distribution point--input variables:
; prcp("dptype")=distribution point type code [W,P,S]
; returns the following variables:
; prcp("in")=name of inv pt (no station #),
; prcp("inv")=keep perpetual inventory flag
; prcp("his")=keep detailed history flag,
; prcp("i")=da of inv pt
;
;PRC*5.1*185 Modified look up parameters for Inventory Point from
; 'AEQMOZ' to 'AEQMZ' to show matches for both Inventory
; Point name and abbreviation.
;
;*83 Routine PRCPLO1 associated with PRC*5.1*83 is a modified copy of
;this routine and any changes made to this routine should also be
;considered for that routine as well.
;
N %,C,DISYS,I,J,PRCF,PRCPFLAG,X,Y
I +$G(DUZ)<1 W !,"YOU ARE NOT SETUP AS A USER!" K PRC,PRCP Q
;
S %=0 F I="FY","PARAM","PER","QTR","SITE" I '+$G(PRC(I)) S %=1 Q
I % S PRCF("X")="S" D ^PRCFSITE I '+$G(PRC("SITE")) K PRC,PRCP Q
;
S %=0 F I="DPTYPE","HIS","I","IN","INV" I $G(PRCP(I))="" S %=1 Q
I '% D DISPLAY Q
;
; allow adding new whse if not one for station
I $G(PRCP("DPTYPE"))="W" D Q:$G(PRCPFLAG)
. K PRCPFLAG
. S %=0 F S %=$O(^PRCP(445,"AC","W",%)) Q:'% I $P($P($G(^PRCP(445,%,0)),"^"),"-")=PRC("SITE") S PRCPFLAG=1 Q
. I $G(PRCPFLAG) K PRCPFLAG Q
. S PRCP("I")=$$INVPT^PRCPUINV(PRC("SITE"),"W",1,1,"")
. I 'PRCP("I") S PRCPFLAG=1 K PRC,PRCP
;
S %=$S($D(PRCP("DPTYPE")):PRCP("DPTYPE"),1:"^")
S (I,J)=0
F S I=$O(^PRCP(445,"AD",DUZ,I)) Q:'I I $D(^PRCP(445,I,0)) D I J>1 Q
. S:%="^"!(%[$P(^PRCP(445,I,0),"^",3)) Y(0)=^(0),J=J+1,Y=I
I J=1 D Q:$G(PRCPFLAG) S PRC("SITE")=+Y(0) D V1 Q
. I '$D(^PRC(411,+Y(0),0)) D K PRC,PRCP S PRCPFLAG=1
. . W !,"ERROR - SITE PARAMETERS IN FILE 411 FOR SITE "
. . W +Y(0)," ARE MISSING."
I $G(PRCHAUTH) Q:'$G(PRCP("I")) D G V1
. S Y=PRCP("I")_"^"_$P($G(^PRCP(445,PRCP("I"),0)),U)
;
S DIC="^PRCP(445,",DIC(0)="AEQMZ" ;PRC*5.1*185 Modified look up parameters
S DIC("S")="I +^(0)=PRC(""SITE""),$P(^(0),U,2)=""Y"",$D(^PRCP(445,+Y,4,DUZ,0))"
I $D(PRCP("DPTYPE")) S DIC("S")=DIC("S")_",PRCP(""DPTYPE"")[$P(^PRCP(445,+Y,0),U,3)"
S DIC("A")="Select "_$S('$D(PRCP("DPTYPE")):"",PRCP("DPTYPE")="W":"Supply Warehouse ",PRCP("DPTYPE")="P":"Primary ",PRCP("DPTYPE")="S":"Secondary ",1:"")_"Inventory Point: "
S D="C",PRCPPRIV=1
D IX^DIC
K PRCPPRIV,DIC
I Y<0 K PRC,PRCP Q
;
V1 ; internal program jump
D PARAM(+Y)
;
DISPLAY ; display top of page header
I '$G(PRCP("I")) G PRCPUSEL
S %=0 F I="RV1","RV0","XY" I '$D(PRCP(I)) S %=1 Q
I % D TERM
;
S %="",$P(%," ",81)=""
S X="I N V E N T O R Y version "_$P($T(PRCPUSEL+1),";",3)
S Y=80-$L(X)\2
S X=$E(%,1,Y)_X_%
W @IOF,PRCP("RV1"),$E(X,1,40)
X PRCP("XY")
W $E(X,41,80),PRCP("RV0")
S PRCP("PAR")=^PRCP(445,PRCP("I"),0)
S X=$S(+$G(PRC("SITE")):"("_PRC("SITE")_") ",1:"")
S X=X_$S(PRCP("DPTYPE")="W":"Warehouse ",PRCP("DPTYPE")="P":"Primary ",PRCP("DPTYPE")="S":"Secondary ",1:"")
S X=X_"Inventory Point: "_PRCP("IN")
W !,X,?(80-$L($P($G(PRC("PER")),"^",2))),$P($G(PRC("PER")),"^",2)
I PRCP("DPTYPE")="P" S Y=$P(PRCP("PAR"),"^",12) I Y,Y'>DT D
. D DD^%DT
. W !,?6,"--> NEXT REQUEST FOR WAREHOUSE ISSUES IS DUE IN SUPPLY ON ",Y,"."
I $P(PRCP("PAR"),"^",9)="Y" D
. W !?6,"--> THERE ARE ITEMS AT OR BELOW THE EMERGENCY STOCK LEVEL."
I $E($P(PRCP("PAR"),"^",14),1,5)'=$E(DT,1,5) D
. W !?6,"--> USAGE/DISTRIBUTION TOTALS NEEDS TO BE PURGED."
I $E($P(PRCP("PAR"),"^",17),1,5)'=$E(DT,1,5) D
. W !?6,"--> RECEIPTS HISTORY BY ITEM NEEDS TO BE PURGED."
I PRCP("DPTYPE")'="S",$E($P(PRCP("PAR"),"^",19),1,5)'=$E(DT,1,5) D
. W !?6,"--> DISTRIBUTION HISTORY NEEDS TO BE PURGED."
I $E($P(PRCP("PAR"),"^",18),1,5)'=$E(DT,1,5) D
. W !?6,"--> TRANSACTION REGISTER NEEDS TO BE PURGED."
I $P(PRCP("PAR"),"^",6)="Y",$E($P(PRCP("PAR"),"^",22),1,5)'=$E(DT,1,5) D
. W !?6,"--> OPENING MONTHLY INVENTORY BALANCES NEED TO BE SET."
I PRCP("DPTYPE")="S",$P($G(^PRCP(445,PRCP("I"),5)),"^",1)]"" D SSMSG
I $O(^PRCP(447.1,"C",+PRCP("PAR"),PRCP("I"),"")) D
. W !?6,"--> THERE ARE UNPROCESSED SUPPLY STATION TRANSACTIONS."
;
W !,PRCP("RV1"),$E(%,1,40) X PRCP("XY") W $E(%,41,80),PRCP("RV0")
Q
;
;
; to the menu (called from option file)
N X
S X(1)="YOU MUST SELECT A VALID INVENTORY POINT BEFORE ACCESSING THIS MENU" D DISPLAY^PRCPUX2(1,79,.X)
Q
;
;
PARAM(INVPT) ; set up parameters for inventory point
K PRCP
N DATA
S DATA=$G(^PRCP(445,INVPT,0)) I DATA="" Q
S PRCP("I")=INVPT,PRCP("IN")=$P($P(DATA,"^"),"-",2,99),PRCP("INV")=$P(DATA,"^",2),PRCP("HIS")=$P(DATA,"^",6),PRCP("DPTYPE")=$P(DATA,"^",3)
D TERM
Q
;
;
TERM ; get terminal attributes
N X
I '$D(IOF)!('$G(IOST(0))) S IOP="HOME" D ^%ZIS K IOP
S X="IORVON;IORVOFF" D ENDR^%ZISS
S PRCP("RV1")=$G(IORVON),PRCP("RV0")=$G(IORVOFF)
S PRCP("XY")="N DX,DY S (DX,DY)=0 "_$G(^%ZOSF("XY"))
Q
;
SSMSG ; check supply station secondaries, give message of qty mismatch
N GIPCNT,INVPT,ITEM,PRCPFLAG,SSCNT
S INVPT=PRCP("I")
S ITEM=0
F S ITEM=$O(^PRCP(445,INVPT,1,ITEM)) Q:'+ITEM D I $D(PRCPFLAG) Q
. I $P($G(^PRCP(445,INVPT,1,ITEM,0)),"^",9)<1 Q ; not a SS item
. S GIPCNT=$P($G(^PRCP(445,INVPT,1,ITEM,0)),"^",7)
. S SSCNT=$P($G(^PRCP(445,INVPT,1,ITEM,9)),"^",1)
. I 'GIPCNT,'SSCNT Q
. I GIPCNT=SSCNT Q
. W !,?6,"--> QUANTITY DISCREPANCIES EXIST WITH THE SUPPLY STATION."
. S PRCPFLAG=1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRCPUSEL 5709 printed Oct 16, 2024@18:17:08 Page 2
PRCPUSEL ;WISC/RFJ/DAP-utilities: setup inventory variables ;14 Feb 91
V ;;5.1;IFCAP;**1,83,110,118,185**;Oct 20, 2000;Build 3
+1 ;Per VHA Directive 2004-038, this routine should not be modified.
+2 ; enter distribution point--input variables:
+3 ; prcp("dptype")=distribution point type code [W,P,S]
+4 ; returns the following variables:
+5 ; prcp("in")=name of inv pt (no station #),
+6 ; prcp("inv")=keep perpetual inventory flag
+7 ; prcp("his")=keep detailed history flag,
+8 ; prcp("i")=da of inv pt
+9 ;
+10 ;PRC*5.1*185 Modified look up parameters for Inventory Point from
+11 ; 'AEQMOZ' to 'AEQMZ' to show matches for both Inventory
+12 ; Point name and abbreviation.
+13 ;
+14 ;*83 Routine PRCPLO1 associated with PRC*5.1*83 is a modified copy of
+15 ;this routine and any changes made to this routine should also be
+16 ;considered for that routine as well.
+17 ;
+18 NEW %,C,DISYS,I,J,PRCF,PRCPFLAG,X,Y
+19 IF +$GET(DUZ)<1
WRITE !,"YOU ARE NOT SETUP AS A USER!"
KILL PRC,PRCP
QUIT
+20 ;
+21 SET %=0
FOR I="FY","PARAM","PER","QTR","SITE"
IF '+$GET(PRC(I))
SET %=1
QUIT
+22 IF %
SET PRCF("X")="S"
DO ^PRCFSITE
IF '+$GET(PRC("SITE"))
KILL PRC,PRCP
QUIT
+23 ;
+24 SET %=0
FOR I="DPTYPE","HIS","I","IN","INV"
IF $GET(PRCP(I))=""
SET %=1
QUIT
+25 IF '%
DO DISPLAY
QUIT
+26 ;
+27 ; allow adding new whse if not one for station
+28 IF $GET(PRCP("DPTYPE"))="W"
Begin DoDot:1
+29 KILL PRCPFLAG
+30 SET %=0
FOR
SET %=$ORDER(^PRCP(445,"AC","W",%))
if '%
QUIT
IF $PIECE($PIECE($GET(^PRCP(445,%,0)),"^"),"-")=PRC("SITE")
SET PRCPFLAG=1
QUIT
+31 IF $GET(PRCPFLAG)
KILL PRCPFLAG
QUIT
+32 SET PRCP("I")=$$INVPT^PRCPUINV(PRC("SITE"),"W",1,1,"")
+33 IF 'PRCP("I")
SET PRCPFLAG=1
KILL PRC,PRCP
End DoDot:1
if $GET(PRCPFLAG)
QUIT
+34 ;
+35 SET %=$SELECT($DATA(PRCP("DPTYPE")):PRCP("DPTYPE"),1:"^")
+36 SET (I,J)=0
+37 FOR
SET I=$ORDER(^PRCP(445,"AD",DUZ,I))
if 'I
QUIT
IF $DATA(^PRCP(445,I,0))
Begin DoDot:1
+38 if %="^"!(%[$PIECE(^PRCP(445,I,0),"^",3))
SET Y(0)=^(0)
SET J=J+1
SET Y=I
End DoDot:1
IF J>1
QUIT
+39 IF J=1
Begin DoDot:1
+40 IF '$DATA(^PRC(411,+Y(0),0))
Begin DoDot:2
+41 WRITE !,"ERROR - SITE PARAMETERS IN FILE 411 FOR SITE "
+42 WRITE +Y(0)," ARE MISSING."
End DoDot:2
KILL PRC,PRCP
SET PRCPFLAG=1
End DoDot:1
if $GET(PRCPFLAG)
QUIT
SET PRC("SITE")=+Y(0)
DO V1
QUIT
+43 IF $GET(PRCHAUTH)
if '$GET(PRCP("I"))
QUIT
Begin DoDot:1
+44 SET Y=PRCP("I")_"^"_$PIECE($GET(^PRCP(445,PRCP("I"),0)),U)
End DoDot:1
GOTO V1
+45 ;
+46 ;PRC*5.1*185 Modified look up parameters
SET DIC="^PRCP(445,"
SET DIC(0)="AEQMZ"
+47 SET DIC("S")="I +^(0)=PRC(""SITE""),$P(^(0),U,2)=""Y"",$D(^PRCP(445,+Y,4,DUZ,0))"
+48 IF $DATA(PRCP("DPTYPE"))
SET DIC("S")=DIC("S")_",PRCP(""DPTYPE"")[$P(^PRCP(445,+Y,0),U,3)"
+49 SET DIC("A")="Select "_$SELECT('$DATA(PRCP("DPTYPE")):"",PRCP("DPTYPE")="W":"Supply Warehouse ",PRCP("DPTYPE")="P":"Primary ",PRCP("DPTYPE")="S":"Secondary ",1:"")_"Inventory Point: "
+50 SET D="C"
SET PRCPPRIV=1
+51 DO IX^DIC
+52 KILL PRCPPRIV,DIC
+53 IF Y<0
KILL PRC,PRCP
QUIT
+54 ;
V1 ; internal program jump
+1 DO PARAM(+Y)
+2 ;
DISPLAY ; display top of page header
+1 IF '$GET(PRCP("I"))
GOTO PRCPUSEL
+2 SET %=0
FOR I="RV1","RV0","XY"
IF '$DATA(PRCP(I))
SET %=1
QUIT
+3 IF %
DO TERM
+4 ;
+5 SET %=""
SET $PIECE(%," ",81)=""
+6 SET X="I N V E N T O R Y version "_$PIECE($TEXT(PRCPUSEL+1),";",3)
+7 SET Y=80-$LENGTH(X)\2
+8 SET X=$EXTRACT(%,1,Y)_X_%
+9 WRITE @IOF,PRCP("RV1"),$EXTRACT(X,1,40)
+10 XECUTE PRCP("XY")
+11 WRITE $EXTRACT(X,41,80),PRCP("RV0")
+12 SET PRCP("PAR")=^PRCP(445,PRCP("I"),0)
+13 SET X=$SELECT(+$GET(PRC("SITE")):"("_PRC("SITE")_") ",1:"")
+14 SET X=X_$SELECT(PRCP("DPTYPE")="W":"Warehouse ",PRCP("DPTYPE")="P":"Primary ",PRCP("DPTYPE")="S":"Secondary ",1:"")
+15 SET X=X_"Inventory Point: "_PRCP("IN")
+16 WRITE !,X,?(80-$LENGTH($PIECE($GET(PRC("PER")),"^",2))),$PIECE($GET(PRC("PER")),"^",2)
+17 IF PRCP("DPTYPE")="P"
SET Y=$PIECE(PRCP("PAR"),"^",12)
IF Y
IF Y'>DT
Begin DoDot:1
+18 DO DD^%DT
+19 WRITE !,?6,"--> NEXT REQUEST FOR WAREHOUSE ISSUES IS DUE IN SUPPLY ON ",Y,"."
End DoDot:1
+20 IF $PIECE(PRCP("PAR"),"^",9)="Y"
Begin DoDot:1
+21 WRITE !?6,"--> THERE ARE ITEMS AT OR BELOW THE EMERGENCY STOCK LEVEL."
End DoDot:1
+22 IF $EXTRACT($PIECE(PRCP("PAR"),"^",14),1,5)'=$EXTRACT(DT,1,5)
Begin DoDot:1
+23 WRITE !?6,"--> USAGE/DISTRIBUTION TOTALS NEEDS TO BE PURGED."
End DoDot:1
+24 IF $EXTRACT($PIECE(PRCP("PAR"),"^",17),1,5)'=$EXTRACT(DT,1,5)
Begin DoDot:1
+25 WRITE !?6,"--> RECEIPTS HISTORY BY ITEM NEEDS TO BE PURGED."
End DoDot:1
+26 IF PRCP("DPTYPE")'="S"
IF $EXTRACT($PIECE(PRCP("PAR"),"^",19),1,5)'=$EXTRACT(DT,1,5)
Begin DoDot:1
+27 WRITE !?6,"--> DISTRIBUTION HISTORY NEEDS TO BE PURGED."
End DoDot:1
+28 IF $EXTRACT($PIECE(PRCP("PAR"),"^",18),1,5)'=$EXTRACT(DT,1,5)
Begin DoDot:1
+29 WRITE !?6,"--> TRANSACTION REGISTER NEEDS TO BE PURGED."
End DoDot:1
+30 IF $PIECE(PRCP("PAR"),"^",6)="Y"
IF $EXTRACT($PIECE(PRCP("PAR"),"^",22),1,5)'=$EXTRACT(DT,1,5)
Begin DoDot:1
+31 WRITE !?6,"--> OPENING MONTHLY INVENTORY BALANCES NEED TO BE SET."
End DoDot:1
+32 IF PRCP("DPTYPE")="S"
IF $PIECE($GET(^PRCP(445,PRCP("I"),5)),"^",1)]""
DO SSMSG
+33 IF $ORDER(^PRCP(447.1,"C",+PRCP("PAR"),PRCP("I"),""))
Begin DoDot:1
+34 WRITE !?6,"--> THERE ARE UNPROCESSED SUPPLY STATION TRANSACTIONS."
End DoDot:1
+35 ;
+36 WRITE !,PRCP("RV1"),$EXTRACT(%,1,40)
XECUTE PRCP("XY")
WRITE $EXTRACT(%,41,80),PRCP("RV0")
+37 QUIT
+38 ;
+39 ;
+1 ; to the menu (called from option file)
+2 NEW X
+3 SET X(1)="YOU MUST SELECT A VALID INVENTORY POINT BEFORE ACCESSING THIS MENU"
DO DISPLAY^PRCPUX2(1,79,.X)
+4 QUIT
+5 ;
+6 ;
PARAM(INVPT) ; set up parameters for inventory point
+1 KILL PRCP
+2 NEW DATA
+3 SET DATA=$GET(^PRCP(445,INVPT,0))
IF DATA=""
QUIT
+4 SET PRCP("I")=INVPT
SET PRCP("IN")=$PIECE($PIECE(DATA,"^"),"-",2,99)
SET PRCP("INV")=$PIECE(DATA,"^",2)
SET PRCP("HIS")=$PIECE(DATA,"^",6)
SET PRCP("DPTYPE")=$PIECE(DATA,"^",3)
+5 DO TERM
+6 QUIT
+7 ;
+8 ;
TERM ; get terminal attributes
+1 NEW X
+2 IF '$DATA(IOF)!('$GET(IOST(0)))
SET IOP="HOME"
DO ^%ZIS
KILL IOP
+3 SET X="IORVON;IORVOFF"
DO ENDR^%ZISS
+4 SET PRCP("RV1")=$GET(IORVON)
SET PRCP("RV0")=$GET(IORVOFF)
+5 SET PRCP("XY")="N DX,DY S (DX,DY)=0 "_$GET(^%ZOSF("XY"))
+6 QUIT
+7 ;
SSMSG ; check supply station secondaries, give message of qty mismatch
+1 NEW GIPCNT,INVPT,ITEM,PRCPFLAG,SSCNT
+2 SET INVPT=PRCP("I")
+3 SET ITEM=0
+4 FOR
SET ITEM=$ORDER(^PRCP(445,INVPT,1,ITEM))
if '+ITEM
QUIT
Begin DoDot:1
+5 ; not a SS item
IF $PIECE($GET(^PRCP(445,INVPT,1,ITEM,0)),"^",9)<1
QUIT
+6 SET GIPCNT=$PIECE($GET(^PRCP(445,INVPT,1,ITEM,0)),"^",7)
+7 SET SSCNT=$PIECE($GET(^PRCP(445,INVPT,1,ITEM,9)),"^",1)
+8 IF 'GIPCNT
IF 'SSCNT
QUIT
+9 IF GIPCNT=SSCNT
QUIT
+10 WRITE !,?6,"--> QUANTITY DISCREPANCIES EXIST WITH THE SUPPLY STATION."
+11 SET PRCPFLAG=1
End DoDot:1
IF $DATA(PRCPFLAG)
QUIT