Index: FOIAVistA/tag/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RACTOE3.m
===================================================================
--- FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RACTOE3.m	(revision 631)
+++ FOIAVistA/tag/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RACTOE3.m	(revision 636)
@@ -1,7 +1,7 @@
-RACTOE3 ; ;05/26/08
+RACTOE3 ; ;12/27/07
  D DE G BEGIN
 DE S DIE="^RAO(75.1,",DIC=DIE,DP=75.1,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^RAO(75.1,DA,""))=""
- I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,4) S:%]"" DE(10)=% S %=$P(%Z,U,9) S:%]"" DE(16)=% S %=$P(%Z,U,12) S:%]"" DE(21)=% S %=$P(%Z,U,13) S:%]"" DE(27)=% S %=$P(%Z,U,14) S:%]"" DE(9)=% S %=$P(%Z,U,17) S:%]"" DE(31)=% S %=$P(%Z,U,22) S:%]"" DE(18)=%
- I $D(^("R")) S %Z=^("R") S %=$P(%Z,U,1) S:%]"" DE(13)=%
+ I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,4) S:%]"" DE(11)=%,DE(20)=% S %=$P(%Z,U,9) S:%]"" DE(27)=% S %=$P(%Z,U,14) S:%]"" DE(9)=% S %=$P(%Z,U,22) S:%]"" DE(32)=%
+ I $D(^("R")) S %Z=^("R") S %=$P(%Z,U,1) S:%]"" DE(24)=%
  K %Z Q
  ;
@@ -80,36 +80,76 @@
  G RD:X="@",Z
 X9 Q
-10 S DW="0;4",DV="SX",DU="",DLB="CATEGORY OF EXAM",DIFLD=4
+10 S DQ=11 ;@20
+11 S DW="0;4",DV="SX",DU="",DLB="CATEGORY OF EXAM",DIFLD=4
  S DU="I:INPATIENT;O:OUTPATIENT;C:CONTRACT;S:SHARING;E:EMPLOYEE;R:RESEARCH;"
  S X=RACAT
  S Y=X
  G Y
