1 | PRCPHLUT ;WISC/CC-Process activity information from file 447.1 ;4/00
|
---|
2 | V ;;5.1;IFCAP;**1,24**;Oct 20, 2000
|
---|
3 | ;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
4 | ;
|
---|
5 | PROCESS(PRCPDA,PRCPDONE) ;
|
---|
6 | N %,ERR,ITEM,ITEMDATA,PRCPAMT,PRCPDATA,PRCPHLUT,PRCPITDA
|
---|
7 | N PRCPITEM,PRCPITNM,PRCPLEFT,PRCPREAS,PRCPREC,PRCPSEC,PRCPSSFL,PRCPTIME
|
---|
8 | N PRCPUSER,TRANORDR,TYPE
|
---|
9 | ;
|
---|
10 | S PRCPDONE=0
|
---|
11 | S PRCPDATA=^PRCP(447.1,PRCPDA,0)
|
---|
12 | S PRCPHL7=$P(PRCPDATA,"^",6)_".447.1"
|
---|
13 | S PRCPSEC=$P(PRCPDATA,"^",3)
|
---|
14 | S PRCPTIME=$P(PRCPDATA,"^",8)
|
---|
15 | S PRCPREC=$P(PRCPDATA,"^",9)
|
---|
16 | S PRCPUSER=$P(PRCPDATA,"^",10)
|
---|
17 | S PRCPREAS=$P(PRCPDATA,"^",11)
|
---|
18 | S PRCPACTV=$P(PRCPREAS,"~",1)
|
---|
19 | ;
|
---|
20 | S PRCPITDA=0
|
---|
21 | S PRCPITDA=$O(^PRCP(447.1,PRCPDA,1,PRCPITDA)) I '+PRCPITDA S ERR="6F" G ERR ; no item info
|
---|
22 | S PRCPDATA=^PRCP(447.1,PRCPDA,1,PRCPITDA,0)
|
---|
23 | S PRCPAMT=$P(PRCPDATA,"^",3) ; REFILL QTY - patient issue units
|
---|
24 | I PRCPACTV="USGE"!(PRCPACTV="DISP")!(PRCPACTV="ADJD") S PRCPAMT=-PRCPAMT
|
---|
25 | S PRCPITEM=$P(PRCPDATA,"^",1)
|
---|
26 | S PRCPITNM=$P(PRCPDATA,"^",4)
|
---|
27 | S PRCPLEFT=$P(PRCPDATA,"^",2) ; patient issue units
|
---|
28 | ;
|
---|
29 | I '$D(^PRCP(445,PRCPSEC)) S ERR="3A" G ERR ; secondary not in GIP
|
---|
30 | I $P(^PRCP(445,PRCPSEC,0),"^",3)'="S" S ERR="3B" G ERR ; not a secondary
|
---|
31 | I '$D(^PRCP(445,PRCPSEC,1,PRCPITEM)) S ERR="6C" G ERR
|
---|
32 | I $P(^PRCP(445,PRCPSEC,1,PRCPITEM,0),"^",9)'>0 S ERR="6D" G ERR ; is item a supply station item?
|
---|
33 | I $P($G(^PRCP(445,PRCPSEC,5)),"^",1)']"" S ERR="3F" G ERR ; not a supply station secondary
|
---|
34 | ; compare name in 445 to name sent, CONTINUE
|
---|
35 | S PRCPSSFL=$P(^PRCP(445.5,$P(^PRCP(445,PRCPSEC,5),"^",1),0),"^",2)
|
---|
36 | I PRCPSSFL="O",$P(^PRC(441,PRCPITEM,0),"^",2)'=PRCPITNM D NAME^PRCPHL70(PRCPSEC,PRCPITEM,PRCPITNM,PRCPSSFL,PRCPHL7)
|
---|
37 | I PRCPSSFL="S",$G(^PRCP(445,PRCPSEC,1,PRCPITEM,6))'=PRCPITNM D NAME^PRCPHL70(PRCPSEC,PRCPITEM,PRCPITNM,PRCPSSFL,PRCPHL7)
|
---|
38 | ;
|
---|
39 | UPDATE S ITEMDATA=$G(^PRCP(445,PRCPSEC,1,PRCPITEM,0))
|
---|
40 | I ITEMDATA="" S ERR="6C" G ERR ; send message
|
---|
41 | S TYPE="U"
|
---|
42 | I $E($P(PRCPREAS,"~",1),1,3)="ADJ"!($P(PRCPREAS,"~")="DISP") S TYPE="A"
|
---|
43 | S PRCPHLUT("INVVAL")=$J(PRCPAMT*$P(ITEMDATA,"^",22),0,2)
|
---|
44 | S PRCPHLUT("DATE")=PRCPTIME
|
---|
45 | S PRCPHLUT("ITEM")=ITEMDATA
|
---|
46 | S PRCPHLUT("REASON")=$P(PRCPREAS,"~",1)_":"_$P(PRCPREAS,"~",2)
|
---|
47 | S PRCPHLUT("RECIPIENT")=$TR(PRCPREC,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
---|
48 | S PRCPHLUT("USER")=PRCPUSER
|
---|
49 | S PRCPHLUT("SELVAL")=PRCPHLUT("INVVAL")
|
---|
50 | S PRCPHLUT("QTY")=PRCPAMT
|
---|
51 | ;
|
---|
52 | ; save values into GIP files
|
---|
53 | D UPDATE^PRCPHL1(PRCPSEC,PRCPITEM,PRCPLEFT,.PRCPHLUT,TYPE)
|
---|
54 | ;
|
---|
55 | ; check expected qty remaining
|
---|
56 | S ITEMDATA=$G(^PRCP(445,PRCPSEC,1,PRCPITEM,0))
|
---|
57 | I $P(ITEMDATA,"^",7)'=PRCPLEFT D
|
---|
58 | . D QTYDISC^PRCPHL70(PRCPSEC,PRCPITEM,PRCPITNM,$P(ITEMDATA,"^",7),PRCPLEFT,PRCPHL7)
|
---|
59 | ;
|
---|
60 | ;
|
---|
61 | Q S PRCPDONE=1
|
---|
62 | Q
|
---|
63 | ;
|
---|
64 | ERR ;
|
---|
65 | N NUMBER
|
---|
66 | S NUMBER=ERR
|
---|
67 | S PRCPHLUT("SIPNAME")="" I $D(PRCPSEC) S PRCPHLUT("SIPNAME")=$$INVNAME^PRCPUX1(PRCPSEC)
|
---|
68 | S PRCPHLUT("ITEM")="" I $D(PRCPITEM) S PRCPHLUT("ITEM")=PRCPITEM
|
---|
69 | S PRCPHLUT("NAME")="" I $D(PRCPITNM) S PRCPHLUT("NAME")=PRCPITNM
|
---|
70 | S PRCPHLUT("QTY")="" I $D(PRCPAMT) S PRCPHLUT("QTY")=PRCPAMT
|
---|
71 | S PRCPHLUT("LEFT")="" I $D(PRCPLEFT) S PRCPHLUT("LEFT")=PRCPLEFT
|
---|
72 | S PRCPHLUT("ACTIVITY")=""
|
---|
73 | I $D(PRCPREAS) S PRCPHLUT("ACTIVITY")=$E(PRCPREAS,1,4)
|
---|
74 | ; . I $E(PRCPREAS,1,4)="USGE" S PRCPHLUT("ACTIVITY")="USAGE"
|
---|
75 | ; . I $E(PRCPREAS,1,4)="RTRN" S PRCPHLUT("ACTIVITY")="RETURNED ITEM"
|
---|
76 | ; . I $E(PRCPREAS,1,4)="DISP" S PRCPHLUT("ACTIVITY")="DISPOSED ITEM"
|
---|
77 | ; . I $E(PRCPREAS,1,4)="ADJI" S PRCPHLUT("ACTIVITY")="ADJUSTED INVENTORY UP"
|
---|
78 | ; . I $E(PRCPREAS,1,4)="ADJD" S PRCPHLUT("ACTIVITY")="ADJUSTED INVENTORY DOWN"
|
---|
79 | S PRCPHLUT("RECIPIENT")="an unspecified patient" I $D(PRCPREC) S PRCPHLUT("RECIPIENT")=PRCPREC
|
---|
80 | S PRCPHLUT("USER")="" I $D(PRCPUSER) S PRCPHLUT("USER")=PRCPUSER
|
---|
81 | D ERR^PRCPHLM0(ERR,"PRCP_BAD_ACTIVITY",PRCPSEC,.PRCPHLUT,PRCPHL7)
|
---|
82 | G Q
|
---|