source: FOIAVistA/tag/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPHLP.m@ 1156

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

initial load of FOIAVistA 6/30/08 version

File size: 6.3 KB
Line 
1PRCPHLP ;WISC/CC - PROCESS HL7 TXN ON REFILLS AND ORDER POSTING; 4/00
2V ;;5.1;IFCAP;**1**;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 N DIC,DIE,DR,ERR,I,J,X,XMB
6 N NUMBER,ORDERDA,PRIM
7 N PRCPAMT,PRCPHL,PRCPHLPO,PRCPITEM,PRCPLEFT,PRCPOC,PRCPORD
8 N PRCPSEC,PRCPSECN,PRCPSET,PRCPSITE,PRCPTIME,PRCPUSER
9 ;
10 S I=1
11 I HL("MTN")'="ORM" S ERR="1B" G ERR ; wrong message name
12 X HLNEXT I HLQUIT'>0 S ERR="1A" G ERR ; missing segments
13 S PRCPHL(1)=HLNODE,I=2
14 ;
15 X HLNEXT I HLQUIT'>0 S ERR="1A" G ERR ; missing segments
16 S PRCPHL(I)=HLNODE,J=0,I=I+1
17 I $$FLD^HLCSUTL(HLNODE,1)'="ORC" S ERR="1A" G ERR ; wrong segment name
18 D ORC I $D(ERR) G ERR
19 ;
20 X HLNEXT I HLQUIT'>0,PRCPOC="OF" S ERR="1A" G ERR ; missing segments
21 ; Order completion transactions will only have an ORC segment
22 I HLQUIT'>0,PRCPOC="FU" G PROCESS
23 S PRCPHL(I)=HLNODE,I=I+1,J=0
24 I PRCPOC="FU" S ERR="1A" G ERR ; too many segments for order class code
25 I $$FLD^HLCSUTL(HLNODE,1)'="RQD" S ERR="1A" G ERR ; wrong segment name
26 ;
27 ; RQD SEGMENT
28RQD S PRCPITEM=$$FLD^HLCSUTL(HLNODE,5) ; ID~NAME
29 S PRCPAMT=$$FLD^HLCSUTL(HLNODE,6) ; REFILL QTY - restock issue units
30 ;
31 ; check item info
32 I +PRCPITEM'=$P(PRCPITEM,$E(HL("ECH"),1),1)!(+PRCPITEM=0) S ERR="6E" G ERR ; item number invalid
33 I '$D(^PRCP(445.3,ORDERDA,1,$P(PRCPITEM,$E(HL("ECH"),1),1))) S ERR="6A" G ERR ; item not on order
34 I '$D(^PRCP(445,$P(^PRCP(445.3,ORDERDA,0),"^",2),1,$P(PRCPITEM,$E(HL("ECH"),1),1))) S ERR="6B" G ERR ; item not in primary
35 I '$D(^PRCP(445,PRCPSECN,1,$P(PRCPITEM,$E(HL("ECH"),1),1))) S ERR="6C" G ERR
36 I $P(^PRCP(445,PRCPSECN,1,$P(PRCPITEM,$E(HL("ECH"),1),1),0),"^",9)'>0 S ERR="6D" G ERR ; is item a supply station item
37 I $P($G(^PRC(441,$P(PRCPITEM,$E(HL("ECH"),1)),0)),"^",6)="S" S ERR="6G" G ERR ; case cart/ik
38 ;
39 ; verify amount
40 I +PRCPAMT'=PRCPAMT!(PRCPAMT>999999)!(PRCPAMT<-999999) S ERR=4 G ERR
41 ;
42 X HLNEXT I HLQUIT'>0 S ERR="1A" G ERR ; missing segments
43 S PRCPHL(I)=HLNODE,J=0,I=I+1
44 I $$FLD^HLCSUTL(HLNODE,1)'="NTE" S ERR="1A" G ERR ; wrong segment name
45 ;
46 ; READ NTE SEGMENT
47NTE S PRCPLEFT=$$FLD^HLCSUTL(HLNODE,4)
48 I +PRCPLEFT'=PRCPLEFT!(PRCPLEFT>999999)!(PRCPLEFT<-999999) S ERR=5 G ERR
49 ;
50 X HLNEXT I HLQUIT'>0 G PROCESS
51 S PRCPHL(I)=HLNODE,I=I+1,J=0
52 S ERR="1A" G ERR ; too many segments
53 G Q
54 ;
55 ; ORC SEGMENT
56ORC S PRCPOC=$$FLD^HLCSUTL(HLNODE,2)
57 S PRCPSEC=$$FLD^HLCSUTL(HLNODE,5)
58 S PRCPORD=$$FLD^HLCSUTL(HLNODE,3)
59 ;
60 I PRCPOC'="OF",PRCPOC'="FU" S ERR="1C" Q ; order control wrong
61 ;
62 ; find site and IP ien
63 S PRCPSEC=$P(PRCPSEC,$E(HL("ECH"),1),2)
64 I PRCPSEC']"" S ERR="3E" G ERR
65 S PRCPSITE=$P(PRCPSEC,"-",1)
66 I PRCPSITE']"" S ERR="3E" Q ; site missing
67 I '$D(^PRC(411,PRCPSITE,0)) S ERR="3D" Q ; wrong site
68 S DIC="^PRCP(445,",DIC(0)="X",X=PRCPSEC,PRCPPRIV=1
69 D ^DIC K DIC
70 I Y=-1 S ERR="3A" Q ; secondary not in GIP
71 S PRCPSECN=$P(Y,"^",1)
72 I $P(^PRCP(445,PRCPSECN,0),"^",3)'="S" S ERR="3B" Q ; not a secondary
73 ;
74 S PRIM=$O(^PRCP(445,"AB",PRCPSECN,""))
75 I PRIM']"" S ERR="2A" Q
76 ; get internal order number
77 I PRCPORD]"" D I $D(ERR) Q
78 . S DIC="^PRCP(445.3,",DIC(0)="X",X=PRCPORD,PRCPPRIV=1
79 . S DIC("S")="I $P(^(0),U,2)="_PRIM
80 . D ^DIC K DIC
81 . I Y=-1 S ERR="2A" Q ; order not in GIP
82 . S ORDERDA=$P(Y,"^",1)
83 . I $P(^PRCP(445.3,ORDERDA,0),"^",6)="P" S ERR="2B" Q ; order is posted
84 . I $P(^PRCP(445.3,ORDERDA,0),"^",10)']"" S ERR="2C" Q ; order not to be completed by supply station
85 . I $P(^PRCP(445.3,ORDERDA,0),"^",3)'=PRCPSECN S ERR="3C" Q ; sec on order differs
86 I HL("MTN")="ORM",PRCPORD']"" S ERR="2D" Q ; order number missing
87 ;
88 S PRCPTIME=$$FLD^HLCSUTL(HLNODE,10)
89 S PRCPTIME=$$FMDATE^HLFNC(PRCPTIME)
90 S PRCPUSER=$$FLD^HLCSUTL(HLNODE,11)
91 S PRCPUSER=$P(PRCPUSER,$E(HL("ECH"),1),2)
92 S PRCPUSER=$$FMNAME^HLFNC(PRCPUSER,$E(HL("ECH"),1))
93 Q
94 ;
95 ;
96ERR S NUMBER=ERR
97 I '$D(PRCPSECN) S PRCPSECN=0
98 S PRCPHLPO("ORDER")="" I $D(PRCPORD) S PRCPHLPO("ORDER")=PRCPORD
99 S PRCPHLPO("SIPNAME")="AN UNKNOWN INVENTORY POINT"
100 I $D(PRCPSEC),PRCPSEC]"" S PRCPHLPO("SIPNAME")=PRCPSEC
101 S PRCPHLPO("ITEM")=""
102 I $D(PRCPITEM) S PRCPHLPO("ITEM")=$P(PRCPITEM,$E(HL("ECH"),1),1)
103 S PRCPHLPO("NAME")=""
104 I $D(PRCPITEM) S PRCPHLPO("NAME")=$P(PRCPITEM,$E(HL("ECH"),1),2)
105 S PRCPHLPO("QTY")="" I $D(PRCPAMT) S PRCPHLPO("QTY")=PRCPAMT
106 S PRCPHLPO("LEFT")="" I $D(PRCPLEFT) S PRCPHLPO("LEFT")=PRCPLEFT
107 S PRCPHLPO("TYPE")=PRCPOC
108 D ERR^PRCPHLM0(ERR,"PRCP_BAD_ORDER",PRCPSECN,.PRCPHLPO,HLMTIENS_"."_HLMTIEN,.PRCPHL)
109 G UNLOCK
110 ;
111 ;
112PROCESS N %,%H,%I,N,PRCPTXN,PRCPTXNT,PRCPMGTP,PRCPHL7,PRCPITNM,CNT,DA,DIC,DIE,DLAYGO,DR,T,X,Y
113 S X="PRCPHL7TXN",CNT=0
114PROCES0 I $D(^PRCS(410.1,"B",X)) D I $D(ERR) S CNT=CNT+1 G PROCES0:CNT<10 S CNT=0 G ERR
115 . S N="",N=$O(^PRCS(410.1,"B",X,N)),DA=N
116 . L +^PRCS(410.1,DA):15 I $T=0 S ERR=198 Q
117 . S T=$P(^PRCS(410.1,N,0),"^",2)+1 S:T<1 T=1
118 . S $P(^PRCS(410.1,DA,0),"^",2)=+T
119 . S $P(^PRCS(410.1,DA,0),"^",3)=DT
120 . L -^PRCS(410.1,DA)
121 I '$D(^PRCS(410.1,"B",X)) D I $D(ERR) S CNT=CNT+1 G PROCES0:CNT<10 S CNT=0 G ERR
122 . S T=1,DLAYGO=410.1,DIC="^PRCS(410.1,",DIC(0)="FLXZ"
123 . D ^DIC K DLAYGO I Y<0 S ERR=199
124 . S DA=+Y
125 . L +^PRCS(410.1,DA):15 I $T=0 S ERR=198 Q
126 . S $P(^PRCS(410.1,DA,0),"^",2)=+T
127 . S $P(^PRCS(410.1,DA,0),"^",3)=DT
128 . L -^PRCS(410.1,DA)
129 ;
130PROCES1 S CNT=0,X=T
131 S DIC="^PRCP(447.1,"
132 S DIC(0)="L"
133 S DLAYGO=447.1
134 D ^DIC K DIC
135 I Y=-1 S ERR=100,CNT=CNT+1 G PROCES1:CNT<10,ERR
136 I $P(Y,"^",3)'=1 S ERR=101 G ERR
137 S (DA,PRCPTXN)=Y+0
138 L +^PRCP(447.1,DA):3 I $T=0 S ERR=102 D UNLOCK G ERR
139 S DIE="^PRCP(447.1,"
140 S DA=PRCPTXN
141 D NOW^%DTC
142 S PRCPTXNT=%
143 S PRCPHL7=HLMTIENS_"."_HLMTIEN
144 S PRCPMGTP=HL("MTN")_HL("ETN")
145 S DR="1///^S X=PRCPSITE;2///^S X=PRCPSECN;3///^S X=PRCPTXNT;4///^S X=PRCPMGTP;5///^S X=PRCPHL7;6////^S X=ORDERDA;8///^S X=PRCPTIME;10///^S X=PRCPUSER"
146 I PRCPOC="FU" S DR=DR_";11///^S X=PRCPOC"
147 D ^DIE
148 K DIE,DR
149 I PRCPOC="FU" G UNLOCK
150 S DIC="^PRCP(447.1,"_PRCPTXN_",1,"
151 S DA(1)=PRCPTXN
152 S DIC(0)="L"
153 S DLAYGO=447.1
154 S DIC("P")=$P(^DD(447.1,7,0),"^",2)
155 S X=$P(PRCPITEM,$E(HL("ECH"),1),1)
156 S PRCPSET="I 1" ; over rides screen to omit finding case carts/IK's
157 D ^DIC K DIC,DA,DLAYGO
158 I Y=-1 S ERR=110 D UNLOCK G ERR
159 I $P(Y,"^",3)'=1 S ERR=111 D UNLOCK G ERR
160 S DIE="^PRCP(447.1,"_PRCPTXN_",1,"
161 S DA=+Y
162 S PRCPITNM=$P(PRCPITEM,$E(HL("ECH"),1),2)
163 S DR="1///^S X=PRCPLEFT;2///^S X=PRCPAMT;3///^S X=PRCPITNM"
164 D ^DIE K DIE,DIC,DR
165UNLOCK I $D(ERR),$D(PRCPTXN),PRCPTXN>0 S DA=PRCPTXN,DIK="^PRCP(447.1," D ^DIK
166 I $G(PRCPTXN) L -^PRCP(447.1,PRCPTXN)
167Q Q
Note: See TracBrowser for help on using the repository browser.