-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 Y=$E(X),Y=$S(Y="R":"@30",(Y'="")&("CS"[Y):"@40",1:"@50")
+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 RAX=$E(X,1),Y=$S(RAX="R":"@30","CS"[RAX:"@40",RAX="I"&($D(RAWARD))!("EO"[RAX&('$D(RAWARD))):"@50",1:"@25")
  Q
-12 S DQ=13 ;@30
-13 S DW="R;1",DV="FR",DU="",DLB="RESEARCH SOURCE",DIFLD=9.5
+13 S DQ=14 ;@25
+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 $D(RAWARD) W !?3,$C(7),"Please choose 'I' for INPATIENT, 'R' RESEARCH, 'C' CONTRACT,",!?3,"'S' SHARING!"
+ Q
+15 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=15 D X15 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X15 I '$D(RAWARD) W !?3,$C(7),"Please choose 'O' for OUTPATIENT, 'E' EMPLOYEE, 'R' RESEARCH,",!?3,"'C' CONTRACT, 'S' SHARING!"
+ Q
+16 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X16 D CS^RAORD1A I $D(RALIFN("OUT")) S Y="@26"
+ Q
+17 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=17 D X17 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
+X17 I '$D(RALIFN("NO")) S Y="@50"
+ Q
+18 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=18 D X18 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X18 K RALIFN("NO")
+ Q
+19 S DQ=20 ;@26
+20 S DW="0;4",DV="SX",DU="",DLB="CATEGORY OF EXAM",DIFLD=4
+ S DU="I:INPATIENT;O:OUTPATIENT;C:CONTRACT;S:SHARING;E:EMPLOYEE;R:RESEARCH;"
+ S Y="@"
+ S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
+ G RD
+X20 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 K RALIFN("OUT")
+ Q
+22 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=22 D X22 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
+X22 S Y="@20"
+ Q
+23 S DQ=24 ;@30
+24 S DW="R;1",DV="FR",DU="",DLB="RESEARCH SOURCE",DIFLD=9.5
  S X=$S($D(RARSH):RARSH,1:"")
  S Y=X
  G Y
-X13 K:$L(X)>40!($L(X)<3) X
+X24 K:$L(X)>40!($L(X)<3) X
  I $D(X),X'?.ANP K 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 S Y="@50"
+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 S Y="@50"
  Q
-15 S DQ=16 ;@40
-16 S DW="0;9",DV="*P34'R",DU="",DLB="CONTRACT/SHARING SOURCE",DIFLD=9
+26 S DQ=27 ;@40
+27 S DW="0;9",DV="*P34'R",DU="",DLB="CONTRACT/SHARING SOURCE",DIFLD=9
  S DU="DIC(34,"
  S X=$S($D(RASHA):RASHA,1:"")
  S Y=X
  G Y
-X16 S DIC("S")="I $S('$D(^(""I"")):1,'^(""I""):1,DT'>^(""I""):1,1:0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
+X27 S DIC("S")="I $S('$D(^(""I"")):1,'^(""I""):1,DT'>^(""I""):1,1:0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
  Q
  ;
-17 S DQ=18 ;@50
-18 S DW="0;22",DV="P44'",DU="",DLB="REQUESTING LOCATION",DIFLD=22
+28 S DQ=29 ;@50
+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 RAX="I",($P($G(^SC(+RALIFN,0)),U,3)'="W"),($P($G(^SC(+RALIFN,0)),U,3)'="OR") S RAWHEN=$P($G(^RAO(75.1,DA,0)),U,21),RAWHEN=$S(RAWHEN]"":$P(RAWHEN,".",1),1:DT) D REQLOC1^RAORD1A
+ 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 I RAX="O",($P($G(^SC(+RALIFN,0)),U,3)'="C"),($P($G(^SC(+RALIFN,0)),U,3)'="OR") D REQLOC1^RAORD1A
+ Q
+31 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=31 D X31 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
+X31 I $D(RALIFN("OUT")) K RALIFN("OUT") S Y="@999"
+ Q
+32 S DW="0;22",DV="P44'a",DU="",DLB="REQUESTING LOCATION",DIFLD=22
+ S DE(DW)="C32^RACTOE3"
  S DU="SC("
  S X=RALIFN
@@ -117,53 +157,13 @@
  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
-X18 Q
-19 S DQ=20 ;@100
-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 W !,"IS PATIENT SCHEDULED FOR PRE-OP" S %=2 D YN^DICN S:%<0 Y="@999" S:%=2 Y="@120" I '% W !!,"Enter 'YES' if patient is scheduled for pre-op, or 'NO' if not.",! S Y="@100"
+C32 G C32S:$D(DE(32))[0 K DB
+ D ^RACTOE4
+C32S S X="" G:DG(DQ)=X C32F1 K DB
+ D ^RACTOE5
+C32F1 Q
+X32 Q
+33 S DQ=34 ;@100
+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 W !,"IS PATIENT SCHEDULED FOR PRE-OP" S %=2 D YN^DICN S:%<0 Y="@999" S:%=2 Y="@120" I '% W !!,"Enter 'YES' if patient is scheduled for pre-op, or 'NO' if not.",! S Y="@100"
  Q
-21 S DW="0;12",DV="D",DU="",DLB="PRE-OP SCHEDULED DATE (TIME optional)",DIFLD=12
- S X="TODAY"
- S Y=X
- G Y
-X21 S %DT="ETX" D ^%DT S X=Y K:Y<1 X
- Q
- ;
-22 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=22 D X22 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
-X22 S:$D(RAEXMUL) RAPREOP1=X
- Q
-23 S DQ=24 ;@120
-24 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=24 D X24 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
-X24 I RASEX="M" S Y="@130"
- 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 I RASEX'="F" W !,"THE SEX OF THIS PATIENT IS NOT AVAILABLE. IS PATIENT FEMALE" S %=2 D YN^DICN S:%<0 Y="@999" S:%=2 Y="@130" I '% W !!,"Enter 'YES' if patient is female, or 'NO' if patient is male.",! S Y="@120"
- Q
-26 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=26 D X26 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
-X26 S RASEX="F"
- Q
-27 S DW="0;13",DV="RS",DU="",DLB="PREGNANT",DIFLD=13
- S DU="y:YES;n:NO;u:UNKNOWN;"
- S X=$S($D(RAPREG):$$EXTERNAL^DILFD(75.1,13,"",RAPREG),1:"")
- S Y=X
- G Y
-X27 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 RAPREG=X
- Q
-29 S DQ=30 ;@130
-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 I '$D(RAVSTFLG)!('$D(RAVLEDTI)) S Y="@135"
- Q
-31 S DW="0;17",DV="D",DU="",DLB="PAST VISIT DATE/TIME",DIFLD=17
- S X=9999999.9999-RAVLEDTI
- 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
-X31 S %DT="TXR" D ^%DT S X=Y K:Y<1 X
- Q
- ;
-32 S DQ=33 ;@135
-33 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=33 D X33 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
-X33 S:$D(RAWHEN)#2 Y="@145"
- Q
-34 D:$D(DG)>9 F^DIE17 G ^RACTOE4
+35 D:$D(DG)>9 F^DIE17 G ^RACTOE6
