PRCPBALB ;WISC/RGY,RFJ-process barcode data (build array) ;04 Dec 92
;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
Q
;
;
BUILD ; build array
N COUNT,DATA,INVDATA,INVPT,ITEMDA,LINE,QTY,RECORD
K ^TMP($J,"PRCPBALM"),^TMP($J,"PRCPBALMD"),^TMP($J,"PRCPBALME"),^TMP($J,"PRCPBALMU")
S RECORD=1 F S RECORD=$O(^PRCT(446.4,PRCTDA,2,PRCTDA1,1,RECORD)) Q:'RECORD S DATA=^(RECORD,0) I DATA'="" D
. S INVPT=+$P($P(DATA," "),"IE",2),ITEMDA=+$P(DATA," ",2),QTY=+$P(DATA," ",3)
. S ^TMP($J,"PRCPBALMD",RECORD)=INVPT_"^"_ITEMDA_"^"_QTY
. I $E(DATA)="*" S ^TMP($J,"PRCPBALME",RECORD)="Data has been previously uploaded" Q
. I $E(DATA,1,2)'="IE" S ^TMP($J,"PRCPBALME",RECORD)="First two characters should equal IE" Q
. I DATA'?1"IE"1N.N1" "1N.N1" ",DATA'?1"IE"1N.N1" "1N.N1" "1N.N S ^TMP($J,"PRCPBALME",RECORD)="Record data is not in expected format" Q
. I 'INVPT!('ITEMDA) S ^TMP($J,"PRCPBALME",RECORD)="Record data has inventory point or item equal zero" Q
. I PRCPTYPE="U",QTY=0 S ^TMP($J,"PRCPBALME",RECORD)="Quantity is equal to zero for usage" Q
. I '$D(^PRCP(445,INVPT,4,DUZ)) S ^TMP($J,"PRCPBALME",RECORD)="You are not an authorized user for this inventory point" Q
. I '$D(^PRCP(445,INVPT,1,ITEMDA,0)) S ^TMP($J,"PRCPBALME",RECORD)="Item is not stored in inventory point" Q
. I $D(^PRCP(445,"AC","W",INVPT)) S ^TMP($J,"PRCPBALME",RECORD)="Warehouse inventory items cannot be uploaded" Q
. S ^TMP($J,"PRCPBALMU",INVPT,ITEMDA,RECORD)=QTY
; build array
S LINE=0
; show errors first
I $D(^TMP($J,"PRCPBALME")) D
. D SET("* * * ERRORS: ITEMS WHICH WILL NOT BE UPLOADED TO THE INVENTORY POINTS * * *",1,1,80,IORVON,IORVOFF)
. D SET("LINE INVENTORY POINT IM# DESCRIPTION QUANTITY",2,1,80,IORVON,IORVOFF)
. S LINE=2
. S RECORD=0 F S RECORD=$O(^TMP($J,"PRCPBALME",RECORD)) Q:'RECORD S DATA=^TMP($J,"PRCPBALMD",RECORD) D
. . S LINE=LINE+1
. . D SET(RECORD,LINE,1,80)
. . D SET($$INVNAME^PRCPUX1($P(DATA,"^")),LINE,7,30)
. . D SET($P(DATA,"^",2),LINE,32,40)
. . D SET($$DESCR^PRCPUX1($P(DATA,"^"),$P(DATA,"^",2)),LINE,42,70)
. . D SET($J($P(DATA,"^",3),10),LINE,71,80)
. . S LINE=LINE+1
. . D SET(" "_^TMP($J,"PRCPBALME",RECORD),LINE,1,80)
; show records to upload
K PRCPFSCA ;this flag is used to mark items scanned more than once
I LINE'=0 S LINE=LINE+1 D SET("",LINE,1,80)
S LINE=LINE+1
D SET("* * * INVENTORY POINTS AND ITEMS TO UPLOAD * * *",LINE,1,80,IORVON,IORVOFF)
S INVPT=0 F S INVPT=$O(^TMP($J,"PRCPBALMU",INVPT)) Q:'INVPT D
. S LINE=LINE+1
. D SET("",LINE,1,80)
. S LINE=LINE+1
. D SET(" INVENTORY POINT: "_$$INVNAME^PRCPUX1(INVPT),LINE,1,80,IORVON,IORVOFF)
. S ITEMDA=0 F S ITEMDA=$O(^TMP($J,"PRCPBALMU",INVPT,ITEMDA)) Q:'ITEMDA D
. . S INVDATA=$G(^PRCP(445,INVPT,1,ITEMDA,0))
. . S RECORD=0 F COUNT=0:1 S RECORD=$O(^TMP($J,"PRCPBALMU",INVPT,ITEMDA,RECORD)) Q:'RECORD D
. . . S LINE=LINE+1
. . . D SET(RECORD,LINE,1,80)
. . . D SET($E($$DESCR^PRCPUX1(INVPT,ITEMDA),1,27),LINE,7,35)
. . . D SET(ITEMDA,LINE,36,43)
. . . D SET($TR($$NSN^PRCPUX1(ITEMDA),"-"),LINE,44,63)
. . . D SET($J($$UNIT^PRCPUX1(INVPT,ITEMDA),8),LINE,57,64)
. . . D SET($J($P(INVDATA,"^",7)+$P(INVDATA,"^",19),8),LINE,65,72)
. . . D SET($J(+^TMP($J,"PRCPBALMU",INVPT,ITEMDA,RECORD),8),LINE,73,80)
. . I COUNT'=1 S LINE=LINE+1 D SET(" WARNING -- ITEM WAS SCANNED MORE THAN ONCE",LINE,1,80) S PRCPFSCA=1
S VALMCNT=LINE
Q
;
;
SET(STRING,LINE,COLUMN,CLREND,ON,OFF) ; set array
I '$D(@VALMAR@(LINE,0)) D SET^VALM10(LINE,$J("",80))
D SET^VALM10(LINE,$$SETSTR^VALM1(STRING,@VALMAR@(LINE,0),COLUMN,CLREND))
I $G(ON)]""!($G(OFF)]"") D CNTRL^VALM10(LINE,COLUMN,$L(STRING),ON,OFF)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRCPBALB 3912 printed Nov 22, 2024@17:23:07 Page 2
PRCPBALB ;WISC/RGY,RFJ-process barcode data (build array) ;04 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 ;
BUILD ; build array
+1 NEW COUNT,DATA,INVDATA,INVPT,ITEMDA,LINE,QTY,RECORD
+2 KILL ^TMP($JOB,"PRCPBALM"),^TMP($JOB,"PRCPBALMD"),^TMP($JOB,"PRCPBALME"),^TMP($JOB,"PRCPBALMU")
+3 SET RECORD=1
FOR
SET RECORD=$ORDER(^PRCT(446.4,PRCTDA,2,PRCTDA1,1,RECORD))
if 'RECORD
QUIT
SET DATA=^(RECORD,0)
IF DATA'=""
Begin DoDot:1
+4 SET INVPT=+$PIECE($PIECE(DATA," "),"IE",2)
SET ITEMDA=+$PIECE(DATA," ",2)
SET QTY=+$PIECE(DATA," ",3)
+5 SET ^TMP($JOB,"PRCPBALMD",RECORD)=INVPT_"^"_ITEMDA_"^"_QTY
+6 IF $EXTRACT(DATA)="*"
SET ^TMP($JOB,"PRCPBALME",RECORD)="Data has been previously uploaded"
QUIT
+7 IF $EXTRACT(DATA,1,2)'="IE"
SET ^TMP($JOB,"PRCPBALME",RECORD)="First two characters should equal IE"
QUIT
+8 IF DATA'?1"IE"1N.N1" "1N.N1" "
IF DATA'?1"IE"1N.N1" "1N.N1" "1N.N
SET ^TMP($JOB,"PRCPBALME",RECORD)="Record data is not in expected format"
QUIT
+9 IF 'INVPT!('ITEMDA)
SET ^TMP($JOB,"PRCPBALME",RECORD)="Record data has inventory point or item equal zero"
QUIT
+10 IF PRCPTYPE="U"
IF QTY=0
SET ^TMP($JOB,"PRCPBALME",RECORD)="Quantity is equal to zero for usage"
QUIT
+11 IF '$DATA(^PRCP(445,INVPT,4,DUZ))
SET ^TMP($JOB,"PRCPBALME",RECORD)="You are not an authorized user for this inventory point"
QUIT
+12 IF '$DATA(^PRCP(445,INVPT,1,ITEMDA,0))
SET ^TMP($JOB,"PRCPBALME",RECORD)="Item is not stored in inventory point"
QUIT
+13 IF $DATA(^PRCP(445,"AC","W",INVPT))
SET ^TMP($JOB,"PRCPBALME",RECORD)="Warehouse inventory items cannot be uploaded"
QUIT
+14 SET ^TMP($JOB,"PRCPBALMU",INVPT,ITEMDA,RECORD)=QTY
End DoDot:1
+15 ; build array
+16 SET LINE=0
+17 ; show errors first
+18 IF $DATA(^TMP($JOB,"PRCPBALME"))
Begin DoDot:1
+19 DO SET("* * * ERRORS: ITEMS WHICH WILL NOT BE UPLOADED TO THE INVENTORY POINTS * * *",1,1,80,IORVON,IORVOFF)
+20 DO SET("LINE INVENTORY POINT IM# DESCRIPTION QUANTITY",2,1,80,IORVON,IORVOFF)
+21 SET LINE=2
+22 SET RECORD=0
FOR
SET RECORD=$ORDER(^TMP($JOB,"PRCPBALME",RECORD))
if 'RECORD
QUIT
SET DATA=^TMP($JOB,"PRCPBALMD",RECORD)
Begin DoDot:2
+23 SET LINE=LINE+1
+24 DO SET(RECORD,LINE,1,80)
+25 DO SET($$INVNAME^PRCPUX1($PIECE(DATA,"^")),LINE,7,30)
+26 DO SET($PIECE(DATA,"^",2),LINE,32,40)
+27 DO SET($$DESCR^PRCPUX1($PIECE(DATA,"^"),$PIECE(DATA,"^",2)),LINE,42,70)
+28 DO SET($JUSTIFY($PIECE(DATA,"^",3),10),LINE,71,80)
+29 SET LINE=LINE+1
+30 DO SET(" "_^TMP($JOB,"PRCPBALME",RECORD),LINE,1,80)
End DoDot:2
End DoDot:1
+31 ; show records to upload
+32 ;this flag is used to mark items scanned more than once
KILL PRCPFSCA
+33 IF LINE'=0
SET LINE=LINE+1
DO SET("",LINE,1,80)
+34 SET LINE=LINE+1
+35 DO SET("* * * INVENTORY POINTS AND ITEMS TO UPLOAD * * *",LINE,1,80,IORVON,IORVOFF)
+36 SET INVPT=0
FOR
SET INVPT=$ORDER(^TMP($JOB,"PRCPBALMU",INVPT))
if 'INVPT
QUIT
Begin DoDot:1
+37 SET LINE=LINE+1
+38 DO SET("",LINE,1,80)
+39 SET LINE=LINE+1
+40 DO SET(" INVENTORY POINT: "_$$INVNAME^PRCPUX1(INVPT),LINE,1,80,IORVON,IORVOFF)
+41 SET ITEMDA=0
FOR
SET ITEMDA=$ORDER(^TMP($JOB,"PRCPBALMU",INVPT,ITEMDA))
if 'ITEMDA
QUIT
Begin DoDot:2
+42 SET INVDATA=$GET(^PRCP(445,INVPT,1,ITEMDA,0))
+43 SET RECORD=0
FOR COUNT=0:1
SET RECORD=$ORDER(^TMP($JOB,"PRCPBALMU",INVPT,ITEMDA,RECORD))
if 'RECORD
QUIT
Begin DoDot:3
+44 SET LINE=LINE+1
+45 DO SET(RECORD,LINE,1,80)
+46 DO SET($EXTRACT($$DESCR^PRCPUX1(INVPT,ITEMDA),1,27),LINE,7,35)
+47 DO SET(ITEMDA,LINE,36,43)
+48 DO SET($TRANSLATE($$NSN^PRCPUX1(ITEMDA),"-"),LINE,44,63)
+49 DO SET($JUSTIFY($$UNIT^PRCPUX1(INVPT,ITEMDA),8),LINE,57,64)
+50 DO SET($JUSTIFY($PIECE(INVDATA,"^",7)+$PIECE(INVDATA,"^",19),8),LINE,65,72)
+51 DO SET($JUSTIFY(+^TMP($JOB,"PRCPBALMU",INVPT,ITEMDA,RECORD),8),LINE,73,80)
End DoDot:3
+52 IF COUNT'=1
SET LINE=LINE+1
DO SET(" WARNING -- ITEM WAS SCANNED MORE THAN ONCE",LINE,1,80)
SET PRCPFSCA=1
End DoDot:2
End DoDot:1
+53 SET VALMCNT=LINE
+54 QUIT
+55 ;
+56 ;
SET(STRING,LINE,COLUMN,CLREND,ON,OFF) ; set array
+1 IF '$DATA(@VALMAR@(LINE,0))
DO SET^VALM10(LINE,$JUSTIFY("",80))
+2 DO SET^VALM10(LINE,$$SETSTR^VALM1(STRING,@VALMAR@(LINE,0),COLUMN,CLREND))
+3 IF $GET(ON)]""!($GET(OFF)]"")
DO CNTRL^VALM10(LINE,COLUMN,$LENGTH(STRING),ON,OFF)
+4 QUIT