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

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

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1IBNCPEB ;WOIFO/AAT - BULLETINS FOR NCPDP ;05-NOV-04
2 ;;2.0;INTEGRATED BILLING;**276,342,347,363**;21-MAR-94;Build 35
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 Q
5 ;
6BULL(DFN,IBD,IBERR,IBIFN) ;Process NCPDP Error Messages.
7 N IBC,IBT,IBPT,XMSUB,XMY,XMTEXT,XMDUZ,IBMSGT,IBI,IBGRP,IBDUZ,IBRXNO,DRGNM
8 ; Input: same as RX^IBNCPDP2()
9 ;
10 S IBDUZ=$G(IBD("FILLED BY"))
11 S IBRXNO=$G(IBD("RX NO"),"UNKNOWN")
12 S IBPT=$$PT^IBEFUNC(DFN)
13 S XMSUB="NCPDP BILLING ERROR - RX #"_IBRXNO
14 S IBC=0
15 D T("An error occurred while creating IB Third Party Bill for RX #"_IBRXNO)
16 I $G(IBIFN) D T("IB Bill #"_$P($G(^DGCR(399,+IBIFN,0)),U)_" created with errors.")
17 D T()
18 D T("The following error was encountered: "_$P(IBERR,U,2))
19 D T()
20 D T(" Patient: "_$S($L(IBPT):$P(IBPT,U)_" Pt. ID: "_$P(IBPT,U,2),1:"Not Defined"))
21 D T(" Rx filled by: "_$P($G(^VA(200,+IBDUZ,0)),U))
22 D T(" Prescription: "_IBRXNO)
23 D T(" Fill Number: "_$G(IBD("FILL NUMBER")))
24 D T(" Fill Date: "_$G(IBD("FILL DATE")))
25 D T(" Group Plan: "_$P($G(^IBA(355.3,+$G(IBD("PLAN")),0)),U)_" (IEN="_+$G(IBD("PLAN"))_")")
26 D ZERO^IBRXUTL(+$G(IBD("DRUG"))) S DRGNM=^TMP($J,"IBDRUG",+$G(IBD("DRUG")),.01)
27 D T(" Drug: "_DRGNM)
28 D T("Amount Billed: "_$J($G(IBD("BILLED")),5,2))
29 D T(" Amount Paid: "_$J($G(IBD("PAID")),5,2))
30 D T()
31 D T("Please review the circumstances surrounding this error and make necessary")
32 D T("corrections.")
33 S XMDUZ="INTEGRATED BILLING PACKAGE",XMTEXT="IBT("
34 S XMY("G.IBCNR EPHARM")=""
35 D ZXMD
36 K ^TMP($J,"IBDRUG")
37 Q
38 ;
39 ;call mailman in background (using taskman)
40ZXMD ;
41 N ZTIO,ZTRTN,ZTDTH,ZTSAVE,ZTDESC
42 N %,%H,%I,X
43 D NOW^%DTC
44 S ZTIO="",ZTDTH=%,ZTDESC="NCPDP BILLING ERROR BULLETIN"
45 S ZTSAVE("IBT*")="",ZTSAVE("XM*")=""
46 S ZTRTN="^XMD"
47 D ^%ZTLOAD
48 Q
49 ;
50T(IBTXT) ; Add text to the message
51 S IBC=IBC+1,IBT(IBC)=$G(IBTXT," ")
52 Q
53 ;
54 ;-------------------------
55 ;Release charges off hold bulletin
56RELBUL(DFN,IBRX,IBFIL,IBADT,IBACT,IBCR,IBCC,IBIFN,IBRETR) ;
57 ; Input:
58 ; DFN - Patient
59 ; IBRX - Rx IEN
60 ; IBFIL - Refill#
61 ; IBADT - Fill date
62 ; IBACT
63 ; -1 if ^IBR error - when the charge was sent to AR
64 ; 0 == charge was not found
65 ; IBCR - Close Reason code (.01 of BPS CLOSE REASON)
66 ; IBCC - Close Reason Comment
67 ; IBIFN - 3rd party bill IEN
68 ; IBRETR - attempt # after which a bulletion was sent
69 N IBT,IBC,IBGRP,XMSUB,XMDUZ,XMY,XMTEXT,VAERR,VADM,X,VA
70 N IBNAME,IBAGE,IBPID,IBBID,IBRXN
71 D DEM^VADPT ; get patient demographic data
72 I VAERR K VADM
73 S IBNAME=$$PR($G(VADM(1)),26)
74 S IBAGE=$$PR($G(VADM(4)),3)
75 S IBPID=$G(VA("PID"))
76 S IBBID=$G(VA("BID"))
77 S XMSUB=$E(IBNAME,1,8)_"("_IBBID_")"_" PATIENT CHRG NOT RELEASED"_"-"_$E($P($$MCDIV(IBRX,IBFIL),U),1,11)
78 ;
79 S IBC=0
80 ;include a standard CHRG NOT RELEASED text
81 D T("The following charge has not been released from HOLD. Copay was not released")
82 D T("due to technical problems"_$S($G(IBACT)=-1:" with passing the payment to AR.",1:"."))
83 D T("Please review manually and release if necessary.")
84 ;if release of copay attempt was due to claim closing process - include a close reason
85 I IBCR D T("Note: the e-pharmacy claim was closed by OPECC as '"_$$REASON^IBNCPDPU(IBCR)_"'")
86 I $G(IBCC)'="" D T("Additional comment: "_IBCC)
87 D T()
88 D T("Name: "_IBNAME_" Age : "_IBAGE_" Pt. ID: "_IBPID)
89 S IBRXN=$$FILE^IBRXUTL(IBRX,.01)
90 D T("Rx #: "_$$PR(IBRXN_$S(IBFIL:" ("_IBFIL_")",1:""),28)_" Fill Dt: "_$$DAT1^IBOUTL(IBADT))
91 D T()
92 D:$G(IBRETR)>0 T("Attempts to release a copay from hold: "_$G(IBRETR))
93 ;D CHRG
94 ; Transmit mail
95 S XMDUZ="INTEGRATED BILLING PACKAGE",XMTEXT="IBT("
96 S XMY("G.IBCNR EPHARM")=""
97 D ^XMD
98 Q
99 ;
100CHRG ; gets charge data and sets up charge lines
101 N IBTYP,IBFR,IBTO,IBX,IBX1,IBRXN,IBRF,IENS
102 S IBX=$G(^IB(IBACT,0))
103 S IBX1=$G(^IB(IBACT,1))
104 S IBFR=$$DAT1^IBOUTL($S($P(IBX,U,14)'="":($P(IBX,U,14)),1:$P(IBX1,U,2)))
105 S IBTO=$$DAT1^IBOUTL($S($P(IBX,U,15)'="":($P(IBX,U,15)),1:$P(IBX1,U,2)))
106 S IBRXN=$$FILE^IBRXUTL(IBRX,.01) ;$P($P(IBX,U,8),"-")
107 S IBTYP=$P(IBX,U,3)
108 S:IBTYP IBTYP=$P($G(^IBE(350.1,IBTYP,0)),U,3)
109 S:IBTYP IBTYP=$P($$CATN^PRCAFN(IBTYP),U,2)
110 D T("Type: "_$$PR(IBTYP,28)_" Amount : $"_$J(+$P(IBX,U,7),0,2))
111 D T("From: "_$$PR(IBFR,28)_" To : "_IBTO)
112 D T("Rx #: "_$$PR(IBRXN_$S(IBFIL:" ("_IBFIL_")",1:""),28)_" Fill Dt: "_$$DAT1^IBOUTL(IBADT))
113 D T()
114 D T("REFERENCE NUMBER : "_$P(IBX,U))
115 D T("FIRST PARTY BILL : "_$P(IBX,U,11))
116 I $G(IBIFN) D T("THIRD PARTY BILL : "_$P($G(^PRCA(430,+IBIFN,0)),U))
117 Q
118 ;
119PR(STR,LEN) ; pad right
120 N B S STR=$E(STR,1,LEN),$P(B," ",LEN-$L(STR))=" "
121 Q STR_$G(B)
122 ;
123 ;MC Division for the IB
124MCDIV(IBRX,IBFIL) ; Get MC DIVISION name from the Rx/Fill
125 N IBDIV,IBINST,IBMCDIV,IBNAM,IBUNK,PSOFILE,DIR,DIQ,DA,DR,DFN,DIC
126 S IBUNK="DIV UNKNWN"
127 ; outpatient division
128 S DFN=$$FILE^IBRXUTL(IBRX,2)
129 I '$G(IBFIL) S IBDIV=$$FILE^IBRXUTL(IBRX,20)
130 E S IBDIV=+$P($$ZEROSUB^IBRXUTL(DFN,IBRX,IBFIL),U,9)
131 I 'IBDIV Q IBUNK
132 ; related institution
133 S PSOFILE=59,DIC=59,DIQ="IBRXARR",DIQ(0)="I",DA=IBDIV,DR=100
134 D DIQ^PSODI(PSOFILE,DIC,DR,DA,.DIQ)
135 S IBINST=$G(IBRXARR(59,DA,100,"I")) Q:'IBINST IBUNK
136 S IBMCDIV=+$O(^DG(40.8,"AD",IBINST,0)) ; medical center division
137 I 'IBMCDIV Q IBUNK
138 S IBNAM=$P($G(^DG(40.8,IBMCDIV,0)),U)
139 K IBRXARR,PSODIY
140 Q $S(IBNAM="":IBUNK,1:IBNAM)_U_IBMCDIV
141 ;
142 ;IBNCPEB
Note: See TracBrowser for help on using the repository browser.