BUDCRPC3 ; IHS/CMI/LAB - UDS TABLE 6 ; 11 Dec 2015 10:13 AM
;;10.0;IHS/RPMS UNIFORM DATA SYSTEM;;FEB 04, 2016;Build 50
T9D ;EP
NEW BUDAIEN,BUDDATE,BUD0,BUDREC,BUDCILL,Z,BUDPIEC
S BUDAIEN=0
F S BUDAIEN=$O(^BARTR(DUZ(2),"AF",DFN,BUDAIEN)) Q:BUDAIEN'=+BUDAIEN D
.Q:'$D(^BARTR(DUZ(2),BUDAIEN))
.Q:'$D(^BARTR(DUZ(2),BUDAIEN,0))
.S BUD0=^BARTR(DUZ(2),BUDAIEN,0)
.S BUDDATE=$P(BUD0,U,12)
.Q:$P(BUDDATE,".")<BUDBD ;ONLY UDS DATE RANGE
.Q:$P(BUDDATE,".")>BUDED
.S BUDREC="",BUDPIEC=0
.;DATE
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$FMTE^XLFDT(BUDDATE)
.;BILL NUMBER
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,4)
.;TRANSACTION TYPE
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,101)
.;CREDIT 2 A/R TRANSACTION FILE
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$P(BUD0,U,2)
.;DEBIT 3 A/R TRANSACTION FILE
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$P(BUD0,U,3)
.;PRIME BILL AMOUNT
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,3.2)
.;PAYMENT
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,3.6)
.;ADJUSTMENT
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,3.7)
.;ADJUSTMENT CATEGORY
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,102)
.;ADJUSTMENT TYPE
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,103)
.;A/R ACCOUNT
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,6)
.;PATIENT
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,5)
.;VISIT LOCATION
.S BUDCILL=$$VALI^XBDIQ1(90050.03,BUDAIEN,4)
.I BUDCILL S Z=$$VAL^XBDIQ1(90050.01,BUDCILL,108)
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=Z
.;CLINIC TYPE
.I BUDCILL S Z=$$VAL^XBDIQ1(90050.01,BUDCILL,112)
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=Z
.;DOS BEGIN
.I BUDCILL S Z=$$VAL^XBDIQ1(90050.01,BUDCILL,102)
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=Z
.;BILL TYPE
.I BUDCILL S Z=$$VAL^XBDIQ1(90050.01,BUDCILL,4)
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=Z
.;PRIMARY PROVIDER
.I BUDCILL S Z=$$VAL^XBDIQ1(90050.01,BUDCILL,113)
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=Z
.;HRN
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$HRN^AUPNPAT(DFN,DUZ(2))
.;DOB
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$FMTE^XLFDT($$DOB^AUPNPAT(DFN))
.;COMMUNITY
.S BUDPIEC=BUDPIEC+1
.S $P(BUDREC,U,BUDPIEC)=$$COMMRES^AUPNPAT(DFN,"E")
.D SET
.Q
Q
SET ;
S BUDT9C=BUDT9C+1
S ^XTMP("BUDARP9DEL",BUDJ,BUDH,BUDDATE,BUDT9C)=BUDREC
Q
OPIC ;EP
; I = IEN
; Y = 1:yes, 0:no
; X = Pointer to INSURER file.
I '$G(P) Q 0
I '$G(D) Q 0
NEW I,Y,X,G
S Y=0,U="^"
I '$D(^DPT(P,0)) G OPICX
I $P(^DPT(P,0),U,19) G OPICX
I '$D(^AUPNPAT(P,0)) G OPICX
I '$D(^AUPNPRVT(P,11)) G OPICX
I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U)<D G OPICX
S I=0,G=0
F S I=$O(^AUPNPRVT(P,11,I)) Q:I'=+I D
. Q:$P(^AUPNPRVT(P,11,I,0),U)=""
. S G=0
. S X=$P(^AUPNPRVT(P,11,I,0),U) Q:X=""
. I $P($G(^AUTNINS(X,2)),U,1)=T S G=1
. Q:'G
. Q:$P(^AUPNPRVT(P,11,I,0),U,6)>D
. I $P(^AUPNPRVT(P,11,I,0),U,7)]"",$P(^(0),U,7)<D Q
. S Y=1
.Q
I Y Q Y
OPICX ;EP
Q Y
OPI ;EP
; I = IEN
; Y = 1:yes, 0:no
; X = Pointer to INSURER file.
I '$G(P) Q 0
I '$G(D) Q 0
NEW I,Y,X,G
S Y=0,U="^"
I '$D(^DPT(P,0)) G OPIX
I $P(^DPT(P,0),U,19) G OPIX
I '$D(^AUPNPAT(P,0)) G OPIX
I '$D(^AUPNPRVT(P,11)) G OPIX
I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U)<D G OPIX
S I=0,G=0
F S I=$O(^AUPNPRVT(P,11,I)) Q:I'=+I D
. Q:$P(^AUPNPRVT(P,11,I,0),U)=""
. S G=0
. S X=$P(^AUPNPRVT(P,11,I,0),U) Q:X=""
. ;I $P($G(^AUTNINS(X,2)),U,1)="G" S G=1
. I $P($G(^AUTNINS(X,2)),U,1)="I" S G=1
. I $P($G(^AUTNINS(X,2)),U,1)="SEP" S G=1
. I $P($G(^AUTNINS(X,2)),U,1)="T" S G=1
. Q:$P(^AUPNPRVT(P,11,I,0),U,6)>D
. I $P(^AUPNPRVT(P,11,I,0),U,7)]"",$P(^(0),U,7)<D Q
. S Y=1
.Q
I Y Q Y
OPIX ;
Q Y
PI ;EP
; I = IEN
; Y = 1:yes, 0:no
; X = Pointer to INSURER file.
I '$G(P) Q 0
I '$G(D) Q 0
NEW I,Y,X,G
S Y=0,U="^"
I '$D(^DPT(P,0)) G PIX
I $P(^DPT(P,0),U,19) G PIX
I '$D(^AUPNPAT(P,0)) G PIX
I '$D(^AUPNPRVT(P,11)) G PIX
I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U)<D G PIX
S I=0
F S I=$O(^AUPNPRVT(P,11,I)) Q:I'=+I D
. Q:$P(^AUPNPRVT(P,11,I,0),U)=""
. S X=$P(^AUPNPRVT(P,11,I,0),U) Q:X=""
. Q:$P(^AUTNINS(X,0),U)["AHCCCS"
. S G=0
. I $P($G(^AUTNINS(X,2)),U,1)="C" S G=1
. I $P($G(^AUTNINS(X,2)),U,1)="F" S G=1
. I $P($G(^AUTNINS(X,2)),U,1)="H" S G=1
. I $P($G(^AUTNINS(X,2)),U,1)="M" S G=1
. I $P($G(^AUTNINS(X,2)),U,1)="P" S G=1
. I $P($G(^AUTNINS(X,2)),U,1)="W" S G=1
. Q:'G
. Q:$P(^AUPNPRVT(P,11,I,0),U,6)>D
. I $P(^AUPNPRVT(P,11,I,0),U,7)]"",$P(^(0),U,7)<D Q
. S Y=1
.Q
PIX ;
Q Y
ZIPINS(DFN,BUDLASTV) ;EP - ZIP INSURANCE
NEW BUDHAS
S BUDHAS=0
S BUDHAS=$$PI^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV))
I BUDHAS=1 Q "e"
S BUDHAS=$$MCR^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV))
I BUDHAS=1 Q "d"
;S BUDHAS=$$OPI(DFN,$$VD^APCLV(BUDLASTV),"W")
;I BUDHAS=1 D TINS(BUDAGE,"10a") Q
S BUDHAS=$$RR^AUPNPAT(DFN,$$VD^APCLV(BUDLASTV))
I BUDHAS=1 Q "c"
S BUDHAS=$$OPI^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV))
I BUDHAS=1 Q "c"
S BUDHAS=$$OPIC^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV),"K")
I BUDHAS=1 Q "c"
S BUDHAS=$$MCD^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV),"D")
I BUDHAS=1 Q "c"
S BUDHAS=$$MCD^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV),"K")
I BUDHAS=1 Q "c"
;now check workman's comp and 3rd party liability
S BUDHAS=$$WC^BUDCRPC2(DFN,BUDBD,BUDED)
I BUDHAS=1 Q "c"
S BUDHAS=$$TPL^BUDCRPC2(DFN,BUDBD,BUDED)
I BUDHAS=1 Q "c"
;now check guarantor file
;S BUDHAS=$$GUAR(DFN,BUDBD,BUDED)
;I BUDHAS=1 D TINS(BUDAGE,"7") Q
Q "b"
BUDCRPC3 ; IHS/CMI/LAB - UDS TABLE 6 ; 11 Dec 2015 10:13 AM
+1 ;;10.0;IHS/RPMS UNIFORM DATA SYSTEM;;FEB 04, 2016;Build 50
T9D ;EP
+1 NEW BUDAIEN,BUDDATE,BUD0,BUDREC,BUDCILL,Z,BUDPIEC
+2 SET BUDAIEN=0
+3 FOR
SET BUDAIEN=$ORDER(^BARTR(DUZ(2),"AF",DFN,BUDAIEN))
IF BUDAIEN'=+BUDAIEN
QUIT
Begin DoDot:1
+4 IF '$DATA(^BARTR(DUZ(2),BUDAIEN))
QUIT
+5 IF '$DATA(^BARTR(DUZ(2),BUDAIEN,0))
QUIT
+6 SET BUD0=^BARTR(DUZ(2),BUDAIEN,0)
+7 SET BUDDATE=$PIECE(BUD0,U,12)
+8 ;ONLY UDS DATE RANGE
IF $PIECE(BUDDATE,".")<BUDBD
QUIT
+9 IF $PIECE(BUDDATE,".")>BUDED
QUIT
+10 SET BUDREC=""
SET BUDPIEC=0
+11 ;DATE
+12 SET BUDPIEC=BUDPIEC+1
+13 SET $PIECE(BUDREC,U,BUDPIEC)=$$FMTE^XLFDT(BUDDATE)
+14 ;BILL NUMBER
+15 SET BUDPIEC=BUDPIEC+1
+16 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,4)
+17 ;TRANSACTION TYPE
+18 SET BUDPIEC=BUDPIEC+1
+19 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,101)
+20 ;CREDIT 2 A/R TRANSACTION FILE
+21 SET BUDPIEC=BUDPIEC+1
+22 SET $PIECE(BUDREC,U,BUDPIEC)=$PIECE(BUD0,U,2)
+23 ;DEBIT 3 A/R TRANSACTION FILE
+24 SET BUDPIEC=BUDPIEC+1
+25 SET $PIECE(BUDREC,U,BUDPIEC)=$PIECE(BUD0,U,3)
+26 ;PRIME BILL AMOUNT
+27 SET BUDPIEC=BUDPIEC+1
+28 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,3.2)
+29 ;PAYMENT
+30 SET BUDPIEC=BUDPIEC+1
+31 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,3.6)
+32 ;ADJUSTMENT
+33 SET BUDPIEC=BUDPIEC+1
+34 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,3.7)
+35 ;ADJUSTMENT CATEGORY
+36 SET BUDPIEC=BUDPIEC+1
+37 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,102)
+38 ;ADJUSTMENT TYPE
+39 SET BUDPIEC=BUDPIEC+1
+40 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,103)
+41 ;A/R ACCOUNT
+42 SET BUDPIEC=BUDPIEC+1
+43 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,6)
+44 ;PATIENT
+45 SET BUDPIEC=BUDPIEC+1
+46 SET $PIECE(BUDREC,U,BUDPIEC)=$$VAL^XBDIQ1(90050.03,BUDAIEN,5)
+47 ;VISIT LOCATION
+48 SET BUDCILL=$$VALI^XBDIQ1(90050.03,BUDAIEN,4)
+49 IF BUDCILL
SET Z=$$VAL^XBDIQ1(90050.01,BUDCILL,108)
+50 SET BUDPIEC=BUDPIEC+1
+51 SET $PIECE(BUDREC,U,BUDPIEC)=Z
+52 ;CLINIC TYPE
+53 IF BUDCILL
SET Z=$$VAL^XBDIQ1(90050.01,BUDCILL,112)
+54 SET BUDPIEC=BUDPIEC+1
+55 SET $PIECE(BUDREC,U,BUDPIEC)=Z
+56 ;DOS BEGIN
+57 IF BUDCILL
SET Z=$$VAL^XBDIQ1(90050.01,BUDCILL,102)
+58 SET BUDPIEC=BUDPIEC+1
+59 SET $PIECE(BUDREC,U,BUDPIEC)=Z
+60 ;BILL TYPE
+61 IF BUDCILL
SET Z=$$VAL^XBDIQ1(90050.01,BUDCILL,4)
+62 SET BUDPIEC=BUDPIEC+1
+63 SET $PIECE(BUDREC,U,BUDPIEC)=Z
+64 ;PRIMARY PROVIDER
+65 IF BUDCILL
SET Z=$$VAL^XBDIQ1(90050.01,BUDCILL,113)
+66 SET BUDPIEC=BUDPIEC+1
+67 SET $PIECE(BUDREC,U,BUDPIEC)=Z
+68 ;HRN
+69 SET BUDPIEC=BUDPIEC+1
+70 SET $PIECE(BUDREC,U,BUDPIEC)=$$HRN^AUPNPAT(DFN,DUZ(2))
+71 ;DOB
+72 SET BUDPIEC=BUDPIEC+1
+73 SET $PIECE(BUDREC,U,BUDPIEC)=$$FMTE^XLFDT($$DOB^AUPNPAT(DFN))
+74 ;COMMUNITY
+75 SET BUDPIEC=BUDPIEC+1
+76 SET $PIECE(BUDREC,U,BUDPIEC)=$$COMMRES^AUPNPAT(DFN,"E")
+77 DO SET
+78 QUIT
End DoDot:1
+79 QUIT
SET ;
+1 SET BUDT9C=BUDT9C+1
+2 SET ^XTMP("BUDARP9DEL",BUDJ,BUDH,BUDDATE,BUDT9C)=BUDREC
+3 QUIT
OPIC ;EP
+1 ; I = IEN
+2 ; Y = 1:yes, 0:no
+3 ; X = Pointer to INSURER file.
+4 IF '$GET(P)
QUIT 0
+5 IF '$GET(D)
QUIT 0
+6 NEW I,Y,X,G
+7 SET Y=0
SET U="^"
+8 IF '$DATA(^DPT(P,0))
GOTO OPICX
+9 IF $PIECE(^DPT(P,0),U,19)
GOTO OPICX
+10 IF '$DATA(^AUPNPAT(P,0))
GOTO OPICX
+11 IF '$DATA(^AUPNPRVT(P,11))
GOTO OPICX
+12 IF $DATA(^DPT(P,.35))
IF $PIECE(^(.35),U)]""
IF $PIECE(^(.35),U)<D
GOTO OPICX
+13 SET I=0
SET G=0
+14 FOR
SET I=$ORDER(^AUPNPRVT(P,11,I))
IF I'=+I
QUIT
Begin DoDot:1
+15 IF $PIECE(^AUPNPRVT(P,11,I,0),U)=""
QUIT
+16 SET G=0
+17 SET X=$PIECE(^AUPNPRVT(P,11,I,0),U)
IF X=""
QUIT
+18 IF $PIECE($GET(^AUTNINS(X,2)),U,1)=T
SET G=1
+19 IF 'G
QUIT
+20 IF $PIECE(^AUPNPRVT(P,11,I,0),U,6)>D
QUIT
+21 IF $PIECE(^AUPNPRVT(P,11,I,0),U,7)]""
IF $PIECE(^(0),U,7)<D
QUIT
+22 SET Y=1
+23 QUIT
End DoDot:1
+24 IF Y
QUIT Y
OPICX ;EP
+1 QUIT Y
OPI ;EP
+1 ; I = IEN
+2 ; Y = 1:yes, 0:no
+3 ; X = Pointer to INSURER file.
+4 IF '$GET(P)
QUIT 0
+5 IF '$GET(D)
QUIT 0
+6 NEW I,Y,X,G
+7 SET Y=0
SET U="^"
+8 IF '$DATA(^DPT(P,0))
GOTO OPIX
+9 IF $PIECE(^DPT(P,0),U,19)
GOTO OPIX
+10 IF '$DATA(^AUPNPAT(P,0))
GOTO OPIX
+11 IF '$DATA(^AUPNPRVT(P,11))
GOTO OPIX
+12 IF $DATA(^DPT(P,.35))
IF $PIECE(^(.35),U)]""
IF $PIECE(^(.35),U)<D
GOTO OPIX
+13 SET I=0
SET G=0
+14 FOR
SET I=$ORDER(^AUPNPRVT(P,11,I))
IF I'=+I
QUIT
Begin DoDot:1
+15 IF $PIECE(^AUPNPRVT(P,11,I,0),U)=""
QUIT
+16 SET G=0
+17 SET X=$PIECE(^AUPNPRVT(P,11,I,0),U)
IF X=""
QUIT
+18 ;I $P($G(^AUTNINS(X,2)),U,1)="G" S G=1
+19 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="I"
SET G=1
+20 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="SEP"
SET G=1
+21 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="T"
SET G=1
+22 IF $PIECE(^AUPNPRVT(P,11,I,0),U,6)>D
QUIT
+23 IF $PIECE(^AUPNPRVT(P,11,I,0),U,7)]""
IF $PIECE(^(0),U,7)<D
QUIT
+24 SET Y=1
+25 QUIT
End DoDot:1
+26 IF Y
QUIT Y
OPIX ;
+1 QUIT Y
PI ;EP
+1 ; I = IEN
+2 ; Y = 1:yes, 0:no
+3 ; X = Pointer to INSURER file.
+4 IF '$GET(P)
QUIT 0
+5 IF '$GET(D)
QUIT 0
+6 NEW I,Y,X,G
+7 SET Y=0
SET U="^"
+8 IF '$DATA(^DPT(P,0))
GOTO PIX
+9 IF $PIECE(^DPT(P,0),U,19)
GOTO PIX
+10 IF '$DATA(^AUPNPAT(P,0))
GOTO PIX
+11 IF '$DATA(^AUPNPRVT(P,11))
GOTO PIX
+12 IF $DATA(^DPT(P,.35))
IF $PIECE(^(.35),U)]""
IF $PIECE(^(.35),U)<D
GOTO PIX
+13 SET I=0
+14 FOR
SET I=$ORDER(^AUPNPRVT(P,11,I))
IF I'=+I
QUIT
Begin DoDot:1
+15 IF $PIECE(^AUPNPRVT(P,11,I,0),U)=""
QUIT
+16 SET X=$PIECE(^AUPNPRVT(P,11,I,0),U)
IF X=""
QUIT
+17 IF $PIECE(^AUTNINS(X,0),U)["AHCCCS"
QUIT
+18 SET G=0
+19 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="C"
SET G=1
+20 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="F"
SET G=1
+21 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="H"
SET G=1
+22 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="M"
SET G=1
+23 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="P"
SET G=1
+24 IF $PIECE($GET(^AUTNINS(X,2)),U,1)="W"
SET G=1
+25 IF 'G
QUIT
+26 IF $PIECE(^AUPNPRVT(P,11,I,0),U,6)>D
QUIT
+27 IF $PIECE(^AUPNPRVT(P,11,I,0),U,7)]""
IF $PIECE(^(0),U,7)<D
QUIT
+28 SET Y=1
+29 QUIT
End DoDot:1
PIX ;
+1 QUIT Y
ZIPINS(DFN,BUDLASTV) ;EP - ZIP INSURANCE
+1 NEW BUDHAS
+2 SET BUDHAS=0
+3 SET BUDHAS=$$PI^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV))
+4 IF BUDHAS=1
QUIT "e"
+5 SET BUDHAS=$$MCR^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV))
+6 IF BUDHAS=1
QUIT "d"
+7 ;S BUDHAS=$$OPI(DFN,$$VD^APCLV(BUDLASTV),"W")
+8 ;I BUDHAS=1 D TINS(BUDAGE,"10a") Q
+9 SET BUDHAS=$$RR^AUPNPAT(DFN,$$VD^APCLV(BUDLASTV))
+10 IF BUDHAS=1
QUIT "c"
+11 SET BUDHAS=$$OPI^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV))
+12 IF BUDHAS=1
QUIT "c"
+13 SET BUDHAS=$$OPIC^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV),"K")
+14 IF BUDHAS=1
QUIT "c"
+15 SET BUDHAS=$$MCD^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV),"D")
+16 IF BUDHAS=1
QUIT "c"
+17 SET BUDHAS=$$MCD^BUDCRPC2(DFN,$$VD^APCLV(BUDLASTV),"K")
+18 IF BUDHAS=1
QUIT "c"
+19 ;now check workman's comp and 3rd party liability
+20 SET BUDHAS=$$WC^BUDCRPC2(DFN,BUDBD,BUDED)
+21 IF BUDHAS=1
QUIT "c"
+22 SET BUDHAS=$$TPL^BUDCRPC2(DFN,BUDBD,BUDED)
+23 IF BUDHAS=1
QUIT "c"
+24 ;now check guarantor file
+25 ;S BUDHAS=$$GUAR(DFN,BUDBD,BUDED)
+26 ;I BUDHAS=1 D TINS(BUDAGE,"7") Q
+27 QUIT "b"