1 | PRCVTCA ;WOIFO/SC-2237 CANCEL TO DYNAMED ; 5/31/05 2:31pm
|
---|
2 | ;;5.1;IFCAP;**81**;Oct 20, 2000
|
---|
3 | ;;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
4 | Q
|
---|
5 | ;PRCVTCA is called by routine PRCSEA
|
---|
6 | ;This routine is extracting 2237 data when a user enters thru an
|
---|
7 | ;option Cancel a Permanent Transaction [PRCSCT] and passing that
|
---|
8 | ;info to routine PRCVEE1 which formats data into HL7 Message and
|
---|
9 | ;then sends data to DynaMed. It also updates relevant info in Audit
|
---|
10 | ;File #414.02. A bulletin is send if DM DOC ID is missing from an
|
---|
11 | ;item or if record doesn't get updated properly in Audit File.
|
---|
12 | ;
|
---|
13 | EN(PRCVDA) ;
|
---|
14 | ; Input PRCVDA = ien of top entry of the file
|
---|
15 | ;Quit if system parameter is not set to DynaMed
|
---|
16 | N PRCVSYS
|
---|
17 | S PRCVSYS=$$GET^XPAR("SYS","PRCV COTS INVENTORY",1,"Q")
|
---|
18 | Q:PRCVSYS'=1
|
---|
19 | ;
|
---|
20 | N PRCVRIEN,PRCVDUZ,PRCVNO,PRCVIT,PRCVEXTN,PRCVV,PRCVFLDS
|
---|
21 | N PRCVSTA,CNT,PRCVTM,K,PRCVCRDT,PRCVPGDT,PRCVL,PRCVDT
|
---|
22 | N PRCVI,PRCVJ,PRCVK,PRCVDID,PRCVITN,PRCVQTY,PRCVCST,PRCVDNB
|
---|
23 | N PRCVDTCR,PRCVNAME,PRCVIEN,PRCVTIME,PRCVOCD,PRCV2IEN
|
---|
24 | N PRCVAR,PRCVFMS,PRCVUOP,PRCVSTK,PRCVPKG,PRCVBOC,PRCVNIF
|
---|
25 | N PRCVFCP,PRCVTMP,PRCVTT
|
---|
26 | ;
|
---|
27 | S PRCVDUZ=DUZ
|
---|
28 | S PRCV2IEN=PRCVDA ; ien of the 2237 trx.
|
---|
29 | S PRCVTIME=$H
|
---|
30 | S PRCVEXTN=$$GET1^DIQ(410,PRCV2IEN_",",.01) ;.01 value of 2237 trx
|
---|
31 | ;
|
---|
32 | ;Quit if DM 2237 .01 value is not found in Audit file 414.02 'D' xref
|
---|
33 | ;And check if child 2237 that was split has a parent 2237 (in
|
---|
34 | ;file 410,node10,piece 2,fld51) is recorded in Audit File 414.02
|
---|
35 | ;'D' x-ref.
|
---|
36 | S PRCVTT=$$CHKDM^PRCVLIC(PRCVEXTN) Q:PRCVTT'=1
|
---|
37 | ;
|
---|
38 | D NOW^%DTC,YX^%DTC
|
---|
39 | S PRCVTM=Y ;date/time in ext format MAR 07, 2005@16:08
|
---|
40 | S PRCVFCP=$P($G(PRCVEXTN),"-",4)
|
---|
41 | S PRCVNO="PRCVUP*"_PRCVEXTN ; .01 val in the XTMP subscript
|
---|
42 | ;S PRCVNO="PRCVUP*"_PRCV2IEN ; ien in the XTMP subscript
|
---|
43 | S PRCVSTA=$$GET1^DIQ(4,$$KSP^XUPARAM("INST")_",",99)
|
---|
44 | S PRCVNAME=$$GET1^DIQ(200,PRCVDUZ_",",.01,"E")
|
---|
45 | ;
|
---|
46 | S CNT=0
|
---|
47 | K ^XTMP(PRCVNO,PRCVTIME)
|
---|
48 | D SETUP0 ; set up XTMP global's zero node
|
---|
49 | D ITEM ; process all of the items
|
---|
50 | I CNT>0 D SETUP1 ; if there is a line item then set Node 1
|
---|
51 | I CNT'>0 K ^XTMP(PRCVNO,PRCVTIME)
|
---|
52 | ;Call HL7 Message builder/transmitter routine
|
---|
53 | ;PRCVNO is comprised of "PRCVUP*Trx#" & Trx# is Sta-fy-Qtr-FCP-seq#
|
---|
54 | ;PRCVTIME is time stamp in $H format
|
---|
55 | I CNT>0 D BEGIN^PRCVEE1(PRCVNO,PRCVTIME)
|
---|
56 | D EXIT
|
---|
57 | Q
|
---|
58 | ;
|
---|
59 | ITEM ;
|
---|
60 | ;N PRCVAR
|
---|
61 | S (PRCVI,PRCVJ,PRCVL)=0
|
---|
62 | S PRCVIEN=$$GET1^DIQ(410,PRCV2IEN_",",12,"I") ;vendor ien F410N3P4
|
---|
63 | S PRCVFMS=$$GET1^DIQ(440,PRCVIEN_",",34,"I") ;FMS vendor ien F440N3P4
|
---|
64 | ;
|
---|
65 | F S PRCVI=$O(^PRCS(410,PRCV2IEN,"IT",PRCVI)) Q:PRCVI'>0!(+PRCVI=0) D
|
---|
66 | . N PRCVAR
|
---|
67 | . S PRCVFLDS="2;3;4;5;6;7;17"
|
---|
68 | . D GETS^DIQ(410.02,PRCVI_","_PRCV2IEN_",",PRCVFLDS,"","PRCVAR")
|
---|
69 | . S PRCVDNB=$$GET1^DIQ(410.02,PRCVI_","_PRCV2IEN_",",18,"I")
|
---|
70 | . D SETUP ; DO a setup in XTMP struct
|
---|
71 | . Q
|
---|
72 | Q
|
---|
73 | ;
|
---|
74 | ;
|
---|
75 | SETUP ;set up XTMP ITEM node(S) & UPDATE audit file for each item on a RIL
|
---|
76 | ;Order Control code^Item ien^Qty^Vendor ien^^Cost^DynaMed doc ID^Date Needed By^Unit of Purchase^Vendor Stock Number^Packaging Mult.^BOC^Nif #
|
---|
77 | ;
|
---|
78 | S PRCVOCD="CA" ; order control code for entire 2237 cancellation
|
---|
79 | S PRCVQTY=PRCVAR(410.02,PRCVI_","_PRCV2IEN_",",2) ; qty N0P2
|
---|
80 | S PRCVUOP=PRCVAR(410.02,PRCVI_","_PRCV2IEN_",",3) ; unit of purchase N0P3
|
---|
81 | S PRCVBOC=PRCVAR(410.02,PRCVI_","_PRCV2IEN_",",4) ; BOC w descr N0P4
|
---|
82 | S PRCVITN=PRCVAR(410.02,PRCVI_","_PRCV2IEN_",",5) ; item ien N0P5
|
---|
83 | S PRCVSTK=PRCVAR(410.02,PRCVI_","_PRCV2IEN_",",6) ; stock # N0P6
|
---|
84 | S PRCVCST=PRCVAR(410.02,PRCVI_","_PRCV2IEN_",",7) ; unit cost N0P7
|
---|
85 | S PRCVDID=PRCVAR(410.02,PRCVI_","_PRCV2IEN_",",17) ; DM doc id N4P1
|
---|
86 | I PRCVDID="" D Q ; if DM doc id is missing, send a bulletin
|
---|
87 | . S XMB(1)="processing a CANCEL of the 2237 #: "_PRCVEXTN
|
---|
88 | . S XMB(2)=" ...None Found"
|
---|
89 | . S XMB(3)="The line item ien: "_$G(PRCVITN)_" is missing it's DM DOC ID."
|
---|
90 | . K ^TMP($J,"PRCVTCA") S PRCVTMP="PRCVTCA"
|
---|
91 | . S ^TMP($J,"PRCVTCA",1,0)=""
|
---|
92 | . S ^TMP($J,"PRCVTCA",2,0)="2237 #: "_$G(PRCVEXTN)
|
---|
93 | . S ^TMP($J,"PRCVTCA",3,0)="Item's IEN: "_$G(PRCVITN)
|
---|
94 | . D DMERXMB^PRCVLIC(PRCVTMP,PRCVSTA,PRCVFCP)
|
---|
95 | . Q
|
---|
96 | ;S PRCVDNB=PRCVAR(410.02,PRCVI_","_PRCV2IEN_",",18) ; dt needed in external FM format N4P2
|
---|
97 | ;S PRCVDT=$$HLDATE^HLFNC(PRCVDNB,"DT") ; YYYYMMDD -- hl7 format
|
---|
98 | ;S PRCVDT=$$FMTE^XLFDT(PRCVDNB,"7D") ; YYYY/M/D or YYYY/MM/DD
|
---|
99 | S PRCVPKG=$$GET1^DIQ(441.01,PRCVIEN_","_PRCVITN_",",1.6) ; pkg mult F441.01N0P8
|
---|
100 | S PRCVNIF=$$GET1^DIQ(441,PRCVITN_",",51) ; nif no F441N0P15
|
---|
101 | ;
|
---|
102 | ;
|
---|
103 | S CNT=CNT+1
|
---|
104 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",1)=PRCVOCD
|
---|
105 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",2)=PRCVITN
|
---|
106 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",3)=PRCVQTY
|
---|
107 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",4)=PRCVIEN
|
---|
108 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",5)=PRCVFMS
|
---|
109 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",6)=PRCVCST
|
---|
110 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",7)=PRCVDID
|
---|
111 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",8)=PRCVDNB
|
---|
112 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",9)=PRCVUOP
|
---|
113 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",10)=PRCVSTK
|
---|
114 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",11)=PRCVPKG
|
---|
115 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",12)=+PRCVBOC
|
---|
116 | S $P(^XTMP(PRCVNO,PRCVTIME,2,CNT),"^",13)=PRCVNIF
|
---|
117 | ;
|
---|
118 | ;update Audit File 414.02 for 2237 CANCEL fields 8 and 9
|
---|
119 | ;#8 date/time removed from IFCAP #9 who deleted
|
---|
120 | D NOW^%DTC
|
---|
121 | N PRCVZ,PRCVARR
|
---|
122 | S PRCVZ=""
|
---|
123 | S PRCVZ=$O(^PRCV(414.02,"B",PRCVDID,PRCVZ))
|
---|
124 | I +$G(PRCVZ)'>0 D BULLET Q ;if record is missing fr 414.02 file
|
---|
125 | S PRCVARR(414.02,PRCVZ_",",8)=% ; int dt/time for removing
|
---|
126 | S PRCVARR(414.02,PRCVZ_",",9)=PRCVDUZ ; who deleted
|
---|
127 | D UPDATE^DIE("","PRCVARR")
|
---|
128 | I $D(^TMP("DIERR",$J)) D Q
|
---|
129 | .S XMB(1)="processing CANCEL of a 2237 #: "_$G(PRCVEXTN)
|
---|
130 | .S XMB(2)=$G(PRCVDID)
|
---|
131 | .S XMB(3)="ERROR while updating AUDIT FILE #414.02"
|
---|
132 | .K ^TMP($J,"PRCVTCA") S PRCVTMP="PRCVTCA"
|
---|
133 | .S ^TMP($J,"PRCVTCA",1,0)=""
|
---|
134 | .S ^TMP($J,"PRCVTCA",2,0)="2237 #: "_$G(PRCVEXTN)
|
---|
135 | .S ^TMP($J,"PRCVTCA",3,0)="Item's IEN: "_$G(PRCVITN)
|
---|
136 | .S ^TMP($J,"PRCVTCA",4,0)="DM DOC ID: "_$G(PRCVDID)
|
---|
137 | .S ^TMP($J,"PRCVTCA",5,0)="Deleted By: "_$G(PRCVNAME)_" (DUZ: "_$G(PRCVDUZ)_")"
|
---|
138 | .S ^TMP($J,"PRCVTCA",6,0)="Error Text: "_$G(^TMP("DIERR",$J,1,"TEXT",1))
|
---|
139 | .D DMERXMB^PRCVLIC(PRCVTMP,PRCVSTA,PRCVFCP)
|
---|
140 | QUIT
|
---|
141 | ;
|
---|
142 | SETUP0 ;set up XTMP 0 node
|
---|
143 | ;Termination Date^Entry Date^Descriptive Text_Time in ext format
|
---|
144 | ;D NOW^%DTC,YX^%DTC
|
---|
145 | ;S PRCVTM=Y ;date/time in ext format MAR 07, 2005@16:08
|
---|
146 | S PRCVCRDT=DT ; DT is FM internal dt 3050307
|
---|
147 | S PRCVPGDT=$$FMADD^XLFDT(DT,5) ; purge XTMP global in 5 days
|
---|
148 | ;adding extra 0 node to comply w SACC std 4/28/05
|
---|
149 | S ^XTMP(PRCVNO,0)=PRCVPGDT_"^"_PRCVCRDT_"^"_"Transmit message to DynaMed for updates"
|
---|
150 | S $P(^XTMP(PRCVNO,PRCVTIME,0),"^",1)=PRCVPGDT
|
---|
151 | S $P(^XTMP(PRCVNO,PRCVTIME,0),"^",2)=PRCVCRDT
|
---|
152 | S $P(^XTMP(PRCVNO,PRCVTIME,0),"^",3)="2237 Cancellation Update to DynaMed: "_PRCVTM
|
---|
153 | Q
|
---|
154 | ;
|
---|
155 | SETUP1 ;set up XTMP 1 node
|
---|
156 | ;Number of records^Site^DUZ^Entered By Last Name^Entered By First Name^IEN of 2237
|
---|
157 | ;
|
---|
158 | I $D(PRCVNAME),PRCVNAME]"" D NAMECOMP^XLFNAME(.PRCVNAME)
|
---|
159 | S $P(^XTMP(PRCVNO,PRCVTIME,1),"^")=CNT ; total no of items
|
---|
160 | S $P(^XTMP(PRCVNO,PRCVTIME,1),"^",2)=PRCVSTA ; Sta
|
---|
161 | ;S $P(^XTMP(PRCVNO,PRCVTIME,1),"^",3)=PRCVDTCR ; dt/time created
|
---|
162 | S $P(^XTMP(PRCVNO,PRCVTIME,1),"^",3)=PRCVDUZ ; DUZ
|
---|
163 | S $P(^XTMP(PRCVNO,PRCVTIME,1),"^",4)=PRCVNAME("FAMILY")
|
---|
164 | S $P(^XTMP(PRCVNO,PRCVTIME,1),"^",5)=PRCVNAME("GIVEN")
|
---|
165 | S $P(^XTMP(PRCVNO,PRCVTIME,1),"^",6)=PRCV2IEN ; ien of 2237
|
---|
166 | Q
|
---|
167 | ;
|
---|
168 | ;PRCVZ - record in Audit File
|
---|
169 | BULLET ;Send a bulletin if record is missing from audit file
|
---|
170 | I PRCVZ="" D Q
|
---|
171 | .S XMB(1)="processing CANCEL of 2237 #: "_$G(PRCVEXTN)
|
---|
172 | .S XMB(2)=$G(PRCVDID)
|
---|
173 | .S XMB(3)="the record related to DM DOC ID is missing in AUDIT FILE #414.02"
|
---|
174 | .K ^TMP($J,"PRCVTCA") S PRCVTMP="PRCVTCA"
|
---|
175 | .S ^TMP($J,"PRCVTCA",1,0)=""
|
---|
176 | .S ^TMP($J,"PRCVTCA",2,0)="2237 #: "_$G(PRCVEXTN)
|
---|
177 | .S ^TMP($J,"PRCVTCA",3,0)="DM DOC ID: "_$G(PRCVDID)
|
---|
178 | .S ^TMP($J,"PRCVTCA",4,0)="Item's IEN: "_$G(PRCVITN)
|
---|
179 | .D DMERXMB^PRCVLIC(PRCVTMP,PRCVSTA,PRCVFCP)
|
---|
180 | Q
|
---|
181 | ;
|
---|
182 | ;
|
---|
183 | EXIT ;kill variables and quit
|
---|
184 | K %,X,Y
|
---|
185 | Q
|
---|
186 | ;
|
---|
187 | ;
|
---|