PRCPAGU2 ;WISC/RFJ-autogenerate find quantity ;11 Dec 92
;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
Q
;
;
QTYORD ; continue with auto-generation; get quantity to order
; available=onhand+duein-dueout
; if available<standard or available<optional, order it
; up to normal stock level or temp stock level
N DUEIN,DUEOUT
S DUEIN=$$GETIN^PRCPUDUE(PRCP("I"),ITEMDA),DUEOUT=$$GETOUT^PRCPUDUE(PRCP("I"),ITEMDA)
S QTYAVAIL=$P(ITEMDATA,"^",7)+DUEIN-DUEOUT
S LEVEL=$P(ITEMDATA,"^",9),TEMPLVL="" I $P(ITEMDATA,"^",23) S LEVEL=$P(ITEMDATA,"^",23),TEMPLVL="*"
S QTY=0,TYPE=""
; its less than optional reorder point
I QTYAVAIL'>$P(ITEMDATA,"^",4) S QTY=LEVEL-QTYAVAIL,TYPE="OPT"
; its less than stand reorder point, but optional is entered
I QTYAVAIL'>$P(ITEMDATA,"^",10),QTY S TYPE="STA"
; its less than stand reorder point, no optional
I QTYAVAIL'>$P(ITEMDATA,"^",10),'QTY S QTY=LEVEL-QTYAVAIL,TYPE="STA"
I 'QTY S ORDER="NOT" D SET Q
S QTY=QTY/CONV I $P(QTY,".",2)>0 S QTY=$P(QTY,".")+1
; bring quantity up to minum issue qty and issue multiple
I QTY<MINISS S QTY=MINISS
I ISSMULT>1 S %=QTY#ISSMULT I % S QTY=QTY+ISSMULT-%
S TOTITEMS=TOTITEMS+1,ORDER="OK"
SET ; set temp global with orders ORDER = "OK" or "NOT" ordered
S %="^"_QTYAVAIL_"^"_$P(ITEMDATA,"^",10)_"^"_$P(ITEMDATA,"^",4)_"^"_TYPE_"^"_LEVEL_"^"_TEMPLVL_"^"_CONV_"^"_QTY_"^"_UNITI_"^"_UNITR_"^"_COST_"^"_MINISS_"^"_ISSMULT
S ^TMP($J,"PRCPAG",ORDER,$E(VENDORNM,1,10),VENDOR,GROUPNM,DESCNSN,ITEMDA)=$P(ITEMDATA,"^",7)_"^"_DUEIN_"^"_DUEOUT_%
I ORDER="NOT" Q
S ^TMP($J,"PRCPAG","V+",VENDOR,TYPE)="" Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRCPAGU2 1688 printed Dec 13, 2024@02:12:46 Page 2
PRCPAGU2 ;WISC/RFJ-autogenerate find quantity ;11 Dec 92
+1 ;;5.1;IFCAP;;Oct 20, 2000
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 QUIT
+4 ;
+5 ;
QTYORD ; continue with auto-generation; get quantity to order
+1 ; available=onhand+duein-dueout
+2 ; if available<standard or available<optional, order it
+3 ; up to normal stock level or temp stock level
+4 NEW DUEIN,DUEOUT
+5 SET DUEIN=$$GETIN^PRCPUDUE(PRCP("I"),ITEMDA)
SET DUEOUT=$$GETOUT^PRCPUDUE(PRCP("I"),ITEMDA)
+6 SET QTYAVAIL=$PIECE(ITEMDATA,"^",7)+DUEIN-DUEOUT
+7 SET LEVEL=$PIECE(ITEMDATA,"^",9)
SET TEMPLVL=""
IF $PIECE(ITEMDATA,"^",23)
SET LEVEL=$PIECE(ITEMDATA,"^",23)
SET TEMPLVL="*"
+8 SET QTY=0
SET TYPE=""
+9 ; its less than optional reorder point
+10 IF QTYAVAIL'>$PIECE(ITEMDATA,"^",4)
SET QTY=LEVEL-QTYAVAIL
SET TYPE="OPT"
+11 ; its less than stand reorder point, but optional is entered
+12 IF QTYAVAIL'>$PIECE(ITEMDATA,"^",10)
IF QTY
SET TYPE="STA"
+13 ; its less than stand reorder point, no optional
+14 IF QTYAVAIL'>$PIECE(ITEMDATA,"^",10)
IF 'QTY
SET QTY=LEVEL-QTYAVAIL
SET TYPE="STA"
+15 IF 'QTY
SET ORDER="NOT"
DO SET
QUIT
+16 SET QTY=QTY/CONV
IF $PIECE(QTY,".",2)>0
SET QTY=$PIECE(QTY,".")+1
+17 ; bring quantity up to minum issue qty and issue multiple
+18 IF QTY<MINISS
SET QTY=MINISS
+19 IF ISSMULT>1
SET %=QTY#ISSMULT
IF %
SET QTY=QTY+ISSMULT-%
+20 SET TOTITEMS=TOTITEMS+1
SET ORDER="OK"
SET ; set temp global with orders ORDER = "OK" or "NOT" ordered
+1 SET %="^"_QTYAVAIL_"^"_$PIECE(ITEMDATA,"^",10)_"^"_$PIECE(ITEMDATA,"^",4)_"^"_TYPE_"^"_LEVEL_"^"_TEMPLVL_"^"_CONV_"^"_QTY_"^"_UNITI_"^"_UNITR_"^"_COST_"^"_MINISS_"^"_ISSMULT
+2 SET ^TMP($JOB,"PRCPAG",ORDER,$EXTRACT(VENDORNM,1,10),VENDOR,GROUPNM,DESCNSN,ITEMDA)=$PIECE(ITEMDATA,"^",7)_"^"_DUEIN_"^"_DUEOUT_%
+3 IF ORDER="NOT"
QUIT
+4 SET ^TMP($JOB,"PRCPAG","V+",VENDOR,TYPE)=""
QUIT