source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCCCB0.m@ 1310

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

initial load of WorldVistAEHR

File size: 7.0 KB
Line 
1IBCCCB0 ;ALB/ARH - COPY BILL FOR COB (OVERFLOW) ;06-19-97
2 ;;2.0;INTEGRATED BILLING;**51,137,155**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5DSPRB(IBIFN) ; display related bills
6 ;
7 N IBCOB,IBI,IBLABEL,IBJ,IBK,IBINS,IBAR,IBDS Q:'$G(IBIFN)
8 S IBDS="------------------------------------------------------------------"
9 D BCOB^IBCU3(IBIFN,.IBCOB) I $O(IBCOB(0)) D
10 . W !!!,?13,"Payer Responsible",?33,"Bill #",?41,"Status",?49,"Original",?59,"Collected",?72,"Balance",!,?13,IBDS
11 . S IBI=0 F S IBI=$O(IBCOB(IBI)) Q:'IBI D
12 .. S IBLABEL=$S(IBI=1:"Primary",IBI=2:"Secondary",IBI=3:"Tertiary",1:"Other")_":",IBLABEL=$J(IBLABEL,10)
13 .. S IBJ=0 F S IBJ=$O(IBCOB(IBI,IBJ)) Q:'IBJ D
14 ... S IBK="" F S IBK=$O(IBCOB(IBI,IBJ,IBK)) Q:IBK="" D
15 .... S IBINS=$G(^DIC(36,+IBJ,0))
16 .... W !," ",IBLABEL,?13,$E($P(IBINS,U),1,18) S IBLABEL="" Q:'IBK
17 .... S IBAR=$$BILL^RCJIBFN2(IBK)
18 .... W ?33,$P($G(^DGCR(399,+IBK,0)),U)
19 .... W ?43,$P($$STNO^RCJIBFN2(+$P(IBAR,U,2)),U,2)
20 .... W ?47,$J($P(IBAR,U),10,2)
21 .... W ?58,$J($P(IBAR,U,4),10,2)
22 .... W ?69,$J($P(IBAR,U,3),10,2)
23 I +$$IB^IBRUTL(IBIFN,0) W !!,?8,"* There are patient bills on Hold for the date range of this bill."
24 W !!
25 Q
26 ;
27CTCOPY(IBIFN,IBMRA) ; based on the type of bill, copy it without cancelling
28 ; IBMRA = 1 if an MRA bill and copy for prof components is desired
29 ;
30 N IB0,IBCTYPE I +$G(IBCBCOPY) Q
31 S IB0=$G(^DGCR(399,+$G(IBIFN),0)),IBCTYPE=+$P(IB0,U,27) Q:'IBCTYPE
32 I $S('$G(IBMRA):$P(IB0,U,21)'=$E($$BINS^IBCU3(+$G(IBIFN))),1:0) Q ; don't copy if not first in series, current payer=first payer and not an MRA
33 I IBCTYPE=1 D CTCOPY1(IBIFN) Q
34 I IBCTYPE=2 D CTCOPY2(IBIFN) Q
35 Q
36 ;
37CTCOPY1(IBIFN) ; Copy a Reasonable Charges inst bill to create a prof bill:
38 ; - Billing Rate must be Reasonable Charges
39 ; - Bill being copied must be an inst bill
40 ; - Prof bill must not already exist for the event date
41 ; - If the bill is outpt at least one CPT must have prof charges
42 ; - Procedure codes are copied only if the care is outpt
43 ;
44 N IB0,IBU,IBBTYPE,IBBCTO,IBBCTN,IBBCTOD,IBBCTND,IBNOCPT,IBCTCOPY,IBX,IBHV,IBNOTC
45 ;
46 S IBCTCOPY=1 ; flag - the copy function entered to auto copy Inst->Prof
47 ;
48 S IB0=$G(^DGCR(399,+$G(IBIFN),0)) Q:IB0="" S IBU=$G(^("U")) Q:'IBU
49 S IBBTYPE=$S($P(IB0,U,5)<3:"Inpatient",1:"Outpatient")
50 ;
51 S IBBCTO=$P(IB0,U,27),IBBCTN=0 I 'IBBCTO Q
52 I IBBCTO=1 S IBBCTN=2 ; inst defined, create prof
53 I 'IBBCTN Q
54 ;
55 I '$$BILLRATE^IBCRU3($P(IB0,U,7),$P(IB0,U,5),$P(IBU,U,1,2),"RC") Q ; copy only reasonable charges bills
56 ;
57 S IBBCTOD=$S(IBBCTO=1:"INSTITUTIONAL",2:"PROFESSIONAL"),IBBCTND=$S(IBBCTN=1:"INSTITUTIONAL",2:"PROFESSIONAL")
58 ;
59 I $P(IB0,U,5)>2,'$$CPTCHG^IBCRCU1(IBIFN,"PROF") W !!!,"There are no Reasonable Charges Outpatient Professional charges for this bill,",!,"second bill not created.",!! Q
60 ;
61 W !!!,"This ",IBBTYPE," ",IBBCTOD," bill may have corresponding ",IBBCTND," charges."
62 ;
63 I '$G(^DGCR(399,IBIFN,"U1")) W !!,"The current bill has no charges defined, no second bill created." Q
64 ;
65 S IBX=$$CTCHK^IBCU41(IBIFN) I +IBX W !!,"There is an existing ",IBBTYPE," ",IBBCTND," bill (",$P($G(^DGCR(399,+IBX,0)),U,1),") that appears",!,"to correspond to this ",IBBCTOD," bill, second bill not created.",!! Q
66 ;
67 W !,"Creating an ",IBBTYPE," ",IBBCTND," bill.",!!
68 ;
69 S IBCOB(0,27)=IBBCTN
70 S IBIDS(.15)=IBIFN D KVAR^IBCCCB
71 ;
72 I $P(IB0,U,5)<3 S IBNOCPT=1 ; do not copy inpt facility procedures (ICD) to inpt prof bill
73 S IBNOTC=1 ; don't copy TC modifier from inst to prof bill
74 D STEP2^IBCCC ; copy/create second bill
75 ;
76 I $G(IBHV("IBIFN1"))!(IBCTCOPY=1) D FTPRV^IBCEU5(+$G(IBHV("IBIFN1")),1) ; Change att to rend prov if new prof bill added
77 S IBV=0,IBAC=1
78 ;
79 ; DSS QuadraMed Interface: CPT Sequence and Diagnosis Linkage
80 I +$G(IBHV("IBIFN1")),$$QMED^IBCU1("CTCOPY^VEJDIBE1",IBHV("IBIFN1")) D CTCOPY^VEJDIBE1(IBHV("IBIFN1"))
81 Q
82 ;
83CTCOPY2(IBIFN) ; Copy a Reasonable Charges prof bill to create another prof bill if user wants another:
84 ; - Billing Rate must be Reasonable Charges
85 ; - Bill being copied must be a prof bill
86 ; - Procedures are not copied
87 ;
88 N IB0,IBU,IBBTYPE,IBBCTO,IBNOCPT,IBCTCOPY,IBX,DIR,DIRUT,DUOUT,DTOUT,X,Y
89 ;
90 S IBCTCOPY=2 ; flag indicating the copy function is entered to auto Copy prof->prof
91 ;
92 S IB0=$G(^DGCR(399,+$G(IBIFN),0)) Q:IB0="" S IBU=$G(^("U")) Q:'IBU
93 S IBBTYPE=$S($P(IB0,U,5)<3:"Inpatient",1:"Outpatient")
94 S IBBCTO=$P(IB0,U,27) I IBBCTO'=2 Q ; prof bills only
95 ;
96 I '$$BILLRATE^IBCRU3($P(IB0,U,7),$P(IB0,U,5),$P(IBU,U,1,2),"RC") Q ; copy only reasonable charges bills
97 ;
98 I '$G(^DGCR(399,IBIFN,"U1")) Q ; if the current bill has no charges do not allow creation of another one
99 ;
100 ; ask if they want a second prof bill
101 S DIR("?",1)="If answered Yes, the current bill will be copied, without being cancelled,"
102 S DIR("?",2)="to create another Professional bill for the same dates of care.",DIR("?",3)=" "
103 S DIR("?")="Enter Yes if multiple professional bills are needed for the care provided on this date."
104 S DIR("A")="Copy this bill to create another Professional bill for this date now"
105 W !! S DIR(0)="Y",DIR("B")="No" D ^DIR I $D(DIRUT)!('Y) Q
106 ;
107 W !,"Creating an ",IBBTYPE," Professional bill.",!!
108 ;
109 S IBIDS(.15)=IBIFN D KVAR^IBCCCB
110 ;
111 S IBNOCPT=1
112 D STEP2^IBCCC ; copy/create second prof bill
113 S IBV=0,IBAC=1
114 Q
115 ;
116 ;
117FINALEOB(IBIFN) ; Returns 1 if user indicates final EOB has been received
118 ; from prior payer
119 N DIR,X,Y,IBOK
120 S IBOK=0
121 I '$$MCRONBIL^IBEFUNC(IBIFN) D G FEOBQ
122 . S DIR(0)="YA",DIR("B")="NO",DIR("A")="Has the final EOB been received for this claim?: "
123 . S DIR("?",1)="COB should not normally be performed until the claim is fully processed by the",DIR("?",2)="prior payer. Enter Y (yes) if the prior payer's final EOB has",DIR("?")="been received"
124 . D ^DIR K DIR
125 . I Y'=0 S IBOK=$S(Y>0:1,1:0)
126 I $$SPLTMRA^IBCEMU1(IBIFN)=1 D G FEOBQ
127 . W !!," Only one MRA has been received for this claim. The MRA on file indicates"
128 . W !," that it is a 'split MRA' meaning that additional MRA's are needed."
129 . W !," Processing cannot continue until all MRA's have been received for this claim."
130 . W ! S DIR(0)="E" D ^DIR K DIR
131 . Q
132 ;
133 I $$SPLTMRA^IBCEMU1(IBIFN)>1 D
134 . W !!," At least 2 MRA's have been received for this claim."
135 . W !,"Please verify that all possible MRA's have been received for",!,"this claim before processing.",!
136 S DIR(0)="YA",DIR("B")="NO",DIR("A")="Are you sure you want to continue to process this COB?: "
137 D ^DIR K DIR
138 W !
139 S IBOK=$S(Y'=1:0,1:1)
140FEOBQ Q IBOK
141 ;
142 ;
143COBOK(IBIFN) ; Returns 1 if user indicates the COB process should proceed
144 ; even though the prior payer's bill is still in ENTERED/NOT REVIEWED
145 ; or REQUEST MRA status (1,2)
146 N DIR,X,Y,IBOK,IBSTAT
147 S IBOK=0,IBSTAT=$P($G(^DGCR(399,IBIFN,0)),U,13)
148 I "^1^2"'[(U_IBSTAT_U) S IBOK=1 G COBOKQ
149 S DIR(0)="YA",DIR("B")="NO"
150 S DIR("A",1)="The bill for the prior ("_$P("primary^secondary",U,+$$COBN^IBCEF(IBIFN))_") payer is still in "_$$EXTERNAL^DILFD(399,.13,,IBSTAT)_" status"
151 S DIR("A")="Are you sure you want to continue to process this COB?: "
152 D ^DIR K DIR
153 W !
154 S IBOK=$S(Y'=1:0,1:1)
155COBOKQ Q IBOK
156 ;
Note: See TracBrowser for help on using the repository browser.