IBXS6 ; GENERATED FROM 'IB SCREEN6' INPUT TEMPLATE(#512), FILE 399;01/15/20
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,19) S:%]"" DE(22)=%,DE(26)=% S %=$P(%Z,U,22) S:%]"" DE(14)=% S %=$P(%Z,U,24) S:%]"" DE(5)=% S %=$P(%Z,U,25) S:%]"" DE(7)=% S %=$P(%Z,U,26) S:%]"" DE(11)=% S %=$P(%Z,U,27) S:%]"" DE(17)=%
I $D(^("U")) S %Z=^("U") S %=$P(%Z,U,1) S:%]"" DE(42)=% S %=$P(%Z,U,2) S:%]"" DE(43)=% S %=$P(%Z,U,3) S:%]"" DE(39)=% S %=$P(%Z,U,5) S:%]"" DE(32)=% S %=$P(%Z,U,6) S:%]"" DE(37)=% S %=$P(%Z,U,7) S:%]"" DE(35)=% S %=$P(%Z,U,11) S:%]"" DE(46)=%
I S %=$P(%Z,U,15) S:%]"" DE(47)=%
I $D(^("U3")) S %Z=^("U3") S %=$P(%Z,U,2) S:%]"" DE(15)=%
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="IBXS6",DQ=1
N DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR K DIEFIRE,DIEBADK S DIEZTMP=$$GETTMP^DIKC1("DIEZ")
M DIEZAR=^DIE(512,"AR") S DICRREC="TRIG^DIE17"
S:$D(DTIME)[0 DTIME=300 S D0=DA,DIIENS=DA_",",DIEZ=512,U="^"
1 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=1 D X1 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
X1 S:IBDR20'["61" Y="@62"
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 S:$P($G(^DGCR(399,DA,0)),U,19)'=3 Y="@612"
Q
3 S DQ=4 ;@611
4 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=4 D X4 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
X4 S DIE("NO^")=""
Q
5 S DW="0;24",DV="RS",DU="",DIFLD=.24,DLB="LOCATION OF CARE"
S DU="1:HOSPITAL - INPT OR OPT (INCLUDES CLINICS);2:SKILLED NURSING (NHCU);3:HOME HEALTH AGENCY;7:CLINIC (ONLY INDEPENDENT/SATELITE);8:SPEC. FACILITY HOSP/AMB SURG CTR;"
G RE
X5 Q
6 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 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
X6 S:'$D(DIE("NO^")) DIE("NO^")=""
Q
7 S DW="0;25",DV="R*P399.1'",DU="",DIFLD=.25,DLB="BILL CLASSIFICATION"
S DE(DW)="C7^IBXS6"
S DU="DGCR(399.1,"
G RE
C7 G C7S:$D(DE(7))[0 K DB
S X=DE(7),DIC=DIE
D ALLID^IBCEP3(DA,.25,2)
C7S S X="" G:DG(DQ)=X C7F1 K DB
S X=DG(DQ),DIC=DIE
D ALLID^IBCEP3(DA,.25,1)
C7F1 Q
X7 S DIC("S")="I $P(^(0),U,23),$$TOBIN^IBCU4(Y,D0)" D ^DIC K DIC S DIC=$G(DIE),X=+Y K:Y<0 X
Q
;
8 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 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
X8 I '$$TOBIN^IBCU4($P(^DGCR(399,DA,0),U,25),DA) W !!,*7," ** The 'BILL CLASSIFICATION' must be consistent with the 'LOCATION OF CARE.'",! S Y="@611"
Q
9 S DQ=10 ;@612
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 K DIE("NO^")
Q
11 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW="0;26",DV="RS",DU="",DIFLD=.26,DLB="TIMEFRAME OF BILL"
S DE(DW)="C11^IBXS6"
S DU="1:ADMIT THRU DISCHARGE;2:INTERIM - 1ST CLAIM;3:INTERIM - CONTINUING CLAIM;4:INTERIM - LAST CLAIM;5:LATE CHARGES ONLY;6:ADJUSTMENT CLAIM;7:REPLACEMENT CLAIM;8:VOID/CANCEL PRIOR CLAIM;0:NON-PAY/ZERO CLAIM;"
G RE
C11 G C11S:$D(DE(11))[0 K DB
S X=DE(11),DIC=DIE
;
C11S S X="" G:DG(DQ)=X C11F1 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,0)):^(0),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y S X=DIV S X=DIV,X=X S DIH=$G(^DGCR(399,DIV(0),0)),DIV=X S $P(^(0),U,6)=DIV,DIH=399,DIG=.06 D ^DICR
C11F1 Q
X11 Q
12 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=12 D X12 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
X12 I '$$INPAT^IBCEF(DA)!($$FT^IBCEF(DA)'=3) S Y="@6121"
Q
13 S DQ=14 ;@6121
14 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW="0;22",DV="P40.8'",DU="",DIFLD=.22,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C14^IBXS6",DE(DW,"INDEX")=1
S DU="DG(40.8,"
G RE
C14 G C14S:$D(DE(14))[0 K DB
S X=DE(14),DIC=DIE
;
C14S S X="" G:DG(DQ)=X C14F1 K DB
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=$$CLIAREQ^IBCEP8A(DA) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"U2")):^("U2"),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$CLIA^IBCEP8A(DA) X ^DD(399,.22,1,7,1.4)
C14F1 S DIEZRXR(399,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=820 S DIEZRXR(399,DIXR)=""
Q
X14 Q
15 D:$D(DG)>9 F^DIE17,DE S DQ=15,DW="U3;2",DV="*P8932.1'",DU="",DIFLD=243,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="USC(8932.1,"
G RE
X15 S DIC("S")="I $P($G(^(90002)),U,2)=""N""" D ^DIC K DIC S DIC=$G(DIE),X=+Y K:Y<0 X
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 D DISPTAX^IBCEP81($P($G(^DGCR(399,DA,"U3")),U,2),"Service Facility")
Q
17 S DW="0;27",DV="S",DU="",DIFLD=.27,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C17^IBXS6",DE(DW,"INDEX")=1
S DU="1:INSTITUTIONAL;2:PROFESSIONAL;"
G RE
C17 G C17S:$D(DE(17))[0 K DB
S X=DE(17),DIC=DIE
;
S X=DE(17),DIC=DIE
;
C17S S X="" G:DG(DQ)=X C17F1 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,0)):^(0),1:"") S X=$P(Y(1),U,19),X=X S DIU=X K Y S X=DIV S X=$$FT^IBCU3(DA,1) X ^DD(399,.27,1,1,1.4)
S X=DG(DQ),DIC=DIE
X ^DD(399,.27,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"U")):^("U"),1:"") S X=$P(Y(1),U,8),X=X S DIU=X K Y S X=DIV S X=3 S DIH=$G(^DGCR(399,DIV(0),"U")),DIV=X S $P(^("U"),U,8)=DIV,DIH=399,DIG=158 D ^DICR
C17F1 N X,X1,X2 S DIXR=989 D C17X1(U) K X2 M X2=X D C17X1("O") K X1 M X1=X
I $G(X(1))]"" D
. D CMAEDALL^IBCU9(DA)
K X M X=X2 I $G(X(1))]"" D
. D CMAEDALL^IBCU9(DA)
G C17F2
C17X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",399,DIIENS,.27,DION),$P($G(^DGCR(399,DA,0)),U,27))
S X=$G(X(1))
Q
C17F2 Q
X17 Q
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 DGRVRCAL=1
Q
19 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=19 D X19 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
X19 S DIPA("FT1")=$P($G(^DGCR(399,DA,0)),U,19)
Q
20 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=20 D X20 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
X20 D CKFT^IBCIUT1(IBIFN)
Q
21 S DQ=22 ;@614
22 D:$D(DG)>9 F^DIE17,DE S DQ=22,DW="0;19",DV="R*P353'",DU="",DIFLD=.19,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C22^IBXS6",DE(DW,"INDEX")=1
S DU="IBE(353,"
G RE
C22 G C22S:$D(DE(22))[0 K DB
S X=DE(22),DIC=DIE
;
S X=DE(22),DIC=DIE
S DGRVRCAL=2
S X=DE(22),DIC=DIE
D ALLID^IBCEP3(DA,.19,2)
S X=DE(22),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,1)=DIV,DIH=399,DIG=140 D ^DICR
S X=DE(22),DIC=DIE
D ATTREND^IBCU1(DA,"","")
S X=DE(22),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,2)=DIV,DIH=399,DIG=141 D ^DICR
S X=DE(22),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,3)=DIV,DIH=399,DIG=142 D ^DICR
S X=DE(22),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,4)=DIV,DIH=399,DIG=143 D ^DICR
S X=DE(22),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,5),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,5)=DIV,DIH=399,DIG=144 D ^DICR
S X=DE(22),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,6)=DIV,DIH=399,DIG=145 D ^DICR
C22S S X="" G:DG(DQ)=X C22F1 K DB
S X=DG(DQ),DIC=DIE
X ^DD(399,.19,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,0)):^(0),1:"") S X=$P(Y(1),U,9),X=X S DIU=X K Y S X=DIV S X=5 S DIH=$G(^DGCR(399,DIV(0),0)),DIV=X S $P(^(0),U,9)=DIV,DIH=399,DIG=.09 D ^DICR
S X=DG(DQ),DIC=DIE
S DGRVRCAL=1
S X=DG(DQ),DIC=DIE
D ALLID^IBCEP3(DA,.19,1)
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
D ATTREND^IBCU1(DA,"","")
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
;
C22F1 N X,X1,X2 S DIXR=984 D C22X1(U) K X2 M X2=X D C22X1("O") K X1 M X1=X
K X M X=X2 D
. N IBLNPRV I $$LNPRVFT^IBCEU7(X,.IBLNPRV) D FILE^DIE("E","IBLNPRV") Q
G C22F2
C22X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",399,DIIENS,.19,DION),$P($G(^DGCR(399,DA,0)),U,19))
S X=$G(X(1))
Q
C22F2 S DIXR=985 D C22X2(U) K X2 M X2=X D C22X2("O") K X1 M X1=X
K X M X=X2 D
. N DIEXARR M DIEXARR=X S DIEZCOND=1
. S X=X(1)=3
. S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
. D REMOVE^IBCEU7(DA,X(1))
G C22F3
C22X2(DION) K X
S X(1)=$G(@DIEZTMP@("V",399,DIIENS,.19,DION),$P($G(^DGCR(399,DA,0)),U,19))
S X=$G(X(1))
Q
C22F3 S DIEZRXR(399,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=820 S DIEZRXR(399,DIXR)=""
Q
X22 S DIC("S")="I $$FTINPUT^IBCU9(Y)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
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 DIPA("FT")=$P($G(^DGCR(399,DA,0)),U,19)
Q
24 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=24 D X24 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
X24 I $P($G(^IBE(353,+DIPA("FT"),2)),U,2)="P",$P($G(^(2)),U,4) S DIPA("FT1")=DIPA("FT") D CKFT^IBCIUT1(IBIFN) S Y="@615"
Q
25 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=25 D X25 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
X25 W !,*7,"Must be a printable national form type"
Q
26 D:$D(DG)>9 F^DIE17,DE S DQ=26,DW="0;19",DV="R*P353'",DU="",DIFLD=.19,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C26^IBXS6",DE(DW,"INDEX")=1
S DU="IBE(353,"
S X=$G(DIPA("FT1"))
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
C26 G C26S:$D(DE(26))[0 K DB
S X=DE(26),DIC=DIE
;
S X=DE(26),DIC=DIE
S DGRVRCAL=2
S X=DE(26),DIC=DIE
D ALLID^IBCEP3(DA,.19,2)
S X=DE(26),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,1)=DIV,DIH=399,DIG=140 D ^DICR
S X=DE(26),DIC=DIE
D ATTREND^IBCU1(DA,"","")
S X=DE(26),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,2)=DIV,DIH=399,DIG=141 D ^DICR
S X=DE(26),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,3)=DIV,DIH=399,DIG=142 D ^DICR
S X=DE(26),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,4)=DIV,DIH=399,DIG=143 D ^DICR
S X=DE(26),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,5),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,5)=DIV,DIH=399,DIG=144 D ^DICR
S X=DE(26),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M2")):^("M2"),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y S X="" S DIH=$G(^DGCR(399,DIV(0),"M2")),DIV=X S $P(^("M2"),U,6)=DIV,DIH=399,DIG=145 D ^DICR
C26S S X="" G:DG(DQ)=X C26F1 K DB
S X=DG(DQ),DIC=DIE
X ^DD(399,.19,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,0)):^(0),1:"") S X=$P(Y(1),U,9),X=X S DIU=X K Y S X=DIV S X=5 S DIH=$G(^DGCR(399,DIV(0),0)),DIV=X S $P(^(0),U,9)=DIV,DIH=399,DIG=.09 D ^DICR
S X=DG(DQ),DIC=DIE
S DGRVRCAL=1
S X=DG(DQ),DIC=DIE
D ALLID^IBCEP3(DA,.19,1)
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
D ATTREND^IBCU1(DA,"","")
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
;
C26F1 N X,X1,X2 S DIXR=984 D C26X1(U) K X2 M X2=X D C26X1("O") K X1 M X1=X
K X M X=X2 D
. N IBLNPRV I $$LNPRVFT^IBCEU7(X,.IBLNPRV) D FILE^DIE("E","IBLNPRV") Q
G C26F2
C26X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",399,DIIENS,.19,DION),$P($G(^DGCR(399,DA,0)),U,19))
S X=$G(X(1))
Q
C26F2 S DIXR=985 D C26X2(U) K X2 M X2=X D C26X2("O") K X1 M X1=X
K X M X=X2 D
. N DIEXARR M DIEXARR=X S DIEZCOND=1
. S X=X(1)=3
. S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
. D REMOVE^IBCEU7(DA,X(1))
G C26F3
C26X2(DION) K X
S X(1)=$G(@DIEZTMP@("V",399,DIIENS,.19,DION),$P($G(^DGCR(399,DA,0)),U,19))
S X=$G(X(1))
Q
C26F3 S DIEZRXR(399,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=820 S DIEZRXR(399,DIXR)=""
Q
X26 S DIC("S")="I $$FTINPUT^IBCU9(Y)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
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 S Y="@614"
Q
28 S DQ=29 ;@615
29 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=29 D X29 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
X29 D FTPRV^IBCEU5(DA)
Q
30 S DQ=31 ;@62
31 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=31 D X31 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
X31 S:IBDR20'["62" Y="@63"
Q
32 D:$D(DG)>9 F^DIE17,DE S DQ=32,DW="U;5",DV="RFOX",DU="",DIFLD=155,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(32,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
G RE
X32 I $D(X) D YN^IBCU
I $D(X),X'?.ANP K X
Q
;
33 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=33 D X33 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
X33 S:X=0 Y=156
Q
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 I '$$ROIDTCK^IBCEU7(DA) S Y="@621"
Q
35 S DW="U;7",DV="FOX",DU="",DIFLD=157,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(35,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
G RE
X35 I $D(X) D YN^IBCU S:$G(X)=1 X=$$ROI399^IBNCPDR4($G(DA))
I $D(X),X'?.ANP K X
Q
;
36 S DQ=37 ;@621
37 S DW="U;6",DV="RFOX",DU="",DIFLD=156,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(37,2)="S Y(0)=Y S Y=$S(Y="""":"""",""Yy1""[Y:""YES"",""Nn0""[Y:""NO"",1:"""")"
G RE
X37 I $D(X) D YN^IBCU I $D(X) X:X=0 ^DD(399,156,9.3) K IBRATY
I $D(X),X'?.ANP K X
Q
;
38 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=38 D X38 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
X38 S:'$D(IBOX) Y="@63"
Q
39 S DW="U;3",DV="RFOX",DU="",DIFLD=153,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(39,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
G RE
X39 I $D(X) D YN^IBCU
I $D(X),X'?.ANP K X
Q
;
40 S DQ=41 ;@63
41 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=41 D X41 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
X41 S:IBDR20'["63" Y="@64"
Q
42 S DW="U;1",DV="RDX",DU="",DIFLD=151,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C42^IBXS6"
G RE
C42 G C42S:$D(DE(42))[0 K DB
S X=DE(42),DIC=DIE
;
S X=DE(42),DIC=DIE
S DGRVRCAL=2
S X=DE(42),DIC=DIE
;
S X=DE(42),DIC=DIE
K:$P(^DGCR(399,DA,0),"^",2) ^DGCR(399,"APDS",$P(^(0),U,2),-X,DA)
C42S S X="" G:DG(DQ)=X C42F1 K DB
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X I $P(^DGCR(399,DA,0),U,5)<3 I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"U")):^("U"),1:"") S X=$P(Y(1),U,15),X=X S DIU=X K Y S X=DIV S X=$$LOS1^IBCU64(DA) X ^DD(399,151,1,1,1.4)
S X=DG(DQ),DIC=DIE
S DGRVRCAL=1
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X I +$G(^DGCR(399,DA,"U1"))=0 I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"U1")):^("U1"),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X=DIV S X=0 X ^DD(399,151,1,3,1.4)
S X=DG(DQ),DIC=DIE
S:$P(^DGCR(399,DA,0),"^",2) ^DGCR(399,"APDS",$P(^(0),U,2),-X,DA)=""
C42F1 Q
X42 S %DT="ETP" D ^%DT S X=Y K:Y<1 X I $D(X) D DDAT^IBCU4 K IB00
Q
;
43 D:$D(DG)>9 F^DIE17,DE S DQ=43,DW="U;2",DV="RDX",DU="",DIFLD=152,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C43^IBXS6"
G RE
C43 G C43S:$D(DE(43))[0 K DB
S X=DE(43),DIC=DIE
;
S X=DE(43),DIC=DIE
S DGRVRCAL=2
C43S S X="" G:DG(DQ)=X C43F1 K DB
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X I $P(^DGCR(399,DA,0),U,5)<3 I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"U")):^("U"),1:"") S X=$P(Y(1),U,15),X=X S DIU=X K Y S X=DIV S X=$$LOS1^IBCU64(DA) X ^DD(399,152,1,1,1.4)
S X=DG(DQ),DIC=DIE
S DGRVRCAL=1
C43F1 Q
X43 S %DT="ETP" D ^%DT S X=Y K:Y<1 X I $D(X) D DDAT1^IBCU4 K IB00
Q
;
44 S DQ=45 ;@64
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:IBDR20'["64" Y="@65"
Q
46 D:$D(DG)>9 F^DIE17,DE S DQ=46,DW="U;11",DV="*P399.1'",DU="",DIFLD=161,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C46^IBXS6"
S DU="DGCR(399.1,"
G RE
C46 G C46S:$D(DE(46))[0 K DB
S X=DE(46),DIC=DIE
;
C46S S X="" G:DG(DQ)=X C46F1 K DB
D ^IBXS61
C46F1 Q
X46 S DIC("S")="I $P(^DGCR(399.1,+Y,0),""^"",5)=1" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
47 D:$D(DG)>9 F^DIE17,DE S DQ=47,DW="U;15",DV="F",DU="",DIFLD=165,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C47^IBXS6"
G RE
C47 G C47S:$D(DE(47))[0 K DB
S X=DE(47),DIC=DIE
;
S X=DE(47),DIC=DIE
;
C47S S X="" G:DG(DQ)=X C47F1 K DB
D ^IBXS62
C47F1 Q
X47 K:$L(X)>6!($L(X)<1)!'(X?.N) X
I $D(X),X'?.ANP K X
Q
;
48 S DQ=49 ;@65
49 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=49 D X49 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
X49 S:IBDR20'["65" Y="@66"
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 D RCD^IBCU1
Q
51 D:$D(DG)>9 F^DIE17,DE S DQ=51,D=0 K DE(1) ;42
S DIFLD=42,DGO="^IBXS63",DC="16^399.042IPA^RC^",DV="399.042MR*P399.2'",DW="0;1",DOW=$$LABEL^DIALOGZ(DP,DIFLD),DLB=$P($$EZBLD^DIALOG(8042,DOW),": ") S:D DC=DC_D
S DU="DGCR(399.2,"
G RE:D I $D(DSC(399.042))#2,$P(DSC(399.042),"I $D(^UTILITY(",1)="" X DSC(399.042) S D=$O(^(0)) S:D="" D=-1 G M51
S D=$S($D(^DGCR(399,DA,"RC",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
M51 I D>0 S DC=DC_D I $D(^DGCR(399,DA,"RC",+D,0)) S DE(51)=$P(^(0),U,1)
G RE
R51 D DE
S D=$S($D(^DGCR(399,DA,"RC",0)):$P(^(0),U,3,4),1:1) G 51+1
;
52 D:$D(DG)>9 F^DIE17 G ^IBXS64
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBXS6 20789 printed Oct 16, 2024@18:31:06 Page 2
IBXS6 ; GENERATED FROM 'IB SCREEN6' INPUT TEMPLATE(#512), FILE 399;01/15/20
+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,19)
if %]""
SET DE(22)=%
SET DE(26)=%
SET %=$PIECE(%Z,U,22)
if %]""
SET DE(14)=%
SET %=$PIECE(%Z,U,24)
if %]""
SET DE(5)=%
SET %=$PIECE(%Z,U,25)
if %]""
SET DE(7)=%
SET %=$PIECE(%Z,U,26)
if %]""
SET DE(11)=%
SET %=$PIECE(%Z,U,27)
if %]""
SET DE(17)=%
+2 IF $DATA(^("U"))
SET %Z=^("U")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(42)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(43)=%
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(39)=%
SET %=$PIECE(%Z,U,5)
if %]""
SET DE(32)=%
SET %=$PIECE(%Z,U,6)
if %]""
SET DE(37)=%
SET %=$PIECE(%Z,U,7)
if %]""
SET DE(35)=%
SET %=$PIECE(%Z,U,11)
if %]""
SET DE(46)=%
+3 IF $TEST
SET %=$PIECE(%Z,U,15)
if %]""
SET DE(47)=%
+4 IF $DATA(^("U3"))
SET %Z=^("U3")
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(15)=%
+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="IBXS6"
SET DQ=1
+1 NEW DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR
KILL DIEFIRE,DIEBADK
SET DIEZTMP=$$GETTMP^DIKC1("DIEZ")
+2 MERGE DIEZAR=^DIE(512,"AR")
SET DICRREC="TRIG^DIE17"
+3 if $DATA(DTIME)[0
SET DTIME=300
SET D0=DA
SET DIIENS=DA_","
SET DIEZ=512
SET U="^"
1 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=1
DO X1
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
X1 if IBDR20'["61"
SET Y="@62"
+1 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 if $PIECE($GET(^DGCR(399,DA,0)),U,19)'=3
SET Y="@612"
+1 QUIT
3 ;@611
SET DQ=4
4 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=4
DO X4
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
X4 SET DIE("NO^")=""
+1 QUIT
5 SET DW="0;24"
SET DV="RS"
SET DU=""
SET DIFLD=.24
SET DLB="LOCATION OF CARE"
+1 SET DU="1:HOSPITAL - INPT OR OPT (INCLUDES CLINICS);2:SKILLED NURSING (NHCU);3:HOME HEALTH AGENCY;7:CLINIC (ONLY INDEPENDENT/SATELITE);8:SPEC. FACILITY HOSP/AMB SURG CTR;"
+2 GOTO RE
X5 QUIT
6 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=6
DO X6
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
X6 if '$DATA(DIE("NO^"))
SET DIE("NO^")=""
+1 QUIT
7 SET DW="0;25"
SET DV="R*P399.1'"
SET DU=""
SET DIFLD=.25
SET DLB="BILL CLASSIFICATION"
+1 SET DE(DW)="C7^IBXS6"
+2 SET DU="DGCR(399.1,"
+3 GOTO RE
C7 if $DATA(DE(7))[0
GOTO C7S
KILL DB
+1 SET X=DE(7)
SET DIC=DIE
+2 DO ALLID^IBCEP3(DA,.25,2)
C7S SET X=""
if DG(DQ)=X
GOTO C7F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO ALLID^IBCEP3(DA,.25,1)
C7F1 QUIT
X7 SET DIC("S")="I $P(^(0),U,23),$$TOBIN^IBCU4(Y,D0)"
DO ^DIC
KILL DIC
SET DIC=$GET(DIE)
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
8 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=8
DO X8
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
X8 IF '$$TOBIN^IBCU4($PIECE(^DGCR(399,DA,0),U,25),DA)
WRITE !!,*7," ** The 'BILL CLASSIFICATION' must be consistent with the 'LOCATION OF CARE.'",!
SET Y="@611"
+1 QUIT
9 ;@612
SET DQ=10
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 KILL DIE("NO^")
+1 QUIT
11 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=11
SET DW="0;26"
SET DV="RS"
SET DU=""
SET DIFLD=.26
SET DLB="TIMEFRAME OF BILL"
+1 SET DE(DW)="C11^IBXS6"
+2 SET DU="1:ADMIT THRU DISCHARGE;2:INTERIM - 1ST CLAIM;3:INTERIM - CONTINUING CLAIM;4:INTERIM - LAST CLAIM;5:LATE CHARGES ONLY;6:ADJUSTMENT CLAIM;7:REPLACEMENT CLAIM;8:VOID/CANCEL PRIOR CLAIM;0:NON-PAY/ZERO CLAIM;"
+3 GOTO RE
C11 if $DATA(DE(11))[0
GOTO C11S
KILL DB
+1 SET X=DE(11)
SET DIC=DIE
+2 ;
C11S SET X=""
if DG(DQ)=X
GOTO C11F1
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,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,6)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=DIV
SET X=X
SET DIH=$GET(^DGCR(399,DIV(0),0))
SET DIV=X
SET $PIECE(^(0),U,6)=DIV
SET DIH=399
SET DIG=.06
DO ^DICR
C11F1 QUIT
X11 QUIT
12 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=12
DO X12
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
X12 IF '$$INPAT^IBCEF(DA)!($$FT^IBCEF(DA)'=3)
SET Y="@6121"
+1 QUIT
13 ;@6121
SET DQ=14
14 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=14
SET DW="0;22"
SET DV="P40.8'"
SET DU=""
SET DIFLD=.22
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C14^IBXS6"
SET DE(DW,"INDEX")=1
+2 SET DU="DG(40.8,"
+3 GOTO RE
C14 if $DATA(DE(14))[0
GOTO C14S
KILL DB
+1 SET X=DE(14)
SET DIC=DIE
+2 ;
C14S SET X=""
if DG(DQ)=X
GOTO C14F1
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(0)=X
SET X=$$CLIAREQ^IBCEP8A(DA)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"U2")):^("U2"),1:"")
SET X=$PIECE(Y(1),U,13)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=$$CLIA^IBCEP8A(DA)
XECUTE ^DD(399,.22,1,7,1.4)
C14F1 SET DIEZRXR(399,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=820
SET DIEZRXR(399,DIXR)=""
+2 QUIT
X14 QUIT
15 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=15
SET DW="U3;2"
SET DV="*P8932.1'"
SET DU=""
SET DIFLD=243
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="USC(8932.1,"
+2 GOTO RE
X15 SET DIC("S")="I $P($G(^(90002)),U,2)=""N"""
DO ^DIC
KILL DIC
SET DIC=$GET(DIE)
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
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 DO DISPTAX^IBCEP81($PIECE($GET(^DGCR(399,DA,"U3")),U,2),"Service Facility")
+1 QUIT
17 SET DW="0;27"
SET DV="S"
SET DU=""
SET DIFLD=.27
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C17^IBXS6"
SET DE(DW,"INDEX")=1
+2 SET DU="1:INSTITUTIONAL;2:PROFESSIONAL;"
+3 GOTO RE
C17 if $DATA(DE(17))[0
GOTO C17S
KILL DB
+1 SET X=DE(17)
SET DIC=DIE
+2 ;
+3 SET X=DE(17)
SET DIC=DIE
+4 ;
C17S SET X=""
if DG(DQ)=X
GOTO C17F1
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,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,19)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=$$FT^IBCU3(DA,1)
XECUTE ^DD(399,.27,1,1,1.4)
+3 SET X=DG(DQ)
SET DIC=DIE
+4 XECUTE ^DD(399,.27,1,2,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"U")):^("U"),1:"")
SET X=$PIECE(Y(1),U,8)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=3
SET DIH=$GET(^DGCR(399,DIV(0),"U"))
SET DIV=X
SET $PIECE(^("U"),U,8)=DIV
SET DIH=399
SET DIG=158
DO ^DICR
C17F1 NEW X,X1,X2
SET DIXR=989
DO C17X1(U)
KILL X2
MERGE X2=X
DO C17X1("O")
KILL X1
MERGE X1=X
+1 IF $GET(X(1))]""
Begin DoDot:1
+2 DO CMAEDALL^IBCU9(DA)
End DoDot:1
+3 KILL X
MERGE X=X2
IF $GET(X(1))]""
Begin DoDot:1
+4 DO CMAEDALL^IBCU9(DA)
End DoDot:1
+5 GOTO C17F2
C17X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",399,DIIENS,.27,DION),$PIECE($GET(^DGCR(399,DA,0)),U,27))
+2 SET X=$GET(X(1))
+3 QUIT
C17F2 QUIT
X17 QUIT
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 DGRVRCAL=1
+1 QUIT
19 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=19
DO X19
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
X19 SET DIPA("FT1")=$PIECE($GET(^DGCR(399,DA,0)),U,19)
+1 QUIT
20 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=20
DO X20
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
X20 DO CKFT^IBCIUT1(IBIFN)
+1 QUIT
21 ;@614
SET DQ=22
22 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=22
SET DW="0;19"
SET DV="R*P353'"
SET DU=""
SET DIFLD=.19
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C22^IBXS6"
SET DE(DW,"INDEX")=1
+2 SET DU="IBE(353,"
+3 GOTO RE
C22 if $DATA(DE(22))[0
GOTO C22S
KILL DB
+1 SET X=DE(22)
SET DIC=DIE
+2 ;
+3 SET X=DE(22)
SET DIC=DIE
+4 SET DGRVRCAL=2
+5 SET X=DE(22)
SET DIC=DIE
+6 DO ALLID^IBCEP3(DA,.19,2)
+7 SET X=DE(22)
SET DIC=DIE
+8 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),1:"")
SET X=$PIECE(Y(1),U,1)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,1)=DIV
SET DIH=399
SET DIG=140
DO ^DICR
+9 SET X=DE(22)
SET DIC=DIE
+10 DO ATTREND^IBCU1(DA,"","")
+11 SET X=DE(22)
SET DIC=DIE
+12 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),1:"")
SET X=$PIECE(Y(1),U,2)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,2)=DIV
SET DIH=399
SET DIG=141
DO ^DICR
+13 SET X=DE(22)
SET DIC=DIE
+14 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),1:"")
SET X=$PIECE(Y(1),U,3)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,3)=DIV
SET DIH=399
SET DIG=142
DO ^DICR
+15 SET X=DE(22)
SET DIC=DIE
+16 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),1:"")
SET X=$PIECE(Y(1),U,4)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,4)=DIV
SET DIH=399
SET DIG=143
DO ^DICR
+17 SET X=DE(22)
SET DIC=DIE
+18 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),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),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,5)=DIV
SET DIH=399
SET DIG=144
DO ^DICR
+19 SET X=DE(22)
SET DIC=DIE
+20 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),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),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,6)=DIV
SET DIH=399
SET DIG=145
DO ^DICR
C22S SET X=""
if DG(DQ)=X
GOTO C22F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE ^DD(399,.19,1,1,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,9)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=5
SET DIH=$GET(^DGCR(399,DIV(0),0))
SET DIV=X
SET $PIECE(^(0),U,9)=DIV
SET DIH=399
SET DIG=.09
DO ^DICR
+3 SET X=DG(DQ)
SET DIC=DIE
+4 SET DGRVRCAL=1
+5 SET X=DG(DQ)
SET DIC=DIE
+6 DO ALLID^IBCEP3(DA,.19,1)
+7 SET X=DG(DQ)
SET DIC=DIE
+8 ;
+9 SET X=DG(DQ)
SET DIC=DIE
+10 DO ATTREND^IBCU1(DA,"","")
+11 SET X=DG(DQ)
SET DIC=DIE
+12 ;
+13 SET X=DG(DQ)
SET DIC=DIE
+14 ;
+15 SET X=DG(DQ)
SET DIC=DIE
+16 ;
+17 SET X=DG(DQ)
SET DIC=DIE
+18 ;
+19 SET X=DG(DQ)
SET DIC=DIE
+20 ;
C22F1 NEW X,X1,X2
SET DIXR=984
DO C22X1(U)
KILL X2
MERGE X2=X
DO C22X1("O")
KILL X1
MERGE X1=X
+1 KILL X
MERGE X=X2
Begin DoDot:1
+2 NEW IBLNPRV
IF $$LNPRVFT^IBCEU7(X,.IBLNPRV)
DO FILE^DIE("E","IBLNPRV")
QUIT
End DoDot:1
+3 GOTO C22F2
C22X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",399,DIIENS,.19,DION),$PIECE($GET(^DGCR(399,DA,0)),U,19))
+2 SET X=$GET(X(1))
+3 QUIT
C22F2 SET DIXR=985
DO C22X2(U)
KILL X2
MERGE X2=X
DO C22X2("O")
KILL X1
MERGE X1=X
+1 KILL X
MERGE X=X2
Begin DoDot:1
+2 NEW DIEXARR
MERGE DIEXARR=X
SET DIEZCOND=1
+3 SET X=X(1)=3
+4 SET DIEZCOND=$GET(X)
KILL X
MERGE X=DIEXARR
if 'DIEZCOND
QUIT
+5 DO REMOVE^IBCEU7(DA,X(1))
End DoDot:1
+6 GOTO C22F3
C22X2(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",399,DIIENS,.19,DION),$PIECE($GET(^DGCR(399,DA,0)),U,19))
+2 SET X=$GET(X(1))
+3 QUIT
C22F3 SET DIEZRXR(399,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=820
SET DIEZRXR(399,DIXR)=""
+2 QUIT
X22 SET DIC("S")="I $$FTINPUT^IBCU9(Y)"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
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 DIPA("FT")=$PIECE($GET(^DGCR(399,DA,0)),U,19)
+1 QUIT
24 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=24
DO X24
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
X24 IF $PIECE($GET(^IBE(353,+DIPA("FT"),2)),U,2)="P"
IF $PIECE($GET(^(2)),U,4)
SET DIPA("FT1")=DIPA("FT")
DO CKFT^IBCIUT1(IBIFN)
SET Y="@615"
+1 QUIT
25 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=25
DO X25
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
X25 WRITE !,*7,"Must be a printable national form type"
+1 QUIT
26 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=26
SET DW="0;19"
SET DV="R*P353'"
SET DU=""
SET DIFLD=.19
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C26^IBXS6"
SET DE(DW,"INDEX")=1
+2 SET DU="IBE(353,"
+3 SET X=$GET(DIPA("FT1"))
+4 SET Y=X
+5 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
+6 GOTO RD
C26 if $DATA(DE(26))[0
GOTO C26S
KILL DB
+1 SET X=DE(26)
SET DIC=DIE
+2 ;
+3 SET X=DE(26)
SET DIC=DIE
+4 SET DGRVRCAL=2
+5 SET X=DE(26)
SET DIC=DIE
+6 DO ALLID^IBCEP3(DA,.19,2)
+7 SET X=DE(26)
SET DIC=DIE
+8 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),1:"")
SET X=$PIECE(Y(1),U,1)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,1)=DIV
SET DIH=399
SET DIG=140
DO ^DICR
+9 SET X=DE(26)
SET DIC=DIE
+10 DO ATTREND^IBCU1(DA,"","")
+11 SET X=DE(26)
SET DIC=DIE
+12 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),1:"")
SET X=$PIECE(Y(1),U,2)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,2)=DIV
SET DIH=399
SET DIG=141
DO ^DICR
+13 SET X=DE(26)
SET DIC=DIE
+14 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),1:"")
SET X=$PIECE(Y(1),U,3)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,3)=DIV
SET DIH=399
SET DIG=142
DO ^DICR
+15 SET X=DE(26)
SET DIC=DIE
+16 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),1:"")
SET X=$PIECE(Y(1),U,4)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DGCR(399,DIV(0),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,4)=DIV
SET DIH=399
SET DIG=143
DO ^DICR
+17 SET X=DE(26)
SET DIC=DIE
+18 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),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),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,5)=DIV
SET DIH=399
SET DIG=144
DO ^DICR
+19 SET X=DE(26)
SET DIC=DIE
+20 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"M2")):^("M2"),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),"M2"))
SET DIV=X
SET $PIECE(^("M2"),U,6)=DIV
SET DIH=399
SET DIG=145
DO ^DICR
C26S SET X=""
if DG(DQ)=X
GOTO C26F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE ^DD(399,.19,1,1,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,9)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=5
SET DIH=$GET(^DGCR(399,DIV(0),0))
SET DIV=X
SET $PIECE(^(0),U,9)=DIV
SET DIH=399
SET DIG=.09
DO ^DICR
+3 SET X=DG(DQ)
SET DIC=DIE
+4 SET DGRVRCAL=1
+5 SET X=DG(DQ)
SET DIC=DIE
+6 DO ALLID^IBCEP3(DA,.19,1)
+7 SET X=DG(DQ)
SET DIC=DIE
+8 ;
+9 SET X=DG(DQ)
SET DIC=DIE
+10 DO ATTREND^IBCU1(DA,"","")
+11 SET X=DG(DQ)
SET DIC=DIE
+12 ;
+13 SET X=DG(DQ)
SET DIC=DIE
+14 ;
+15 SET X=DG(DQ)
SET DIC=DIE
+16 ;
+17 SET X=DG(DQ)
SET DIC=DIE
+18 ;
+19 SET X=DG(DQ)
SET DIC=DIE
+20 ;
C26F1 NEW X,X1,X2
SET DIXR=984
DO C26X1(U)
KILL X2
MERGE X2=X
DO C26X1("O")
KILL X1
MERGE X1=X
+1 KILL X
MERGE X=X2
Begin DoDot:1
+2 NEW IBLNPRV
IF $$LNPRVFT^IBCEU7(X,.IBLNPRV)
DO FILE^DIE("E","IBLNPRV")
QUIT
End DoDot:1
+3 GOTO C26F2
C26X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",399,DIIENS,.19,DION),$PIECE($GET(^DGCR(399,DA,0)),U,19))
+2 SET X=$GET(X(1))
+3 QUIT
C26F2 SET DIXR=985
DO C26X2(U)
KILL X2
MERGE X2=X
DO C26X2("O")
KILL X1
MERGE X1=X
+1 KILL X
MERGE X=X2
Begin DoDot:1
+2 NEW DIEXARR
MERGE DIEXARR=X
SET DIEZCOND=1
+3 SET X=X(1)=3
+4 SET DIEZCOND=$GET(X)
KILL X
MERGE X=DIEXARR
if 'DIEZCOND
QUIT
+5 DO REMOVE^IBCEU7(DA,X(1))
End DoDot:1
+6 GOTO C26F3
C26X2(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",399,DIIENS,.19,DION),$PIECE($GET(^DGCR(399,DA,0)),U,19))
+2 SET X=$GET(X(1))
+3 QUIT
C26F3 SET DIEZRXR(399,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=820
SET DIEZRXR(399,DIXR)=""
+2 QUIT
X26 SET DIC("S")="I $$FTINPUT^IBCU9(Y)"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
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 SET Y="@614"
+1 QUIT
28 ;@615
SET DQ=29
29 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=29
DO X29
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
X29 DO FTPRV^IBCEU5(DA)
+1 QUIT
30 ;@62
SET DQ=31
31 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=31
DO X31
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
X31 if IBDR20'["62"
SET Y="@63"
+1 QUIT
32 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=32
SET DW="U;5"
SET DV="RFOX"
SET DU=""
SET DIFLD=155
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(32,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
+2 GOTO RE
X32 IF $DATA(X)
DO YN^IBCU
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
33 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=33
DO X33
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
X33 if X=0
SET Y=156
+1 QUIT
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 IF '$$ROIDTCK^IBCEU7(DA)
SET Y="@621"
+1 QUIT
35 SET DW="U;7"
SET DV="FOX"
SET DU=""
SET DIFLD=157
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(35,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
+2 GOTO RE
X35 IF $DATA(X)
DO YN^IBCU
if $GET(X)=1
SET X=$$ROI399^IBNCPDR4($GET(DA))
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
36 ;@621
SET DQ=37
37 SET DW="U;6"
SET DV="RFOX"
SET DU=""
SET DIFLD=156
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(37,2)="S Y(0)=Y S Y=$S(Y="""":"""",""Yy1""[Y:""YES"",""Nn0""[Y:""NO"",1:"""")"
+2 GOTO RE
X37 IF $DATA(X)
DO YN^IBCU
IF $DATA(X)
if X=0
XECUTE ^DD(399,156,9.3)
KILL IBRATY
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
38 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=38
DO X38
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
X38 if '$DATA(IBOX)
SET Y="@63"
+1 QUIT
39 SET DW="U;3"
SET DV="RFOX"
SET DU=""
SET DIFLD=153
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(39,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
+2 GOTO RE
X39 IF $DATA(X)
DO YN^IBCU
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
40 ;@63
SET DQ=41
41 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=41
DO X41
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
X41 if IBDR20'["63"
SET Y="@64"
+1 QUIT
42 SET DW="U;1"
SET DV="RDX"
SET DU=""
SET DIFLD=151
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C42^IBXS6"
+2 GOTO RE
C42 if $DATA(DE(42))[0
GOTO C42S
KILL DB
+1 SET X=DE(42)
SET DIC=DIE
+2 ;
+3 SET X=DE(42)
SET DIC=DIE
+4 SET DGRVRCAL=2
+5 SET X=DE(42)
SET DIC=DIE
+6 ;
+7 SET X=DE(42)
SET DIC=DIE
+8 if $PIECE(^DGCR(399,DA,0),"^",2)
KILL ^DGCR(399,"APDS",$PIECE(^(0),U,2),-X,DA)
C42S SET X=""
if DG(DQ)=X
GOTO C42F1
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(0)=X
IF $PIECE(^DGCR(399,DA,0),U,5)<3
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"U")):^("U"),1:"")
SET X=$PIECE(Y(1),U,15)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=$$LOS1^IBCU64(DA)
XECUTE ^DD(399,151,1,1,1.4)
+3 SET X=DG(DQ)
SET DIC=DIE
+4 SET DGRVRCAL=1
+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
IF +$GET(^DGCR(399,DA,"U1"))=0
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"U1")):^("U1"),1:"")
SET X=$PIECE(Y(1),U,1)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=0
XECUTE ^DD(399,151,1,3,1.4)
+7 SET X=DG(DQ)
SET DIC=DIE
+8 if $PIECE(^DGCR(399,DA,0),"^",2)
SET ^DGCR(399,"APDS",$PIECE(^(0),U,2),-X,DA)=""
C42F1 QUIT
X42 SET %DT="ETP"
DO ^%DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
DO DDAT^IBCU4
KILL IB00
+1 QUIT
+2 ;
43 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=43
SET DW="U;2"
SET DV="RDX"
SET DU=""
SET DIFLD=152
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C43^IBXS6"
+2 GOTO RE
C43 if $DATA(DE(43))[0
GOTO C43S
KILL DB
+1 SET X=DE(43)
SET DIC=DIE
+2 ;
+3 SET X=DE(43)
SET DIC=DIE
+4 SET DGRVRCAL=2
C43S SET X=""
if DG(DQ)=X
GOTO C43F1
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(0)=X
IF $PIECE(^DGCR(399,DA,0),U,5)<3
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DGCR(399,D0,"U")):^("U"),1:"")
SET X=$PIECE(Y(1),U,15)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=$$LOS1^IBCU64(DA)
XECUTE ^DD(399,152,1,1,1.4)
+3 SET X=DG(DQ)
SET DIC=DIE
+4 SET DGRVRCAL=1
C43F1 QUIT
X43 SET %DT="ETP"
DO ^%DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
DO DDAT1^IBCU4
KILL IB00
+1 QUIT
+2 ;
44 ;@64
SET DQ=45
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 if IBDR20'["64"
SET Y="@65"
+1 QUIT
46 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=46
SET DW="U;11"
SET DV="*P399.1'"
SET DU=""
SET DIFLD=161
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C46^IBXS6"
+2 SET DU="DGCR(399.1,"
+3 GOTO RE
C46 if $DATA(DE(46))[0
GOTO C46S
KILL DB
+1 SET X=DE(46)
SET DIC=DIE
+2 ;
C46S SET X=""
if DG(DQ)=X
GOTO C46F1
KILL DB
+1 DO ^IBXS61
C46F1 QUIT
X46 SET DIC("S")="I $P(^DGCR(399.1,+Y,0),""^"",5)=1"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
47 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=47
SET DW="U;15"
SET DV="F"
SET DU=""
SET DIFLD=165
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C47^IBXS6"
+2 GOTO RE
C47 if $DATA(DE(47))[0
GOTO C47S
KILL DB
+1 SET X=DE(47)
SET DIC=DIE
+2 ;
+3 SET X=DE(47)
SET DIC=DIE
+4 ;
C47S SET X=""
if DG(DQ)=X
GOTO C47F1
KILL DB
+1 DO ^IBXS62
C47F1 QUIT
X47 if $LENGTH(X)>6!($LENGTH(X)<1)!'(X?.N)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
48 ;@65
SET DQ=49
49 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=49
DO X49
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
X49 if IBDR20'["65"
SET Y="@66"
+1 QUIT
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 DO RCD^IBCU1
+1 QUIT
51 ;42
if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=51
SET D=0
KILL DE(1)
+1 SET DIFLD=42
SET DGO="^IBXS63"
SET DC="16^399.042IPA^RC^"
SET DV="399.042MR*P399.2'"
SET DW="0;1"
SET DOW=$$LABEL^DIALOGZ(DP,DIFLD)
SET DLB=$PIECE($$EZBLD^DIALOG(8042,DOW),": ")
if D
SET DC=DC_D
+2 SET DU="DGCR(399.2,"
+3 if D
GOTO RE
IF $DATA(DSC(399.042))#2
IF $PIECE(DSC(399.042),"I $D(^UTILITY(",1)=""
XECUTE DSC(399.042)
SET D=$ORDER(^(0))
if D=""
SET D=-1
GOTO M51
+4 SET D=$SELECT($DATA(^DGCR(399,DA,"RC",0)):$PIECE(^(0),U,3,4),$ORDER(^(0))'="":$ORDER(^(0)),1:-1)
M51 IF D>0
SET DC=DC_D
IF $DATA(^DGCR(399,DA,"RC",+D,0))
SET DE(51)=$PIECE(^(0),U,1)
+1 GOTO RE
R51 DO DE
+1 SET D=$SELECT($DATA(^DGCR(399,DA,"RC",0)):$PIECE(^(0),U,3,4),1:1)
GOTO 51+1
+2 ;
52 if $DATA(DG)>9
DO F^DIE17
GOTO ^IBXS64