FBCTAU2 ; ;10/31/14
D DE G BEGIN
DE S DIE="^FBAAA(D0,1,",DIC=DIE,DP=161.01,DL=2,DIEL=1,DU="" K DG,DE,DB Q:$O(^FBAAA(D0,1,DA,""))=""
I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,4) S:%]"" DE(14)=% S %=$P(%Z,U,8) S:%]"" DE(4)=% S %=$P(%Z,U,14) S:%]"" DE(11)=% S %=$P(%Z,U,19) S:%]"" DE(17)=% S %=$P(%Z,U,20) S:%]"" DE(18)=%
I $D(^(3)) S %Z=^(3) S %=$P(%Z,U,1) S:%]"" DE(6)=% S %=$P(%Z,U,2) S:%]"" DE(8)=%
I $D(^(100)) S %Z=^(100) S %=$P(%Z,U,1) S:%]"" DE(15)=%
I $D(^("C")) S %Z=^("C") S %=$P(%Z,U,1) S:%]"" DE(19)=%,DE(22)=% S %=$P(%Z,U,2) S:%]"" DE(1)=%
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 S X="" W " (No Editing)" Q
TR 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 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" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I W:'$D(DB(DQ)) " "_% 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
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),";") S:%]"" 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
SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
D ^DIR I 'DDER S %=Y(0),X=Y
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="FBCTAU2",DQ=1
1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW="C;2",DV="RP80'",DU="",DLB="ICD DIAGNOSIS",DIFLD=.087
S DU="ICD9("
S X=XX1
S Y=X
S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD:X="@",Z
X1 Q
2 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 D X2 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X2 S Y="@10"
Q
3 S DQ=4 ;@9
4 S DW="0;8",DV="F",DU="",DLB="DX LINE 1",DIFLD=.08
G RE
X4 K:$L(X)>60!($L(X)<3) X
I $D(X),X'?.ANP K X
Q
;
5 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X5 S:X="" Y=.021
Q
6 S DW="3;1",DV="F",DU="",DLB="DX LINE 2",DIFLD=.085
G RE
X6 K:$L(X)>60!($L(X)<2) X
I $D(X),X'?.ANP K X
Q
;
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:X="" Y=.021
Q
8 S DW="3;2",DV="F",DU="",DLB="DX LINE 3",DIFLD=.086
G RE
X8 K:$L(X)>60!($L(X)<2) X
I $D(X),X'?.ANP K X
Q
;
9 S DQ=10 ;@10
10 S D=0 K DE(1) ;.021
S Y="AUTHORIZATION REMARKS^W^^0;1^Q",DG="2",DC="^161.06" D DIEN^DIWE K DE(1) G A
;
11 S DW="0;14",DV="S",DU="",DLB="TYPE OF CARE",DIFLD=2
S DU="1:C&P;2:OPT NSC;3:OPT SC;"
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(FBAAASKV) FBAAASKV="N"
Q
13 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X13 S:FBAAASKV'="y" Y=100
Q
14 S DW="0;4",DV="P161.2",DU="",DLB="VENDOR",DIFLD=.04
S DE(DW)="C14^FBCTAU2"
S DU="FBAAV("
G RE
C14 G C14S:$D(DE(14))[0 K DB
S X=DE(14),DIC=DIE
K ^FBAAA("ACV",$E(X,1,30),DA(1),DA)
C14S S X="" G:DG(DQ)=X C14F1 K DB
S X=DG(DQ),DIC=DIE
S ^FBAAA("ACV",$E(X,1,30),DA(1),DA)=""
C14F1 Q
X14 Q
15 D:$D(DG)>9 F^DIE17,DE S DQ=15,DW="100;1",DV="P200'",DU="",DLB="CLERK",DIFLD=100
S DU="VA(200,"
S X=DUZ
S Y=X
S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD:X="@",Z
X15 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 W !!
Q
17 S DW="0;19",DV="FXO",DU="",DLB="ACCIDENT RELATED (Y/N)",DIFLD=.096
S DQ(17,2)="S Y(0)=Y D OUTYN^FBAAUTL3"
S DE(DW)="C17^FBCTAU2"
G RE
C17 G C17S:$D(DE(17))[0 K DB
S X=DE(17),DIC=DIE
K ^FBAAA("AA",X,$P(^FBAAA(DA(1),1,DA,0),U,1),DA(1),DA)
C17S S X="" G:DG(DQ)=X C17F1 K DB
S X=DG(DQ),DIC=DIE
S ^FBAAA("AA",X,$P(^FBAAA(DA(1),1,DA,0),U,1),DA(1),DA)=""
C17F1 Q
X17 I $D(X) D YN^FBAAUTL3
I $D(X),X'?.ANP K X
Q
;
18 D:$D(DG)>9 F^DIE17,DE S DQ=18,DW="0;20",DV="RFXO",DU="",DLB="POTENTIAL COST RECOVERY CASE",DIFLD=.097
S DQ(18,2)="S Y(0)=Y D OUTYN^FBAAUTL3"
S DE(DW)="C18^FBCTAU2"
S X="NO"
S Y=X
G Y
C18 G C18S:$D(DE(18))[0 K DB
S X=DE(18),DIC=DIE
K ^FBAAA("AC",X,$P(^FBAAA(DA(1),1,DA,0),U,1),DA(1),DA)
S X=DE(18),DIC=DIE
K:$P(^FBAAA(DA(1),1,DA,0),U) ^FBAAA("AIC",DA(1),-($P(^FBAAA(DA(1),1,DA,0),U)),X,DA)
C18S S X="" G:DG(DQ)=X C18F1 K DB
S X=DG(DQ),DIC=DIE
S ^FBAAA("AC",X,$P(^FBAAA(DA(1),1,DA,0),U,1),DA(1),DA)=""
S X=DG(DQ),DIC=DIE
S:$P(^FBAAA(DA(1),1,DA,0),U) ^FBAAA("AIC",DA(1),-($P(^FBAAA(DA(1),1,DA,0),U)),X,DA)=""
C18F1 Q
X18 I $D(X) D YN^FBAAUTL3
I $D(X),X'?.ANP K X
Q
;
19 D:$D(DG)>9 F^DIE17,DE S DQ=19,DW="C;1",DV="FX",DU="",DLB="PRINT AUTHORIZATION (Y/N)",DIFLD=1
S DE(DW)="C19^FBCTAU2"
S X="YES"
S Y=X
G Y
C19 G C19S:$D(DE(19))[0 K DB
S X=DE(19),DIC=DIE
D KILL^FBAAUTL2
S X=DE(19),DIC=DIE
K ^FBAAA("AF",$P(^FBAAA(DA(1),1,DA,0),U,3),DT,DA(1),DA)
C19S S X="" G:DG(DQ)=X C19F1 K DB
S X=DG(DQ),DIC=DIE
D ADD^FBAAUTL2
S X=DG(DQ),DIC=DIE
S ^FBAAA("AF",$P(^FBAAA(DA(1),1,DA,0),U,3),DT,DA(1),DA)=""
C19F1 Q
X19 I $D(X) D YN^FBAAUTL3
I $D(X),X'?.ANP K X
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 S FBAAP79=$S(X["Y":"Y",1:"")
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 I X["Y" S Y=""
Q
22 D:$D(DG)>9 F^DIE17,DE S DQ=22,DW="C;1",DV="FX",DU="",DLB="PRINT AUTHORIZATION (Y/N)",DIFLD=1
S DE(DW)="C22^FBCTAU2"
S X="@"
S Y=X
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C22 G C22S:$D(DE(22))[0 K DB
S X=DE(22),DIC=DIE
D KILL^FBAAUTL2
S X=DE(22),DIC=DIE
K ^FBAAA("AF",$P(^FBAAA(DA(1),1,DA,0),U,3),DT,DA(1),DA)
C22S S X="" G:DG(DQ)=X C22F1 K DB
S X=DG(DQ),DIC=DIE
D ADD^FBAAUTL2
S X=DG(DQ),DIC=DIE
S ^FBAAA("AF",$P(^FBAAA(DA(1),1,DA,0),U,3),DT,DA(1),DA)=""
C22F1 Q
X22 I $D(X) D YN^FBAAUTL3
I $D(X),X'?.ANP K X
Q
;
23 G 1^DIE17
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBCTAU2 7771 printed Dec 13, 2024@01:58:10 Page 2
FBCTAU2 ; ;10/31/14
+1 DO DE
GOTO BEGIN
DE SET DIE="^FBAAA(D0,1,"
SET DIC=DIE
SET DP=161.01
SET DL=2
SET DIEL=1
SET DU=""
KILL DG,DE,DB
if $ORDER(^FBAAA(D0,1,DA,""))=""
QUIT
+1 IF $DATA(^(0))
SET %Z=^(0)
SET %=$PIECE(%Z,U,4)
if %]""
SET DE(14)=%
SET %=$PIECE(%Z,U,8)
if %]""
SET DE(4)=%
SET %=$PIECE(%Z,U,14)
if %]""
SET DE(11)=%
SET %=$PIECE(%Z,U,19)
if %]""
SET DE(17)=%
SET %=$PIECE(%Z,U,20)
if %]""
SET DE(18)=%
+2 IF $DATA(^(3))
SET %Z=^(3)
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(6)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(8)=%
+3 IF $DATA(^(100))
SET %Z=^(100)
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(15)=%
+4 IF $DATA(^("C"))
SET %Z=^("C")
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(19)=%
SET DE(22)=%
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(1)=%
+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
SET X=""
WRITE " (No Editing)"
QUIT
TR 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 $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 $DATA(^DD(DP,DIFLD,12.1))
XECUTE ^(12.1)
IF X?.ANP
DO SET
IF 'DDER
if $DATA(DIC("S"))
XECUTE DIC("S")
IF $TEST
if '$DATA(DB(DQ))
WRITE " "_%
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
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=%
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
SET NEW DIR
SET DIR(0)="SV"_$EXTRACT("o",$DATA(DB(DQ)))_U_DU
SET DIR("V")=1
+1 IF $DATA(DB(DQ))
IF '$DATA(DIQUIET)
NEW DIQUIET
SET DIQUIET=1
+2 DO ^DIR
IF 'DDER
SET %=Y(0)
SET X=Y
+3 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="FBCTAU2"
SET DQ=1
1 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=1
SET DW="C;2"
SET DV="RP80'"
SET DU=""
SET DLB="ICD DIAGNOSIS"
SET DIFLD=.087
+1 SET DU="ICD9("
+2 SET X=XX1
+3 SET Y=X
+4 SET X=Y
SET DB(DQ)=1
SET DE(DW,"4/")=""
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+5 if X="@"
GOTO RD
GOTO Z
X1 QUIT
2 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=2
DO X2
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X2 SET Y="@10"
+1 QUIT
3 ;@9
SET DQ=4
4 SET DW="0;8"
SET DV="F"
SET DU=""
SET DLB="DX LINE 1"
SET DIFLD=.08
+1 GOTO RE
X4 if $LENGTH(X)>60!($LENGTH(X)<3)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
5 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=5
DO X5
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X5 if X=""
SET Y=.021
+1 QUIT
6 SET DW="3;1"
SET DV="F"
SET DU=""
SET DLB="DX LINE 2"
SET DIFLD=.085
+1 GOTO RE
X6 if $LENGTH(X)>60!($LENGTH(X)<2)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
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 X=""
SET Y=.021
+1 QUIT
8 SET DW="3;2"
SET DV="F"
SET DU=""
SET DLB="DX LINE 3"
SET DIFLD=.086
+1 GOTO RE
X8 if $LENGTH(X)>60!($LENGTH(X)<2)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
9 ;@10
SET DQ=10
10 ;.021
SET D=0
KILL DE(1)
+1 SET Y="AUTHORIZATION REMARKS^W^^0;1^Q"
SET DG="2"
SET DC="^161.06"
DO DIEN^DIWE
KILL DE(1)
GOTO A
+2 ;
11 SET DW="0;14"
SET DV="S"
SET DU=""
SET DLB="TYPE OF CARE"
SET DIFLD=2
+1 SET DU="1:C&P;2:OPT NSC;3:OPT SC;"
+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(FBAAASKV)
SET FBAAASKV="N"
+1 QUIT
13 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=13
DO X13
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X13 if FBAAASKV'="y"
SET Y=100
+1 QUIT
14 SET DW="0;4"
SET DV="P161.2"
SET DU=""
SET DLB="VENDOR"
SET DIFLD=.04
+1 SET DE(DW)="C14^FBCTAU2"
+2 SET DU="FBAAV("
+3 GOTO RE
C14 if $DATA(DE(14))[0
GOTO C14S
KILL DB
+1 SET X=DE(14)
SET DIC=DIE
+2 KILL ^FBAAA("ACV",$EXTRACT(X,1,30),DA(1),DA)
C14S SET X=""
if DG(DQ)=X
GOTO C14F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^FBAAA("ACV",$EXTRACT(X,1,30),DA(1),DA)=""
C14F1 QUIT
X14 QUIT
15 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=15
SET DW="100;1"
SET DV="P200'"
SET DU=""
SET DLB="CLERK"
SET DIFLD=100
+1 SET DU="VA(200,"
+2 SET X=DUZ
+3 SET Y=X
+4 SET X=Y
SET DB(DQ)=1
SET DE(DW,"4/")=""
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+5 if X="@"
GOTO RD
GOTO Z
X15 QUIT
16 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=16
DO X16
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X16 WRITE !!
+1 QUIT
17 SET DW="0;19"
SET DV="FXO"
SET DU=""
SET DLB="ACCIDENT RELATED (Y/N)"
SET DIFLD=.096
+1 SET DQ(17,2)="S Y(0)=Y D OUTYN^FBAAUTL3"
+2 SET DE(DW)="C17^FBCTAU2"
+3 GOTO RE
C17 if $DATA(DE(17))[0
GOTO C17S
KILL DB
+1 SET X=DE(17)
SET DIC=DIE
+2 KILL ^FBAAA("AA",X,$PIECE(^FBAAA(DA(1),1,DA,0),U,1),DA(1),DA)
C17S SET X=""
if DG(DQ)=X
GOTO C17F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^FBAAA("AA",X,$PIECE(^FBAAA(DA(1),1,DA,0),U,1),DA(1),DA)=""
C17F1 QUIT
X17 IF $DATA(X)
DO YN^FBAAUTL3
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
18 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=18
SET DW="0;20"
SET DV="RFXO"
SET DU=""
SET DLB="POTENTIAL COST RECOVERY CASE"
SET DIFLD=.097
+1 SET DQ(18,2)="S Y(0)=Y D OUTYN^FBAAUTL3"
+2 SET DE(DW)="C18^FBCTAU2"
+3 SET X="NO"
+4 SET Y=X
+5 GOTO Y
C18 if $DATA(DE(18))[0
GOTO C18S
KILL DB
+1 SET X=DE(18)
SET DIC=DIE
+2 KILL ^FBAAA("AC",X,$PIECE(^FBAAA(DA(1),1,DA,0),U,1),DA(1),DA)
+3 SET X=DE(18)
SET DIC=DIE
+4 if $PIECE(^FBAAA(DA(1),1,DA,0),U)
KILL ^FBAAA("AIC",DA(1),-($PIECE(^FBAAA(DA(1),1,DA,0),U)),X,DA)
C18S SET X=""
if DG(DQ)=X
GOTO C18F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^FBAAA("AC",X,$PIECE(^FBAAA(DA(1),1,DA,0),U,1),DA(1),DA)=""
+3 SET X=DG(DQ)
SET DIC=DIE
+4 if $PIECE(^FBAAA(DA(1),1,DA,0),U)
SET ^FBAAA("AIC",DA(1),-($PIECE(^FBAAA(DA(1),1,DA,0),U)),X,DA)=""
C18F1 QUIT
X18 IF $DATA(X)
DO YN^FBAAUTL3
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
19 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=19
SET DW="C;1"
SET DV="FX"
SET DU=""
SET DLB="PRINT AUTHORIZATION (Y/N)"
SET DIFLD=1
+1 SET DE(DW)="C19^FBCTAU2"
+2 SET X="YES"
+3 SET Y=X
+4 GOTO Y
C19 if $DATA(DE(19))[0
GOTO C19S
KILL DB
+1 SET X=DE(19)
SET DIC=DIE
+2 DO KILL^FBAAUTL2
+3 SET X=DE(19)
SET DIC=DIE
+4 KILL ^FBAAA("AF",$PIECE(^FBAAA(DA(1),1,DA,0),U,3),DT,DA(1),DA)
C19S SET X=""
if DG(DQ)=X
GOTO C19F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO ADD^FBAAUTL2
+3 SET X=DG(DQ)
SET DIC=DIE
+4 SET ^FBAAA("AF",$PIECE(^FBAAA(DA(1),1,DA,0),U,3),DT,DA(1),DA)=""
C19F1 QUIT
X19 IF $DATA(X)
DO YN^FBAAUTL3
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
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 SET FBAAP79=$SELECT(X["Y":"Y",1:"")
+1 QUIT
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["Y"
SET Y=""
+1 QUIT
22 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=22
SET DW="C;1"
SET DV="FX"
SET DU=""
SET DLB="PRINT AUTHORIZATION (Y/N)"
SET DIFLD=1
+1 SET DE(DW)="C22^FBCTAU2"
+2 SET X="@"
+3 SET Y=X
+4 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+5 GOTO RD
C22 if $DATA(DE(22))[0
GOTO C22S
KILL DB
+1 SET X=DE(22)
SET DIC=DIE
+2 DO KILL^FBAAUTL2
+3 SET X=DE(22)
SET DIC=DIE
+4 KILL ^FBAAA("AF",$PIECE(^FBAAA(DA(1),1,DA,0),U,3),DT,DA(1),DA)
C22S SET X=""
if DG(DQ)=X
GOTO C22F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO ADD^FBAAUTL2
+3 SET X=DG(DQ)
SET DIC=DIE
+4 SET ^FBAAA("AF",$PIECE(^FBAAA(DA(1),1,DA,0),U,3),DT,DA(1),DA)=""
C22F1 QUIT
X22 IF $DATA(X)
DO YN^FBAAUTL3
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
23 GOTO 1^DIE17