IBXS7 ; GENERATED FROM 'IB SCREEN7' INPUT TEMPLATE(#513), 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(27)=%,DE(31)=% S %=$P(%Z,U,22) S:%]"" DE(19)=% S %=$P(%Z,U,24) S:%]"" DE(11)=% S %=$P(%Z,U,25) S:%]"" DE(13)=% S %=$P(%Z,U,26) S:%]"" DE(17)=% S %=$P(%Z,U,27) S:%]"" DE(22)=%
I $D(^("U")) S %Z=^("U") S %=$P(%Z,U,1) S:%]"" DE(47)=% S %=$P(%Z,U,2) S:%]"" DE(48)=% S %=$P(%Z,U,3) S:%]"" DE(44)=% S %=$P(%Z,U,5) S:%]"" DE(37)=% S %=$P(%Z,U,6) S:%]"" DE(42)=% S %=$P(%Z,U,7) S:%]"" DE(40)=% S %=$P(%Z,U,12) S:%]"" DE(18)=%
I $D(^("U1")) S %Z=^("U1") S %=$P(%Z,U,2) S:%]"" DE(53)=% S %=$P(%Z,U,3) S:%]"" DE(55)=%
I $D(^("U3")) S %Z=^("U3") S %=$P(%Z,U,2) S:%]"" DE(20)=%
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="IBXS7",DQ=1
N DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR K DIEFIRE,DIEBADK S DIEZTMP=$$GETTMP^DIKC1("DIEZ")
M DIEZAR=^DIE(513,"AR") S DICRREC="TRIG^DIE17"
S:$D(DTIME)[0 DTIME=300 S D0=DA,DIIENS=DA_",",DIEZ=513,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'["74" Y="@71"
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:$D(IBOUT) Y="@999"
Q
3 S D=0 K DE(1) ;43
S DIFLD=43,DGO="^IBXS71",DC="1^399.043DA^OP^",DV="399.043MDX",DW="0;1",DOW=$$LABEL^DIALOGZ(DP,DIFLD),DLB=$P($$EZBLD^DIALOG(8042,DOW),": ") S:D DC=DC_D
G RE:D I $D(DSC(399.043))#2,$P(DSC(399.043),"I $D(^UTILITY(",1)="" X DSC(399.043) S D=$O(^(0)) S:D="" D=-1 G M3
S D=$S($D(^DGCR(399,DA,"OP",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
M3 I D>0 S DC=DC_D I $D(^DGCR(399,DA,"OP",+D,0)) S DE(3)=$P(^(0),U,1)
G RE
R3 D DE
S D=$S($D(^DGCR(399,DA,"OP",0)):$P(^(0),U,3,4),1:1) G 3+1
;
4 S DQ=5 ;@999
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 K IBOUT
Q
6 S DQ=7 ;@71
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 S:IBDR20'["71" Y="@72"
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 S:$P($G(^DGCR(399,DA,0)),U,19)'=3 Y="@712"
Q
9 S DQ=10 ;@711
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 S DIE("NO^")=""
Q
11 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
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 S:'$D(DIE("NO^")) DIE("NO^")=""
Q
13 S DW="0;25",DV="R*P399.1'",DU="",DIFLD=.25,DLB="BILL CLASSIFICATION"
S DE(DW)="C13^IBXS7"
S DU="DGCR(399.1,"
G RE
C13 G C13S:$D(DE(13))[0 K DB
S X=DE(13),DIC=DIE
D ALLID^IBCEP3(DA,.25,2)
C13S S X="" G:DG(DQ)=X C13F1 K DB
S X=DG(DQ),DIC=DIE
D ALLID^IBCEP3(DA,.25,1)
C13F1 Q
X13 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
;
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 '$$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="@711"
Q
15 S DQ=16 ;@712
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 K DIE("NO^")
Q
17 D:$D(DG)>9 F^DIE17,DE S DQ=17,DW="0;26",DV="RS",DU="",DIFLD=.26,DLB="TIMEFRAME OF BILL"
S DE(DW)="C17^IBXS7"
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
C17 G C17S:$D(DE(17))[0 K DB
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,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
C17F1 Q
X17 Q
18 D:$D(DG)>9 F^DIE17,DE S DQ=18,DW="U;12",DV="*P399.1'",DU="",DIFLD=162,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="DGCR(399.1,"
G RE
X18 S DIC("S")="I $P(^DGCR(399.1,+Y,0),""^"",6)=1" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
19 S DW="0;22",DV="P40.8'",DU="",DIFLD=.22,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C19^IBXS7",DE(DW,"INDEX")=1
S DU="DG(40.8,"
G RE
C19 G C19S:$D(DE(19))[0 K DB
S X=DE(19),DIC=DIE
;
C19S S X="" G:DG(DQ)=X C19F1 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)
C19F1 S DIEZRXR(399,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=820 S DIEZRXR(399,DIXR)=""
Q
X19 Q
20 D:$D(DG)>9 F^DIE17,DE S DQ=20,DW="U3;2",DV="*P8932.1'",DU="",DIFLD=243,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="USC(8932.1,"
G RE
X20 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
;
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 D DISPTAX^IBCEP81($P($G(^DGCR(399,DA,"U3")),U,2),"Service Facility")
Q
22 S DW="0;27",DV="S",DU="",DIFLD=.27,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C22^IBXS7",DE(DW,"INDEX")=1
S DU="1:INSTITUTIONAL;2:PROFESSIONAL;"
G RE
C22 G C22S:$D(DE(22))[0 K DB
S X=DE(22),DIC=DIE
;
S X=DE(22),DIC=DIE
;
C22S S X="" G:DG(DQ)=X C22F1 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
C22F1 N X,X1,X2 S DIXR=989 D C22X1(U) K X2 M X2=X D C22X1("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 C22F2
C22X1(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
C22F2 Q
X22 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 DGRVRCAL=1
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 S DIPA("FT1")=$P($G(^DGCR(399,DA,0)),U,19)
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 D CKFT^IBCIUT1(IBIFN)
Q
26 S DQ=27 ;@714
27 D:$D(DG)>9 F^DIE17,DE S DQ=27,DW="0;19",DV="R*P353'",DU="",DIFLD=.19,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C27^IBXS7",DE(DW,"INDEX")=1
S DU="IBE(353,"
G RE
C27 G C27S:$D(DE(27))[0 K DB
S X=DE(27),DIC=DIE
;
S X=DE(27),DIC=DIE
S DGRVRCAL=2
S X=DE(27),DIC=DIE
D ALLID^IBCEP3(DA,.19,2)
S X=DE(27),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(27),DIC=DIE
D ATTREND^IBCU1(DA,"","")
S X=DE(27),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(27),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(27),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(27),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(27),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
C27S S X="" G:DG(DQ)=X C27F1 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
;
C27F1 N X,X1,X2 S DIXR=984 D C27X1(U) K X2 M X2=X D C27X1("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 C27F2
C27X1(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
C27F2 S DIXR=985 D C27X2(U) K X2 M X2=X D C27X2("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 C27F3
C27X2(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
C27F3 S DIEZRXR(399,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=820 S DIEZRXR(399,DIXR)=""
Q
X27 S DIC("S")="I $$FTINPUT^IBCU9(Y)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
28 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=28 D X28 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
X28 S DIPA("FT")=$P($G(^DGCR(399,DA,0)),U,19)
Q
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 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="@715"
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 W !,*7,"Must be a printable national form type"
Q
31 D:$D(DG)>9 F^DIE17,DE S DQ=31,DW="0;19",DV="R*P353'",DU="",DIFLD=.19,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C31^IBXS7",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
C31 G C31S:$D(DE(31))[0 K DB
S X=DE(31),DIC=DIE
;
S X=DE(31),DIC=DIE
S DGRVRCAL=2
S X=DE(31),DIC=DIE
D ALLID^IBCEP3(DA,.19,2)
S X=DE(31),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(31),DIC=DIE
D ATTREND^IBCU1(DA,"","")
S X=DE(31),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(31),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(31),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(31),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(31),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
C31S S X="" G:DG(DQ)=X C31F1 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
;
C31F1 N X,X1,X2 S DIXR=984 D C31X1(U) K X2 M X2=X D C31X1("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 C31F2
C31X1(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
C31F2 S DIXR=985 D C31X2(U) K X2 M X2=X D C31X2("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 C31F3
C31X2(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
C31F3 S DIEZRXR(399,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=820 S DIEZRXR(399,DIXR)=""
Q
X31 S DIC("S")="I $$FTINPUT^IBCU9(Y)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
32 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=32 D X32 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
X32 S Y="@714"
Q
33 S DQ=34 ;@715
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 D FTPRV^IBCEU5(DA)
Q
35 S DQ=36 ;@72
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 S:IBDR20'["72" Y="@73"
Q
37 D:$D(DG)>9 F^DIE17,DE S DQ=37,DW="U;5",DV="RFOX",DU="",DIFLD=155,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(37,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
G RE
X37 I $D(X) D YN^IBCU
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:X=0 Y=156
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 I '$$ROIDTCK^IBCEU7(DA) S Y="@721"
Q
40 S DW="U;7",DV="FOX",DU="",DIFLD=157,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(40,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
G RE
X40 I $D(X) D YN^IBCU S:$G(X)=1 X=$$ROI399^IBNCPDR4($G(DA))
I $D(X),X'?.ANP K X
Q
;
41 S DQ=42 ;@721
42 S DW="U;6",DV="RFOX",DU="",DIFLD=156,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(42,2)="S Y(0)=Y S Y=$S(Y="""":"""",""Yy1""[Y:""YES"",""Nn0""[Y:""NO"",1:"""")"
G RE
X42 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
;
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 S:'$D(IBOX) Y="@73"
Q
44 S DW="U;3",DV="RFOX",DU="",DIFLD=153,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(44,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
G RE
X44 I $D(X) D YN^IBCU
I $D(X),X'?.ANP K X
Q
;
45 S DQ=46 ;@73
46 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=46 D X46 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
X46 S:IBDR20'["73" Y="@75"
Q
47 S DW="U;1",DV="RDX",DU="",DIFLD=151,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C47^IBXS7"
G RE
C47 G C47S:$D(DE(47))[0 K DB
S X=DE(47),DIC=DIE
;
S X=DE(47),DIC=DIE
S DGRVRCAL=2
S X=DE(47),DIC=DIE
;
S X=DE(47),DIC=DIE
K:$P(^DGCR(399,DA,0),"^",2) ^DGCR(399,"APDS",$P(^(0),U,2),-X,DA)
C47S S X="" G:DG(DQ)=X C47F1 K DB
D ^IBXS72
C47F1 Q
X47 S %DT="ETP" D ^%DT S X=Y K:Y<1 X I $D(X) D DDAT^IBCU4 K IB00
Q
;
48 D:$D(DG)>9 F^DIE17,DE S DQ=48,DW="U;2",DV="RDX",DU="",DIFLD=152,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C48^IBXS7"
G RE
C48 G C48S:$D(DE(48))[0 K DB
S X=DE(48),DIC=DIE
;
S X=DE(48),DIC=DIE
S DGRVRCAL=2
C48S S X="" G:DG(DQ)=X C48F1 K DB
D ^IBXS73
C48F1 Q
X48 S %DT="ETP" D ^%DT S X=Y K:Y<1 X I $D(X) D DDAT1^IBCU4 K IB00
Q
;
49 S DQ=50 ;@75
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:IBDR20'["75" Y="@76"
Q
51 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=51 D X51 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
X51 D RCD^IBCU1
Q
52 D:$D(DG)>9 F^DIE17,DE S DQ=52,D=0 K DE(1) ;42
S DIFLD=42,DGO="^IBXS74",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 M52
S D=$S($D(^DGCR(399,DA,"RC",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
M52 I D>0 S DC=DC_D I $D(^DGCR(399,DA,"RC",+D,0)) S DE(52)=$P(^(0),U,1)
G RE
R52 D DE
S D=$S($D(^DGCR(399,DA,"RC",0)):$P(^(0),U,3,4),1:1) G 52+1
;
53 S DW="U1;2",DV="NJ8,2",DU="",DIFLD=202,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C53^IBXS7"
G RE
C53 G C53S:$D(DE(53))[0 K DB
D ^IBXS75
C53S S X="" G:DG(DQ)=X C53F1 K DB
D ^IBXS76
C53F1 Q
X53 S:X["$" X=$P(X,"$",2) K:X'?.N.1".".2N!(X>99999)!(X<0) X
Q
;
54 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=54 D X54 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
X54 S:'X Y="@757"
Q
55 D:$D(DG)>9 F^DIE17,DE S DQ=55,DW="U1;3",DV="FX",DU="",DIFLD=203,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X55 K:$L(X)>24!($L(X)<3) X
I $D(X),X'?.ANP K X
Q
;
56 S DQ=57 ;@757
57 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=57 D X57 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
X57 I $P(^DGCR(399,DA,"U1"),"^",11)']"" S Y="@76"
Q
58 D:$D(DG)>9 F^DIE17 G ^IBXS77
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBXS7 20949 printed Dec 13, 2024@02:30:35 Page 2
IBXS7 ; GENERATED FROM 'IB SCREEN7' INPUT TEMPLATE(#513), 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(27)=%
SET DE(31)=%
SET %=$PIECE(%Z,U,22)
if %]""
SET DE(19)=%
SET %=$PIECE(%Z,U,24)
if %]""
SET DE(11)=%
SET %=$PIECE(%Z,U,25)
if %]""
SET DE(13)=%
SET %=$PIECE(%Z,U,26)
if %]""
SET DE(17)=%
SET %=$PIECE(%Z,U,27)
if %]""
SET DE(22)=%
+2 IF $DATA(^("U"))
SET %Z=^("U")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(47)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(48)=%
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(44)=%
SET %=$PIECE(%Z,U,5)
if %]""
SET DE(37)=%
SET %=$PIECE(%Z,U,6)
if %]""
SET DE(42)=%
SET %=$PIECE(%Z,U,7)
if %]""
SET DE(40)=%
SET %=$PIECE(%Z,U,12)
if %]""
SET DE(18)=%
+3 IF $DATA(^("U1"))
SET %Z=^("U1")
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(53)=%
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(55)=%
+4 IF $DATA(^("U3"))
SET %Z=^("U3")
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(20)=%
+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="IBXS7"
SET DQ=1
+1 NEW DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR
KILL DIEFIRE,DIEBADK
SET DIEZTMP=$$GETTMP^DIKC1("DIEZ")
+2 MERGE DIEZAR=^DIE(513,"AR")
SET DICRREC="TRIG^DIE17"
+3 if $DATA(DTIME)[0
SET DTIME=300
SET D0=DA
SET DIIENS=DA_","
SET DIEZ=513
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'["74"
SET Y="@71"
+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 $DATA(IBOUT)
SET Y="@999"
+1 QUIT
3 ;43
SET D=0
KILL DE(1)
+1 SET DIFLD=43
SET DGO="^IBXS71"
SET DC="1^399.043DA^OP^"
SET DV="399.043MDX"
SET DW="0;1"
SET DOW=$$LABEL^DIALOGZ(DP,DIFLD)
SET DLB=$PIECE($$EZBLD^DIALOG(8042,DOW),": ")
if D
SET DC=DC_D
+2 if D
GOTO RE
IF $DATA(DSC(399.043))#2
IF $PIECE(DSC(399.043),"I $D(^UTILITY(",1)=""
XECUTE DSC(399.043)
SET D=$ORDER(^(0))
if D=""
SET D=-1
GOTO M3
+3 SET D=$SELECT($DATA(^DGCR(399,DA,"OP",0)):$PIECE(^(0),U,3,4),$ORDER(^(0))'="":$ORDER(^(0)),1:-1)
M3 IF D>0
SET DC=DC_D
IF $DATA(^DGCR(399,DA,"OP",+D,0))
SET DE(3)=$PIECE(^(0),U,1)
+1 GOTO RE
R3 DO DE
+1 SET D=$SELECT($DATA(^DGCR(399,DA,"OP",0)):$PIECE(^(0),U,3,4),1:1)
GOTO 3+1
+2 ;
4 ;@999
SET DQ=5
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 KILL IBOUT
+1 QUIT
6 ;@71
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 IBDR20'["71"
SET Y="@72"
+1 QUIT
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 $PIECE($GET(^DGCR(399,DA,0)),U,19)'=3
SET Y="@712"
+1 QUIT
9 ;@711
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 SET DIE("NO^")=""
+1 QUIT
11 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
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 '$DATA(DIE("NO^"))
SET DIE("NO^")=""
+1 QUIT
13 SET DW="0;25"
SET DV="R*P399.1'"
SET DU=""
SET DIFLD=.25
SET DLB="BILL CLASSIFICATION"
+1 SET DE(DW)="C13^IBXS7"
+2 SET DU="DGCR(399.1,"
+3 GOTO RE
C13 if $DATA(DE(13))[0
GOTO C13S
KILL DB
+1 SET X=DE(13)
SET DIC=DIE
+2 DO ALLID^IBCEP3(DA,.25,2)
C13S SET X=""
if DG(DQ)=X
GOTO C13F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO ALLID^IBCEP3(DA,.25,1)
C13F1 QUIT
X13 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 ;
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 '$$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="@711"
+1 QUIT
15 ;@712
SET DQ=16
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 KILL DIE("NO^")
+1 QUIT
17 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=17
SET DW="0;26"
SET DV="RS"
SET DU=""
SET DIFLD=.26
SET DLB="TIMEFRAME OF BILL"
+1 SET DE(DW)="C17^IBXS7"
+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
C17 if $DATA(DE(17))[0
GOTO C17S
KILL DB
+1 SET X=DE(17)
SET DIC=DIE
+2 ;
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,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
C17F1 QUIT
X17 QUIT
18 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=18
SET DW="U;12"
SET DV="*P399.1'"
SET DU=""
SET DIFLD=162
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="DGCR(399.1,"
+2 GOTO RE
X18 SET DIC("S")="I $P(^DGCR(399.1,+Y,0),""^"",6)=1"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
19 SET DW="0;22"
SET DV="P40.8'"
SET DU=""
SET DIFLD=.22
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C19^IBXS7"
SET DE(DW,"INDEX")=1
+2 SET DU="DG(40.8,"
+3 GOTO RE
C19 if $DATA(DE(19))[0
GOTO C19S
KILL DB
+1 SET X=DE(19)
SET DIC=DIE
+2 ;
C19S SET X=""
if DG(DQ)=X
GOTO C19F1
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)
C19F1 SET DIEZRXR(399,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=820
SET DIEZRXR(399,DIXR)=""
+2 QUIT
X19 QUIT
20 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=20
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
X20 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 ;
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 DO DISPTAX^IBCEP81($PIECE($GET(^DGCR(399,DA,"U3")),U,2),"Service Facility")
+1 QUIT
22 SET DW="0;27"
SET DV="S"
SET DU=""
SET DIFLD=.27
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C22^IBXS7"
SET DE(DW,"INDEX")=1
+2 SET DU="1:INSTITUTIONAL;2:PROFESSIONAL;"
+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 ;
C22S SET X=""
if DG(DQ)=X
GOTO C22F1
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
C22F1 NEW X,X1,X2
SET DIXR=989
DO C22X1(U)
KILL X2
MERGE X2=X
DO C22X1("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 C22F2
C22X1(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
C22F2 QUIT
X22 QUIT
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 DGRVRCAL=1
+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 SET DIPA("FT1")=$PIECE($GET(^DGCR(399,DA,0)),U,19)
+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 DO CKFT^IBCIUT1(IBIFN)
+1 QUIT
26 ;@714
SET DQ=27
27 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=27
SET DW="0;19"
SET DV="R*P353'"
SET DU=""
SET DIFLD=.19
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C27^IBXS7"
SET DE(DW,"INDEX")=1
+2 SET DU="IBE(353,"
+3 GOTO RE
C27 if $DATA(DE(27))[0
GOTO C27S
KILL DB
+1 SET X=DE(27)
SET DIC=DIE
+2 ;
+3 SET X=DE(27)
SET DIC=DIE
+4 SET DGRVRCAL=2
+5 SET X=DE(27)
SET DIC=DIE
+6 DO ALLID^IBCEP3(DA,.19,2)
+7 SET X=DE(27)
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(27)
SET DIC=DIE
+10 DO ATTREND^IBCU1(DA,"","")
+11 SET X=DE(27)
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(27)
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(27)
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(27)
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(27)
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
C27S SET X=""
if DG(DQ)=X
GOTO C27F1
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 ;
C27F1 NEW X,X1,X2
SET DIXR=984
DO C27X1(U)
KILL X2
MERGE X2=X
DO C27X1("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 C27F2
C27X1(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
C27F2 SET DIXR=985
DO C27X2(U)
KILL X2
MERGE X2=X
DO C27X2("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 C27F3
C27X2(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
C27F3 SET DIEZRXR(399,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=820
SET DIEZRXR(399,DIXR)=""
+2 QUIT
X27 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 ;
28 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=28
DO X28
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
X28 SET DIPA("FT")=$PIECE($GET(^DGCR(399,DA,0)),U,19)
+1 QUIT
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 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="@715"
+1 QUIT
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 WRITE !,*7,"Must be a printable national form type"
+1 QUIT
31 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=31
SET DW="0;19"
SET DV="R*P353'"
SET DU=""
SET DIFLD=.19
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C31^IBXS7"
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
C31 if $DATA(DE(31))[0
GOTO C31S
KILL DB
+1 SET X=DE(31)
SET DIC=DIE
+2 ;
+3 SET X=DE(31)
SET DIC=DIE
+4 SET DGRVRCAL=2
+5 SET X=DE(31)
SET DIC=DIE
+6 DO ALLID^IBCEP3(DA,.19,2)
+7 SET X=DE(31)
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(31)
SET DIC=DIE
+10 DO ATTREND^IBCU1(DA,"","")
+11 SET X=DE(31)
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(31)
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(31)
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(31)
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(31)
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
C31S SET X=""
if DG(DQ)=X
GOTO C31F1
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 ;
C31F1 NEW X,X1,X2
SET DIXR=984
DO C31X1(U)
KILL X2
MERGE X2=X
DO C31X1("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 C31F2
C31X1(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
C31F2 SET DIXR=985
DO C31X2(U)
KILL X2
MERGE X2=X
DO C31X2("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 C31F3
C31X2(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
C31F3 SET DIEZRXR(399,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=820
SET DIEZRXR(399,DIXR)=""
+2 QUIT
X31 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 ;
32 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=32
DO X32
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
X32 SET Y="@714"
+1 QUIT
33 ;@715
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 DO FTPRV^IBCEU5(DA)
+1 QUIT
35 ;@72
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 IBDR20'["72"
SET Y="@73"
+1 QUIT
37 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=37
SET DW="U;5"
SET DV="RFOX"
SET DU=""
SET DIFLD=155
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(37,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
+2 GOTO RE
X37 IF $DATA(X)
DO YN^IBCU
+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 X=0
SET Y=156
+1 QUIT
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 IF '$$ROIDTCK^IBCEU7(DA)
SET Y="@721"
+1 QUIT
40 SET DW="U;7"
SET DV="FOX"
SET DU=""
SET DIFLD=157
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(40,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
+2 GOTO RE
X40 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 ;
41 ;@721
SET DQ=42
42 SET DW="U;6"
SET DV="RFOX"
SET DU=""
SET DIFLD=156
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(42,2)="S Y(0)=Y S Y=$S(Y="""":"""",""Yy1""[Y:""YES"",""Nn0""[Y:""NO"",1:"""")"
+2 GOTO RE
X42 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 ;
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 '$DATA(IBOX)
SET Y="@73"
+1 QUIT
44 SET DW="U;3"
SET DV="RFOX"
SET DU=""
SET DIFLD=153
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(44,2)="S Y(0)=Y S Y=$S(Y:""YES"",Y=0:""NO"",1:"""")"
+2 GOTO RE
X44 IF $DATA(X)
DO YN^IBCU
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
45 ;@73
SET DQ=46
46 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=46
DO X46
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
X46 if IBDR20'["73"
SET Y="@75"
+1 QUIT
47 SET DW="U;1"
SET DV="RDX"
SET DU=""
SET DIFLD=151
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C47^IBXS7"
+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 SET DGRVRCAL=2
+5 SET X=DE(47)
SET DIC=DIE
+6 ;
+7 SET X=DE(47)
SET DIC=DIE
+8 if $PIECE(^DGCR(399,DA,0),"^",2)
KILL ^DGCR(399,"APDS",$PIECE(^(0),U,2),-X,DA)
C47S SET X=""
if DG(DQ)=X
GOTO C47F1
KILL DB
+1 DO ^IBXS72
C47F1 QUIT
X47 SET %DT="ETP"
DO ^%DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
DO DDAT^IBCU4
KILL IB00
+1 QUIT
+2 ;
48 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=48
SET DW="U;2"
SET DV="RDX"
SET DU=""
SET DIFLD=152
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C48^IBXS7"
+2 GOTO RE
C48 if $DATA(DE(48))[0
GOTO C48S
KILL DB
+1 SET X=DE(48)
SET DIC=DIE
+2 ;
+3 SET X=DE(48)
SET DIC=DIE
+4 SET DGRVRCAL=2
C48S SET X=""
if DG(DQ)=X
GOTO C48F1
KILL DB
+1 DO ^IBXS73
C48F1 QUIT
X48 SET %DT="ETP"
DO ^%DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
DO DDAT1^IBCU4
KILL IB00
+1 QUIT
+2 ;
49 ;@75
SET DQ=50
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 if IBDR20'["75"
SET Y="@76"
+1 QUIT
51 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=51
DO X51
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
X51 DO RCD^IBCU1
+1 QUIT
52 ;42
if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=52
SET D=0
KILL DE(1)
+1 SET DIFLD=42
SET DGO="^IBXS74"
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 M52
+4 SET D=$SELECT($DATA(^DGCR(399,DA,"RC",0)):$PIECE(^(0),U,3,4),$ORDER(^(0))'="":$ORDER(^(0)),1:-1)
M52 IF D>0
SET DC=DC_D
IF $DATA(^DGCR(399,DA,"RC",+D,0))
SET DE(52)=$PIECE(^(0),U,1)
+1 GOTO RE
R52 DO DE
+1 SET D=$SELECT($DATA(^DGCR(399,DA,"RC",0)):$PIECE(^(0),U,3,4),1:1)
GOTO 52+1
+2 ;
53 SET DW="U1;2"
SET DV="NJ8,2"
SET DU=""
SET DIFLD=202
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C53^IBXS7"
+2 GOTO RE
C53 if $DATA(DE(53))[0
GOTO C53S
KILL DB
+1 DO ^IBXS75
C53S SET X=""
if DG(DQ)=X
GOTO C53F1
KILL DB
+1 DO ^IBXS76
C53F1 QUIT
X53 if X["$"
SET X=$PIECE(X,"$",2)
if X'?.N.1".".2N!(X>99999)!(X<0)
KILL X
+1 QUIT
+2 ;
54 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=54
DO X54
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
X54 if 'X
SET Y="@757"
+1 QUIT
55 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=55
SET DW="U1;3"
SET DV="FX"
SET DU=""
SET DIFLD=203
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X55 if $LENGTH(X)>24!($LENGTH(X)<3)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
56 ;@757
SET DQ=57
57 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=57
DO X57
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
X57 IF $PIECE(^DGCR(399,DA,"U1"),"^",11)']""
SET Y="@76"
+1 QUIT
58 if $DATA(DG)>9
DO F^DIE17
GOTO ^IBXS77