source: FOIAVistA/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCDPESR0.m@ 1676

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

initial load of FOIAVistA 6/30/08 version

File size: 8.8 KB
Line 
1RCDPESR0 ;ALB/TMK - Server auto-update utilities - EDI Lockbox ;06/03/02
2 ;;4.5;Accounts Receivable;**173,208**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ; IA for read access to ^IBM(361.1 = 4051
5 ;
6DISP(RCMIN,RCMOUT,RCFMT,RCFULL,RCW,RC3444) ; Format the 835 return msg
7 ; RCMIN = the name of the array that contains the raw message data
8 ; The data is contained at the next level and the subscript is
9 ; numeric and greater than 0 or the data can be at the
10 ; 0-node subsequent to the final subscript.
11 ; If the message array is a global ^TMP($J,"MSG",n), RCMIN
12 ; will equal "^TMP($J,""MSG"")" and the message text will be
13 ; in ^TMP($J,"MSG",1), ^TMP($J,"MSG",2), etc. OR
14 ; the message text can be defined at TMP($J,"MSG",1,0) ^...,2,0)
15 ; etc.
16 ; RCMOUT = the name of the array that should be returned. This array
17 ; will follow the same convention as the input array. The
18 ; array will be returned with a numeric final subscript. If
19 ; RCMOUT is passed as "^TMP($J,""MSG1"")", then the display
20 ; lines will be returned in ^TMP($J,"MSG1",1),
21 ; ^TMP($J,"MSG1",2), etc. Note the array RCMOUT is killed
22 ; on entry to this call
23 ; RCFMT = 0 or null if call should return raw data, 1 to execute the
24 ; transforms attached to the fields
25 ; RCFULL = the name of an array if the data should be returned in
26 ; this array, formatted into lines for display. If not sent,
27 ; only the display data by element is returned in RCMOUT. If
28 ; RCFULL is sent, the array is killed before populating it
29 ; RCW = max # of characters per line to return in array RCFULL
30 ; RC3444 = flag that indicates only return bill data, not header data
31 ;
32 N Z,Z0,Z1,RC,RCCT,RCREF,RCDATA,RCQ,R
33 S RCCT=0,RCREF="" K @RCMOUT
34 S Z=0 F S Z=$O(@RCMIN@(Z)) Q:'Z S Z0=$S($G(@RCMIN@(Z))'="":@RCMIN@(Z),1:$G(@RCMIN@(Z,0))) I Z0'="" S RCQ=0 D
35 . F Z1=1:1:$L(Z0,U) I $P(Z0,U,Z1)'="" D Q:RCQ
36 .. S RCDATA=$P(Z0,U,Z1)
37 .. I Z1=1 D Q:RCQ
38 ... S RC=""
39 ... I RCDATA'="",RCDATA?.N.A D
40 .... S RCREF=$S($E(RCDATA,1,3)'="835":$E(RCDATA,1,8),1:"835"),R=RCREF_"^RCDPESR9",RC=$P($T(@R),";;",2)
41 ... I RC="" S RCCT=RCCT+1,@RCMOUT@(RCCT)="<<<INVALID LINE TYPE - RAW DATA IS:",RCCT=RCCT+1,@RCMOUT@(RCCT)=Z0,RCDATA=""
42 .. Q:RCDATA=""!(RCREF="")!$S(RCREF="835":$G(RC3444),1:0)
43 .. S RC=""
44 .. I RCREF?.A.N D
45 ... S R=RCREF_"+"_Z1_"^RCDPESR9",RC=$P($T(@R),";;",2)
46 .. I RC=""!($P(RC,U)'=RCREF) S:$S(RCDATA'="":1,1:'$P(RC,U,2)) RCCT=RCCT+1,@RCMOUT@(RCCT)="NO DATA DEFINITION PC "_Z1_": "_RCDATA Q
47 .. I RC'="" D
48 ... N X,X1,Y
49 ... S X1=$P(RC,U,4,99)
50 ... I $G(RCFMT),X1'="" S X=RCDATA X X1 S RCDATA=Y ; Output transform
51 ... Q:RCDATA=""&($P(RC,U,2)) ; Don't output if null data
52 ... S RC=$P(RC,U,3)
53 ... S RCCT=RCCT+1,@RCMOUT@(RCCT)=$S(Z1=1:"<<<",1:"")_RC_": "_RCDATA_$S(Z1=1:">>>",1:"")
54 I $G(RCFULL)'="" D FMTDSP(RCMOUT,RCFULL,$G(RCW),$G(RC3444))
55 Q
56 ;
57FMTDSP(RCMUN,RCMFO,RCW,RCNOH05) ; Format the display data in array named in
58 ; RCMUN into lines up to RCW characters wide RCMUN must be set up the
59 ; same as the output of the DISP call above
60 ; Returns array named in RCMFO with the last subscript being the line #
61 ; Note @RCMFO is killed on entry to this call
62 ; Default is 80 if RCW=0 or null
63 ; RCNOH05 = flag that if =1, suppresses the '05' header
64 ;
65 N Z,RCLINE,RCCT,RCCT1,RCMID,RCD,RCSTART,RCLINE,RCDASH
66 K @RCMFO
67 S:'$G(RCW) RCW=80
68 S RCDASH=" "_$TR($J("",RCW-2)," ","-")
69 S (RCCT,RCCT1)=0,RCLINE="",RCMID=RCW\2-1
70 S Z=0 F S Z=$O(@RCMUN@(Z)) Q:'Z S RCD=$G(@RCMUN@(Z)) D
71 . I $E(RCD,1,3)="<<<" D Q ; New line needed ... record start
72 .. I $L(RCLINE)>0 S RCCT=RCCT+1,@RCMFO@(RCCT)=RCLINE,RCLINE=""
73 .. I $L(RCLINE)=0 D
74 ... I Z>1 S RCCT=RCCT+1,@RCMFO@(RCCT)=" "
75 ... I RCD["<<<Line Type: 05 ",'$G(RCNOH05) S RCCT1=RCCT1+1,RCCT=RCCT+1,@RCMFO@(RCCT)=RCDASH,RCCT=RCCT+1,@RCMFO@(RCCT)="****** ERA DETAIL START ******",RCCT=RCCT+1,@RCMFO@(RCCT)=RCDASH
76 ... I $L(RCD)>RCW D Q
77 .... S RCSTART=1
78 .... F S RCCT=RCCT+1,@RCMFO@(RCCT)=$E(RCD,RCSTART,RCSTART+RCW-1),RCSTART=RCSTART+RCW Q:RCSTART>$L(RCD)
79 ... S RCCT=RCCT+1,@RCMFO@(RCCT)=RCD
80 . ;
81 . I $L(RCD)>RCW D Q ; Split line if greater than width given
82 .. I $L(RCLINE) S RCCT=RCCT+1,@RCMFO@(RCCT)=RCLINE
83 .. S RCSTART=1
84 .. F S RCCT=RCCT+1,@RCMFO@(RCCT)=$E(RCD,RCSTART,RCSTART+RCW-1),RCSTART=RCSTART+RCW Q:RCSTART>$L(RCD)
85 .. S RCLINE=""
86 . I $L(RCLINE)=0 D Q ; Format left side of line
87 .. S RCLINE=RCD
88 .. ;
89 .. I $L(RCLINE)>RCMID S RCCT=RCCT+1,@RCMFO@(RCCT)=RCLINE,RCLINE=""
90 . ;
91 . I (RCMID+$L(RCD)+1)>RCW D Q ; data too long for right side of line
92 .. S RCCT=RCCT+1,@RCMFO@(RCCT)=RCLINE,RCLINE=""
93 . S RCLINE=$E(RCLINE_$J("",RCMID),1,RCMID)_" "_RCD,RCCT=RCCT+1,@RCMFO@(RCCT)=RCLINE,RCLINE=""
94 I $L(RCLINE) S RCCT=RCCT+1,@RCMFO@(RCCT)=RCLINE
95 Q
96 ;
97BULLERA(RC,RCTDA,RCXMG,RCSUBJ,RCERR,RCTYP) ; Send a bulletin for entries in 344.5
98 ; RC = flags for data to include (one or more can can be used)
99 ; 'D': display text 'R': raw data 'F': formatted data from raw
100 ; data in file 344.5
101 ; RCTDA = ien of the entry in file 344.5
102 ; RCXMG = mail msg # for the ERA
103 ; RCSUBJ = subject of the bulletin
104 ; RCERR = error text in array or name of error global
105 ; RCTYP = if 0:ERA 1:EEOB
106 ;
107 N XMBODY,XMB,XMINSTR,XMTYPE,XMFULL,XMTO,XMZ,XMERR,Z,Z0,CT,RCXM,RCVAR
108 K ^TMP("RCXM_344.5",$J)
109 S RCERR=$G(RCERR)
110 S RCVAR=$S($E(RCERR,1,5)="^TMP(":RCERR,1:"RCERR")
111 S XMTO("I:G.RCDPE PAYMENTS EXCEPTIONS")="",CT=0,RCTYP=$S('$G(RCTYP):"ERA",1:"EEOB")
112 S CT=CT+1,^TMP("RCXM_344.5",$J,CT)="The following electronic "_RCTYP_" was received at your site.",CT=CT+1,^TMP("RCXM_344.5",$J,CT)="It was received on: "_$$FMTE^XLFDT($$NOW^XLFDT(),2)_" in mail msg # "_RCXMG_"."
113 S CT=CT+1,^TMP("RCXM_344.5",$J,CT)="This message is sent to alert you to conditions regarding this "_RCTYP_".",CT=CT+1,^TMP("RCXM_344.5",$J,CT)=" "
114 I RC["D" D DTXT(RCTDA,.RCXM,.CT) M ^TMP("RCXM_344.5",$J)=RCXM K RCXM
115 S Z=0 F S Z=$O(@RCVAR@(Z)) Q:'Z I $D(@RCVAR@(Z,"*")) S CT=CT+1,^TMP("RCXM_344.5",$J,CT)=@RCVAR@(Z,"*")
116 I $G(RCERR)'="",RCVAR="RCERR" S CT=CT+1,^TMP("RCXM_344.5",$J,CT)=RCERR,CT=CT+1,^TMP("RCXM_344.5",$J,CT)=" "
117 I $O(@RCVAR@(""))'="" D
118 . S Z="" F S Z=$O(@RCVAR@(Z)) Q:Z="" D
119 .. I $G(@RCVAR@(Z))'="" S CT=CT+1,^TMP("RCXM_344.5",$J,CT)=@RCVAR@(Z)
120 .. I $O(@RCVAR@(Z,0)) S Z0="" F S Z0=$O(@RCVAR@(Z,Z0)) Q:Z0="" I Z0'="*" S CT=CT+1,^TMP("RCXM_344.5",$J,CT)=@RCVAR@(Z,Z0)
121 I RC["F" D
122 . N RCCT1
123 . S RCCT1=0
124 . K ^TMP($J,"PRCAZ_RAW"),^TMP($J,"PRCAZ_FMT1"),^TMP($J,"PRCAZ_FMT")
125 . D DISP("^RCY(344.5,"_RCTDA_",2)","^TMP($J,""PRCAZ_FMT1"")",1,"^TMP($J,""PRCAZ_FMT"")",75)
126 . S CT=CT+1,^TMP("RCXM_344.5",$J,CT)="FORMATTED DATA: "
127 . S Z=0 F S Z=$O(^TMP($J,"PRCAZ_FMT",Z)) Q:'Z S CT=CT+1,^TMP("RCXM_344.5",$J,CT)=^TMP($J,"PRCAZ_FMT",Z)
128 . S:RC["R" CT=CT+1,^TMP("RCXM_344.5",$J,CT)=" "
129 I RC["R" D
130 . S CT=CT+1,^TMP("RCXM_344.5",$J,CT)="RAW DATA: "
131 . S Z=0 F S Z=$O(^RCY(344.5,RCTDA,2,Z)) Q:'Z S CT=CT+1,^TMP("RCXM_344.5",$J,CT)=$G(^RCY(344.5,RCTDA,2,Z,0))
132 S XMBODY="^TMP(""RCXM_344.5"",$J)"
133 D
134 . N DUZ S DUZ=.5,DUZ(0)="@"
135 . D SENDMSG^XMXAPI(.5,$E(RCSUBJ,1,65),XMBODY,.XMTO,,.XMZ)
136 K ^TMP($J,"PRCAZ_RAW"),^TMP($J,"PRCAZ_FMT1"),^TMP($J,"PRCAZ_FMT"),^TMP("RCXM_344.5",$J)
137 Q
138 ;
139BULLEFT(RCTDA,RCXMG,RCSUBJ,RCERR) ; Send a bulletin for 'bad' EFT entries
140 ; RCTDA = ien of the entry in file 344.3
141 ; RCXMG = mail msg # for the EFT
142 ; RCSUBJ = subject of the bulletin
143 ; RCERR = error text in array
144 N XMBODY,XMB,XMINSTR,XMTYPE,XMFULL,XMTO,RCXM,XMZ,XMERR,Z,Z0,CT
145 S XMTO("I:G.RCDPE PAYMENTS EXCEPTIONS")="",CT=0
146 S CT=CT+1,RCXM(CT)="The following electronic EFT deposit was received at your site.",CT=CT+1,RCXM(CT)="It was received on: "_$$FMTE^XLFDT($$NOW^XLFDT(),2)_" in mail msg # "_RCXMG_"."
147 S CT=CT+1,RCXM(CT)="This message is sent to alert you to conditions regarding this EFT.",CT=CT+1,RCXM(CT)=" "
148 I $G(RCERR)'="" S CT=CT+1,RCXM(CT)=RCERR,CT=CT+1,RCXM(CT)=" "
149 I $O(RCERR(""))'="" D
150 . S Z="" F S Z=$O(RCERR(Z)) Q:Z="" D
151 .. I $G(RCERR(Z))'="" S CT=CT+1,RCXM(CT)=RCERR(Z)
152 .. I $O(RCERR(Z,0)) S Z0="" F S Z0=$O(RCERR(Z,Z0)) Q:Z0="" S CT=CT+1,RCXM(CT)=RCERR(Z,Z0)
153 S XMBODY="RCXM"
154 D
155 . N DUZ S DUZ=.5,DUZ(0)="@"
156 . D SENDMSG^XMXAPI(.5,$E(RCSUBJ,1,65),XMBODY,.XMTO,,.XMZ)
157 Q
158 ;
159DTXT(RCTDA,RCXM,RCNT) ; Add display text to array RCXM(CT)
160 ; RCTDA = ien of entry in file 344.5
161 ; Send RCNT and RCXM by reference for return values
162 N RCDIQ
163 D GETS^DIQ(344.5,RCTDA_",",1,"EN","RCDIQ")
164 D TXTDE^RCDPEX(RCTDA,.RCDIQ,1,.RCXM,.RCNT)
165 Q
166 ;
167BILLREF(RC3444,RC34441) ; Returns the bill # for the EOB in file 344.4, entry
168 ; number RC3444 and subfile entry RC34441
169 N RCARR
170 D DIQ34441^RCDPEDS(RC3444,RC34441,99,"RCARR")
171 Q $G(RCARR(344.41,RC34441,99,"E"))
172 ;
173GETBILL(DA) ; Called from computed field to find bill reference
174 ; Assumes DA(1)= ien of file 344.4, DA = ien of file 344.41
175 N Z,VAL
176 S Z=$G(^RCY(344.4,DA(1),1,DA,0))
177 I $P(Z,U,2) S VAL=$$BN1^PRCAFN(+$G(^IBM(361.1,+$P(Z,U,2),0))) ; IA 4051
178 I $G(VAL)="" S VAL=$P(Z,U,5)
179 Q VAL
180 ;
Note: See TracBrowser for help on using the repository browser.