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

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

initial load of FOIAVistA 6/30/08 version

File size: 8.5 KB
Line 
1IBCB1 ;ALB/AAS - Process bill after enter/edited ;2-NOV-89
2 ;;2.0;INTEGRATED BILLING;**70,106,51,137,161,182,155,327**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ;MAP TO DGCRB1
6 ;
7 ;IBQUIT = Flag to stop processing
8 ;IBVIEW = Flag for Bill has been viewed
9 ;IBDISP = Flag for Bill entering display been viewed.
10 ;
11 K ^UTILITY($J) I $D(IBAC),IBAC>1 G @IBAC
121 ;complete bill
13 D END,EDITS^IBCB2 G:IBQUIT END
14 ;
15 I '$$IICM^IBCB2(IBIFN) G END ; Ingenix ClaimsManager
16 I '$$IIQMED^IBCB2(IBIFN) G END ; DSS QuadraMed Claims Scrubber
17 ;
183 ;authorize bill/request MRA
19 I '$D(^XUSEC("IB AUTHORIZE",DUZ))!('$D(IBIFN)) W !!,"You do not hold the Authorize Key.",! G END
20 I '$P($G(^IBE(350.9,1,1)),"^",23),DUZ=$P(^DGCR(399,IBIFN,"S"),"^",2) W !!,"Entering user can not authorize.",! G END
21 I $P(^DGCR(399,IBIFN,"S"),"^",9) W !,"Already Approved, Can't change" G END
22 D:'$G(IBAC)!($G(IBAC)>1) EDITS^IBCB2 G:IBQUIT END
23 ;
24 I $G(IBAC)'=1,'$$IICM^IBCB2(IBIFN) G END ; Ingenix ClaimsManager
25 I $G(IBAC)'=1,'$$IIQMED^IBCB2(IBIFN) G END ; DSS QuadraMed Claims Scrubber
26 ;
27AUTH S IBMRA=$$REQMRA^IBEFUNC(IBIFN)
28 S IBEND=0
29 I IBMRA["R" D AUTH^IBCB11 G:IBEND END ;MRA normally required, but MEDIGAP ins co
30 ; doesn't want/need it or MRA parameter off
31 ;
32 W !!,"THIS BILL WILL "_$P("NOT ^",U,$$TXMT^IBCEF4(IBIFN)+1)_"BE TRANSMITTED ELECTRONICALLY"
33 W !!,"WANT TO ",$S('IBMRA:"AUTHORIZE BILL",1:"REQUEST AN MRA")," AT THIS TIME" S %=2 D YN^DICN G:%=-1!(%=2) END
34 I '% W !?4,"YES - If finished entering bill information and to allow bill to be printed or transmitted",!?4,"No - To take no action" G AUTH
35 S (DIC,DIE)=399,IBYY=$S('IBMRA:"@90",1:"@901"),DA=IBIFN,DR="[IB STATUS]" D ^DIE K DIC,DIE,IBYY D:$D(IBX3) DISAP^IBCBULL
36 I $S('IBMRA:'$P(^DGCR(399,IBIFN,"S"),"^",9),1:'$P($G(^DGCR(399,IBIFN,"TX")),U,6)) G END
37 ;
38 ; Update the review status for all EOB's on file
39 D STAT^IBCEMU2(IBIFN,3) ; Accepted - Complete EOB
40 ;
41 D AUTOCK^IBCEU2(IBIFN) ; Checks for need to add any codes to bill based on information already on bill, specifically for EDI purposes
42 S IBTXSTAT=$$TXMT^IBCEF4(IBIFN,,1) ;Determine transmit, whether live/test
43 I IBTXSTAT D I IBMRA D CTCOPY^IBCCCB(IBIFN,1) G END
44 .W !," Adding "
45 .W:+IBTXSTAT=2 "test " W "bill to BILL TRANSMISSION File"_$S('IBMRA:"",1:" for MRA submission")_".",!
46 .W:+IBTXSTAT=1&IBMRA " Bill is no longer editable unless returned in error from Medicare."
47 .S Y=$$ADDTBILL(IBIFN,+IBTXSTAT)
48 .W ! W:'$P(Y,U,3) *7 W $S($P(Y,U,3):" Bill will be submitted electronically",1:" Error loading into transmit file - bill can not be transmitted.")
49 .;
50 ;
51 W !,"Passing completed Bill to Accounts Receivable. Bill is no longer editable."
52 D ARPASS(IBIFN,1)
53 G:'$G(PRCASV("OKAY")) END
54 W !,"Completed Bill Successfully sent to Accounts Receivable." D FIND^IBOHCK(DFN,IBIFN)
55 ;
56 ; Check to see if any unreviewed status messages or EOBs on file and
57 ; what to do about them
58 N IBTXBARR
59 S IBRESUB=$$RESUB^IBCECSA4($S($G(IBCNCOPY):$P($G(^DGCR(399,IBIFN,0)),U,15),1:IBIFN),+IBTXSTAT,"E",.IBTXBARR)
60 I IBRESUB=2 D ; update review statuses to be 'review complete'
61 . N IBDA S IBDA=0
62 . F S IBDA=$O(IBTXBARR(IBDA)) Q:'IBDA D UPDEDI^IBCEM(IBDA,$S($G(IBCNCOPY):"R",1:"E"))
63 . Q
64 ;
65 K IBTXPRT
66 ;
674 ;generate/print bill
68 G:'$D(IBIFN) END
69 S:'$D(IBMRA) IBMRA=+$$NEEDMRA^IBEFUNC(IBIFN)
70 I 'IBMRA,'$P(^DGCR(399,IBIFN,"S"),"^",9) W !!,*7,"Not Authorized, Can Not Print!" G END
71 I IBMRA,'$P(^DGCR(399,IBIFN,"TX"),"^",6) W !!,*7,"Not Ready For MRA Submission, Can Not Print!" G END
72 S IBTXSTAT=$$TXMT^IBCEF4(IBIFN)
73 I IBMRA,$$NEEDMRA^IBEFUNC(IBIFN)'["R" W !!,*7,"MRA Submission not yet confirmed by Austin, Can Not Print!" Q:$S('IBTXSTAT:1,1:"XP"'[$P($G(^IBA(364,+$$LAST364^IBCEF4(IBIFN),0)),U,3))
74 I +IBTXSTAT,$D(^IBA(364,"ABDT",IBIFN)) S IBTXOK="" D I 'IBTXOK S %=2 G GENTX
75 . N IBX,IBTST
76 . S IBX=+$$LAST364^IBCEF4(IBIFN),IBTST=""
77 . I $$TEST^IBCEF4(IBIFN) S (IBTXOK,IBTST)=1
78 . I "XP"[$P($G(^IBA(364,IBX,0)),U,3) D:'IBTST Q
79 .. W !!,*7,"This Bill Can Not Be Printed Until Transmit Confirmed" W:IBMRA " (to request an MRA)" D:'$D(IBVIEW) VIEW^IBCB2
80 . W !!,"This Bill Has Already Been Transmitted" W:IBMRA " (to request an MRA)"
81 . S DIR("B")="Y",DIR("A")="WANT TO PRINT IT ANYWAY",DIR(0)="Y" D ^DIR K DIR Q:$D(DTOUT)!$D(DUOUT)!'Y S IBTXOK=1
82 D DISP^IBCB2
83 S:'$D(IBQUIT) IBQUIT=0
84 D:'$D(IBVIEW) VIEW^IBCB2 G:IBQUIT END
85 S IBPNT=$P(^DGCR(399,IBIFN,"S"),"^",12)
86GEN I $$TEST^IBCEF4(IBIFN) W !!,"THIS BILL IS BEING USED AS A TRANSMISSION TEST BILL"
87 W !!,"WANT TO ",$S(IBPNT]"":"RE-",1:""),"PRINT BILL AT THIS TIME" S %=2 D YN^DICN I %=-1 D:+$G(IBAC)=1 END,CTCOPY^IBCCCB(IBIFN) G END
88 I '% W !?4,"YES - to print the bill now",!?4,"NO - To take no action" G GEN
89GENTX I %'=1 D:+$G(IBAC)=1 END,CTCOPY^IBCCCB(IBIFN) G END
90 ;
91 ; Bill has never been printed. First time print.
92 I 'IBPNT D G END
93 . I $D(IBTXPRT) D TXPRTS
94 . D EN1^IBCF
95 . I $D(IBTXPRT) D TXPRT
96 . D MRA^IBCEMU1(IBIFN) ; Printing the MRA
97 . I +$G(IBAC)=1 D END,CTCOPY^IBCCCB(IBIFN)
98 . Q
99 ;
100 ; Below section is for re-prints
101RPNT G:$$NEEDMRA^IBEFUNC(IBIFN) END
102 R !!,"(2)nd Notice, (3)rd Notice, (C)opy or (O)riginal: C// ",IBPNT:DTIME S:IBPNT="" IBPNT="C" G:IBPNT["^" END
103 S IBPNT=$E(IBPNT,1) I "23oOcC"'[IBPNT W !?5,"Enter 'O' to reprint the original bill or",!?5,"Enter 'C' to reprint the bill as a duplicate copy or",!?5,"Enter '2' or '3' to print 2nd or 3rd follow-up notices." S IBPNT=1 G RPNT
104 W " (",$S("cC"[IBPNT:"COPY","oO"[IBPNT:"ORIGINAL",IBPNT=2:"2nd NOTICE",IBPNT=3:"3rd NOTICE",1:""),")"
105 I $D(IBTXPRT) D
106 . D TXPRTS
107 . I "oOcC"[IBPNT S IBRESUB=$$RESUB^IBCECSA4(IBIFN,1,"P")
108 S IBPNT=$S("oO"[IBPNT:1,"cC"[IBPNT:0,1:IBPNT)
109 D EN1X^IBCF D:$D(IBTXPRT) TXPRT
110 D MRA^IBCEMU1(IBIFN) ; Printing the MRA
111 ;
112 ;
113END K IBER,IBEND D END^IBCBB1 K IBQUIT,IBVIEW,IBDISP,IBST,IB,PRCAERCD,PRCAERR,PRCASVC,PRCAT,DGRA2,IBBT,IBCH,IBNDS,IBOA,IBREV,IBX,DGXRF1,PRCAORA,IBX3,DGBILLBS,DGII,DGVISCNT,DGFIL,DGTE,IBTXOK,IBTXSTAT,IBMRA,IBNOFIX
114 K %DT,DIC,DIE,I,J,X,Y,Y1,Y2,IBER,IBDFN,IBDSDT,IBJ,IBNDI1,IBZZ,VA,IBMA,IBXDT,DI,PRCAPAYR,DGBS,DGCNT,DGDA,DGPAG,DGREVC,DGRV,DGTEXT,DGTOTPAG,IBOPV,DGLCNT,DGTEXT1,DGRSPAC,DGSM,IBPNT,DGINPT,DGLL,IBCPTN,IBFL
115 K IBRESUB,IBOPV1,IBOPV2,IBCHG,DGBIL1,DGU,DDH,IBA1,IBINS,IBPROC,PRCARI K:'$D(PRCASV("NOTICE")) PRCASV
116 K ^TMP("IBXDATA",$J),^TMP("IBXEDIT",$J)
117 K IBCISNT,IBCISTAT,IBCIERR ; remove ClaimsManager variables
118 Q
119 ;
120TX1(IBX,RESUB) ; Transmit a single bill from file 364 entry # IBX
121 ; RESUB = flag (1 = resubmitting a bill, 0 = submitting bill 1st time)
122 ; Returns 1 if successfully extracted to mailman queue for transmission,
123 ; 0 if extract not successful
124 N IBTXOK,IBVVSAVE
125 K ^TMP("IBRESUBMIT",$J),^TMP("IBONE",$J)
126 S IBVVSAVE("IBX")=IBX,^TMP("IBONE",$J)=+$G(RESUB),^($J,IBX)=""
127 D ONE^IBCE837
128 S IBX=IBVVSAVE("IBX")
129 I $P($G(^IBA(364,IBX,0)),U,3)="P" S IBTXOK=1
130 K ^TMP("IBONE",$J)
131 Q $G(IBTXOK)
132 ;
133ARONLY(IBIFN) ; Pass bill to A/R, but that's all
134 D ARPASS(IBIFN,0)
135 Q
136 ;
137ARPASS(IBIFN,UPDOK) ;Pass bill to A/R as NEW BILL
138 ;IBIFN = bill entry #
139 ;UPDOK = flag 1: if error going to A/R, allow interactive edit
140 ; 0: send bulletin to IB EDI for error going to A/R
141 Q:+$$STA^PRCAFN(+IBIFN)'=201 ;Must not have been sent previously
142 D GVAR^IBCBB
143 ;Can't be an ins co that won't reimburse
144 Q:$S($P($G(^DGCR(399,IBIFN,0)),U,11)="i":'IBNDMP,1:0)
145 D ARRAY^IBCBB1,^PRCASVC6
146 D REL^PRCASVC:$G(PRCASV("OKAY"))
147 I '$G(PRCASV("OKAY")) D
148 . N IBQUIT,IBQUIT1
149 . S IBQUIT=0
150 . I $G(UPDOK) D Q
151 .. F D Q:IBQUIT
152 ... D DSPARERR^IBCB2("")
153 ... Q:IBQUIT
154 ... I $$ASKEDIT^IBCB2($G(IBAC)) D VIEW1^IBCB2 Q
155 ... S IBQUIT=1
156 . N XMSUB,XMY,XMTEXT,XMDUZ,IBT
157 . S XMSUB="ERROR PASSING BILL TO A/R ON CONFIRMATION",XMTEXT="IBT(",XMY="G.IB EDI",XMDUZ=.5
158 . S IBT(1)="A problem has been detected while trying to pass bill "_$P($G(^DGCR(399,IBIFN,0)),U)_" to"
159 . S IBT(2)="Accounts Receivable when updating the bill's electronic confirmation."
160 . S IBT(3)="Please use the option PASS BILL TO A/R to complete this process."
161 . D ^XMD
162 Q
163 ;
164ADDTBILL(IBIFN,TXST) ; Add new transmit bill rec to file 364 for bill IBIFN
165 ; TXST = test flag 1=live, 2=test
166 N COB,DD,DO,DIC,DLAYGO,X
167 S TXST=($G(TXST)/2\1),COB=$$COB^IBCEF(IBIFN)
168 S DIC(0)="L",DIC="^IBA(364,",DLAYGO=364,X=IBIFN,DIC("DR")=".03///X;.04///NOW;.07////"_TXST_";.08////"_COB D FILE^DICN
169 Q Y
170 ;
171TXPRTS ; Save off last print date to see if bill was reprinted without queueing
172 I '$$NEEDMRA^IBEFUNC(IBIFN) S IBTXPRT("PRT")=$P($G(^DGCR(399,IBIFN,"S")),U,14)
173 Q
174 ;
175TXPRT ; Set variable if print was tasked or bill was printed (last print date changed)
176 I '$$NEEDMRA^IBEFUNC(IBIFN),$S($G(ZTSK):1,1:IBTXPRT("PRT")'=$P($G(^DGCR(399,IBIFN,"S")),U,14)) S IBTXPRT=1
177 Q
178 ;
Note: See TracBrowser for help on using the repository browser.