SDBT ; GENERATED FROM 'SDB' INPUT TEMPLATE(#485), FILE 44;09/03/24
D DE G BEGIN
DE S DIE="^SC(",DIC=DIE,DP=44,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^SC(DA,""))=""
I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,1) S:%]"" DE(1)=% S %=$P(%Z,U,2) S:%]"" DE(2)=% S %=$P(%Z,U,7) S:%]"" DE(17)=% S %=$P(%Z,U,8) S:%]"" DE(9)=% S %=$P(%Z,U,11) S:%]"" DE(46)=% S %=$P(%Z,U,15) S:%]"" DE(15)=% S %=$P(%Z,U,17) S:%]"" DE(10)=%
I S %=$P(%Z,U,18) S:%]"" DE(41)=% S %=$P(%Z,U,19) S:%]"" DE(4)=% S %=$P(%Z,U,21) S:%]"" DE(12)=% S %=$P(%Z,U,24) S:%]"" DE(30)=% S %=$P(%Z,U,25) S:%]"" DE(19)=% S %=$P(%Z,U,26) S:%]"" DE(50)=% S %=$P(%Z,U,27) S:%]"" DE(51)=%
I S %=$P(%Z,U,30) S:%]"" DE(34)=%
I $D(^(99)) S %Z=^(99) S %=$P(%Z,U,1) S:%]"" DE(20)=%
I $D(^(99.1)) S %Z=^(99.1) S %=$P(%Z,U,1) S:%]"" DE(22)=%
I $D(^("AT")) S %Z=^("AT") S %=$P(%Z,U,1) S:%]"" DE(18)=%
I $D(^("LTR")) S %Z=^("LTR") S %=$P(%Z,U,1) S:%]"" DE(26)=% S %=$P(%Z,U,2) S:%]"" DE(27)=% S %=$P(%Z,U,3) S:%]"" DE(28)=% S %=$P(%Z,U,4) S:%]"" DE(29)=%
I $D(^("PA")) S %Z=^("PA") S %=$P(%Z,U,1) S:%]"" DE(3)=% S %=$P(%Z,U,2) S:%]"" DE(5)=% S %=$P(%Z,U,3) S:%]"" DE(7)=% S %=$P(%Z,U,4) S:%]"" DE(57)=%
I $D(^("PC")) S %Z=^("PC") S %=$P(%Z,U,1) S:%]"" DE(32)=%
I $D(^("PS")) S %Z=^("PS") S %=$P(%Z,U,1) S:%]"" DE(25)=%
I $D(^("RAD")) S %Z=^("RAD") S %=$P(%Z,U,1) S:%]"" DE(24)=%
I $D(^("SDP")) S %Z=^("SDP") S %=$P(%Z,U,1) S:%]"" DE(35)=% S %=$P(%Z,U,2) S:%]"" DE(36)=%
I $D(^("SDPROT")) S %Z=^("SDPROT") S %=$P(%Z,U,1) S:%]"" DE(42)=%
I $D(^("SL")) S %Z=^("SL") S %=$P(%Z,U,1) S:%]"" DE(52)=% S %=$P(%Z,U,2) S:%]"" DE(53)=% S %=$P(%Z,U,3) S:%]"" DE(38)=% S %=$P(%Z,U,5) S:%]"" DE(47)=% S %=$P(%Z,U,6) S:%]"" DE(55)=% S %=$P(%Z,U,7) S:%]"" DE(48)=% S %=$P(%Z,U,8) S:%]"" DE(40)=%
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",X:X'?.ANP
I DV["t" D G UNIQ ;EXTENSIBLE DATA TYPES ;p21
.X $S($D(DB(DQ)):$$VALEXTS^DIETLIBF(DP,DIFLD),1:$$VALEXT^DIETLIBF(DP,DIFLD)) K DIPA
I DV["S" D SET^DIED G V:'DDER K DDER G X ;p22
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
I DG["t" X $$OUTPUT^DIETLIBF(DP,DIFLD) K DIPA G RP ;p21
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="SDBT",DQ=1
N DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR K DIEFIRE,DIEBADK S DIEZTMP=$$GETTMP^DIKC1("DIEZ")
M DIEZAR=^DIE(485,"AR") S DICRREC="TRIG^DIE17"
S:$D(DTIME)[0 DTIME=300 S D0=DA,DIIENS=DA_",",DIEZ=485,U="^"
1 S DW="0;1",DV="RFa",DU="",DIFLD=.01,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C1^SDBT",DE(DW,"INDEX")=1
G RE
C1 G C1S:$D(DE(1))[0 K DB
S X=DE(1),DIC=DIE
K ^SC("B",$E(X,1,30),DA)
S X=DE(1),DIC=DIE
;
S X=DE(1),DIC=DIE
;
S X=DE(1),DIC=DIE
;
S X=DE(1),DIC=DIE
S RTPL=X,X="RTP6" X ^%ZOSF("TEST") S X=RTPL K RTPL I $T D ^RTP6
S X=DE(1),DIC=DIE
;
S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
C1S S X="" G:DG(DQ)=X C1F1 K DB
S X=DG(DQ),DIC=DIE
S ^SC("B",$E(X,1,30),DA)=""
S X=DG(DQ),DIC=DIE
X ^DD(44,.01,1,2,1.3) I X S X=DIV X ^DD(44,.01,1,2,89.2) S X=$P(Y(101),U,1),X=X S X=X S D0=I(0,0) S DIU=X K Y S X=DIV S X=DIV X ^DD(44,.01,1,2,1.4)
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
D N44S^SDEC03(DA,$E(X,1,30))
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
X ^DD(44,.01,1,12,1.3) I X S X=DIV X ^DD(44,.01,1,12,89.2) S X=$P(Y(101),U,1) S D0=I(0,0) S DIU=X K Y S X=DIV S X=DIV X ^DD(44,.01,1,12,1.4)
I $D(DE(1))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C1F1 S DIEZRXR(44,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=1353,1552 S DIEZRXR(44,DIXR)=""
Q
X1 K:$L(X)>30!($L(X)<2)!'(X'?1P.E)!(X'?.ANP) X
I $D(X),X'?.ANP K X
Q
;
2 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW="0;2",DV="F",DU="",DIFLD=1,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C2^SDBT"
G RE
C2 G C2S:$D(DE(2))[0 K DB
S X=DE(2),DIC=DIE
K ^SC("C",$E(X,1,30),DA)
S X=DE(2),DIC=DIE
;
C2S S X="" G:DG(DQ)=X C2F1 K DB
S X=DG(DQ),DIC=DIE
S ^SC("C",$E(X,1,30),DA)=""
S X=DG(DQ),DIC=DIE
D A44S^SDEC03(DA,$E(X,1,7))
C2F1 Q
X2 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>7!($L(X)<1) X
I $D(X),X'?.ANP K X
Q
;
3 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW="PA;1",DV="F",DU="",DIFLD=60,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X3 K:$L(X)>80!($L(X)<3) X
I $D(X),X'?.ANP K X
Q
;
4 S DW="0;19",DV="RS",DU="",DIFLD=2504,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="Y:YES;N:NO;"
S Y="Y"
G Y
X4 Q
5 S DW="PA;2",DV="RSa",DU="",DIFLD=61,DLB="ALLOW DIRECT PATIENT SCHEDULING?"
S DE(DW)="C5^SDBT"
S DU="Y:YES;N:NO;"
G RE
C5 G C5S:$D(DE(5))[0 K DB
S X=DE(5),DIIX=2_U_DIFLD D AUDIT^DIET
C5S S X="" G:DG(DQ)=X C5F1 K DB
I $D(DE(5))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C5F1 Q
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 I (X["Y")!($P($G(^SC(DA,"PA")),"^",2)="Y") S $P(^SC(DA,"PA"),"^",3)="Y",Y="@07"
Q
7 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW="PA;3",DV="RSa",DU="",DIFLD=62,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C7^SDBT"
S DU="Y:YES;N:NO;"
G RE
C7 G C7S:$D(DE(7))[0 K DB
S X=DE(7),DIIX=2_U_DIFLD D AUDIT^DIET
C7S S X="" G:DG(DQ)=X C7F1 K DB
I $D(DE(7))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C7F1 Q
X7 Q
8 S DQ=9 ;@07
9 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW="0;8",DV="RS",DU="",DIFLD=9,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C9^SDBT",DE(DW,"INDEX")=1
S DU="M:MEDICINE;S:SURGERY;P:PSYCHIATRY;R:REHAB MEDICINE;N:NEUROLOGY;0:NONE;"
G RE
C9 G C9S:$D(DE(9))[0 K DB
C9S S X="" G:DG(DQ)=X C9F1 K DB
C9F1 S DIEZRXR(44,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=1552 S DIEZRXR(44,DIXR)=""
Q
X9 Q
10 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW="0;17",DV="RSa",DU="",DIFLD=2502,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C10^SDBT"
S DU="Y:YES;N:NO;"
G RE
C10 G C10S:$D(DE(10))[0 K DB
S X=DE(10),DIC=DIE
;
S X=DE(10),DIIX=2_U_DIFLD D AUDIT^DIET
C10S S X="" G:DG(DQ)=X C10F1 K DB
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^SC(D0,0)):^(0),1:"") S X=$P(Y(1),U,21),X=X S DIU=X K Y S X="" X ^DD(44,2502,1,1,1.4)
I $D(DE(10))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C10F1 Q
X10 Q
11 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=11 D X11 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X11 S:X'["Y" Y="@05"
Q
12 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW="0;21",DV="S",DU="",DIFLD=2502.5,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="0:NO;1:YES;"
G RE
X12 Q
13 S DQ=14 ;@05
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 S:$S('$D(^DG(43,1,"GL")):1,$D(^DG(43,1,"GL"))&('$P(^DG(43,1,"GL"),"^",2)):1,1:0) Y="@10"
Q
15 S DW="0;15",DV="RP40.8'a",DU="",DIFLD=3.5,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C15^SDBT"
S DU="DG(40.8,"
S X=+$O(^DG(40.8,0)),X=$S($D(^(X,0)):$P(^(0),"^"),1:"")
S Y=X
G Y
C15 G C15S:$D(DE(15))[0 K DB
S X=DE(15),DIIX=2_U_DIFLD D AUDIT^DIET
C15S S X="" G:DG(DQ)=X C15F1 K DB
I $D(DE(15))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C15F1 Q
X15 Q
16 S DQ=17 ;@10
17 D:$D(DG)>9 F^DIE17,DE S DQ=17,DW="0;7",DV="R*P40.7'Xa",DU="",DIFLD=8,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C17^SDBT",DE(DW,"INDEX")=1
S DU="DIC(40.7,"
G RE
C17 G C17S:$D(DE(17))[0 K DB
S X=DE(17),DIIX=2_U_DIFLD D AUDIT^DIET
C17S S X="" G:DG(DQ)=X C17F1 K DB
I $D(DE(17))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C17F1 N X,X1,X2 S DIXR=458 D C17X1(U) K X2 M X2=X D C17X1("O") K X1 M X1=X
I $G(X(1))]"" D
. K ^SC("AST",X,DA)
K X M X=X2 I $G(X(1))]"" D
. S ^SC("AST",X,DA)=""
G C17F2
C17X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",44,DIIENS,8,DION),$P($G(^SC(DA,0)),U,7))
S X=$G(X(1))
Q
C17F2 S DIEZRXR(44,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=1552 S DIEZRXR(44,DIXR)=""
Q
X17 S DIC("S")="I $P(^(0),U,2)'=900&$S('$P(^(0),U,3):1,$P(^(0),U,3)>DT:1,1:0),""PE""[$P(^(0),U,6),$S('$P(^(0),U,7):1,$P(^(0),U,7)'>DT:1,1:0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
18 D:$D(DG)>9 F^DIE17,DE S DQ=18,DW="AT;1",DV="*P409.1'",DU="",DIFLD=2507,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="SD(409.1,"
S Y="REGULAR"
G Y
X18 S DIC("S")="I '$P(^(0),U,3)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
19 S DW="0;25",DV="S",DU="",DIFLD=2802,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C19^SDBT"
S DU="1:YES;"
G RE
C19 G C19S:$D(DE(19))[0 K DB
S X=DE(19),DIC=DIE
K ^SC("AE",$E(X,1,30),DA)
C19S S X="" G:DG(DQ)=X C19F1 K DB
S X=DG(DQ),DIC=DIE
S ^SC("AE",$E(X,1,30),DA)=""
C19F1 Q
X19 Q
20 D:$D(DG)>9 F^DIE17,DE S DQ=20,DW="99;1",DV="F",DU="",DIFLD=99,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X20 K:$L(X)>13!($L(X)<3) X
I $D(X),X'?.ANP K X
Q
;
21 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=21 D X21 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X21 S:X="" $P(^SC(DA,99.1),"^",1)="",Y="@15"
Q
22 S DW="99.1;1",DV="F",DU="",DIFLD=99.1,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X22 K:$L(X)>26!($L(X)<1) X
I $D(X),X'?.ANP K X
Q
;
23 S DQ=24 ;@15
24 S DW="RAD;1",DV="S",DU="",DIFLD=2000,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="Y:YES;"
G RE
X24 Q
25 S DW="PS;1",DV="RS",DU="",DIFLD=2000.5,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="0:YES;1:NO;"
S Y="YES"
G Y
X25 Q
26 S DW="LTR;1",DV="*P407.5'",DU="",DIFLD=2508,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C26^SDBT"
S DU="VA(407.5,"
G RE
C26 G C26S:$D(DE(26))[0 K DB
S X=DE(26),DIC=DIE
K ^SC("ALTN",$E(X,1,30),DA)
C26S S X="" G:DG(DQ)=X C26F1 K DB
S X=DG(DQ),DIC=DIE
S ^SC("ALTN",$E(X,1,30),DA)=""
C26F1 Q
X26 S DIC("S")="I $P(^(0),""^"",2)=""N""" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
27 D:$D(DG)>9 F^DIE17,DE S DQ=27,DW="LTR;2",DV="*P407.5'",DU="",DIFLD=2509,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C27^SDBT"
S DU="VA(407.5,"
G RE
C27 G C27S:$D(DE(27))[0 K DB
S X=DE(27),DIC=DIE
K ^SC("ALTP",$E(X,1,30),DA)
C27S S X="" G:DG(DQ)=X C27F1 K DB
S X=DG(DQ),DIC=DIE
S ^SC("ALTP",$E(X,1,30),DA)=""
C27F1 Q
X27 S DIC("S")="I $P(^(0),""^"",2)=""P""" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
28 D:$D(DG)>9 F^DIE17,DE S DQ=28,DW="LTR;3",DV="*P407.5'",DU="",DIFLD=2510,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C28^SDBT"
S DU="VA(407.5,"
G RE
C28 G C28S:$D(DE(28))[0 K DB
S X=DE(28),DIC=DIE
K ^SC("ALTC",$E(X,1,30),DA)
C28S S X="" G:DG(DQ)=X C28F1 K DB
S X=DG(DQ),DIC=DIE
S ^SC("ALTC",$E(X,1,30),DA)=""
C28F1 Q
X28 S DIC("S")="I $P(^(0),""^"",2)=""C""" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
29 D:$D(DG)>9 F^DIE17,DE S DQ=29,DW="LTR;4",DV="*P407.5'",DU="",DIFLD=2511,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C29^SDBT"
S DU="VA(407.5,"
G RE
C29 G C29S:$D(DE(29))[0 K DB
S X=DE(29),DIC=DIE
K ^SC("ALTA",$E(X,1,30),DA)
C29S S X="" G:DG(DQ)=X C29F1 K DB
S X=DG(DQ),DIC=DIE
S ^SC("ALTA",$E(X,1,30),DA)=""
C29F1 Q
X29 S DIC("S")="I $P(^(0),""^"",2)=""A""" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
30 D:$D(DG)>9 F^DIE17,DE S DQ=30,DW="0;24",DV="S",DU="",DIFLD=24,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="0:NO;1:YES;"
G RE
X30 Q
31 S D=0 K DE(1) ;2600
S DIFLD=2600,DGO="^SDBT1",DC="2^44.1P^PR^",DV="44.1M*P200'",DW="0;1",DOW=$$LABEL^DIALOGZ(DP,DIFLD),DLB=$P($$EZBLD^DIALOG(8042,DOW),": ") S:D DC=DC_D
S DU="VA(200,"
G RE:D I $D(DSC(44.1))#2,$P(DSC(44.1),"I $D(^UTILITY(",1)="" X DSC(44.1) S D=$O(^(0)) S:D="" D=-1 G M31
S D=$S($D(^SC(DA,"PR",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
M31 I D>0 S DC=DC_D I $D(^SC(DA,"PR",+D,0)) S DE(31)=$P(^(0),U,1)
G RE
R31 D DE
S D=$S($D(^SC(DA,"PR",0)):$P(^(0),U,3,4),1:1) G 31+1
;
32 S DW="PC;1",DV="S",DU="",DIFLD=2801,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="1:YES;0:NO;"
G RE
X32 Q
33 S D=0 K DE(1) ;2700
S DIFLD=2700,DGO="^SDBT2",DC="2^44.11P^DX^",DV="44.11M*P80'X",DW="0;1",DOW=$$LABEL^DIALOGZ(DP,DIFLD),DLB=$P($$EZBLD^DIALOG(8042,DOW),": ") S:D DC=DC_D
S DU="ICD9("
G RE:D I $D(DSC(44.11))#2,$P(DSC(44.11),"I $D(^UTILITY(",1)="" X DSC(44.11) S D=$O(^(0)) S:D="" D=-1 G M33
S D=$S($D(^SC(DA,"DX",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
M33 I D>0 S DC=DC_D I $D(^SC(DA,"DX",+D,0)) S DE(33)=$P(^(0),U,1)
G RE
R33 D DE
S D=$S($D(^SC(DA,"DX",0)):$P(^(0),U,3,4),1:1) G 33+1
;
34 S DW="0;30",DV="S",DU="",DIFLD=30,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="1:YES;0:NO;"
G RE
X34 Q
35 S DW="SDP;1",DV="RNJ3,0",DU="",DIFLD=2001,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S Y="999"
G Y
X35 K:+X'=X!(X>999)!(X<0)!(X?.E1"."1N.N) X
Q
;
36 S DW="SDP;2",DV="RNJ3,0",DU="",DIFLD=2002,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X36 K:+X'=X!(X>999)!(X<11)!(X?.E1"."1N.N) X
Q
;
37 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=37 D X37 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
X37 S:+$O(^SC(DA,"ST",0))>0 Y="@25"
Q
38 S DW="SL;3",DV="NJ2,0",DU="",DIFLD=1914,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X38 K:+X'=X!(X>16)!(X<0)!(X?.E1"."1N.N) X
Q
;
39 S DQ=40 ;@25
40 S DW="SL;8",DV="S",DU="",DIFLD=1918.5,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="Y:YES;"
G RE
X40 Q
41 S DW="0;18",DV="*P40.7'Xa",DU="",DIFLD=2503,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C41^SDBT",DE(DW,"INDEX")=1
S DU="DIC(40.7,"
G RE
C41 G C41S:$D(DE(41))[0 K DB
S X=DE(41),DIIX=2_U_DIFLD D AUDIT^DIET
C41S S X="" G:DG(DQ)=X C41F1 K DB
I $D(DE(41))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C41F1 N X,X1,X2 S DIXR=457 D C41X1(U) K X2 M X2=X D C41X1("O") K X1 M X1=X
I $G(X(1))]"" D
. K ^SC("ACST",X,DA)
K X M X=X2 I $G(X(1))]"" D
. S ^SC("ACST",X,DA)=""
G C41F2
C41X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",44,DIIENS,2503,DION),$P($G(^SC(DA,0)),U,18))
S X=$G(X(1))
Q
C41F2 S DIEZRXR(44,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=1552 S DIEZRXR(44,DIXR)=""
Q
X41 S DIC("S")="I $P(^(0),U,2)'=900&$S('$P(^(0),U,3):1,$P(^(0),U,3)>DT:1,1:0),""SE""[$P(^(0),U,6),$S('$P(^(0),U,7):1,$P(^(0),U,7)'>DT:1,1:0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
42 D:$D(DG)>9 F^DIE17,DE S DQ=42,DW="SDPROT;1",DV="S",DU="",DIFLD=2500,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="Y:YES;"
G RE
X42 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:X'="Y" Y="@30"
Q
44 S D=0 K DE(1) ;2501
S DIFLD=2501,DGO="^SDBT3",DC="1^44.04PA^SDPRIV^",DV="44.04MP200'X",DW="0;1",DOW=$$LABEL^DIALOGZ(DP,DIFLD),DLB=$P($$EZBLD^DIALOG(8042,DOW),": ") S:D DC=DC_D
S DU="VA(200,"
G RE:D I $D(DSC(44.04))#2,$P(DSC(44.04),"I $D(^UTILITY(",1)="" X DSC(44.04) S D=$O(^(0)) S:D="" D=-1 G M44
S D=$S($D(^SC(DA,"SDPRIV",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
M44 I D>0 S DC=DC_D I $D(^SC(DA,"SDPRIV",+D,0)) S DE(44)=$P(^(0),U,1)
G RE
R44 D DE
S D=$S($D(^SC(DA,"SDPRIV",0)):$P(^(0),U,3,4),1:1) G 44+1
;
45 S DQ=46 ;@30
46 S DW="0;11",DV="F",DU="",DIFLD=10,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X46 K:$L(X)>25!($L(X)<1) X
I $D(X),X'?.ANP K X
Q
;
47 S DW="SL;5",DV="*P44'",DU="",DIFLD=1916,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="SC("
G RE
X47 S DIC("S")="I $P(^(0),""^"",3)=""C"",'$G(^(""OOS""))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
Q
;
48 S DW="SL;7",DV="RNJ4,0",DU="",DIFLD=1918,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C48^SDBT",DE(DW,"INDEX")=1
G RE
C48 G C48S:$D(DE(48))[0 K DB
C48S S X="" G:DG(DQ)=X C48F1 K DB
C48F1 S DIEZRXR(44,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=1552 S DIEZRXR(44,DIXR)=""
Q
X48 K:+X'=X!(X>9999)!(X<0)!(X?.E1"."1N.N) X
Q
;
49 D:$D(DG)>9 F^DIE17,DE S DQ=49,D=0 K DE(1) ;1910
S DIFLD=1910,DGO="^SDBT4",DC="1^44.03A^SI^",DV="44.03F",DW="0;1",DOW=$$LABEL^DIALOGZ(DP,DIFLD),DLB=$P($$EZBLD^DIALOG(8042,DOW),": ") S:D DC=DC_D
I $D(DSC(44.03))#2,$P(DSC(44.03),"I $D(^UTILITY(",1)="" X DSC(44.03) S D=$O(^(0)) S:D="" D=-1 G M49
S D=$S($D(^SC(DA,"SI",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
M49 I D>0 S DC=DC_D I $D(^SC(DA,"SI",+D,0)) S DE(49)=$P(^(0),U,1)
G RE
R49 D DE
G A
;
50 S DW="0;26",DV="RS",DU="",DIFLD=20,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="1:YES;0:NO;"
S Y="NO"
G Y
X50 Q
51 S DW="0;27",DV="RS",DU="",DIFLD=21,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="1:YES;0:NO;"
S Y="NO"
G Y
X51 Q
52 S DW="SL;1",DV="RNJ2,0X",DU="",DIFLD=1912,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X52 K:+X'=X!(X>240)!(X<10)!(X?.E1"."1N.N)!($S('(X#10):0,'(X#15):0,1:1)) X I $D(X) S SDLA=X I $D(^SC(DA,"SL")),+$P(^("SL"),U,6) S SDZ0=$P(^("SL"),U,6),SDZ1=60\SDZ0 I X#SDZ1 D LAPPT^SDUTL
Q
;
53 S DW="SL;2",DV="S",DU="",DIFLD=1913,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="V:YES, VARIABLE LENGTH;"
G RE
X53 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:+$O(^SC(DA,"ST",0))>0 Y="@99"
Q
55 S DW="SL;6",DV="RSX",DU="",DIFLD=1917,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DU="1:60-MIN ;2:30-MIN ;4:15-MIN ;3:20-MIN ;6:10-MIN ;"
S Y="4"
G Y
X55 S ZSI=$S(X=1!(X=2)!(X=3)!(X=4)!(X=6):60/X,1:0),SDLA=$S('$D(^SC(DA,"SL")):0,1:+^("SL")) K:('SDLA)!('ZSI) SDLA,ZSI,X Q:'$D(X) I SDLA#ZSI>0 X ^DD(44,1917,9.2) Q
Q
;
56 S DQ=57 ;@99
57 S DW="PA;4",DV="St11",DU="",DIFLD=63,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
G RE
X57 D READSET^DIED(.X,"1:YES;0:NO")
I $D(X),X'?.ANP K X
Q
;
58 G 0^DIE17
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDBT 19265 printed Dec 13, 2024@02:48:37 Page 2
SDBT ; GENERATED FROM 'SDB' INPUT TEMPLATE(#485), FILE 44;09/03/24
+1 DO DE
GOTO BEGIN
DE SET DIE="^SC("
SET DIC=DIE
SET DP=44
SET DL=1
SET DIEL=0
SET DU=""
KILL DG,DE,DB
if $ORDER(^SC(DA,""))=""
QUIT
+1 IF $DATA(^(0))
SET %Z=^(0)
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(1)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(2)=%
SET %=$PIECE(%Z,U,7)
if %]""
SET DE(17)=%
SET %=$PIECE(%Z,U,8)
if %]""
SET DE(9)=%
SET %=$PIECE(%Z,U,11)
if %]""
SET DE(46)=%
SET %=$PIECE(%Z,U,15)
if %]""
SET DE(15)=%
SET %=$PIECE(%Z,U,17)
if %]""
SET DE(10)=%
+2 IF $TEST
SET %=$PIECE(%Z,U,18)
if %]""
SET DE(41)=%
SET %=$PIECE(%Z,U,19)
if %]""
SET DE(4)=%
SET %=$PIECE(%Z,U,21)
if %]""
SET DE(12)=%
SET %=$PIECE(%Z,U,24)
if %]""
SET DE(30)=%
SET %=$PIECE(%Z,U,25)
if %]""
SET DE(19)=%
SET %=$PIECE(%Z,U,26)
if %]""
SET DE(50)=%
SET %=$PIECE(%Z,U,27)
if %]""
SET DE(51)=%
+3 IF $TEST
SET %=$PIECE(%Z,U,30)
if %]""
SET DE(34)=%
+4 IF $DATA(^(99))
SET %Z=^(99)
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(20)=%
+5 IF $DATA(^(99.1))
SET %Z=^(99.1)
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(22)=%
+6 IF $DATA(^("AT"))
SET %Z=^("AT")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(18)=%
+7 IF $DATA(^("LTR"))
SET %Z=^("LTR")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(26)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(27)=%
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(28)=%
SET %=$PIECE(%Z,U,4)
if %]""
SET DE(29)=%
+8 IF $DATA(^("PA"))
SET %Z=^("PA")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(3)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(5)=%
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(7)=%
SET %=$PIECE(%Z,U,4)
if %]""
SET DE(57)=%
+9 IF $DATA(^("PC"))
SET %Z=^("PC")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(32)=%
+10 IF $DATA(^("PS"))
SET %Z=^("PS")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(25)=%
+11 IF $DATA(^("RAD"))
SET %Z=^("RAD")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(24)=%
+12 IF $DATA(^("SDP"))
SET %Z=^("SDP")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(35)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(36)=%
+13 IF $DATA(^("SDPROT"))
SET %Z=^("SDPROT")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(42)=%
+14 IF $DATA(^("SL"))
SET %Z=^("SL")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(52)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(53)=%
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(38)=%
SET %=$PIECE(%Z,U,5)
if %]""
SET DE(47)=%
SET %=$PIECE(%Z,U,6)
if %]""
SET DE(55)=%
SET %=$PIECE(%Z,U,7)
if %]""
SET DE(48)=%
SET %=$PIECE(%Z,U,8)
if %]""
SET DE(40)=%
+15 KILL %Z
QUIT
+16 ;
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 X'?.ANP
GOTO X
+1 ;EXTENSIBLE DATA TYPES ;p21
IF DV["t"
Begin DoDot:1
+2 XECUTE $SELECT($DATA(DB(DQ)):$$VALEXTS^DIETLIBF(DP,DIFLD),1:$$VALEXT^DIETLIBF(DP,DIFLD))
KILL DIPA
End DoDot:1
GOTO UNIQ
+3 ;p22
IF DV["S"
DO SET^DIED
if 'DDER
GOTO V
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
+1 ;p21
IF DG["t"
XECUTE $$OUTPUT^DIETLIBF(DP,DIFLD)
KILL DIPA
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="SDBT"
SET DQ=1
+1 NEW DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR
KILL DIEFIRE,DIEBADK
SET DIEZTMP=$$GETTMP^DIKC1("DIEZ")
+2 MERGE DIEZAR=^DIE(485,"AR")
SET DICRREC="TRIG^DIE17"
+3 if $DATA(DTIME)[0
SET DTIME=300
SET D0=DA
SET DIIENS=DA_","
SET DIEZ=485
SET U="^"
1 SET DW="0;1"
SET DV="RFa"
SET DU=""
SET DIFLD=.01
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C1^SDBT"
SET DE(DW,"INDEX")=1
+2 GOTO RE
C1 if $DATA(DE(1))[0
GOTO C1S
KILL DB
+1 SET X=DE(1)
SET DIC=DIE
+2 KILL ^SC("B",$EXTRACT(X,1,30),DA)
+3 SET X=DE(1)
SET DIC=DIE
+4 ;
+5 SET X=DE(1)
SET DIC=DIE
+6 ;
+7 SET X=DE(1)
SET DIC=DIE
+8 ;
+9 SET X=DE(1)
SET DIC=DIE
+10 SET RTPL=X
SET X="RTP6"
XECUTE ^%ZOSF("TEST")
SET X=RTPL
KILL RTPL
IF $TEST
DO ^RTP6
+11 SET X=DE(1)
SET DIC=DIE
+12 ;
+13 SET X=DE(1)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C1S SET X=""
if DG(DQ)=X
GOTO C1F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^SC("B",$EXTRACT(X,1,30),DA)=""
+3 SET X=DG(DQ)
SET DIC=DIE
+4 XECUTE ^DD(44,.01,1,2,1.3)
IF X
SET X=DIV
XECUTE ^DD(44,.01,1,2,89.2)
SET X=$PIECE(Y(101),U,1)
SET X=X
SET X=X
SET D0=I(0,0)
SET DIU=X
KILL Y
SET X=DIV
SET X=DIV
XECUTE ^DD(44,.01,1,2,1.4)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 ;
+7 SET X=DG(DQ)
SET DIC=DIE
+8 DO N44S^SDEC03(DA,$EXTRACT(X,1,30))
+9 SET X=DG(DQ)
SET DIC=DIE
+10 ;
+11 SET X=DG(DQ)
SET DIC=DIE
+12 XECUTE ^DD(44,.01,1,12,1.3)
IF X
SET X=DIV
XECUTE ^DD(44,.01,1,12,89.2)
SET X=$PIECE(Y(101),U,1)
SET D0=I(0,0)
SET DIU=X
KILL Y
SET X=DIV
SET X=DIV
XECUTE ^DD(44,.01,1,12,1.4)
+13 IF $DATA(DE(1))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C1F1 SET DIEZRXR(44,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=1353,1552
SET DIEZRXR(44,DIXR)=""
+2 QUIT
X1 if $LENGTH(X)>30!($LENGTH(X)<2)!'(X'?1P.E)!(X'?.ANP)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
2 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=2
SET DW="0;2"
SET DV="F"
SET DU=""
SET DIFLD=1
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C2^SDBT"
+2 GOTO RE
C2 if $DATA(DE(2))[0
GOTO C2S
KILL DB
+1 SET X=DE(2)
SET DIC=DIE
+2 KILL ^SC("C",$EXTRACT(X,1,30),DA)
+3 SET X=DE(2)
SET DIC=DIE
+4 ;
C2S SET X=""
if DG(DQ)=X
GOTO C2F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^SC("C",$EXTRACT(X,1,30),DA)=""
+3 SET X=DG(DQ)
SET DIC=DIE
+4 DO A44S^SDEC03(DA,$EXTRACT(X,1,7))
C2F1 QUIT
X2 if X[""""!($ASCII(X)=45)
KILL X
IF $DATA(X)
if $LENGTH(X)>7!($LENGTH(X)<1)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
3 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=3
SET DW="PA;1"
SET DV="F"
SET DU=""
SET DIFLD=60
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X3 if $LENGTH(X)>80!($LENGTH(X)<3)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
4 SET DW="0;19"
SET DV="RS"
SET DU=""
SET DIFLD=2504
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="Y:YES;N:NO;"
+2 SET Y="Y"
+3 GOTO Y
X4 QUIT
5 SET DW="PA;2"
SET DV="RSa"
SET DU=""
SET DIFLD=61
SET DLB="ALLOW DIRECT PATIENT SCHEDULING?"
+1 SET DE(DW)="C5^SDBT"
+2 SET DU="Y:YES;N:NO;"
+3 GOTO RE
C5 if $DATA(DE(5))[0
GOTO C5S
KILL DB
+1 SET X=DE(5)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C5S SET X=""
if DG(DQ)=X
GOTO C5F1
KILL DB
+1 IF $DATA(DE(5))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C5F1 QUIT
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 (X["Y")!($PIECE($GET(^SC(DA,"PA")),"^",2)="Y")
SET $PIECE(^SC(DA,"PA"),"^",3)="Y"
SET Y="@07"
+1 QUIT
7 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=7
SET DW="PA;3"
SET DV="RSa"
SET DU=""
SET DIFLD=62
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C7^SDBT"
+2 SET DU="Y:YES;N:NO;"
+3 GOTO RE
C7 if $DATA(DE(7))[0
GOTO C7S
KILL DB
+1 SET X=DE(7)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C7S SET X=""
if DG(DQ)=X
GOTO C7F1
KILL DB
+1 IF $DATA(DE(7))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C7F1 QUIT
X7 QUIT
8 ;@07
SET DQ=9
9 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=9
SET DW="0;8"
SET DV="RS"
SET DU=""
SET DIFLD=9
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C9^SDBT"
SET DE(DW,"INDEX")=1
+2 SET DU="M:MEDICINE;S:SURGERY;P:PSYCHIATRY;R:REHAB MEDICINE;N:NEUROLOGY;0:NONE;"
+3 GOTO RE
C9 if $DATA(DE(9))[0
GOTO C9S
KILL DB
C9S SET X=""
if DG(DQ)=X
GOTO C9F1
KILL DB
C9F1 SET DIEZRXR(44,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=1552
SET DIEZRXR(44,DIXR)=""
+2 QUIT
X9 QUIT
10 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=10
SET DW="0;17"
SET DV="RSa"
SET DU=""
SET DIFLD=2502
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C10^SDBT"
+2 SET DU="Y:YES;N:NO;"
+3 GOTO RE
C10 if $DATA(DE(10))[0
GOTO C10S
KILL DB
+1 SET X=DE(10)
SET DIC=DIE
+2 ;
+3 SET X=DE(10)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C10S SET X=""
if DG(DQ)=X
GOTO C10F1
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(^SC(D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,21)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(44,2502,1,1,1.4)
+3 IF $DATA(DE(10))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C10F1 QUIT
X10 QUIT
11 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=11
DO X11
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X11 if X'["Y"
SET Y="@05"
+1 QUIT
12 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=12
SET DW="0;21"
SET DV="S"
SET DU=""
SET DIFLD=2502.5
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="0:NO;1:YES;"
+2 GOTO RE
X12 QUIT
13 ;@05
SET DQ=14
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 $SELECT('$DATA(^DG(43,1,"GL"))
SET Y="@10"
+1 QUIT
15 SET DW="0;15"
SET DV="RP40.8'a"
SET DU=""
SET DIFLD=3.5
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C15^SDBT"
+2 SET DU="DG(40.8,"
+3 SET X=+$ORDER(^DG(40.8,0))
SET X=$SELECT($DATA(^(X,0)):$PIECE(^(0),"^"),1:"")
+4 SET Y=X
+5 GOTO Y
C15 if $DATA(DE(15))[0
GOTO C15S
KILL DB
+1 SET X=DE(15)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C15S SET X=""
if DG(DQ)=X
GOTO C15F1
KILL DB
+1 IF $DATA(DE(15))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C15F1 QUIT
X15 QUIT
16 ;@10
SET DQ=17
17 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=17
SET DW="0;7"
SET DV="R*P40.7'Xa"
SET DU=""
SET DIFLD=8
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C17^SDBT"
SET DE(DW,"INDEX")=1
+2 SET DU="DIC(40.7,"
+3 GOTO RE
C17 if $DATA(DE(17))[0
GOTO C17S
KILL DB
+1 SET X=DE(17)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C17S SET X=""
if DG(DQ)=X
GOTO C17F1
KILL DB
+1 IF $DATA(DE(17))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C17F1 NEW X,X1,X2
SET DIXR=458
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 KILL ^SC("AST",X,DA)
End DoDot:1
+3 KILL X
MERGE X=X2
IF $GET(X(1))]""
Begin DoDot:1
+4 SET ^SC("AST",X,DA)=""
End DoDot:1
+5 GOTO C17F2
C17X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",44,DIIENS,8,DION),$PIECE($GET(^SC(DA,0)),U,7))
+2 SET X=$GET(X(1))
+3 QUIT
C17F2 SET DIEZRXR(44,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=1552
SET DIEZRXR(44,DIXR)=""
+2 QUIT
X17 SET DIC("S")="I $P(^(0),U,2)'=900&$S('$P(^(0),U,3):1,$P(^(0),U,3)>DT:1,1:0),""PE""[$P(^(0),U,6),$S('$P(^(0),U,7):1,$P(^(0),U,7)'>DT:1,1:0)"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
18 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=18
SET DW="AT;1"
SET DV="*P409.1'"
SET DU=""
SET DIFLD=2507
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="SD(409.1,"
+2 SET Y="REGULAR"
+3 GOTO Y
X18 SET DIC("S")="I '$P(^(0),U,3)"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
19 SET DW="0;25"
SET DV="S"
SET DU=""
SET DIFLD=2802
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C19^SDBT"
+2 SET DU="1:YES;"
+3 GOTO RE
C19 if $DATA(DE(19))[0
GOTO C19S
KILL DB
+1 SET X=DE(19)
SET DIC=DIE
+2 KILL ^SC("AE",$EXTRACT(X,1,30),DA)
C19S SET X=""
if DG(DQ)=X
GOTO C19F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^SC("AE",$EXTRACT(X,1,30),DA)=""
C19F1 QUIT
X19 QUIT
20 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=20
SET DW="99;1"
SET DV="F"
SET DU=""
SET DIFLD=99
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X20 if $LENGTH(X)>13!($LENGTH(X)<3)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
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 if X=""
SET $PIECE(^SC(DA,99.1),"^",1)=""
SET Y="@15"
+1 QUIT
22 SET DW="99.1;1"
SET DV="F"
SET DU=""
SET DIFLD=99.1
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X22 if $LENGTH(X)>26!($LENGTH(X)<1)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
23 ;@15
SET DQ=24
24 SET DW="RAD;1"
SET DV="S"
SET DU=""
SET DIFLD=2000
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="Y:YES;"
+2 GOTO RE
X24 QUIT
25 SET DW="PS;1"
SET DV="RS"
SET DU=""
SET DIFLD=2000.5
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="0:YES;1:NO;"
+2 SET Y="YES"
+3 GOTO Y
X25 QUIT
26 SET DW="LTR;1"
SET DV="*P407.5'"
SET DU=""
SET DIFLD=2508
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C26^SDBT"
+2 SET DU="VA(407.5,"
+3 GOTO RE
C26 if $DATA(DE(26))[0
GOTO C26S
KILL DB
+1 SET X=DE(26)
SET DIC=DIE
+2 KILL ^SC("ALTN",$EXTRACT(X,1,30),DA)
C26S SET X=""
if DG(DQ)=X
GOTO C26F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^SC("ALTN",$EXTRACT(X,1,30),DA)=""
C26F1 QUIT
X26 SET DIC("S")="I $P(^(0),""^"",2)=""N"""
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 DQ=27
SET DW="LTR;2"
SET DV="*P407.5'"
SET DU=""
SET DIFLD=2509
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C27^SDBT"
+2 SET DU="VA(407.5,"
+3 GOTO RE
C27 if $DATA(DE(27))[0
GOTO C27S
KILL DB
+1 SET X=DE(27)
SET DIC=DIE
+2 KILL ^SC("ALTP",$EXTRACT(X,1,30),DA)
C27S SET X=""
if DG(DQ)=X
GOTO C27F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^SC("ALTP",$EXTRACT(X,1,30),DA)=""
C27F1 QUIT
X27 SET DIC("S")="I $P(^(0),""^"",2)=""P"""
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 DQ=28
SET DW="LTR;3"
SET DV="*P407.5'"
SET DU=""
SET DIFLD=2510
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C28^SDBT"
+2 SET DU="VA(407.5,"
+3 GOTO RE
C28 if $DATA(DE(28))[0
GOTO C28S
KILL DB
+1 SET X=DE(28)
SET DIC=DIE
+2 KILL ^SC("ALTC",$EXTRACT(X,1,30),DA)
C28S SET X=""
if DG(DQ)=X
GOTO C28F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^SC("ALTC",$EXTRACT(X,1,30),DA)=""
C28F1 QUIT
X28 SET DIC("S")="I $P(^(0),""^"",2)=""C"""
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
29 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=29
SET DW="LTR;4"
SET DV="*P407.5'"
SET DU=""
SET DIFLD=2511
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C29^SDBT"
+2 SET DU="VA(407.5,"
+3 GOTO RE
C29 if $DATA(DE(29))[0
GOTO C29S
KILL DB
+1 SET X=DE(29)
SET DIC=DIE
+2 KILL ^SC("ALTA",$EXTRACT(X,1,30),DA)
C29S SET X=""
if DG(DQ)=X
GOTO C29F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^SC("ALTA",$EXTRACT(X,1,30),DA)=""
C29F1 QUIT
X29 SET DIC("S")="I $P(^(0),""^"",2)=""A"""
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
30 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=30
SET DW="0;24"
SET DV="S"
SET DU=""
SET DIFLD=24
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="0:NO;1:YES;"
+2 GOTO RE
X30 QUIT
31 ;2600
SET D=0
KILL DE(1)
+1 SET DIFLD=2600
SET DGO="^SDBT1"
SET DC="2^44.1P^PR^"
SET DV="44.1M*P200'"
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="VA(200,"
+3 if D
GOTO RE
IF $DATA(DSC(44.1))#2
IF $PIECE(DSC(44.1),"I $D(^UTILITY(",1)=""
XECUTE DSC(44.1)
SET D=$ORDER(^(0))
if D=""
SET D=-1
GOTO M31
+4 SET D=$SELECT($DATA(^SC(DA,"PR",0)):$PIECE(^(0),U,3,4),$ORDER(^(0))'="":$ORDER(^(0)),1:-1)
M31 IF D>0
SET DC=DC_D
IF $DATA(^SC(DA,"PR",+D,0))
SET DE(31)=$PIECE(^(0),U,1)
+1 GOTO RE
R31 DO DE
+1 SET D=$SELECT($DATA(^SC(DA,"PR",0)):$PIECE(^(0),U,3,4),1:1)
GOTO 31+1
+2 ;
32 SET DW="PC;1"
SET DV="S"
SET DU=""
SET DIFLD=2801
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="1:YES;0:NO;"
+2 GOTO RE
X32 QUIT
33 ;2700
SET D=0
KILL DE(1)
+1 SET DIFLD=2700
SET DGO="^SDBT2"
SET DC="2^44.11P^DX^"
SET DV="44.11M*P80'X"
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="ICD9("
+3 if D
GOTO RE
IF $DATA(DSC(44.11))#2
IF $PIECE(DSC(44.11),"I $D(^UTILITY(",1)=""
XECUTE DSC(44.11)
SET D=$ORDER(^(0))
if D=""
SET D=-1
GOTO M33
+4 SET D=$SELECT($DATA(^SC(DA,"DX",0)):$PIECE(^(0),U,3,4),$ORDER(^(0))'="":$ORDER(^(0)),1:-1)
M33 IF D>0
SET DC=DC_D
IF $DATA(^SC(DA,"DX",+D,0))
SET DE(33)=$PIECE(^(0),U,1)
+1 GOTO RE
R33 DO DE
+1 SET D=$SELECT($DATA(^SC(DA,"DX",0)):$PIECE(^(0),U,3,4),1:1)
GOTO 33+1
+2 ;
34 SET DW="0;30"
SET DV="S"
SET DU=""
SET DIFLD=30
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="1:YES;0:NO;"
+2 GOTO RE
X34 QUIT
35 SET DW="SDP;1"
SET DV="RNJ3,0"
SET DU=""
SET DIFLD=2001
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET Y="999"
+2 GOTO Y
X35 if +X'=X!(X>999)!(X<0)!(X?.E1"."1N.N)
KILL X
+1 QUIT
+2 ;
36 SET DW="SDP;2"
SET DV="RNJ3,0"
SET DU=""
SET DIFLD=2002
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X36 if +X'=X!(X>999)!(X<11)!(X?.E1"."1N.N)
KILL X
+1 QUIT
+2 ;
37 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=37
DO X37
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
X37 if +$ORDER(^SC(DA,"ST",0))>0
SET Y="@25"
+1 QUIT
38 SET DW="SL;3"
SET DV="NJ2,0"
SET DU=""
SET DIFLD=1914
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X38 if +X'=X!(X>16)!(X<0)!(X?.E1"."1N.N)
KILL X
+1 QUIT
+2 ;
39 ;@25
SET DQ=40
40 SET DW="SL;8"
SET DV="S"
SET DU=""
SET DIFLD=1918.5
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="Y:YES;"
+2 GOTO RE
X40 QUIT
41 SET DW="0;18"
SET DV="*P40.7'Xa"
SET DU=""
SET DIFLD=2503
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C41^SDBT"
SET DE(DW,"INDEX")=1
+2 SET DU="DIC(40.7,"
+3 GOTO RE
C41 if $DATA(DE(41))[0
GOTO C41S
KILL DB
+1 SET X=DE(41)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C41S SET X=""
if DG(DQ)=X
GOTO C41F1
KILL DB
+1 IF $DATA(DE(41))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C41F1 NEW X,X1,X2
SET DIXR=457
DO C41X1(U)
KILL X2
MERGE X2=X
DO C41X1("O")
KILL X1
MERGE X1=X
+1 IF $GET(X(1))]""
Begin DoDot:1
+2 KILL ^SC("ACST",X,DA)
End DoDot:1
+3 KILL X
MERGE X=X2
IF $GET(X(1))]""
Begin DoDot:1
+4 SET ^SC("ACST",X,DA)=""
End DoDot:1
+5 GOTO C41F2
C41X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",44,DIIENS,2503,DION),$PIECE($GET(^SC(DA,0)),U,18))
+2 SET X=$GET(X(1))
+3 QUIT
C41F2 SET DIEZRXR(44,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=1552
SET DIEZRXR(44,DIXR)=""
+2 QUIT
X41 SET DIC("S")="I $P(^(0),U,2)'=900&$S('$P(^(0),U,3):1,$P(^(0),U,3)>DT:1,1:0),""SE""[$P(^(0),U,6),$S('$P(^(0),U,7):1,$P(^(0),U,7)'>DT:1,1:0)"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
42 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=42
SET DW="SDPROT;1"
SET DV="S"
SET DU=""
SET DIFLD=2500
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="Y:YES;"
+2 GOTO RE
X42 QUIT
43 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=43
DO X43
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X43 if X'="Y"
SET Y="@30"
+1 QUIT
44 ;2501
SET D=0
KILL DE(1)
+1 SET DIFLD=2501
SET DGO="^SDBT3"
SET DC="1^44.04PA^SDPRIV^"
SET DV="44.04MP200'X"
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="VA(200,"
+3 if D
GOTO RE
IF $DATA(DSC(44.04))#2
IF $PIECE(DSC(44.04),"I $D(^UTILITY(",1)=""
XECUTE DSC(44.04)
SET D=$ORDER(^(0))
if D=""
SET D=-1
GOTO M44
+4 SET D=$SELECT($DATA(^SC(DA,"SDPRIV",0)):$PIECE(^(0),U,3,4),$ORDER(^(0))'="":$ORDER(^(0)),1:-1)
M44 IF D>0
SET DC=DC_D
IF $DATA(^SC(DA,"SDPRIV",+D,0))
SET DE(44)=$PIECE(^(0),U,1)
+1 GOTO RE
R44 DO DE
+1 SET D=$SELECT($DATA(^SC(DA,"SDPRIV",0)):$PIECE(^(0),U,3,4),1:1)
GOTO 44+1
+2 ;
45 ;@30
SET DQ=46
46 SET DW="0;11"
SET DV="F"
SET DU=""
SET DIFLD=10
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X46 if $LENGTH(X)>25!($LENGTH(X)<1)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
47 SET DW="SL;5"
SET DV="*P44'"
SET DU=""
SET DIFLD=1916
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="SC("
+2 GOTO RE
X47 SET DIC("S")="I $P(^(0),""^"",3)=""C"",'$G(^(""OOS""))"
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
48 SET DW="SL;7"
SET DV="RNJ4,0"
SET DU=""
SET DIFLD=1918
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C48^SDBT"
SET DE(DW,"INDEX")=1
+2 GOTO RE
C48 if $DATA(DE(48))[0
GOTO C48S
KILL DB
C48S SET X=""
if DG(DQ)=X
GOTO C48F1
KILL DB
C48F1 SET DIEZRXR(44,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=1552
SET DIEZRXR(44,DIXR)=""
+2 QUIT
X48 if +X'=X!(X>9999)!(X<0)!(X?.E1"."1N.N)
KILL X
+1 QUIT
+2 ;
49 ;1910
if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=49
SET D=0
KILL DE(1)
+1 SET DIFLD=1910
SET DGO="^SDBT4"
SET DC="1^44.03A^SI^"
SET DV="44.03F"
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 $DATA(DSC(44.03))#2
IF $PIECE(DSC(44.03),"I $D(^UTILITY(",1)=""
XECUTE DSC(44.03)
SET D=$ORDER(^(0))
if D=""
SET D=-1
GOTO M49
+3 SET D=$SELECT($DATA(^SC(DA,"SI",0)):$PIECE(^(0),U,3,4),$ORDER(^(0))'="":$ORDER(^(0)),1:-1)
M49 IF D>0
SET DC=DC_D
IF $DATA(^SC(DA,"SI",+D,0))
SET DE(49)=$PIECE(^(0),U,1)
+1 GOTO RE
R49 DO DE
+1 GOTO A
+2 ;
50 SET DW="0;26"
SET DV="RS"
SET DU=""
SET DIFLD=20
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="1:YES;0:NO;"
+2 SET Y="NO"
+3 GOTO Y
X50 QUIT
51 SET DW="0;27"
SET DV="RS"
SET DU=""
SET DIFLD=21
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="1:YES;0:NO;"
+2 SET Y="NO"
+3 GOTO Y
X51 QUIT
52 SET DW="SL;1"
SET DV="RNJ2,0X"
SET DU=""
SET DIFLD=1912
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X52 if +X'=X!(X>240)!(X<10)!(X?.E1"."1N.N)!($SELECT('(X#10)
KILL X
IF $DATA(X)
SET SDLA=X
IF $DATA(^SC(DA,"SL"))
IF +$PIECE(^("SL"),U,6)
SET SDZ0=$PIECE(^("SL"),U,6)
SET SDZ1=60\SDZ0
IF X#SDZ1
DO LAPPT^SDUTL
+1 QUIT
+2 ;
53 SET DW="SL;2"
SET DV="S"
SET DU=""
SET DIFLD=1913
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="V:YES, VARIABLE LENGTH;"
+2 GOTO RE
X53 QUIT
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 +$ORDER(^SC(DA,"ST",0))>0
SET Y="@99"
+1 QUIT
55 SET DW="SL;6"
SET DV="RSX"
SET DU=""
SET DIFLD=1917
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DU="1:60-MIN ;2:30-MIN ;4:15-MIN ;3:20-MIN ;6:10-MIN ;"
+2 SET Y="4"
+3 GOTO Y
X55 SET ZSI=$SELECT(X=1!(X=2)!(X=3)!(X=4)!(X=6):60/X,1:0)
SET SDLA=$SELECT('$DATA(^SC(DA,"SL")):0,1:+^("SL"))
if ('SDLA)!('ZSI)
KILL SDLA,ZSI,X
if '$DATA(X)
QUIT
IF SDLA#ZSI>0
XECUTE ^DD(44,1917,9.2)
QUIT
+1 QUIT
+2 ;
56 ;@99
SET DQ=57
57 SET DW="PA;4"
SET DV="St11"
SET DU=""
SET DIFLD=63
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 GOTO RE
X57 DO READSET^DIED(.X,"1:YES;0:NO")
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
58 GOTO 0^DIE17