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

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

revised back to 6/30/08 version

File size: 4.3 KB
Line 
1IBCBB ;ALB/AAS - EDIT CHECK ROUTINE TO BE INVOKED BEFORE ALL BILL APPROVAL ACTIONS ;2-NOV-89
2 ;;2.0;INTEGRATED BILLING;**80,51,137,288,327,361**;21-MAR-94;Build 9
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 ;MAP TO DGCRBB
6 ;
7 ;IBNDn = IBND(n) = ^ib(399,n)
8 ;RETURNS:
9 ;IBER=fields with errors separated by semi-colons
10 ;PRCASV("OKAY")=1 if iber="" and $D(prcasv("array")) compete
11 ;
12GVAR ;set up variables for mccr
13 Q:'$D(IBIFN) F I=0,"M","U","U1","S","MP","TX","UF3","UF31","U2" S @("IBND"_I)=$G(^DGCR(399,IBIFN,I))
14 S IBBNO=$P(IBND0,"^"),DFN=$P(IBND0,"^",2),IBEVDT=$P(IBND0,"^",3)
15 S IBLOC=$P(IBND0,"^",4),IBCL=$P(IBND0,"^",5),IBTF=$P(IBND0,"^",6)
16 S IBAT=$P(IBND0,"^",7),IBWHO=$P(IBND0,"^",11),IBST=$P(IBND0,"^",13),IBFT=$P(IBND0,"^",19)
17 S IBFDT=$P(IBNDU,"^",1),IBTDT=$P(IBNDU,"^",2)
18 S IBTC=$P(IBNDU1,"^",1),IBFY=$P(IBNDU1,"^",9),IBFYC=$P(IBNDU1,"^",10)
19 S IBEU=$P(IBNDS,"^",2),IBRU=$P(IBNDS,"^",5),IBAU=$P(IBNDS,"^",8)
20 S IBTOB=$$TOB(IBND0),IBTOB12=$E(IBTOB,1,2)
21 K ^TMP($J,"BILL-WARN")
22 Q
23 ;
24EN ;Entry to check for errors
25 N IBQ,IBXERR,IBXDATA,IBXSAVE,IBZPRC92,IBQUIT,IBISEQ,IDDATA,IBERRNO
26 I $D(IBFL) N IBFL
27 K ^TMP($J)
28 W !
29 S IBER="" D GVAR I '$D(IBND0) S IBER=-1 Q
30 ;
31 ;I $$ISPROS^IBCEF1(IBIFN) D
32 ;. D WARN^IBCBB11("Bill has prosthetics item(s) and will only print locally")
33 ;. I $$NEEDMRA^IBEFUNC(IBIFN) S IBQUIT=$$IBER^IBCBB3(.IBER,"098")
34 ;
35 ;patient in patient file
36 I DFN="" S IBER=IBER_"IB057;"
37 I DFN]"",'$D(^DPT(DFN)) S IBER=IBER_"IB057;"
38 ;
39 ;Event date in correct format
40 I IBEVDT="" S IBER=IBER_"IB049;"
41 I IBEVDT]"",IBEVDT'?7N&(IBEVDT'?7N1".".N) S IBER=IBER_"IB049;"
42 ;
43 ;Rate Type
44 I IBAT="" S IBER=IBER_"IB059;"
45 I IBAT]"",'$D(^DGCR(399.3,IBAT,0)) S IBER=IBER_"IB059;"
46 I IBAT]"",$D(^DGCR(399.3,IBAT,0)),'$P(^(0),"^",6) S IBER=IBER_"IB059;",IBAT=""
47 ;I IBAT]"",$D(^DGCR(399.3,IBAT,0)) S IBARTP=$P(^PRCA(430.2,$P(^DGCR(399.3,IBAT,0),"^",6),0),"^",6)
48 I IBAT]"",$P($G(^DGCR(399.3,IBAT,0)),"^",6) S IBARTP=$P($$CATN^PRCAFN($P(^DGCR(399.3,IBAT,0),"^",6)),"^",3)
49 ;Check that AR category expects same debtor as defined in who's responsible.
50 I $D(IBARTP),IBWHO="i"&(IBARTP'="T")!(IBWHO="p"&("PC"'[IBARTP))!(IBWHO="o"&(IBARTP'="N")) S IBER=IBER_"IB058;"
51 ;
52 ;Who's Responsible
53 I IBWHO=""!($L(IBWHO)>1)!("iop"'[IBWHO) S IBER=IBER_"IB065;"
54 S IBMRA=$S($$MCRWNR^IBEFUNC(+$$CURR^IBCEF2(IBIFN)):$$TXMT^IBCEF4(IBIFN)>0,1:0)
55 ; MCR will not reimburse is only valid if there is subsequent insurance
56 ; that will reimburse
57 I IBWHO="i" D
58 . I IBMRA D Q
59 .. N Z,IBZ
60 .. S IBZ=0
61 .. F Z=$$COBN^IBCEF(IBIFN):1:3 I $D(^DGCR(399,IBIFN,"I"_(Z+1))),$P($G(^DIC(36,+$G(^DGCR(399,IBIFN,"I"_(Z+1))),0)),U,2)'="N" S IBZ=1 Q
62 .. I 'IBZ S IBER=IBER_"IB054;" D WARN^IBCBB11("A valid claim for MEDICARE WNR needs subsequent ins. that will reimburse")
63 ..
64 . I $$COB^IBCEF(IBIFN)="S",$$MCRWNR^IBEFUNC(+$$CURR^IBCEF2(IBIFN))=1,$D(^DGCR(399,IBIFN,"I3")) Q
65 . I $S('IBNDMP:1,1:$P(IBNDMP,U,2)'=$$BPP^IBCNS2(IBIFN,1)) S IBER=IBER_"IB054;"
66 I IBWHO="o",'$P(IBNDM,"^",11) S IBER=IBER_"IB053;"
67 ;
68 ; All insurance subscribers must have a birth date on file
69 ; - 11/10/04 - IB*2.0*288
70 ; - 12/14/06 - IB*2.0*361 - must have INSURED'S SEX too
71 ; IB error codes
72 ; IB221 - Primary insurance subscriber missing date of birth
73 ; IB222 - Secondary insurance subscriber missing date of birth
74 ; IB223 - Tertiary insurance subscriber missing date of birth
75 ; IB261 - Primary insurance subscriber is missing INSURED'S SEX
76 ; IB262 - Secondary insurance subscriber is missing INSURED'S SEX
77 ; IB263 - Tertiary insurance subscriber is missing INSURED'S SEX
78 ;
79 F IBISEQ=1:1:3 D
80 . I '$P($G(^DGCR(399,IBIFN,"I"_IBISEQ)),U,1) Q ; no insurance here
81 . K ^UTILITY("VADM",$J),^UTILITY("VAPA",$J)
82 . S IDDATA=$$INSDEM^IBCEF(IBIFN,IBISEQ)
83 . K ^UTILITY("VADM",$J),^UTILITY("VAPA",$J)
84 . I '$P(IDDATA,U,1) D ; birth date missing
85 .. S IBERRNO=220+IBISEQ
86 .. S IBER=IBER_"IB"_IBERRNO_";"
87 . I "^M^F^"'[(U_$P(IDDATA,U,2)_U) D ; sex missing
88 .. S IBERRNO=260+IBISEQ
89 .. S IBER=IBER_"IB"_IBERRNO_";"
90 . Q
91 ;
92 D ^IBCBB1
93 Q
94 ;
95EDIT(IBIFN) ; Run edits from within the billing edit screens
96 N IBVIEW,IBDISP,IBNOFIX,DIR,X,Y
97 S (IBNOFIX,IBVIEW,IBDISP)=1
98 D EDITS^IBCB2
99 W ! S DIR("A")="Press RETURN to continue",DIR(0)="E" D ^DIR K DIR
100 Q
101 ;
102TOB(IBND0) ;
103 ; IBND0 = the 0-node of the bill (file 399)
104 Q ($P(IBND0,U,24)_$P($G(^DGCR(399.1,+$P(IBND0,U,25),0)),U,2)_$P(IBND0,U,26))
105 ;
Note: See TracBrowser for help on using the repository browser.