IBXS36 ; ;11/02/18
D DE G BEGIN
DE S DIE="^DGCR(399,",DIC=DIE,DP=399,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DGCR(399,DA,""))=""
I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,21) S:%]"" DE(4)=%
I $D(^("M")) S %Z=^("M") S %=$P(%Z,U,11) S:%]"" DE(1)=%
I $D(^("M1")) S %Z=^("M1") S %=$P(%Z,U,2) S:%]"" DE(8)=%,DE(19)=%,DE(25)=% S %=$P(%Z,U,3) S:%]"" DE(37)=%,DE(48)=%,DE(54)=% S %=$P(%Z,U,4) S:%]"" DE(66)=% S %=$P(%Z,U,10) S:%]"" DE(9)=%,DE(20)=%,DE(29)=%,DE(32)=%
I S %=$P(%Z,U,11) S:%]"" DE(38)=%,DE(49)=%,DE(58)=%,DE(61)=% S %=$P(%Z,U,12) S:%]"" DE(67)=%
K %Z Q
;
W W !?DL+DL-2,DLB_": "
Q
O D W W Y W:$X>45 !?9
I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 K X S X("FIELD")=DIFLD,X("FILE")=DP W " ("_$$EZBLD^DIALOG(710,.X)_")" K X S X="" Q ;**
TR Q:DV["K"&(DUZ(0)'="@") R X:DTIME E S (DTOUT,X)=U W $C(7)
Q
A K DQ(DQ) S DQ=DQ+1
B G @DQ
RE G A:DV["K"&(DUZ(0)'["@"),PR:$D(DE(DQ)) D W,TR
N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
RD G QS:X?."?" I X["^" D D G ^DIE17
I X="@" D D G Z^DIE2
I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" I X?.ANP D SET^DIED I 'DDER G V
K DDER G X
P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
V D @("X"_DQ) K YS
UNIQ I DV["U",$D(X),DIFLD=.01 K % M %=@(DIE_"""B"",X)") K %(DA) K:$O(%(0)) X
Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
S X="?BAD"
QS S DZ=X D D,QQ^DIEQ G B
D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") I %]"" S Y=$S($G(DUZ("LANG"))'>1:%,'DIFLD:%,1:$$SET^DIQ(DP,DIFLD,Y))
RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
I I DV'["I",DV'["#" G RD
D E^DIE0 G RD:$D(X),PR
Q
SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
Q
NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
BEGIN S DNM="IBXS36",DQ=1
1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW="M;11",DV="RP4",DU="",DIFLD=111,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C1^IBXS36"
S DU="DIC(4,"
G RE
C1 G C1S:$D(DE(1))[0 K DB
S X=DE(1),DIC=DIE
D DEL^IBCU5
S X=DE(1),DIC=DIE
S DGRVRCAL=2
C1S S X="" G:DG(DQ)=X C1F1 K DB
S X=DG(DQ),DIC=DIE
D MAILIN^IBCU5
S X=DG(DQ),DIC=DIE
S DGRVRCAL=1
C1F1 Q
X1 Q
2 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 D X2 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X2 K DIC("DR"),DLAYGO
Q
3 S DQ=4 ;@31
4 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW="0;21",DV="*S",DU="",DIFLD=.21,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C4^IBXS36"
S DU="P:PRIMARY INSURANCE;S:SECONDARY INSURANCE;T:TERTIARY INSURANCE;A:PATIENT;"
G RE
C4 G C4S:$D(DE(4))[0 K DB
S X=DE(4),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"MP")):^("MP"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(399,.21,1,1,2.4)
S X=DE(4),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=('$$REQMRA^IBEFUNC(DA)&$$NEEDMRA^IBEFUNC(DA)) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"TX")):^("TX"),1:"") S X=$P(Y(1),U,5),X=X S DIU=X K Y S X="" X ^DD(399,.21,1,2,2.4)
S X=DE(4),DIC=DIE
;
S X=DE(4),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=$$DELETE^IBCEF84(DA) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"TX")):^("TX"),1:"") S X=$P(Y(1),U,8),X=X S DIU=X K Y S X="" X ^DD(399,.21,1,4,2.4)
S X=DE(4),DIC=DIE
;
S X=DE(4),DIC=DIE
;
S X=DE(4),DIC=DIE
;
S X=DE(4),DIC=DIE
;
S X=DE(4),DIC=DIE
;
S X=DE(4),DIC=DIE
;
C4S S X="" G:DG(DQ)=X C4F1 K DB
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"MP")):^("MP"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X=DIV S X=$$BPP^IBCNS2(DA) X ^DD(399,.21,1,1,1.4)
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=('$$REQMRA^IBEFUNC(DA)&$$NEEDMRA^IBEFUNC(DA)) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"TX")):^("TX"),1:"") S X=$P(Y(1),U,5),X=X S DIU=X K Y S X=DIV S X=0 X ^DD(399,.21,1,2,1.4)
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=$S($$WNRBILL^IBEFUNC(DA,X):1,1:0) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"TX")):^("TX"),1:"") S X=$P(Y(1),U,8),X=X S DIU=X K Y S X="" X ^DD(399,.21,1,3,1.4)
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=$$CREATE^IBCEF84(DA) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"TX")):^("TX"),1:"") S X=$P(Y(1),U,8),X=X S DIU=X K Y S X=DIV S X=1 X ^DD(399,.21,1,4,1.4)
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=Y(0),X=X S X=X="P" I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,5),X=X S DIU=X K Y S X="" X ^DD(399,.21,1,5,1.4)
S X=DG(DQ),DIC=DIE
X ^DD(399,.21,1,6,1.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M1")),DIV=X S $P(^("M1"),U,6)=DIV,DIH=399,DIG=126 D ^DICR
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,7),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M1")),DIV=X S $P(^("M1"),U,7)=DIV,DIH=399,DIG=127 D ^DICR
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=Y(0),X=X S X=X="P" I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"U2")):^("U2"),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(399,.21,1,8,1.4)
S X=DG(DQ),DIC=DIE
X ^DD(399,.21,1,9,1.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"U2")):^("U2"),1:"") S X=$P(Y(1),U,5),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"U2")),DIV=X S $P(^("U2"),U,5)=DIV,DIH=399,DIG=219 D ^DICR
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"U2")):^("U2"),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"U2")),DIV=X S $P(^("U2"),U,6)=DIV,DIH=399,DIG=220 D ^DICR
C4F1 Q
X4 Q
5 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X5 S:IBDR20'["32" Y="@33"
Q
6 S DQ=7 ;@3211
7 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X7 I '$$SUPPPT^IBCEP7B(DA,1) S Y="@3212"
Q
8 D:$D(DG)>9 F^DIE17,DE S DQ=8,DW="M1;2",DV="FX",DU="",DIFLD=122,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C8^IBXS36"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C8 G C8S:$D(DE(8))[0 K DB
S X=DE(8),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,2)="" I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,10),X=X S DIU=X K Y S X="" X ^DD(399,122,1,1,2.4)
C8S S X="" G:DG(DQ)=X C8F1 K DB
S X=DG(DQ),DIC=DIE
;
C8F1 Q
X8 K:$L(X)>13!($L(X)<3)!($TR(X," ")="") X
I $D(X),X'?.ANP K X
Q
;
9 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW="M1;10",DV="*P355.97'",DU="",DIFLD=128,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="IBE(355.97,"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
X9 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
10 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=10 D X10 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X10 W !,"No Billing Prov Secondary IDs will be sent for Primary Ins/Elect Plan Type."
Q
11 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=11 D X11 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X11 S Y="@3221"
Q
12 S DQ=13 ;@3212
13 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X13 I '$$ATTREND^IBCEP7B(DA,1) S Y="@3213"
Q
14 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=14 D X14 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X14 I $P($G(^DGCR(399,DA,"M1")),U,2)]"" S Y="@3213"
Q
15 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=15 D X15 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X15 W !,"The Att/Rend ID will be sent as the primary ins. Billing Prov Sec ID."
Q
16 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X16 S Y="@3221"
Q
17 S DQ=18 ;@3213
18 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=18 D X18 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X18 S IBPSDAT=$$GETID^IBCEP7B(DA,1),IBPSID=$P(IBPSDAT,U),IBPSQUAL=$P(IBPSDAT,U,2) I IBPSID="" S Y="@321"
Q
19 S DW="M1;2",DV="FX",DU="",DIFLD=122,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C19^IBXS36"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C19 G C19S:$D(DE(19))[0 K DB
S X=DE(19),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,2)="" I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,10),X=X S DIU=X K Y S X="" X ^DD(399,122,1,1,2.4)
C19S S X="" G:DG(DQ)=X C19F1 K DB
S X=DG(DQ),DIC=DIE
;
C19F1 Q
X19 K:$L(X)>13!($L(X)<3)!($TR(X," ")="") X
I $D(X),X'?.ANP K X
Q
;
20 D:$D(DG)>9 F^DIE17,DE S DQ=20,DW="M1;10",DV="*P355.97'",DU="",DIFLD=128,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="IBE(355.97,"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
X20 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
21 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=21 D X21 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X21 S DIE("NO^")=1
Q
22 S DQ=23 ;@321
23 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=23 D X23 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X23 S IBPSIDO=$P($G(^DGCR(399,DA,"M1")),U,2),IBPSQO=$P($G(^DGCR(399,DA,"M1")),U,10)
Q
24 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=24 G A
25 S DW="M1;2",DV="FX",DU="",DIFLD=122,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C25^IBXS36"
S X="IBPSID" Q:X Q:$NA(@X)[U S X=$G(@X)
S Y=X
G Y
C25 G C25S:$D(DE(25))[0 K DB
S X=DE(25),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,2)="" I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,10),X=X S DIU=X K Y S X="" X ^DD(399,122,1,1,2.4)
C25S S X="" G:DG(DQ)=X C25F1 K DB
S X=DG(DQ),DIC=DIE
;
C25F1 Q
X25 K:$L(X)>13!($L(X)<3)!($TR(X," ")="") X
I $D(X),X'?.ANP K X
Q
;
26 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=26 D X26 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X26 I $G(IBPSQO)]"",X'=$G(IBPSID),X'=$G(IBPSIDO) S Y="@3214"
Q
27 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=27 D X27 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X27 I $G(IBPSQO)="",$G(IBPSQUAL)="",X]"" S Y="@3214"
Q
28 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=28 G A
29 D:$D(DG)>9 F^DIE17,DE S DQ=29,DW="M1;10",DV="*P355.97'",DU="",DIFLD=128,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="IBE(355.97,"
S X="IBPSQUAL" Q:X Q:$NA(@X)[U S X=$G(@X)
S Y=X
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
X29 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
30 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=30 D X30 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X30 S Y="@3215"
Q
31 S DQ=32 ;@3214
32 S DW="M1;10",DV="*P355.97'",DU="",DIFLD=128,DLB="Primary ID Qualifier"
S DU="IBE(355.97,"
G RE
X32 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
33 S DQ=34 ;@3215
34 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=34 D X34 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X34 K DIE("NO^")
Q
35 S DQ=36 ;@3221
36 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=36 D X36 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X36 I '$$SUPPPT^IBCEP7B(DA,2) S Y="@3222"
Q
37 S DW="M1;3",DV="FX",DU="",DIFLD=123,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C37^IBXS36"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C37 G C37S:$D(DE(37))[0 K DB
S X=DE(37),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,3)="" I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,11),X=X S DIU=X K Y S X="" X ^DD(399,123,1,1,2.4)
C37S S X="" G:DG(DQ)=X C37F1 K DB
S X=DG(DQ),DIC=DIE
;
C37F1 Q
X37 K:$L(X)>13!($L(X)<3)!($TR(X," ")="") X
I $D(X),X'?.ANP K X
Q
;
38 D:$D(DG)>9 F^DIE17,DE S DQ=38,DW="M1;11",DV="*P355.97'",DU="",DIFLD=129,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="IBE(355.97,"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
X38 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
39 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=39 D X39 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X39 W !,"No Billing Prov Secondary IDs will be sent for Secondary Ins/Elect Plan Type."
Q
40 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=40 D X40 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X40 S Y="@3231"
Q
41 S DQ=42 ;@3222
42 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=42 D X42 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X42 I '$$ATTREND^IBCEP7B(DA,2) S Y="@3223"
Q
43 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=43 D X43 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X43 I $P($G(^DGCR(399,DA,"M1")),U,3)]"" S Y="@3223"
Q
44 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=44 D X44 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X44 W !,"The Att/Rend ID will be sent as the secondary ins. Billing Prov Sec ID."
Q
45 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=45 D X45 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X45 S Y="@3231"
Q
46 S DQ=47 ;@3223
47 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=47 D X47 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X47 S IBPSDAT=$$GETID^IBCEP7B(DA,2),IBPSID=$P(IBPSDAT,U),IBPSQUAL=$P(IBPSDAT,U,2) I IBPSID="" S Y="@322"
Q
48 S DW="M1;3",DV="FX",DU="",DIFLD=123,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C48^IBXS36"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C48 G C48S:$D(DE(48))[0 K DB
S X=DE(48),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,3)="" I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,11),X=X S DIU=X K Y S X="" X ^DD(399,123,1,1,2.4)
C48S S X="" G:DG(DQ)=X C48F1 K DB
S X=DG(DQ),DIC=DIE
;
C48F1 Q
X48 K:$L(X)>13!($L(X)<3)!($TR(X," ")="") X
I $D(X),X'?.ANP K X
Q
;
49 D:$D(DG)>9 F^DIE17,DE S DQ=49,DW="M1;11",DV="*P355.97'",DU="",DIFLD=129,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="IBE(355.97,"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
X49 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
50 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=50 D X50 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X50 S DIE("NO^")=1
Q
51 S DQ=52 ;@322
52 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=52 D X52 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X52 S IBPSIDO=$P($G(^DGCR(399,DA,"M1")),U,3),IBPSQO=$P($G(^DGCR(399,DA,"M1")),U,11)
Q
53 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=53 G A
54 S DW="M1;3",DV="FX",DU="",DIFLD=123,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C54^IBXS36"
S X="IBPSID" Q:X Q:$NA(@X)[U S X=$G(@X)
S Y=X
G Y
C54 G C54S:$D(DE(54))[0 K DB
S X=DE(54),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,3)="" I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"M1")):^("M1"),1:"") S X=$P(Y(1),U,11),X=X S DIU=X K Y S X="" X ^DD(399,123,1,1,2.4)
C54S S X="" G:DG(DQ)=X C54F1 K DB
S X=DG(DQ),DIC=DIE
;
C54F1 Q
X54 K:$L(X)>13!($L(X)<3)!($TR(X," ")="") X
I $D(X),X'?.ANP K X
Q
;
55 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=55 D X55 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X55 I $G(IBPSQO)]"",X'=$G(IBPSID),X'=$G(IBPSIDO) S Y="@3224"
Q
56 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=56 D X56 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X56 I $G(IBPSQO)="",$G(IBPSQUAL)="",X]"" S Y="@3224"
Q
57 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=57 G A
58 D:$D(DG)>9 F^DIE17,DE S DQ=58,DW="M1;11",DV="*P355.97'",DU="",DIFLD=129,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="IBE(355.97,"
S X="IBPSQUAL" Q:X Q:$NA(@X)[U S X=$G(@X)
S Y=X
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
X58 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
59 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=59 D X59 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X59 S Y="@3225"
Q
60 S DQ=61 ;@3224
61 S DW="M1;11",DV="*P355.97'",DU="",DIFLD=129,DLB="Secondary ID Qualifier"
S DU="IBE(355.97,"
G RE
X61 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
62 S DQ=63 ;@3225
63 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=63 D X63 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X63 K DIE("NO^")
Q
64 S DQ=65 ;@3231
65 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=65 D X65 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X65 I '$$SUPPPT^IBCEP7B(DA,3) S Y="@3232"
Q
66 S DW="M1;4",DV="FX",DU="",DIFLD=124,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C66^IBXS36"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C66 G C66S:$D(DE(66))[0 K DB
D ^IBXS37
C66S S X="" G:DG(DQ)=X C66F1 K DB
D ^IBXS38
C66F1 Q
X66 K:$L(X)>13!($L(X)<3)!($TR(X," ")="") X
I $D(X),X'?.ANP K X
Q
;
67 D:$D(DG)>9 F^DIE17,DE S DQ=67,DW="M1;12",DV="*P355.97'",DU="",DIFLD=130,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="IBE(355.97,"
S Y="@"
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
X67 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
68 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=68 D X68 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X68 W !,"No Billing Prov Secondary IDs will be sent for Tertiary Ins/Elect Plan Type."
Q
69 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=69 D X69 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X69 D:(IBDRLP'[33&(IBDRLP'[34)) PAUSE^VALM1 S Y="@33"
Q
70 S DQ=71 ;@3232
71 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=71 D X71 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X71 I '$$ATTREND^IBCEP7B(DA,3) S Y="@3233"
Q
72 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=72 D X72 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X72 I $P($G(^DGCR(399,DA,"M1")),U,4)]"" S Y="@3233"
Q
73 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=73 D X73 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X73 W !,"The Att/Rend ID will be sent as the tertiary ins. Billing Prov Sec ID."
Q
74 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=74 D X74 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X74 D:(IBDRLP'[33&(IBDRLP'[34)) PAUSE^VALM1 S Y="@33"
Q
75 S DQ=76 ;@3233
76 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=76 D X76 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X76 S IBPSDAT=$$GETID^IBCEP7B(DA,3),IBPSID=$P(IBPSDAT,U),IBPSQUAL=$P(IBPSDAT,U,2) I IBPSID="" S Y="@323"
Q
77 D:$D(DG)>9 F^DIE17 G ^IBXS39
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBXS36 20783 printed Dec 13, 2024@02:30:16 Page 2
IBXS36 ; ;11/02/18
+1 DO DE
GOTO BEGIN
DE SET DIE="^DGCR(399,"
SET DIC=DIE
SET DP=399
SET DL=1
SET DIEL=0
SET DU=""
KILL DG,DE,DB
if $ORDER(^DGCR(399,DA,""))=""
QUIT
+1 IF $DATA(^(0))
SET %Z=^(0)
SET %=$PIECE(%Z,U,21)
if %]""
SET DE(4)=%
+2 IF $DATA(^("M"))
SET %Z=^("M")
SET %=$PIECE(%Z,U,11)
if %]""
SET DE(1)=%
+3 IF $DATA(^("M1"))
SET %Z=^("M1")
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(8)=%
SET DE(19)=%
SET DE(25)=%
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(37)=%
SET DE(48)=%
SET DE(54)=%
SET %=$PIECE(%Z,U,4)
if %]""
SET DE(66)=%
SET %=$PIECE(%Z,U,10)
if %]""
SET DE(9)=%
SET DE(20)=%
SET DE(29)=%
SET DE(32)=%
+4 IF $TEST
SET %=$PIECE(%Z,U,11)
if %]""
SET DE(38)=%
SET DE(49)=%
SET DE(58)=%
SET DE(61)=%
SET %=$PIECE(%Z,U,12)
if %]""
SET DE(67)=%
+5 KILL %Z
QUIT
+6 ;
W WRITE !?DL+DL-2,DLB_": "
+1 QUIT
O DO W
WRITE Y
if $X>45
WRITE !?9
+1 IF $LENGTH(Y)>19
IF 'DV
IF DV'["I"
IF (DV["F"!(DV["K"))
GOTO RW^DIR2
+2 ;**
if Y]""
WRITE "// "
IF 'DV
IF DV["I"
IF $DATA(DE(DQ))#2
KILL X
SET X("FIELD")=DIFLD
SET X("FILE")=DP
WRITE " ("_$$EZBLD^DIALOG(710,.X)_")"
KILL X
SET X=""
QUIT
TR if DV["K"&(DUZ(0)'="@")
QUIT
READ X:DTIME
IF '$TEST
SET (DTOUT,X)=U
WRITE $CHAR(7)
+1 QUIT
A KILL DQ(DQ)
SET DQ=DQ+1
B GOTO @DQ
RE if DV["K"&(DUZ(0)'["@")
GOTO A
if $DATA(DE(DQ))
GOTO PR
DO W
DO TR
N IF X=""
if $DATA(^DD("KEY","F",DP,DIFLD))
GOTO NKEY
if DV'["R"
GOTO A
if 'DV
GOTO X
if D'>0
GOTO X
GOTO A
RD if X?."?"
GOTO QS
IF X["^"
DO D
GOTO ^DIE17
+1 IF X="@"
DO D
GOTO Z^DIE2
+2 IF X=" "
IF DV["d"
IF DV'["P"
IF $DATA(^DISV(DUZ,"DIE",DLB))
SET X=^(DLB)
IF DV'["D"
IF DV'["S"
WRITE " "_X
T if DV
GOTO M^DIE17
if DV["V"
GOTO ^DIE3
if DV'["S"
GOTO P
IF X?.ANP
DO SET^DIED
IF 'DDER
GOTO V
+1 KILL DDER
GOTO X
P IF DV["P"
SET DIC=U_DU
SET DIC(0)=$EXTRACT("EN",$DATA(DB(DQ))+1)_"M"_$EXTRACT("L",DV'["'")
if DIC(0)["L"
SET DLAYGO=+$PIECE(DV,"P",2)
if DV["*"
GOTO AST^DIED
DO NOSCR^DIED
SET X=+Y
SET DIC=DIE
if X<0
GOTO X
+1 if DV'["N"
GOTO V
DO D
IF $LENGTH($PIECE(X,"."))>24
KILL X
GOTO Z
+2 IF $PIECE(DQ(DQ),U,5)'["$"
IF X?.1"-".N.1".".N
IF $PIECE(DQ(DQ),U,5,99)["+X'=X"
SET X=+X
V DO @("X"_DQ)
KILL YS
UNIQ IF DV["U"
IF $DATA(X)
IF DIFLD=.01
KILL %
MERGE %=@(DIE_"""B"",X)")
KILL %(DA)
if $ORDER(%(0))
KILL X
Z KILL DIC("S"),DLAYGO
IF $DATA(X)
IF X'=U
if $GET(DE(DW,"INDEX"))
DO SAVEVALS
if '$$KEYCHK
GOTO UNIQFERR^DIE17
SET DG(DW)=X
if DV["d"
SET ^DISV(DUZ,"DIE",DLB)=X
GOTO A
X if '$DATA(ZTQUEUED)
WRITE $CHAR(7),"??"
IF $DATA(DB(DQ))
GOTO Z^DIE17
+1 SET X="?BAD"
QS SET DZ=X
DO D
DO QQ^DIEQ
GOTO B
D SET D=DIFLD
SET DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$PIECE($TEXT(@("X"_DQ))," ",2,99)
QUIT
Y IF '$DATA(DE(DQ))
DO O
if "@"'[X
GOTO RD
if DV'["R"&(X="@")
GOTO A
if X="@"
GOTO X
SET X=Y
GOTO N
PR SET DG=DV
SET Y=DE(DQ)
SET X=DU
IF $DATA(DQ(DQ,2))
XECUTE DQ(DQ,2)
GOTO RP
R IF DG["P"
IF @("$D(^"_X_"0))")
SET X=+$PIECE(^(0),U,2)
if '$DATA(^(Y,0))
GOTO RP
SET Y=$PIECE(^(0),U)
SET X=$PIECE(^DD(X,.01,0),U,3)
SET DG=$PIECE(^(0),U,2)
GOTO R
+1 IF DG["V"
IF +Y
IF $PIECE(Y,";",2)["("
IF $DATA(@(U_$PIECE(Y,";",2)_"0)"))
SET X=+$PIECE(^(0),U,2)
if '$DATA(^(+Y,0))
GOTO RP
SET Y=$PIECE(^(0),U)
IF $DATA(^DD(+X,.01,0))
SET DG=$PIECE(^(0),U,2)
SET X=$PIECE(^(0),U,3)
GOTO R
+2 if DG["D"
XECUTE ^DD("DD")
IF DG["S"
SET %=$PIECE($PIECE(";"_X,";"_Y_":",2),";")
IF %]""
SET Y=$SELECT($GET(DUZ("LANG"))'>1:%,'DIFLD:%,1:$$SET^DIQ(DP,DIFLD,Y))
RP DO O
IF X=""
SET X=DE(DQ)
if 'DV
GOTO A
if DC<2
GOTO A
GOTO N^DIE17
I IF DV'["I"
IF DV'["#"
GOTO RD
+1 DO E^DIE0
if $DATA(X)
GOTO RD
GOTO PR
+2 QUIT
SAVEVALS SET @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$GET(DE(DQ))
if $DATA(^("F"))[0
SET ^("F")=$GET(DE(DQ))
+1 IF $DATA(DE(DW,"4/"))
SET @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
+2 IF '$TEST
KILL @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
+3 QUIT
NKEY if '$DATA(ZTQUEUED)
WRITE "?? Required key field"
SET X="?BAD"
GOTO QS
KEYCHK() if $GET(DE(DW,"KEY"))=""
QUIT 1
QUIT @DE(DW,"KEY")
BEGIN SET DNM="IBXS36"
SET DQ=1
1 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=1
SET DW="M;11"
SET DV="RP4"
SET DU=""
SET DIFLD=111
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C1^IBXS36"
+2 SET DU="DIC(4,"
+3 GOTO RE
C1 if $DATA(DE(1))[0
GOTO C1S
KILL DB
+1 SET X=DE(1)
SET DIC=DIE
+2 DO DEL^IBCU5
+3 SET X=DE(1)
SET DIC=DIE
+4 SET DGRVRCAL=2
C1S SET X=""
if DG(DQ)=X
GOTO C1F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO MAILIN^IBCU5
+3 SET X=DG(DQ)
SET DIC=DIE
+4 SET DGRVRCAL=1
C1F1 QUIT
X1 QUIT
2 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=2
DO X2
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X2 KILL DIC("DR"),DLAYGO
+1 QUIT
3 ;@31
SET DQ=4
4 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=4
SET DW="0;21"
SET DV="*S"
SET DU=""
SET DIFLD=.21
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C4^IBXS36"
+2 SET DU="P:PRIMARY INSURANCE;S:SECONDARY INSURANCE;T:TERTIARY INSURANCE;A:PATIENT;"
+3 GOTO RE
C4 if $DATA(DE(4))[0
GOTO C4S
KILL DB
+1 SET X=DE(4)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"MP")):^("MP"),1:"")
SET X=$PIECE(Y(1),U,2)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,.21,1,1,2.4)
+3 SET X=DE(4)
SET DIC=DIE
+4 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET X=('$$REQMRA^IBEFUNC(DA)&$$NEEDMRA^IBEFUNC(DA))
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"TX")):^("TX"),1:"")
SET X=$PIECE(Y(1),U,5)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,.21,1,2,2.4)
+5 SET X=DE(4)
SET DIC=DIE
+6 ;
+7 SET X=DE(4)
SET DIC=DIE
+8 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET X=$$DELETE^IBCEF84(DA)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"TX")):^("TX"),1:"")
SET X=$PIECE(Y(1),U,8)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,.21,1,4,2.4)
+9 SET X=DE(4)
SET DIC=DIE
+10 ;
+11 SET X=DE(4)
SET DIC=DIE
+12 ;
+13 SET X=DE(4)
SET DIC=DIE
+14 ;
+15 SET X=DE(4)
SET DIC=DIE
+16 ;
+17 SET X=DE(4)
SET DIC=DIE
+18 ;
+19 SET X=DE(4)
SET DIC=DIE
+20 ;
C4S SET X=""
if DG(DQ)=X
GOTO C4F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"MP")):^("MP"),1:"")
SET X=$PIECE(Y(1),U,2)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=$$BPP^IBCNS2(DA)
XECUTE ^DD(399,.21,1,1,1.4)
+3 SET X=DG(DQ)
SET DIC=DIE
+4 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET X=('$$REQMRA^IBEFUNC(DA)&$$NEEDMRA^IBEFUNC(DA))
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"TX")):^("TX"),1:"")
SET X=$PIECE(Y(1),U,5)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=0
XECUTE ^DD(399,.21,1,2,1.4)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET X=$SELECT($$WNRBILL^IBEFUNC(DA,X):1,1:0)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"TX")):^("TX"),1:"")
SET X=$PIECE(Y(1),U,8)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,.21,1,3,1.4)
+7 SET X=DG(DQ)
SET DIC=DIE
+8 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET X=$$CREATE^IBCEF84(DA)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"TX")):^("TX"),1:"")
SET X=$PIECE(Y(1),U,8)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=1
XECUTE ^DD(399,.21,1,4,1.4)
+9 SET X=DG(DQ)
SET DIC=DIE
+10 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET X=Y(0)
SET X=X
SET X=X="P"
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,5)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,.21,1,5,1.4)
+11 SET X=DG(DQ)
SET DIC=DIE
+12 XECUTE ^DD(399,.21,1,6,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,6)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M1"))
SET DIV=X
SET $PIECE(^("M1"),U,6)=DIV
SET DIH=399
SET DIG=126
DO ^DICR
+13 SET X=DG(DQ)
SET DIC=DIE
+14 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,7)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M1"))
SET DIV=X
SET $PIECE(^("M1"),U,7)=DIV
SET DIH=399
SET DIG=127
DO ^DICR
+15 SET X=DG(DQ)
SET DIC=DIE
+16 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET X=Y(0)
SET X=X
SET X=X="P"
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"U2")):^("U2"),1:"")
SET X=$PIECE(Y(1),U,4)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,.21,1,8,1.4)
+17 SET X=DG(DQ)
SET DIC=DIE
+18 XECUTE ^DD(399,.21,1,9,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"U2")):^("U2"),1:"")
SET X=$PIECE(Y(1),U,5)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"U2"))
SET DIV=X
SET $PIECE(^("U2"),U,5)=DIV
SET DIH=399
SET DIG=219
DO ^DICR
+19 SET X=DG(DQ)
SET DIC=DIE
+20 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"U2")):^("U2"),1:"")
SET X=$PIECE(Y(1),U,6)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"U2"))
SET DIV=X
SET $PIECE(^("U2"),U,6)=DIV
SET DIH=399
SET DIG=220
DO ^DICR
C4F1 QUIT
X4 QUIT
5 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=5
DO X5
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X5 if IBDR20'["32"
SET Y="@33"
+1 QUIT
6 ;@3211
SET DQ=7
7 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=7
DO X7
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X7 IF '$$SUPPPT^IBCEP7B(DA,1)
SET Y="@3212"
+1 QUIT
8 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=8
SET DW="M1;2"
SET DV="FX"
SET DU=""
SET DIFLD=122
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C8^IBXS36"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
C8 if $DATA(DE(8))[0
GOTO C8S
KILL DB
+1 SET X=DE(8)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,2)=""
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,10)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,122,1,1,2.4)
C8S SET X=""
if DG(DQ)=X
GOTO C8F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
C8F1 QUIT
X8 if $LENGTH(X)>13!($LENGTH(X)<3)!($TRANSLATE(X," ")="")
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
9 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=9
SET DW="M1;10"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=128
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="IBE(355.97,"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
X9 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
10 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=10
DO X10
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X10 WRITE !,"No Billing Prov Secondary IDs will be sent for Primary Ins/Elect Plan Type."
+1 QUIT
11 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=11
DO X11
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X11 SET Y="@3221"
+1 QUIT
12 ;@3212
SET DQ=13
13 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=13
DO X13
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X13 IF '$$ATTREND^IBCEP7B(DA,1)
SET Y="@3213"
+1 QUIT
14 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=14
DO X14
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X14 IF $PIECE($GET(^DGCR(399,DA,"M1")),U,2)]""
SET Y="@3213"
+1 QUIT
15 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=15
DO X15
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X15 WRITE !,"The Att/Rend ID will be sent as the primary ins. Billing Prov Sec ID."
+1 QUIT
16 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=16
DO X16
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X16 SET Y="@3221"
+1 QUIT
17 ;@3213
SET DQ=18
18 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=18
DO X18
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X18 SET IBPSDAT=$$GETID^IBCEP7B(DA,1)
SET IBPSID=$PIECE(IBPSDAT,U)
SET IBPSQUAL=$PIECE(IBPSDAT,U,2)
IF IBPSID=""
SET Y="@321"
+1 QUIT
19 SET DW="M1;2"
SET DV="FX"
SET DU=""
SET DIFLD=122
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C19^IBXS36"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
C19 if $DATA(DE(19))[0
GOTO C19S
KILL DB
+1 SET X=DE(19)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,2)=""
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,10)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,122,1,1,2.4)
C19S SET X=""
if DG(DQ)=X
GOTO C19F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
C19F1 QUIT
X19 if $LENGTH(X)>13!($LENGTH(X)<3)!($TRANSLATE(X," ")="")
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
20 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=20
SET DW="M1;10"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=128
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="IBE(355.97,"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
X20 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
21 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=21
DO X21
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X21 SET DIE("NO^")=1
+1 QUIT
22 ;@321
SET DQ=23
23 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=23
DO X23
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X23 SET IBPSIDO=$PIECE($GET(^DGCR(399,DA,"M1")),U,2)
SET IBPSQO=$PIECE($GET(^DGCR(399,DA,"M1")),U,10)
+1 QUIT
24 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=24
GOTO A
25 SET DW="M1;2"
SET DV="FX"
SET DU=""
SET DIFLD=122
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C25^IBXS36"
+2 SET X="IBPSID"
if X
QUIT
if $NAME(@X)[U
QUIT
SET X=$GET(@X)
+3 SET Y=X
+4 GOTO Y
C25 if $DATA(DE(25))[0
GOTO C25S
KILL DB
+1 SET X=DE(25)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,2)=""
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,10)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,122,1,1,2.4)
C25S SET X=""
if DG(DQ)=X
GOTO C25F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
C25F1 QUIT
X25 if $LENGTH(X)>13!($LENGTH(X)<3)!($TRANSLATE(X," ")="")
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
26 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=26
DO X26
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X26 IF $GET(IBPSQO)]""
IF X'=$GET(IBPSID)
IF X'=$GET(IBPSIDO)
SET Y="@3214"
+1 QUIT
27 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=27
DO X27
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X27 IF $GET(IBPSQO)=""
IF $GET(IBPSQUAL)=""
IF X]""
SET Y="@3214"
+1 QUIT
28 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=28
GOTO A
29 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=29
SET DW="M1;10"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=128
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="IBE(355.97,"
+2 SET X="IBPSQUAL"
if X
QUIT
if $NAME(@X)[U
QUIT
SET X=$GET(@X)
+3 SET Y=X
+4 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+5 GOTO RD
X29 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
30 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=30
DO X30
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X30 SET Y="@3215"
+1 QUIT
31 ;@3214
SET DQ=32
32 SET DW="M1;10"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=128
SET DLB="Primary ID Qualifier"
+1 SET DU="IBE(355.97,"
+2 GOTO RE
X32 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
33 ;@3215
SET DQ=34
34 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=34
DO X34
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X34 KILL DIE("NO^")
+1 QUIT
35 ;@3221
SET DQ=36
36 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=36
DO X36
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X36 IF '$$SUPPPT^IBCEP7B(DA,2)
SET Y="@3222"
+1 QUIT
37 SET DW="M1;3"
SET DV="FX"
SET DU=""
SET DIFLD=123
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C37^IBXS36"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
C37 if $DATA(DE(37))[0
GOTO C37S
KILL DB
+1 SET X=DE(37)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,3)=""
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,11)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,123,1,1,2.4)
C37S SET X=""
if DG(DQ)=X
GOTO C37F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
C37F1 QUIT
X37 if $LENGTH(X)>13!($LENGTH(X)<3)!($TRANSLATE(X," ")="")
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
38 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=38
SET DW="M1;11"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=129
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="IBE(355.97,"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
X38 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
39 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=39
DO X39
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X39 WRITE !,"No Billing Prov Secondary IDs will be sent for Secondary Ins/Elect Plan Type."
+1 QUIT
40 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=40
DO X40
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X40 SET Y="@3231"
+1 QUIT
41 ;@3222
SET DQ=42
42 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=42
DO X42
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X42 IF '$$ATTREND^IBCEP7B(DA,2)
SET Y="@3223"
+1 QUIT
43 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=43
DO X43
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X43 IF $PIECE($GET(^DGCR(399,DA,"M1")),U,3)]""
SET Y="@3223"
+1 QUIT
44 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=44
DO X44
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X44 WRITE !,"The Att/Rend ID will be sent as the secondary ins. Billing Prov Sec ID."
+1 QUIT
45 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=45
DO X45
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X45 SET Y="@3231"
+1 QUIT
46 ;@3223
SET DQ=47
47 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=47
DO X47
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X47 SET IBPSDAT=$$GETID^IBCEP7B(DA,2)
SET IBPSID=$PIECE(IBPSDAT,U)
SET IBPSQUAL=$PIECE(IBPSDAT,U,2)
IF IBPSID=""
SET Y="@322"
+1 QUIT
48 SET DW="M1;3"
SET DV="FX"
SET DU=""
SET DIFLD=123
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C48^IBXS36"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
C48 if $DATA(DE(48))[0
GOTO C48S
KILL DB
+1 SET X=DE(48)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,3)=""
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,11)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,123,1,1,2.4)
C48S SET X=""
if DG(DQ)=X
GOTO C48F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
C48F1 QUIT
X48 if $LENGTH(X)>13!($LENGTH(X)<3)!($TRANSLATE(X," ")="")
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
49 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=49
SET DW="M1;11"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=129
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="IBE(355.97,"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
X49 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
50 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=50
DO X50
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X50 SET DIE("NO^")=1
+1 QUIT
51 ;@322
SET DQ=52
52 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=52
DO X52
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X52 SET IBPSIDO=$PIECE($GET(^DGCR(399,DA,"M1")),U,3)
SET IBPSQO=$PIECE($GET(^DGCR(399,DA,"M1")),U,11)
+1 QUIT
53 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=53
GOTO A
54 SET DW="M1;3"
SET DV="FX"
SET DU=""
SET DIFLD=123
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C54^IBXS36"
+2 SET X="IBPSID"
if X
QUIT
if $NAME(@X)[U
QUIT
SET X=$GET(@X)
+3 SET Y=X
+4 GOTO Y
C54 if $DATA(DE(54))[0
GOTO C54S
KILL DB
+1 SET X=DE(54)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,3)=""
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M1")):^("M1"),1:"")
SET X=$PIECE(Y(1),U,11)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(399,123,1,1,2.4)
C54S SET X=""
if DG(DQ)=X
GOTO C54F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
C54F1 QUIT
X54 if $LENGTH(X)>13!($LENGTH(X)<3)!($TRANSLATE(X," ")="")
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
55 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=55
DO X55
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X55 IF $GET(IBPSQO)]""
IF X'=$GET(IBPSID)
IF X'=$GET(IBPSIDO)
SET Y="@3224"
+1 QUIT
56 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=56
DO X56
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X56 IF $GET(IBPSQO)=""
IF $GET(IBPSQUAL)=""
IF X]""
SET Y="@3224"
+1 QUIT
57 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=57
GOTO A
58 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=58
SET DW="M1;11"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=129
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="IBE(355.97,"
+2 SET X="IBPSQUAL"
if X
QUIT
if $NAME(@X)[U
QUIT
SET X=$GET(@X)
+3 SET Y=X
+4 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+5 GOTO RD
X58 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
59 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=59
DO X59
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X59 SET Y="@3225"
+1 QUIT
60 ;@3224
SET DQ=61
61 SET DW="M1;11"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=129
SET DLB="Secondary ID Qualifier"
+1 SET DU="IBE(355.97,"
+2 GOTO RE
X61 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
62 ;@3225
SET DQ=63
63 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=63
DO X63
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X63 KILL DIE("NO^")
+1 QUIT
64 ;@3231
SET DQ=65
65 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=65
DO X65
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X65 IF '$$SUPPPT^IBCEP7B(DA,3)
SET Y="@3232"
+1 QUIT
66 SET DW="M1;4"
SET DV="FX"
SET DU=""
SET DIFLD=124
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C66^IBXS36"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
C66 if $DATA(DE(66))[0
GOTO C66S
KILL DB
+1 DO ^IBXS37
C66S SET X=""
if DG(DQ)=X
GOTO C66F1
KILL DB
+1 DO ^IBXS38
C66F1 QUIT
X66 if $LENGTH(X)>13!($LENGTH(X)<3)!($TRANSLATE(X," ")="")
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
67 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=67
SET DW="M1;12"
SET DV="*P355.97'"
SET DU=""
SET DIFLD=130
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="IBE(355.97,"
+2 SET Y="@"
+3 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+4 GOTO RD
X67 SET DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
68 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=68
DO X68
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X68 WRITE !,"No Billing Prov Secondary IDs will be sent for Tertiary Ins/Elect Plan Type."
+1 QUIT
69 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=69
DO X69
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X69 if (IBDRLP'[33&(IBDRLP'[34))
DO PAUSE^VALM1
SET Y="@33"
+1 QUIT
70 ;@3232
SET DQ=71
71 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=71
DO X71
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X71 IF '$$ATTREND^IBCEP7B(DA,3)
SET Y="@3233"
+1 QUIT
72 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=72
DO X72
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X72 IF $PIECE($GET(^DGCR(399,DA,"M1")),U,4)]""
SET Y="@3233"
+1 QUIT
73 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=73
DO X73
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X73 WRITE !,"The Att/Rend ID will be sent as the tertiary ins. Billing Prov Sec ID."
+1 QUIT
74 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=74
DO X74
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X74 if (IBDRLP'[33&(IBDRLP'[34))
DO PAUSE^VALM1
SET Y="@33"
+1 QUIT
75 ;@3233
SET DQ=76
76 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=76
DO X76
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X76 SET IBPSDAT=$$GETID^IBCEP7B(DA,3)
SET IBPSID=$PIECE(IBPSDAT,U)
SET IBPSQUAL=$PIECE(IBPSDAT,U,2)
IF IBPSID=""
SET Y="@323"
+1 QUIT
77 if $DATA(DG)>9
DO F^DIE17
GOTO ^IBXS39