source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPHLU.m@ 1078

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

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1PRCPHLU ;WISC/CC - PROCESS HL7 TXN ON ITEM UTILIZATION AT THE SUPPLY STATION; 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 DA,DIC,DIE,DLAYGO,DR,ERR,I,J,NUMBER,X,Y
6 N PRCPAMT,PRCPHL,PRCPHL7,PRCPITEM,PRCPITNM,PRCPLEFT,PRCPOC,PRCPRCOD,PRCPREAS
7 N PRCPREC,PRCPSEC,PRCPSECN,PRCPSITE,PRCPTIME,PRCPTXN,PRCPUSER,PRCP7
8 S I=1
9 ;
10RAS I HL("MTN")'="RAS" S ERR="1B" G ERR ; wrong message name
11 X HLNEXT I HLQUIT'>0 S ERR="1A" G ERR ; missing segments
12 S PRCPHL(1)=HLNODE,I=I+1,J=0
13 ;
14 X HLNEXT I HLQUIT'>0 S ERR="1A" G ERR ; missing segments
15 S PRCPHL(I)=HLNODE,J=0,I=I+1
16 S PRCPREC=""
17 I $$FLD^HLCSUTL(HLNODE,1)="PID" D I HLQUIT'>0 S ERR="1A" G ERR ; missing segments
18 . S PRCPREC=$$FLD^HLCSUTL(HLNODE,6)
19 . S PRCPREC=$$FMNAME^HLFNC(PRCPREC,$E(HL("ECH"),1))
20 . X HLNEXT
21 . S PRCPHL(I)=HLNODE,J=0,I=I+1
22 ;
23 I $$FLD^HLCSUTL(HLNODE,1)'="ORC" S ERR="1A" G ERR ; wrong segment name
24 D ORC I $D(ERR) G ERR
25 ;
26 X HLNEXT I HLQUIT'>0 S ERR="1A" G ERR ; missing segments
27 S PRCPHL(I)=HLNODE,J=0,I=I+1
28 I $$FLD^HLCSUTL(HLNODE,1)'="RXA" S ERR="1A" G ERR ; wrong segment name
29 ;
30 ; RXA SEGMENT
31RXA S PRCPITEM=$$FLD^HLCSUTL(HLNODE,6) ; ID~NAME
32 S PRCPTIME=$$FLD^HLCSUTL(HLNODE,4)
33 S PRCPTIME=$$FMDATE^HLFNC(PRCPTIME)
34 S PRCPAMT=$$FLD^HLCSUTL(HLNODE,7) ; QTY - 2ndary issue units
35 S PRCPUSER=$$FLD^HLCSUTL(HLNODE,11)
36 S PRCPUSER=$P(PRCPUSER,$E(HL("ECH"),1),2)
37 S PRCPUSER=$$FMNAME^HLFNC(PRCPUSER,$E(HL("ECH"),1))
38 S PRCPREAS=$$FLD^HLCSUTL(HLNODE,19)
39 S PRCPRCOD=$P(PRCPREAS,$E(HL("ECH"),1),1)
40 S PRCPREAS=PRCPRCOD_"~"_$P(PRCPREAS,$E(HL("ECH"),1),2)
41 S PRCPLEFT=$$FLD^HLCSUTL(HLNODE,20)
42 ;
43 ; verify info extracted
44 I +PRCPITEM'=$P(PRCPITEM,$E(HL("ECH"),1),1)!(+PRCPITEM=0) S ERR="6E" G ERR ; item number invalid
45 I '$D(^PRCP(445,PRCPSECN,1,$P(PRCPITEM,$E(HL("ECH"),1),1))) S ERR="6C" G ERR
46 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?
47 ;
48 I +PRCPAMT'=PRCPAMT!(PRCPAMT>999999)!(PRCPAMT<-999999) S ERR=4 G ERR
49 I +PRCPLEFT'=PRCPLEFT!(PRCPLEFT>999999)!(PRCPLEFT<-999999) S ERR=5 G ERR
50 ;
51 I PRCPOC="LI",PRCPRCOD'="RTRN",PRCPRCOD'="USGE" S ERR="1D" G ERR
52 I PRCPOC="RP",PRCPRCOD]"",PRCPRCOD'="DISP",$E(PRCPRCOD,1,3)'="ADJ" S ERR="1D" G ERR
53 ;
54 X HLNEXT I HLQUIT'>0 S ERR="1A" G ERR ; missing segments
55 S PRCPHL(I)=HLNODE,J=0,I=I+1
56 I $$FLD^HLCSUTL(HLNODE,1)'="RXR" S ERR="1A" G ERR ; wrong segment name
57 X HLNEXT I HLQUIT'>0 G PROCESS
58 S PRCPHL(I)=HLNODE,I=I+1,J=0
59 S ERR="1A" G ERR ; too many segments
60 G Q
61 ;
62 ;
63 ; ORC SEGMENT
64ORC S PRCPOC=$$FLD^HLCSUTL(HLNODE,2)
65 S PRCPSEC=$$FLD^HLCSUTL(HLNODE,5)
66 ;
67 I HL("MTN")="RAS",PRCPOC'="LI",PRCPOC'="RP" S ERR="1C" Q ; order control wrong
68 ; get site and IP info
69 I PRCPSEC']"" S ERR="3E" Q
70 S PRCPSEC=$P(PRCPSEC,$E(HL("ECH"),1),2) I PRCPSEC']"" S ERR="3E" Q
71 S PRCPSITE=$P(PRCPSEC,"-",1)
72 I PRCPSITE']"" S ERR="3E" Q
73 I '$D(^PRC(411,PRCPSITE,0)) S ERR="3D" Q ; wrong site
74 S DIC="^PRCP(445,",DIC(0)="X",X=PRCPSEC,PRCPPRIV=1
75 D ^DIC K DIC
76 I Y=-1 S ERR="3A" Q ; secondary not in GIP
77 S PRCPSECN=$P(Y,"^",1)
78 I $P(^PRCP(445,PRCPSECN,0),"^",3)'="S" S ERR="3B" G ERR ; not a secondary
79 S PRCPTIME=$$FLD^HLCSUTL(HLNODE,10)
80 S PRCPTIME=$$FMDATE^HLFNC(PRCPTIME)
81 S PRCPUSER=$$FLD^HLCSUTL(HLNODE,11)
82 S PRCPUSER=$P(PRCPUSER,$E(HL("ECH"),1),2)
83 S PRCPUSER=$$FMNAME^HLFNC(PRCPUSER,$E(HL("ECH"),1))
84 Q
85ERR ;
86 S NUMBER=ERR
87 I '$D(PRCPSECN) S PRCPSECN=0
88 S PRCP7("SIPNAME")="AN UNKNOWN INVENTORY POINT"
89 I $D(PRCPSEC),PRCPSEC]"" S PRCP7("SIPNAME")=PRCPSEC
90 S PRCP7("ITEM")=""
91 I $D(PRCPITEM) S PRCP7("ITEM")=$P(PRCPITEM,$E(HL("ECH"),1),1)
92 S PRCP7("NAME")=""
93 I $D(PRCPITEM) S PRCP7("NAME")=$P(PRCPITEM,$E(HL("ECH"),1),2)
94 S PRCP7("ACTIVITY")=""
95 I $D(PRCPREAS) S PRCP7("ACTIVITY")=$E(PRCPREAS,1,4)
96 S PRCP7("QTY")="" I $D(PRCPAMT) S PRCP7("QTY")=PRCPAMT
97 S PRCP7("LEFT")="" I $D(PRCPLEFT) S PRCP7("LEFT")=PRCPLEFT
98 S PRCP7("RECIPIENT")=""
99 I $D(PRCPREC) S PRCP7("RECIPIENT")=PRCPREC
100 S PRCP7("USER")=""
101 I $D(PRCPUSER) S PRCP7("USER")=PRCPUSER
102 D ERR^PRCPHLM0(ERR,"PRCP_BAD_ACTIVITY",PRCPSECN,.PRCP7,HLMTIENS_"."_HLMTIEN,.PRCPHL)
103 I ERR,$D(PRCPTXN) S DA=PRCPTXN,DIK="^PRCP(447.1," D ^DIK
104 G UNLOCK
105 ;
106PROCESS N %,%H,%I,PRCPTXNT,PRCPMGTP,CNT,DA,DIC,DIE,DR,N,T,X,Y
107 S X="PRCPHL7TXN",CNT=0
108PROCES0 I $D(^PRCS(410.1,"B",X)) D I $D(ERR) S CNT=CNT+1 G PROCES0:CNT<10 S CNT=0 G ERR
109 . S N="",N=$O(^PRCS(410.1,"B",X,N)),DA=N
110 . L +^PRCS(410.1,DA):15 I $T=0 S ERR=198 Q
111 . S T=$P(^PRCS(410.1,N,0),"^",2)+1 S:T<1 T=1
112 . S $P(^PRCS(410.1,DA,0),"^",2)=+T
113 . S $P(^PRCS(410.1,DA,0),"^",3)=DT
114 . L -^PRCS(410.1,DA)
115 I '$D(^PRCS(410.1,"B",X)) D I $D(ERR) S CNT=CNT+1 G PROCES0:CNT<10 S CNT=0 G ERR
116 . S T=1,DLAYGO=410.1,DIC="^PRCS(410.1,",DIC(0)="FLXZ"
117 . D ^DIC K DLAYGO I Y<0 S ERR=199
118 . S DA=+Y
119 . L +^PRCS(410.1,DA):15 I $T=0 S ERR=198 Q
120 . S $P(^PRCS(410.1,DA,0),"^",2)=+T
121 . S $P(^PRCS(410.1,DA,0),"^",3)=DT
122 . L -^PRCS(410.1,DA)
123 ;
124 S X=T
125 S DIC="^PRCP(447.1,"
126 S DIC(0)="L"
127 S DLAYGO=447.1
128 D ^DIC K DIC
129 I Y=-1 S ERR=100 G ERR
130 I $P(Y,"^",3)'=1 S ERR=101 G ERR
131 S (DA,PRCPTXN)=Y+0
132 L +^PRCP(447.1,DA):3 I $T=0 S ERR=102 G ERR
133 S DIE="^PRCP(447.1,"
134 S DA=PRCPTXN
135 D NOW^%DTC
136 S PRCPTXNT=%
137 S PRCPMGTP=HL("MTN")_HL("ETN")
138 S PRCPHL7=HLMTIENS_"."_HLMTIEN
139 S DR="1///^S X=PRCPSITE;2///^S X=PRCPSECN;3///^S X=PRCPTXNT;4///^S X=PRCPMGTP;5///^S X=PRCPHL7;8///^S X=PRCPTIME;9///^S X=PRCPREC;10///^S X=PRCPUSER;11///^S X=PRCPREAS"
140 D ^DIE
141 K DIE,DR
142 S DIC="^PRCP(447.1,"_PRCPTXN_",1,"
143 S DA(1)=PRCPTXN
144 S DIC(0)="L"
145 S DLAYGO=447.1
146 S DIC("P")=$P(^DD(447.1,7,0),"^",2)
147 S X=$P(PRCPITEM,$E(HL("ECH"),1),1)
148 S PRCPSET="I 1" ; over rides screen to omit finding case carts/IK's
149 D ^DIC K DIC,DA,DLAYGO
150 I Y=-1 S ERR=110 G ERR
151 I $P(Y,"^",3)'=1 S ERR=111 G ERR
152 S DIE="^PRCP(447.1,"_PRCPTXN_",1,"
153 S DA=+Y
154 S PRCPITNM=$P(PRCPITEM,$E(HL("ECH"),1),2)
155 S DR="1///^S X=PRCPLEFT;2///^S X=PRCPAMT;3///^S X=PRCPITNM"
156 D ^DIE K DIE,DIC,DR
157UNLOCK I $D(PRCPTXN),PRCPTXN>0 L -^PRCP(447.1,PRCPTXN)
158Q Q
Note: See TracBrowser for help on using the repository browser.