source: FOIAVistA/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPHLPO.m@ 1608

Last change on this file since 1608 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.7 KB
Line 
1PRCPHLPO ;WISC/CC-REFILL AND POST ORDER FROM 447.1 ENTRY ;4/00
2V ;;5.1;IFCAP;**1,24**;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5PROCESS(PRCPDA,PRCPDONE) ;
6 N CONV,DIE,DR,ERR,I,ITEM,LOCKORD,LOCKPRIM,ORDERDA,X,PRCPITDA,PRIM
7 N PRCPAMT,PRCPDATA,PRCPHL7,PRCPITEM,PRCPITNM,PRCPLEFT,PRCPNOIT
8 N PRCPORD,PRCPPOST,PRCPPRIM,PRCPSECO,PRCPSS,PRCPSSFL,PRCPTIME,PRCPUSER
9 ;
10 S PRCPDONE=0,LOCKORD=0,LOCKPRIM=0,ERR=0
11 S PRCPDATA=^PRCP(447.1,PRCPDA,0)
12 S PRCPHL7=$P(PRCPDATA,"^",6)_".447.1"
13 S ORDERDA=$P(PRCPDATA,"^",7)
14 S PRCPSECO=$P(PRCPDATA,"^",3)
15 S PRCPTIME=$P(PRCPDATA,"^",8)
16 S PRCPUSER=$P(PRCPDATA,"^",10)
17 S PRCPPOST=$P(PRCPDATA,"^",11)
18 ;
19 L +^PRCP(445.3,ORDERDA):3 I $T=0 S PRCPDONE=0 Q
20 D ADD^PRCPULOC(445.3,ORDERDA_"-1",0,"HL7 Distribution Order Processing")
21 S LOCKORD=1
22 ;
23 I PRCPPOST'="FU" D I $D(ERR),+ERR>0 G ERR
24 . S PRCPITDA=0
25 . S PRCPITDA=$O(^PRCP(447.1,PRCPDA,1,PRCPITDA))
26 . I '+PRCPITDA S ERR="6F" Q ; no item in transaction
27 . S PRCPDATA=^PRCP(447.1,PRCPDA,1,PRCPITDA,0)
28 . S PRCPITEM=$P(PRCPDATA,"^",1)
29 . S PRCPAMT=$P(PRCPDATA,"^",3) ; REFILL QTY - restock issue units
30 . S PRCPLEFT=$P(PRCPDATA,"^",2)
31 . S PRCPITNM=$P(PRCPDATA,"^",4)
32 ;
33 I '$D(^PRCP(445.3,ORDERDA)) S ERR="2A" G ERR ; order not in GIP
34 S PRCPPRIM=$P(^PRCP(445.3,ORDERDA,0),"^",2)
35 I $P(^PRCP(445.3,ORDERDA,0),"^",6)="P" S ERR="2B" G ERR ; order is posted
36 I $P(^PRCP(445.3,ORDERDA,0),"^",10)']"" S ERR="2C" G ERR ; order not to be completed by supply station
37 I '$D(^PRCP(445,PRCPSECO)) S ERR="3A" G ERR ; secondary not in GIP
38 I $P(^PRCP(445,PRCPSECO,0),"^",3)'="S" S ERR="3B" G ERR ; not a secondary
39 I PRCPPOST="FU" D G:ERR>0 ERR G UPDATE
40 . I $P($G(^PRCP(445,PRCPSECO,5)),"^",1)']"" S ERR="3F" ; not a supply station secondary
41 ;
42 I PRCPITDA']"" S ERR="6F" G ERR ; no item information
43 I '$D(^PRCP(445.3,ORDERDA,1,PRCPITEM)) S ERR="6A" G ERR ; not on the GIP order"
44 I '$D(^PRCP(445,PRCPSECO,1,PRCPITEM)) S ERR="6C" G ERR ; "Not in this inventory point"
45 I $P(^PRCP(445,PRCPSECO,1,PRCPITEM,0),"^",9)'>0 S ERR="6D" G ERR ; not flagged as a supply station item"
46 I '$D(^PRCP(445,PRCPPRIM,1,PRCPITEM)) S ERR="6B" G ERR ; not in the primary"
47 I $P($G(^PRCP(445,PRCPSECO,5)),"^",1)']"" S ERR="3F" G ERR ; not a supply station secondary
48 I $P($G(^PRC(441,PRCPITEM,0)),"^",6)="S" S ERR="6G" G ERR ; case cart/ik
49 ; compare name in 445 with name sent, notify user if mismatch, CONTINUE
50 S PRCPSSFL=$P(^PRCP(445.5,$P(^PRCP(445,PRCPSECO,5),"^",1),0),"^",2)
51 ; if item name on supply station comes from item master
52 I PRCPSSFL="O",$P(^PRC(441,PRCPITEM,0),"^",2)'=PRCPITNM D NAME^PRCPHL70(PRCPSECO,PRCPITEM,PRCPITNM,PRCPSSFL,PRCPHL7)
53 ; if item name on supply station is from the secondary
54 I PRCPSSFL="S",$G(^PRCP(445,PRCPSECO,1,PRCPITEM,6))'=PRCPITNM D NAME^PRCPHL70(PRCPSECO,PRCPITEM,PRCPITNM,PRCPSSFL,PRCPHL7)
55 ;
56UPDATE I $P(^PRCP(445.3,ORDERDA,0),"^",6)="P" S ERR="2B" G ERR ; order is posted
57 I PRCPPOST'="FU",'$D(^PRCP(445.3,ORDERDA,1,PRCPITEM)) S ERR="6D" G ERR ; item not on order
58 I PRCPPOST'="FU" D G Q ; add amount received to order
59 . S DIE="^PRCP(445.3,"_ORDERDA_",1,"
60 . S DA=PRCPITEM
61 . ; the following lines handle the case on an item in multiple bins
62 . ; The user receiving an item in multiple bins will generate one
63 . ; transaction per bin.
64 . S X=$P($G(^PRCP(445.3,ORDERDA,1,DA,0)),"^",7)+0 ; amt refilled so far
65 . S PRCPAMT=PRCPAMT+X
66 . S DR="6///^S X=PRCPAMT"
67 . D ^DIE K DIE
68 . S PRCPDONE=1
69 . ;
70 . S ^PRCP(445,PRCPSECO,1,PRCPITEM,9)=PRCPLEFT_"^"_PRCPTIME
71 ;
72 I PRCPPOST="FU" D G Q
73 . S PRCPSS=1
74 . L +^PRCP(445,PRCPPRIM,1):3 I $T=0 S PRCPDONE=0 Q
75 . S LOCKPRIM=1
76 . D ADD^PRCPULOC(445,PRCPPRIM_"-1",0,"HL7 Distribution Order Processing")
77 . D PRCPSS^PRCPOPP(ORDERDA,PRCPSECO,PRCPPRIM,PRCPSS)
78 . S PRCPDONE=1
79 . ; verify each item has refill amount
80 . S ITEM=0
81 . F S ITEM=$O(^PRCP(445.3,ORDERDA,1,ITEM)) Q:'ITEM D
82 . . S X=$P($G(^PRCP(445.3,ORDERDA,1,ITEM,0)),"^",7)
83 . . I X']"" S PRCPNOIT(ITEM)=1
84 . I $D(PRCPNOIT) D ; send message for items not refilled
85 . . N ITEMNM,LN,PRCPXMY,TYPE,XMB,XMDUZ,XMTEXT,XMY
86 . . K ^TMP($J,"PRCPHL7")
87 . . S ITEM=0,LN=0
88 . . F S ITEM=$O(PRCPNOIT(ITEM)) Q:'ITEM D
89 . . . S LN=LN+1
90 . . . S ITEMNM=$P($G(^PRCP(445,PRCPSECO,1,ITEM,6)),"^",1)
91 . . . I ITEMNM']"" S TYPE=$P(^PRCP(445.5,$P(^PRCP(445,PRCPSECO,5),"^",1),0),"^",2) D
92 . . . . I TYPE="S" S ITEMNM=$P($G(^PRCP(445,PRCPPRIM,1,ITEM,6)),"^",1)
93 . . . . I TYPE="O" S ITEMNM=$P($G(^PRC(441,ITEM,0)),"^",2)
94 . . . S ^TMP($J,"PRCPHL7",1,LN,0)=$E(" ",$L(ITEM),7)_ITEM_" "_ITEMNM
95 . . S ^TMP($J,"PRCPHL7",1,0)=LN
96 . . D GETUSER^PRCPXTRM(PRCPPRIM) Q:'$O(PRCPXMY("")) ; find primary inventory point users
97 . . S ITEM=0
98 . . ; restrict message to inventory point managers
99 . . F S ITEM=$O(PRCPXMY(ITEM)) Q:ITEM'>0 I PRCPXMY(ITEM)=1 S XMY(ITEM)=""
100 . . S XMTEXT="^TMP($J,""PRCPHL7"",1,"
101 . . S XMB(1)=$P(^PRCP(445.3,ORDERDA,0),"^",1)
102 . . S XMB(3)=$$INVNAME^PRCPUX1(PRCPSECO)
103 . . S XMB(2)=$P(^PRCP(445,$P(^PRCP(445.3,ORDERDA,0),"^",2),0),"^",1)
104 . . S XMB="PRCP_NO_REFILL"
105 . . S XMDUZ="SUPPLY STATION INTERFACE"
106 . . D EN^XMB
107 . . K ^TMP($J,"PRCPHL7")
108 ;
109ERR ;
110 N NUMBER,PRCPHLPO
111 S NUMBER=ERR
112 S PRCPHLPO("ORDER")=$P($G(^PRCP(445.3,ORDERDA,0)),"^",1)
113 S PRCPHLPO("SIPNAME")="" I $D(^PRCP(445,PRCPSECO)) S PRCPHLPO("SIPNAME")=$$INVNAME^PRCPUX1(PRCPSECO)
114 S PRCPHLPO("ITEM")="" I $D(PRCPITEM) S PRCPHLPO("ITEM")=PRCPITEM
115 S PRCPHLPO("NAME")="" I $D(PRCPITNM) S PRCPHLPO("NAME")=PRCPITNM
116 S PRCPHLPO("QTY")="" I $D(PRCPAMT) S PRCPHLPO("QTY")=PRCPAMT
117 S PRCPHLPO("LEFT")="" I $D(PRCPLEFT) S PRCPHLPO("LEFT")=PRCPLEFT
118 S PRCPHLPO("TYPE")="" I $D(PRCPPOST) S PRCPHLPO("TYPE")=PRCPPOST
119 D ERR^PRCPHLM0(ERR,"PRCP_BAD_ORDER",PRCPSECO,.PRCPHLPO,PRCPHL7)
120 S PRCPDONE=1
121 ;
122Q I LOCKORD L -^PRCP(445.3,ORDERDA) D CLEAR^PRCPULOC(445.3,ORDERDA_"-1",0)
123 I LOCKPRIM L -^PRCP(445,PRCPPRIM,1) D CLEAR^PRCPULOC(445,PRCPPRIM_"-1",0)
124 Q
Note: See TracBrowser for help on using the repository browser.