EEOEEDIE ;HISC/JWR - BREAKS DOWN "DR" STRINGS, AND HOLDS DATA FOR TRANSMISSION ;11/23/92 10:03
;;2.0;EEO Complaint Tracking;;Apr 27, 1995
ENTER ;Entry point, breaks down 'DR' strings, prepares a pre-edit session array of data from file 785
K EEOEE S ^XTMP("EEOX",0)=DT+5_"^"_DT
S EEOEE("DIE")=$S(+DIE:DIE,1:+$P(@(DIE_"0)"),"^",2)),EEOEE("DA")=DA,EEOEE("DR")=DR
F AEE=1:1 S BEE=$P(EEOEE("DR"),";",AEE) Q:BEE="" D
.I '(+BEE) S EEOEE("DR")=$P(EEOEE("DR"),";",1,AEE-1)_$S(AEE=1:"",1:";")_$P(EEOEE("DR"),";",AEE+1,AEE+999),AEE=AEE-1
.I BEE[":" S CEE=$P(EEOEE("DR"),";",AEE),EEOEE("DR")=$P(EEOEE("DR"),";",1,AEE-1)_$S(AEE=1:"",1:";")_$P(BEE,":",1)_";"_$P(EEOEE("DR"),";",AEE+1,AEE+999) S DEE=$P(BEE,":",1) F S DEE=$O(^DD(785,DEE)) Q:DEE'>0 Q:DEE>$P(BEE,":",2) D
..S:'$D(EEOEE("TEST",DEE)) EEOEE("DR")=$P(EEOEE("DR"),";",1,AEE)_";"_DEE_";"_$P(EEOEE("DR"),";",AEE+1,AEE+999),EEOEE("TEST",DEE)=""
F AEE=1:1 S BEE=$P(EEOEE("DR"),";",AEE) Q:BEE="" S EEOEE("TEST",+BEE)=""
S EEOEE("ARRAY")="BEFORE" D ARRAY
D DIE
AFTER ;Sets up an array of the data after the edit session and looks for changes from prior to the edit session
S EEOEE("ARRAY")="AFTER" D ARRAY
S AEE="" F S AEE=$O(EEOEE("BEFORE",785,EEOEE("DA"),AEE)) Q:AEE="" D
.I AEE>6&(AEE<12) D MUCMP Q
.F BEE=1:1 S DEE=$P(EEOEE("BEFORE",785,EEOEE("DA"),AEE),"^",BEE) Q:$P(EEOEE("BEFORE",785,EEOEE("DA"),AEE),"^",BEE-1,999)=""&($P(EEOEE("AFTER",785,EEOEE("DA"),AEE),"^",BEE-1,999)="") S EEE=$P(EEOEE("AFTER",785,EEOEE("DA"),AEE),"^",BEE) D TEST
K EEOEE Q
SAVE ;Marks those records to be transmitted by the tasked option
Q:'$D(DA)!($G(FYI)=$G(DA)) I $P($G(^EEO(785,DA,1)),U,3)>0 S DR="62///X",FYI=DA D ^DIE Q
Q
NEW ;Lookup on complaint
D ^DIC Q:Y'>0 Q:DIC(0)'["L" N Y Q
ARRAY ;Sets up before and after edit arrays to check for changed data
S AEE="" F S AEE=$O(EEOEE("TEST",AEE)) Q:AEE="" D
.Q:'$D(^DD(785,AEE,0))
.S LEE=^DD(785,AEE,0) Q:$P(LEE,"^",2)["C" S NEE=$P(LEE,"^",4),PEE=$P(NEE,";",2),NEE=$P(NEE,";",1) I PEE=0 D MULT Q
.S $P(EEOEE(EEOEE("ARRAY"),785,EEOEE("DA"),NEE),"^",PEE)=$P($G(^EEO(785,EEOEE("DA"),NEE)),"^",PEE)
Q
DIE ;The call to ^DIE
N EEOEE D ^DIE Q
MULT ;Makes multiples into test arrays during edits (like 'ARRAY' entry pt.)
I '$D(^EEO(785,EEOEE("DA"),NEE,0)) S EEOEE(EEOEE("ARRAY"),785,EEOEE("DA"),NEE,1)="" Q
S EEOG=0 F S EEOG=$O(^EEO(785,EEOEE("DA"),NEE,EEOG)) Q:EEOG'>0 D
.S EEOEE(EEOEE("ARRAY"),785,EEOEE("DA"),NEE,EEOG)=$G(^EEO(785,EEOEE("DA"),NEE,EEOG,0))
Q
TEST ;Test to determine if data has been changed
I DEE=EEE Q
I DEE'="",EEE="" D
.I AEE>6&(AEE<12) S:BEE=1 $P(^XTMP("EEOX",EEOEE("DA"),AEE,VEE),U,BEE)="@"_DEE D SAVE S:BEE'=1 $P(^XTMP("EEOX",EEOEE("DA"),AEE,VEE),U,BEE)="@" Q
.E S X="@" S $P(^XTMP("EEOX",EEOEE("DA"),AEE),U,BEE)="@" D SAVE Q
I DEE'=EEE S X=EEE D SAVE Q
Q
MUCMP ;Puts multipes data into variables to be tested for changed data
S VEE=0 F S VEE=$O(EEOEE("BEFORE",785,EEOEE("DA"),AEE,VEE)) Q:VEE="" D
.F BEE=1:1 S DEE=$P(EEOEE("BEFORE",785,EEOEE("DA"),AEE,VEE),"^",BEE) Q:$P(EEOEE("BEFORE",785,EEOEE("DA"),AEE,VEE),"^",BEE-1,999)=""&($P($G(EEOEE("AFTER",785,EEOEE("DA"),AEE,VEE)),"^",BEE-1,999)="") D
..S EEE=$P($G(EEOEE("AFTER",785,EEOEE("DA"),AEE,VEE)),"^",BEE) D TEST
.K EEOEE("AFTER",785,EEOEE("DA"),AEE,VEE)
ADD I $O(EEOEE("AFTER",785,EEOEE("DA"),AEE,0))>0 D SAVE Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEEOEEDIE 3363 printed Dec 13, 2024@01:50:53 Page 2
EEOEEDIE ;HISC/JWR - BREAKS DOWN "DR" STRINGS, AND HOLDS DATA FOR TRANSMISSION ;11/23/92 10:03
+1 ;;2.0;EEO Complaint Tracking;;Apr 27, 1995
ENTER ;Entry point, breaks down 'DR' strings, prepares a pre-edit session array of data from file 785
+1 KILL EEOEE
SET ^XTMP("EEOX",0)=DT+5_"^"_DT
+2 SET EEOEE("DIE")=$SELECT(+DIE:DIE,1:+$PIECE(@(DIE_"0)"),"^",2))
SET EEOEE("DA")=DA
SET EEOEE("DR")=DR
+3 FOR AEE=1:1
SET BEE=$PIECE(EEOEE("DR"),";",AEE)
if BEE=""
QUIT
Begin DoDot:1
+4 IF '(+BEE)
SET EEOEE("DR")=$PIECE(EEOEE("DR"),";",1,AEE-1)_$SELECT(AEE=1:"",1:";")_$PIECE(EEOEE("DR"),";",AEE+1,AEE+999)
SET AEE=AEE-1
+5 IF BEE[":"
SET CEE=$PIECE(EEOEE("DR"),";",AEE)
SET EEOEE("DR")=$PIECE(EEOEE("DR"),";",1,AEE-1)_$SELECT(AEE=1:"",1:";")_$PIECE(BEE,":",1)_";"_$PIECE(EEOEE("DR"),";",AEE+1,AEE+999)
SET DEE=$PIECE(BEE,":",1)
FOR
SET DEE=$ORDER(^DD(785,DEE))
if DEE'>0
QUIT
if DEE>$PIECE(BEE,"
QUIT
Begin DoDot:2
+6 if '$DATA(EEOEE("TEST",DEE))
SET EEOEE("DR")=$PIECE(EEOEE("DR"),";",1,AEE)_";"_DEE_";"_$PIECE(EEOEE("DR"),";",AEE+1,AEE+999)
SET EEOEE("TEST",DEE)=""
End DoDot:2
End DoDot:1
+7 FOR AEE=1:1
SET BEE=$PIECE(EEOEE("DR"),";",AEE)
if BEE=""
QUIT
SET EEOEE("TEST",+BEE)=""
+8 SET EEOEE("ARRAY")="BEFORE"
DO ARRAY
+9 DO DIE
AFTER ;Sets up an array of the data after the edit session and looks for changes from prior to the edit session
+1 SET EEOEE("ARRAY")="AFTER"
DO ARRAY
+2 SET AEE=""
FOR
SET AEE=$ORDER(EEOEE("BEFORE",785,EEOEE("DA"),AEE))
if AEE=""
QUIT
Begin DoDot:1
+3 IF AEE>6&(AEE<12)
DO MUCMP
QUIT
+4 FOR BEE=1:1
SET DEE=$PIECE(EEOEE("BEFORE",785,EEOEE("DA"),AEE),"^",BEE)
if $PIECE(EEOEE("BEFORE",785,EEOEE("DA"),AEE),"^",BEE-1,999)=""&($PIECE(EEOEE("AFTER",785,EEOEE("DA"),AEE),"^",BEE-1,999)="")
QUIT
SET EEE=$PIECE(EEOEE("AFTER",785,EEOEE("DA"),AEE),"^",BEE)
DO TEST
End DoDot:1
+5 KILL EEOEE
QUIT
SAVE ;Marks those records to be transmitted by the tasked option
+1 if '$DATA(DA)!($GET(FYI)=$GET(DA))
QUIT
IF $PIECE($GET(^EEO(785,DA,1)),U,3)>0
SET DR="62///X"
SET FYI=DA
DO ^DIE
QUIT
+2 QUIT
NEW ;Lookup on complaint
+1 DO ^DIC
if Y'>0
QUIT
if DIC(0)'["L"
QUIT
NEW Y
QUIT
ARRAY ;Sets up before and after edit arrays to check for changed data
+1 SET AEE=""
FOR
SET AEE=$ORDER(EEOEE("TEST",AEE))
if AEE=""
QUIT
Begin DoDot:1
+2 if '$DATA(^DD(785,AEE,0))
QUIT
+3 SET LEE=^DD(785,AEE,0)
if $PIECE(LEE,"^",2)["C"
QUIT
SET NEE=$PIECE(LEE,"^",4)
SET PEE=$PIECE(NEE,";",2)
SET NEE=$PIECE(NEE,";",1)
IF PEE=0
DO MULT
QUIT
+4 SET $PIECE(EEOEE(EEOEE("ARRAY"),785,EEOEE("DA"),NEE),"^",PEE)=$PIECE($GET(^EEO(785,EEOEE("DA"),NEE)),"^",PEE)
End DoDot:1
+5 QUIT
DIE ;The call to ^DIE
+1 NEW EEOEE
DO ^DIE
QUIT
MULT ;Makes multiples into test arrays during edits (like 'ARRAY' entry pt.)
+1 IF '$DATA(^EEO(785,EEOEE("DA"),NEE,0))
SET EEOEE(EEOEE("ARRAY"),785,EEOEE("DA"),NEE,1)=""
QUIT
+2 SET EEOG=0
FOR
SET EEOG=$ORDER(^EEO(785,EEOEE("DA"),NEE,EEOG))
if EEOG'>0
QUIT
Begin DoDot:1
+3 SET EEOEE(EEOEE("ARRAY"),785,EEOEE("DA"),NEE,EEOG)=$GET(^EEO(785,EEOEE("DA"),NEE,EEOG,0))
End DoDot:1
+4 QUIT
TEST ;Test to determine if data has been changed
+1 IF DEE=EEE
QUIT
+2 IF DEE'=""
IF EEE=""
Begin DoDot:1
+3 IF AEE>6&(AEE<12)
if BEE=1
SET $PIECE(^XTMP("EEOX",EEOEE("DA"),AEE,VEE),U,BEE)="@"_DEE
DO SAVE
if BEE'=1
SET $PIECE(^XTMP("EEOX",EEOEE("DA"),AEE,VEE),U,BEE)="@"
QUIT
+4 IF '$TEST
SET X="@"
SET $PIECE(^XTMP("EEOX",EEOEE("DA"),AEE),U,BEE)="@"
DO SAVE
QUIT
End DoDot:1
+5 IF DEE'=EEE
SET X=EEE
DO SAVE
QUIT
+6 QUIT
MUCMP ;Puts multipes data into variables to be tested for changed data
+1 SET VEE=0
FOR
SET VEE=$ORDER(EEOEE("BEFORE",785,EEOEE("DA"),AEE,VEE))
if VEE=""
QUIT
Begin DoDot:1
+2 FOR BEE=1:1
SET DEE=$PIECE(EEOEE("BEFORE",785,EEOEE("DA"),AEE,VEE),"^",BEE)
if $PIECE(EEOEE("BEFORE",785,EEOEE("DA"),AEE,VEE),"^",BEE-1,999)=""&($PIECE($GET(EEOEE("AFTER",785,EEOEE("DA"),AEE,VEE)),"^",BEE-1,999)="")
QUIT
Begin DoDot:2
+3 SET EEE=$PIECE($GET(EEOEE("AFTER",785,EEOEE("DA"),AEE,VEE)),"^",BEE)
DO TEST
End DoDot:2
+4 KILL EEOEE("AFTER",785,EEOEE("DA"),AEE,VEE)
End DoDot:1
ADD IF $ORDER(EEOEE("AFTER",785,EEOEE("DA"),AEE,0))>0
DO SAVE
QUIT