source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCECSA1.m@ 1791

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

initial load of FOIAVistA 6/30/08 version

File size: 6.5 KB
Line 
1IBCECSA1 ;ALB/CXW - IB STATUS AWAITING RESOLUTION SCREEN ;28-JUL-99
2 ;;2.0;INTEGRATED BILLING;**137,283,288,320,368**;21-MAR-94;Build 21
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ; DBIA for $$BN1^PRCAFN()
5 ;
6BLD ; Build list entrypoint
7 N IBDA,IBREV,IBIFN,IBPAY,IBSSN,IBSER,IB399,IBLOC,IBDIV,IBUER,IBMSG,IBERR,IBPEN,SEVERITY,A,IBOAM,IBPAT,IBSTSMSG,SV1,SV2,SV3
8 K ^TMP("IBCECSA",$J),^TMP("IBCECSB",$J),^TMP("IBCECSD",$J)
9 W !!,"Compiling CSA status messages ... "
10 S IBSEV=$G(IBSEV,"R")
11 S VALMCNT=0,IB364=""
12 S SEVERITY=""
13 F S SEVERITY=$O(^IBM(361,"ACSA",SEVERITY)) Q:SEVERITY="" I SEVERITY="R"!(IBSEV="B") S IBREV="" F S IBREV=$O(^IBM(361,"ACSA",SEVERITY,IBREV)) Q:IBREV="" I IBREV<2 S IBDA=0 F S IBDA=$O(^IBM(361,"ACSA",SEVERITY,IBREV,IBDA)) Q:'IBDA D
14 . S IB=$G(^IBM(361,IBDA,0)),IBIFN=+IB
15 . S IBPEN=$$FMDIFF^XLFDT(DT,$P(IB,U,2),1)
16 . ;quit if not pending for at least the minimum # of days requested
17 . Q:IBDAYS>IBPEN
18 . S IB399=$G(^DGCR(399,IBIFN,0))
19 . ;
20 . ; no cancelled claims allowed on the CSA screen
21 . ; if we find one, then update the appropriate EDI files
22 . I $P(IB399,U,13)=7 D UPDEDI^IBCEM(+$P(IB,U,11),"C") Q
23 . ;
24 . ; automatically review this message if the claim was last printed on
25 . ; or after the MCS - 'Resubmit by Print' date
26 . I $P(IB,U,16),($P($G(^DGCR(399,IBIFN,"S")),U,14)\1)'<$P(IB,U,16) D UPDEDI^IBCEM(+$P(IB,U,11),"P") Q
27 . ;
28 . S IBDIV=+$P(IB399,U,22)
29 . S IBUER=+$P($G(^DGCR(399,IBIFN,"S")),U,11)
30 . ;
31 . ; If Request MRA bill, pull the MRA Requestor user instead
32 . I 'IBUER,$P(IB399,U,13)=2 S IBUER=+$P($G(^DGCR(399,IBIFN,"S")),U,8)
33 . I $D(^TMP("IBBIL",$J)),'$D(^TMP("IBBIL",$J,IBUER)) Q ; User not selected
34 . I $D(^TMP("IBDIV",$J)),'$D(^TMP("IBDIV",$J,IBDIV)) Q ; Div not selected
35 . ;
36 . S IBPAY=$P($G(^DIC(36,+$P($G(^DGCR(399,IBIFN,"MP")),U),0)),U)
37 . I IBPAY="" S IBPAY=$P($G(^DIC(36,+$$CURR^IBCEF2(IBIFN),0)),U)
38 . I IBPAY="" S IBPAY="UNKNOWN PAYER"
39 . S IBPAT=$G(^DPT(+$P(IB399,U,2),0))
40 . S IBSSN=$E($P(IBPAT,U,9),6,9) I IBSSN="" S IBSSN="~unk"
41 . S IBPAT=$P(IBPAT,U,1) I IBPAT="" S IBPAT="~UNKNOWN PATIENT NAME"
42 . S IBSER=$P($G(^DGCR(399,IBIFN,"U")),U)
43 . S IBLOC=$P(IB399,U,4)
44 . S IBLOC=$S(IBLOC=1:"HOSPITAL",IBLOC=2:"SKILLED NURSING",1:"CLINIC")
45 . I IBDIV S IBDIV=$P($G(^DG(40.8,IBDIV,0)),U)
46 . I IBDIV=""!(IBDIV=0) S IBDIV="UNSPECIFIED"
47 . S IBMSG=$S($P(IB,U,8):"PAYER",1:"NON-PAYER")
48 . S IBUER=$S(IBUER:$P($G(^VA(200,IBUER,0)),U),1:"UNKNOWN")_"~"_IBUER
49 . S IB364=$P(IB,U,11)
50 . S IBOAM=$G(^DGCR(399,IBIFN,"U1"))
51 . S IBOAM=$P(IBOAM,U,1)-$P(IBOAM,U,2) ; current balance (total charges - offset)
52 . ;
53 . S IBSTSMSG=$$TXT(IBDA) ; status message text
54 . S IBERR=$E(IBSTSMSG,1,60)
55 . I IBERR="" S IBERR="-"
56 . ;
57 . S IB=$$BN1^PRCAFN(IBIFN) ; external bill#
58 . S A=IBIFN_U_IBPAY_U_IBPAT_U_IBSSN_U_IBSER_U_IBOAM_U_IBLOC_U_IBDIV_U_IBUER_U_IBMSG_U_IBPEN_U_$S(IBREV:"*",1:"")_U_IB364_U_IB
59 . ;
60 . S SV1=$$SRTV($G(IBSORT1),IBDA)
61 . S SV2=$$SRTV($G(IBSORT2),IBDA)
62 . S SV3=$$SRTV($G(IBSORT3),IBDA)
63 . S ^TMP("IBCECSB",$J,SV1,SV2,SV3,IBDA)=A
64 . S ^TMP("IBCECSB",$J,SV1,SV2,SV3,IBDA,"MSG")=IBSTSMSG
65 . Q
66 ;
67 I '$D(^TMP("IBCECSB",$J)) D NMAT Q
68 D SCRN
69 Q
70 ;
71NMAT ;No CSA list
72 S VALMCNT=2,IBCNT=2
73 S ^TMP("IBCECSA",$J,1,0)=" "
74 S ^TMP("IBCECSA",$J,2,0)="No Messages Matching Selection Criteria Found"
75 Q
76 ;
77SRTV(SORT,IBDA) ; sort value calculation given the sort code letter
78 I SORT="" Q IBDA
79 Q $$SV^IBCECSA(SORT)
80 ;
81SCRN ;
82 NEW IBSRT1,IBSRT2,IBSRT3,IBX,IBCNT,IBIFN,IBDA,IB,INFX,DAT,X
83 W !,"Building the CSA list display ... "
84 S IBCNT=0,IBSRT1=""
85 F S IBSRT1=$O(^TMP("IBCECSB",$J,IBSRT1)) Q:IBSRT1="" D
86 . D SRTBRK(1,$G(IBSORT1),IBSRT1)
87 . S IBSRT2=""
88 . F S IBSRT2=$O(^TMP("IBCECSB",$J,IBSRT1,IBSRT2)) Q:IBSRT2="" D
89 .. D SRTBRK(2,$G(IBSORT2),IBSRT2)
90 .. S IBSRT3=""
91 .. F S IBSRT3=$O(^TMP("IBCECSB",$J,IBSRT1,IBSRT2,IBSRT3)) Q:IBSRT3="" D
92 ... D SRTBRK(3,$G(IBSORT3),IBSRT3)
93 ... S IBDA=0
94 ... F S IBDA=$O(^TMP("IBCECSB",$J,IBSRT1,IBSRT2,IBSRT3,IBDA)) Q:'IBDA D
95 .... S IB=$G(^TMP("IBCECSB",$J,IBSRT1,IBSRT2,IBSRT3,IBDA))
96 .... S IBSTSMSG=$G(^TMP("IBCECSB",$J,IBSRT1,IBSRT2,IBSRT3,IBDA,"MSG"))
97 .... S IBIFN=+IB
98 .... S IB364=$P(IB,U,13)
99 .... S DAT=IBIFN_U_IBDA_U_IBSRT1_U_IBSRT2_U_IB364_U_IBSRT3
100 .... ;
101 .... S IBCNT=IBCNT+1
102 .... S X=$$SETFLD^VALM1($J(IBCNT,3),"","NUMBER")
103 .... D SETL1(IB,.X)
104 .... D SET(X,IBCNT,DAT)
105 .... ;
106 .... S X=$$SETSTR^VALM1(IBSTSMSG,"",6,75)
107 .... D SET(X,IBCNT,DAT)
108 .... Q
109 ... Q
110 .. Q
111 . Q
112 Q
113 ;
114SRTBRK(LVL,SORT,IBSRT) ; sort break for display of certain sort data
115 ; LVL - sort level
116 ; SORT - sort letter code
117 ; IBSRT - subscript data
118 ;
119 NEW IBS,DSPDATA
120 I '$F(".A.D.N.","."_$G(SORT)_".") G SRTBRKX
121 S IBS=$$SD^IBCECSA(SORT)
122 S DSPDATA=IBSRT
123 I SORT="A" S DSPDATA=$P(DSPDATA,"~",1) ; biller name
124 I SORT="N" S DSPDATA=-DSPDATA ; number of days pending
125 D SET($J("",LVL-1)_IBS_": "_DSPDATA,IBCNT,"")
126SRTBRKX ;
127 Q
128 ;
129SET(X,CNT,DAT) ;set up list manager screen array
130 S VALMCNT=VALMCNT+1
131 I 'CNT S CNT=1
132 S ^TMP("IBCECSA",$J,VALMCNT,0)=X
133 S ^TMP("IBCECSA",$J,"IDX",VALMCNT,CNT)=""
134 I DAT'="" S ^TMP("IBCECSA",$J,CNT)=VALMCNT_U_DAT
135 Q
136 ;
137SETL1(IB,X) ;
138 S X=$$SETFLD^VALM1($P($G(^DGCR(399,+IB,0)),U,1)_$P(IB,U,12),X,"BILL")
139 S X=$$SETFLD^VALM1($P(IB,U,2),X,"PNAME")
140 S X=$$SETFLD^VALM1($P(IB,U,3),X,"PANAME")
141 S X=$$SETFLD^VALM1($P(IB,U,4),X,"SSN")
142 S X=$$SETFLD^VALM1($$FMTE^XLFDT($P(IB,U,5),"2Z"),X,"SERVICE")
143 S X=$$SETFLD^VALM1($J("$"_$FN($P(IB,U,6),"",2),10),X,"CURBAL")
144 Q
145 ;
146TXT(IBDA,LEN) ; Return a string of status message text
147 ; IBDA - ien to file 361
148 ; LEN - desired maximum length of combined text string
149 NEW MSG,LN,STOP,TX,HLN,REFN,DELIM
150 S MSG="",LN=0,LEN=$G(LEN,75),STOP=0
151 F S LN=$O(^IBM(361,+$G(IBDA),1,LN)) Q:'LN D Q:STOP
152 . S TX=$G(^IBM(361,IBDA,1,LN,0))
153 . S TX=$$TRIM^XLFSTR(TX)
154 . ; Don't include parts added by ^IBCE277
155 . Q:TX="Informational Message:"
156 . Q:TX="Warning Message:"
157 . Q:TX="Error Message:"
158 . I $E(TX,1,27)="Clearinghouse Trace Number:" S STOP=1 Q
159 . I $E(TX,1,18)="Payer Status Date:" S STOP=1 Q
160 . I $E(TX,1,19)="Payer Claim Number:" S STOP=1 Q
161 . I $E(TX,1,12)="Split Claim:" S STOP=1 Q
162 . I $E(TX,1,11)="Claim Type:" S STOP=1 Q
163 . I $E(TX,1,8)="Patient:" S STOP=1 Q
164 . I $E(TX,1,14)="Service Dates:" S STOP=1 Q
165 . I $E(TX,1,11)="Payer Name:" S STOP=1 Q
166 . I $E(TX,1,7)="Source:" S STOP=1 Q
167 . I TX["HL=" S HLN=+$P(TX,"HL=",2),DELIM="HL="_HLN,TX=$P(TX,DELIM,1)_"HL= "_$P(TX,DELIM,2,9)
168 . I TX["ENVOY REF: " S REFN=$E($P(TX,"ENVOY REF: ",2),1,14),DELIM="ENVOY REF: "_REFN,TX=$P(TX,DELIM,1)_"ENVOY REF: "_$P(TX,DELIM,2,9)
169 . I ($L(MSG)+$L(TX))>500 S STOP=1 Q
170 . S MSG=MSG_$S(MSG="":"",1:" ")_TX
171 . I $L(MSG)>LEN S STOP=1
172 . Q
173 Q $E(MSG,1,LEN)
174 ;
Note: See TracBrowser for help on using the repository browser.