1 | PRCPPOLB ;WISC/RFJ-receive purchase order (build array) ;06 Jan 94
|
---|
2 | ;;5.1;IFCAP;;Oct 20, 2000
|
---|
3 | ;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
4 | Q
|
---|
5 | ;
|
---|
6 | ;
|
---|
7 | REBUILD ; called here to rebuild array
|
---|
8 | K PRCPDATA,^TMP($J,"PRCPPOLM"),^TMP($J,"PRCPPOLMREC")
|
---|
9 | S (PRCPFLAG,PRCPFCOS)=0
|
---|
10 | N %,AVGCOST,CONV,INVDATA,ITEMDA,LINE,LINEDA,PODATA,POQTY,POUI,QTYRECVE,TOTCOST,TRANDA,TRANDATA,TRUI,UNITCOST,X
|
---|
11 | S TRANDA=+$P(^PRC(442,PRCPORDR,0),"^",12)
|
---|
12 | S LINE=0
|
---|
13 | S LINEDA=0 F S LINEDA=$O(^PRC(442,PRCPORDR,2,LINEDA)) Q:'LINEDA S PODATA=$G(^(LINEDA,0)) I PODATA'="" D
|
---|
14 | . S %=$O(^PRC(442,PRCPORDR,2,LINEDA,3,"AC",PRCPPART,0)) Q:'%
|
---|
15 | . S POQTY=+$P($G(^PRC(442,PRCPORDR,2,LINEDA,3,%,0)),"^",2) I 'POQTY Q
|
---|
16 | . S ITEMDA=+$P(PODATA,"^",5) I 'ITEMDA,$P(PODATA,"^",13)'="" S ITEMDA=+$O(^PRC(441,"BB",$P(PODATA,"^",13),0))
|
---|
17 | . S LINE=LINE+1
|
---|
18 | . D SET(LINEDA,LINE,1,80,IORVON,IORVOFF)
|
---|
19 | . D SET($$DESCR^PRCPUX1(PRCPINPT,ITEMDA),LINE,6,23)
|
---|
20 | . D SET($J(+ITEMDA,6),LINE,24,29)
|
---|
21 | . D SET($J(POQTY,8),LINE,30,37)
|
---|
22 | . ;
|
---|
23 | . ; get outstanding transaction data
|
---|
24 | . I 'TRANDA S TRANDA=+$P(PODATA,"^",10)
|
---|
25 | . S TRANDATA=$G(^PRCP(445,PRCPINPT,1,ITEMDA,7,TRANDA,0)),TRUI=$$UNITVAL^PRCPUX1($P(TRANDATA,"^",4),$P(TRANDATA,"^",3),"/"),CONV=$P(TRANDATA,"^",5)
|
---|
26 | . ; if there is not a due-in established, look up conversion factor
|
---|
27 | . ; from procurement source multiple
|
---|
28 | . I 'CONV S CONV=$P($$GETVEN^PRCPUVEN(PRCPINPT,ITEMDA,+$P($G(^PRC(442,PRCPORDR,1)),"^")_";PRC(440,",0),"^",4)
|
---|
29 | . I 'CONV S CONV="?"
|
---|
30 | . S QTYRECVE=POQTY*$S('CONV:1,1:CONV)
|
---|
31 | . ;
|
---|
32 | . ; get costs
|
---|
33 | . S TOTCOST=$J(POQTY*$P(PODATA,"^",9),0,2),UNITCOST=$J(TOTCOST/QTYRECVE,0,2)
|
---|
34 | . S INVDATA=$G(^PRCP(445,PRCPINPT,1,ITEMDA,0)),AVGCOST=$P(INVDATA,"^",22)
|
---|
35 | . D SET($J(CONV,5),LINE,38,42)
|
---|
36 | . D SET($J(QTYRECVE,8),LINE,43,50)
|
---|
37 | . D SET($J(AVGCOST,10,2),LINE,51,60)
|
---|
38 | . D SET($J(UNITCOST,10,2),LINE,61,70)
|
---|
39 | . D SET($J(TOTCOST,10,2),LINE,71,80)
|
---|
40 | . ;
|
---|
41 | . ; cost to distribution point
|
---|
42 | . I '$D(^PRCP(445,PRCPINPT,1,ITEMDA,0)) D
|
---|
43 | . . S X=$G(^TMP($J,"PRCPPOLMCOS",LINEDA))
|
---|
44 | . . I X="" S ^TMP($J,"PRCPPOLMCOS",LINEDA)=ITEMDA
|
---|
45 | . . S %=$$INVNAME^PRCPUX1($P(X,"^",2))
|
---|
46 | . . I '$P(X,"^",2) S PRCPFCOS=1,%="<NONE>"
|
---|
47 | . . S LINE=LINE+1
|
---|
48 | . . I ITEMDA D SET("WARNING: ITEM NOT STORED IN INVENTORY POINT, COST TO: "_%,LINE,6,80)
|
---|
49 | . . I 'ITEMDA D SET("WARNING: NO ITEM MASTER NUMBER, COST TO: "_%,LINE,6,80)
|
---|
50 | . ;
|
---|
51 | . ; check for errors
|
---|
52 | . I $P($G(^PRCS(410,TRANDA,0)),"^",6)'=PRCPINPT S LINE=LINE+1,PRCPFLAG=1 D SET("ERROR: INVENTORY POINT NOT TIED TO 2237 ("_$P($G(PRCS(410,TRANDA,0)),"^")_")",LINE,6,80,IORVON,IORVOFF)
|
---|
53 | . I $D(^PRCP(445,PRCPINPT,1,ITEMDA,0)),TRANDATA="",QTYRECVE>0 S LINE=LINE+1,PRCPFLAG=1 D SET("ERROR: 2237 ("_$P($G(^PRCS(410,TRANDA,0)),"^")_") NOT ESTABLISHED AS A DUE-IN",LINE,6,80,IORVON,IORVOFF)
|
---|
54 | . S POUI=$$UNITVAL^PRCPUX1($P(PODATA,"^",12),$P(PODATA,"^",3),"/")
|
---|
55 | . I TRANDATA'="",POUI'=TRUI S LINE=LINE+1,PRCPFLAG=1 D SET("ERROR: PO U/I ("_POUI_") DOES NOT EQUAL DUE-IN U/R ("_TRUI_")",LINE,6,80,IORVON,IORVOFF)
|
---|
56 | . I $P(QTYRECVE,".",2) S LINE=LINE+1,PRCPFLAG=1 D SET("ERROR: RECEIVING QUANTITY CANNOT BE A FRACTION",LINE,6,80,IORVON,IORVOFF)
|
---|
57 | . I $D(^PRCP(445,PRCPINPT,1,ITEMDA,0)),'CONV S LINE=LINE+1,PRCPFLAG=1 D SET("ERROR: NO CONVERSION FACTOR. EDIT THE DUE-IN OR VENDOR TO SET THE CF",LINE,6,80,IORVON,IORVOFF)
|
---|
58 | . I PRCPFLAG S VALMSG="FIX ERRORS BEFORE RECEIVING" Q
|
---|
59 | . S ^TMP($J,"PRCPPOLMREC",LINEDA)=ITEMDA_"^"_QTYRECVE_"^"_TOTCOST_"^"_TRANDA_"^"_POUI
|
---|
60 | S VALMCNT=LINE
|
---|
61 | Q
|
---|
62 | ;
|
---|
63 | ;
|
---|
64 | SET(STRING,LINE,COLUMN,CLREND,ON,OFF) ; set array
|
---|
65 | I '$D(@VALMAR@(LINE,0)) D SET^VALM10(LINE,$J("",80))
|
---|
66 | D SET^VALM10(LINE,$$SETSTR^VALM1(STRING,@VALMAR@(LINE,0),COLUMN,CLREND))
|
---|
67 | I $G(ON)]""!($G(OFF)]"") D CNTRL^VALM10(LINE,COLUMN,$L(STRING),ON,OFF)
|
---|
68 | Q
|
---|