ABMUTLF ; IHS/ASDST/DMJ - FACILITY UTILITIES ;
;;2.6;IHS 3P BILLING SYSTEM;**10,11**;NOV 12, 2009;Build 133
;Original;DMJ;09/21/95 12:47 PM
;
; IHS/SD/SDR - v2.5 p8 - IM14883/IM16505
; Fix to pull Medicare number for Part B
;
; IHS/SD/SDR/LSL - v2.5 p8 - IM13693/IM17856
; Added code for 837 PI Billing
;
; IHS/SD/SDR - v2.5 p11 - NPI
;
PTAX(X) ;EP - provider taxonomy
;x=location ien
N I,ABM0
S Y=""
S I=0
F S I=$O(^AUTTLOC(X,11,I)) Q:'I D
.S ABM0=^AUTTLOC(X,11,I,0)
.Q:$P(ABM0,U)>ABMP("VDT")
.I $P(ABM0,"^",2) Q:$P(ABM0,"^",2)<ABMP("VDT")
.S ABMCLASS=$P(ABM0,"^",7)
.Q:'ABMCLASS
.S Y=$P($G(^AUTTPTAX(ABMCLASS,1)),U)
Q Y
MCR(X) ;EP - medicare provider number
;x=location ien
; get group number if 999 and Medicare
S Y=""
I ABMP("VTYP")=999,ABMP("ITYPE")="R" D
.S Y=$P($G(^ABMNINS(X,ABMP("INS"),0)),U,6)
.S:Y="" Y=$P($G(^ABMNINS(DUZ(2),ABMP("INS"),0)),U,6)
.S:Y="" Y=$P($G(^ABMNINS(X,ABMP("INS"),1,ABMP("VTYP"),0)),U,8)
.S:Y="" Y=$P($G(^ABMNINS(DUZ(2),ABMP("INS"),1,ABMP("VTYP"),0)),U,8)
I ABMP("BTYP")=831,($G(ABMP("ITYPE"))="R") D
.S Y=$P($G(^ABMNINS(DUZ(2),ABMP("INS"),1,ABMP("VTYP"),0)),U,8)
S:Y="" Y=$P($G(^AUTNINS(ABMP("INS"),15,X,0)),"^",2)
S:Y="" Y=$P($G(^AUTTLOC(X,0)),"^",19)
Q Y
MCD(X) ;EP - medicaid provider number
;x=location ien
S Y=$P($G(^ABMNINS(X,ABMP("INS"),1,ABMP("VTYP"),0)),"^",8)
S:Y="" Y=$P($G(^AUTNINS(ABMP("INS"),15,X,0)),"^",2)
Q Y
EIN(X) ;EP - federal tax id number
;x=location ien
S Y=$P($G(^AUTTLOC(X,0)),"^",18)
Q Y
PI(X) ;EP - PI Provider Number
;x=location ien
;I $G(ABMFILE)="9999999.06",($G(ABMNPIU)="N")!($G(ABMNPIU)="B"),ABMEIC="EI" S Y=$TR($P($G(^AUTTLOC(X,0)),U,18),"-") Q Y ;abm*2.6*10 HEAT72888
;start new code abm*2.6*10 HEAT72888
N Y
I $G(ABMFILE)="9999999.06",($G(ABMNPIU)="N")!($G(ABMNPIU)="B"),ABMEIC="EI" D Q Y
.I $P($G(^ABMNINS(ABMP("LDFN"),ABMP("INS"),1,ABMP("VTYP"),1)),U,8)'="" S Y=$P($G(^AUTTLOC($P($G(^ABMNINS(ABMP("LDFN"),ABMP("INS"),1,ABMP("VTYP"),1)),U,8),0)),U,18)
.I $G(Y)="",($P($G(^ABMDPARM(ABMP("LDFN"),1,2)),U,12)'="") S Y=$P($G(^AUTTLOC($P($G(^ABMDPARM(ABMP("LDFN"),1,2)),U,12),0)),U,18)
.I $G(Y)="" S Y=$P($G(^AUTTLOC(DUZ(2),0)),U,18)
.S Y=$TR(Y,"-") ;abm*2.6*11 NOHEAT
;end new code HEAT72888
S Y=$P($G(^ABMNINS(X,ABMP("INS"),1,ABMP("VTYP"),0)),U,8)
S:Y="" Y=$P($G(^AUTNINS(ABMP("INS"),15,X,0)),U,2)
S Y=$TR(Y,"-") ;abm*2.6*10 HEAT72888
Q Y
NPIUSAGE(X,Y) ;PEP - NPI Usage in 3P Insurer file
;x=location (i.e., DUZ(2))
;y=insurer
Q $P($G(^ABMNINS(+X,+Y,0)),U,9)
ABMUTLF ; IHS/ASDST/DMJ - FACILITY UTILITIES ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;**10,11**;NOV 12, 2009;Build 133
+2 ;Original;DMJ;09/21/95 12:47 PM
+3 ;
+4 ; IHS/SD/SDR - v2.5 p8 - IM14883/IM16505
+5 ; Fix to pull Medicare number for Part B
+6 ;
+7 ; IHS/SD/SDR/LSL - v2.5 p8 - IM13693/IM17856
+8 ; Added code for 837 PI Billing
+9 ;
+10 ; IHS/SD/SDR - v2.5 p11 - NPI
+11 ;
PTAX(X) ;EP - provider taxonomy
+1 ;x=location ien
+2 NEW I,ABM0
+3 SET Y=""
+4 SET I=0
+5 FOR
SET I=$ORDER(^AUTTLOC(X,11,I))
IF 'I
QUIT
Begin DoDot:1
+6 SET ABM0=^AUTTLOC(X,11,I,0)
+7 IF $PIECE(ABM0,U)>ABMP("VDT")
QUIT
+8 IF $PIECE(ABM0,"^",2)
IF $PIECE(ABM0,"^",2)<ABMP("VDT")
QUIT
+9 SET ABMCLASS=$PIECE(ABM0,"^",7)
+10 IF 'ABMCLASS
QUIT
+11 SET Y=$PIECE($GET(^AUTTPTAX(ABMCLASS,1)),U)
End DoDot:1
+12 QUIT Y
MCR(X) ;EP - medicare provider number
+1 ;x=location ien
+2 ; get group number if 999 and Medicare
+3 SET Y=""
+4 IF ABMP("VTYP")=999
IF ABMP("ITYPE")="R"
Begin DoDot:1
+5 SET Y=$PIECE($GET(^ABMNINS(X,ABMP("INS"),0)),U,6)
+6 IF Y=""
SET Y=$PIECE($GET(^ABMNINS(DUZ(2),ABMP("INS"),0)),U,6)
+7 IF Y=""
SET Y=$PIECE($GET(^ABMNINS(X,ABMP("INS"),1,ABMP("VTYP"),0)),U,8)
+8 IF Y=""
SET Y=$PIECE($GET(^ABMNINS(DUZ(2),ABMP("INS"),1,ABMP("VTYP"),0)),U,8)
End DoDot:1
+9 IF ABMP("BTYP")=831
IF ($GET(ABMP("ITYPE"))="R")
Begin DoDot:1
+10 SET Y=$PIECE($GET(^ABMNINS(DUZ(2),ABMP("INS"),1,ABMP("VTYP"),0)),U,8)
End DoDot:1
+11 IF Y=""
SET Y=$PIECE($GET(^AUTNINS(ABMP("INS"),15,X,0)),"^",2)
+12 IF Y=""
SET Y=$PIECE($GET(^AUTTLOC(X,0)),"^",19)
+13 QUIT Y
MCD(X) ;EP - medicaid provider number
+1 ;x=location ien
+2 SET Y=$PIECE($GET(^ABMNINS(X,ABMP("INS"),1,ABMP("VTYP"),0)),"^",8)
+3 IF Y=""
SET Y=$PIECE($GET(^AUTNINS(ABMP("INS"),15,X,0)),"^",2)
+4 QUIT Y
EIN(X) ;EP - federal tax id number
+1 ;x=location ien
+2 SET Y=$PIECE($GET(^AUTTLOC(X,0)),"^",18)
+3 QUIT Y
PI(X) ;EP - PI Provider Number
+1 ;x=location ien
+2 ;I $G(ABMFILE)="9999999.06",($G(ABMNPIU)="N")!($G(ABMNPIU)="B"),ABMEIC="EI" S Y=$TR($P($G(^AUTTLOC(X,0)),U,18),"-") Q Y ;abm*2.6*10 HEAT72888
+3 ;start new code abm*2.6*10 HEAT72888
+4 NEW Y
+5 IF $GET(ABMFILE)="9999999.06"
IF ($GET(ABMNPIU)="N")!($GET(ABMNPIU)="B")
IF ABMEIC="EI"
Begin DoDot:1
+6 IF $PIECE($GET(^ABMNINS(ABMP("LDFN"),ABMP("INS"),1,ABMP("VTYP"),1)),U,8)'=""
SET Y=$PIECE($GET(^AUTTLOC($PIECE($GET(^ABMNINS(ABMP("LDFN"),ABMP("INS"),1,ABMP("VTYP"),1)),U,8),0)),U,18)
+7 IF $GET(Y)=""
IF ($PIECE($GET(^ABMDPARM(ABMP("LDFN"),1,2)),U,12)'="")
SET Y=$PIECE($GET(^AUTTLOC($PIECE($GET(^ABMDPARM(ABMP("LDFN"),1,2)),U,12),0)),U,18)
+8 IF $GET(Y)=""
SET Y=$PIECE($GET(^AUTTLOC(DUZ(2),0)),U,18)
+9 ;abm*2.6*11 NOHEAT
SET Y=$TRANSLATE(Y,"-")
End DoDot:1
QUIT Y
+10 ;end new code HEAT72888
+11 SET Y=$PIECE($GET(^ABMNINS(X,ABMP("INS"),1,ABMP("VTYP"),0)),U,8)
+12 IF Y=""
SET Y=$PIECE($GET(^AUTNINS(ABMP("INS"),15,X,0)),U,2)
+13 ;abm*2.6*10 HEAT72888
SET Y=$TRANSLATE(Y,"-")
+14 QUIT Y
NPIUSAGE(X,Y) ;PEP - NPI Usage in 3P Insurer file
+1 ;x=location (i.e., DUZ(2))
+2 ;y=insurer
+3 QUIT $PIECE($GET(^ABMNINS(+X,+Y,0)),U,9)