EEOEINP ;HISC/JWR - DETERMINES THE PROPER SEQUENCE OF DATES ENTERED FOR CERTAIN FIELDS ;09/09/93 13:35
;;2.0;EEO Complaint Tracking;;Apr 27, 1995
;Compares sequenciality of dates being entered in edit sessions and provides help for improper order.
S (EEOO2,EEOO3)="",EO=EEOS D DD
I $D(EEOSEQ) F EEE=1:1 S EO=$P(EEOSEQ,U,EEE) Q:EO="" D DD,SEQ
I $D(EEOREV) F EEE=1:1 S EO=$P(EEOREV,U,EEE) Q:EO="" D DD,REV
G PRINT
DD ;Gathers data dictionary information for fields being evaluated
S EEOR=$G(^DD(785,EO,0)) Q:$P(EEOR,U,2)["C" S EEOO(EO)=$P(EEOR,U,4),EEOOE(EO)=$P(EEOR,U)
DG ;Gathers information from this edit session for the field being tested.
K EOO S EEOA=$P(EEOO(EO),";"),EEOB=$P(EEOO(EO),";",2) S:$D(DG(EEOO(EO))) EOO=DG(EEOO(EO))
GLOBE ;Gathers data from the EEOA node of the record being evaluated
S EEOT=$G(^EEO(785,D0,EEOA))
S EOO=$G(EOO) S:EOO="" $P(EEOO(EO),U,4)="D"
Q:$P(EEOT,U,EEOB)=""&(EOO)=""
S Y=$P(EEOT,U,EEOB) D DD^%DT S $P(EEOO(EO),U,2)=Y I EOO'="" S Y=EOO D DD^%DT S $P(EEOO(EO),U,3)=Y
Q
SEQ ;Test the date entered against the other dates it is dependent on
S EOO1=$P($G(EEOT),U,EEOB)
Q:EOO'>0&(EOO1'>0)
I EO>EEOS,X>EOO,EOO'="" D BAD
I EO>EEOS&(X>EOO1)&(EOO="") D BAD
I EO<EEOS,X<EOO,EOO'="" D BAD
I EO<EEOS&(X<EOO1)&(EOO="") D BAD
Q
BAD ;Makes a string of fields not matching the correct date sequence.
Q:EOO'>0&(EOO1'>0)
;Q:$P(EEOO(EO),U,4)["D"
S:EO>EEOS EEOO2=EEOO2_"^"_EO S:EO<EEOS EEOO3=EEOO3_"^"_EO
Q
PRINT ;Prints a list of dates that must occur either before or after the date entered in the edit session
G:$G(EEOO2)=""&($G(EEOO3)="") QUIT W "??",!
I $G(EEOO2)'="" W !,"*** The following fields must occur after the date entered above: *** ",! S E3=1,EO1=EEOO2 D LIST
G:$G(EEOO3)="" QUIT W !!,"*** The following fields must be prior to the date entered above: ***",! S E3=1,EO1=EEOO3
LIST ;List the dates that are out of sequence
F EEOX=2:1:4 D
.S EEOO1=$P(EO1,U,EEOX) Q:EEOO1="" W !," * ",EEOOE(EEOO1)
.W:$P($G(EEOO(EEOO1)),U,3)'="" $J($P(EEOO(EEOO1),U,3),50-$L(EEOOE(EEOO1)))
.W:$P($G(EEOO(EEOO1)),U,3)="" $J($P(EEOO(EEOO1),U,2),50-$L(EEOOE(EEOO1)))
QUIT ;kills variables, quits
I $G(EEOO2)'=""!($G(EEOO3)'="") S Y=X D DD^%DT W !!,EEOOE(EEOS)_": ("_Y_")"
K EEOT,EEOO1,EEOS,EEOT,EEOR,EEOX,EEOOE,EEOO,EEOB,EEOA,EEOSCR,EOO,EEOO2,EEOO3,EEO("B"),EEOREV,EEOSEQ,EO
Q
REV ;Comes here if Chronological sequence is different than field #'s order.
S EOO1=$P($G(EEOT),U,EEOB)
Q:EOO'>0&(EOO1'>0)
I EO>EEOS,X<EOO,EOO'="" D OOPS
I EO>EEOS&(X<EOO1)&(EOO="") D OOPS
I EO<EEOS,X>EOO,EOO'="" D OOPS
I EO<EEOS&(X>EOO1)&(EOO="") D OOPS
Q
OOPS ;Checks for deleted records
Q:$P(EEOO(EO),U,4)["D"
S:EO<EEOS EEOO2=EEOO2_"^"_EO S:EO>EEOS EEOO3=EEOO3_"^"_EO Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEEOEINP 2764 printed Oct 16, 2024@17:51:48 Page 2
EEOEINP ;HISC/JWR - DETERMINES THE PROPER SEQUENCE OF DATES ENTERED FOR CERTAIN FIELDS ;09/09/93 13:35
+1 ;;2.0;EEO Complaint Tracking;;Apr 27, 1995
+2 ;Compares sequenciality of dates being entered in edit sessions and provides help for improper order.
+3 SET (EEOO2,EEOO3)=""
SET EO=EEOS
DO DD
+4 IF $DATA(EEOSEQ)
FOR EEE=1:1
SET EO=$PIECE(EEOSEQ,U,EEE)
if EO=""
QUIT
DO DD
DO SEQ
+5 IF $DATA(EEOREV)
FOR EEE=1:1
SET EO=$PIECE(EEOREV,U,EEE)
if EO=""
QUIT
DO DD
DO REV
+6 GOTO PRINT
DD ;Gathers data dictionary information for fields being evaluated
+1 SET EEOR=$GET(^DD(785,EO,0))
if $PIECE(EEOR,U,2)["C"
QUIT
SET EEOO(EO)=$PIECE(EEOR,U,4)
SET EEOOE(EO)=$PIECE(EEOR,U)
DG ;Gathers information from this edit session for the field being tested.
+1 KILL EOO
SET EEOA=$PIECE(EEOO(EO),";")
SET EEOB=$PIECE(EEOO(EO),";",2)
if $DATA(DG(EEOO(EO)))
SET EOO=DG(EEOO(EO))
GLOBE ;Gathers data from the EEOA node of the record being evaluated
+1 SET EEOT=$GET(^EEO(785,D0,EEOA))
+2 SET EOO=$GET(EOO)
if EOO=""
SET $PIECE(EEOO(EO),U,4)="D"
+3 if $PIECE(EEOT,U,EEOB)=""&(EOO)=""
QUIT
+4 SET Y=$PIECE(EEOT,U,EEOB)
DO DD^%DT
SET $PIECE(EEOO(EO),U,2)=Y
IF EOO'=""
SET Y=EOO
DO DD^%DT
SET $PIECE(EEOO(EO),U,3)=Y
+5 QUIT
SEQ ;Test the date entered against the other dates it is dependent on
+1 SET EOO1=$PIECE($GET(EEOT),U,EEOB)
+2 if EOO'>0&(EOO1'>0)
QUIT
+3 IF EO>EEOS
IF X>EOO
IF EOO'=""
DO BAD
+4 IF EO>EEOS&(X>EOO1)&(EOO="")
DO BAD
+5 IF EO<EEOS
IF X<EOO
IF EOO'=""
DO BAD
+6 IF EO<EEOS&(X<EOO1)&(EOO="")
DO BAD
+7 QUIT
BAD ;Makes a string of fields not matching the correct date sequence.
+1 if EOO'>0&(EOO1'>0)
QUIT
+2 ;Q:$P(EEOO(EO),U,4)["D"
+3 if EO>EEOS
SET EEOO2=EEOO2_"^"_EO
if EO<EEOS
SET EEOO3=EEOO3_"^"_EO
+4 QUIT
PRINT ;Prints a list of dates that must occur either before or after the date entered in the edit session
+1 if $GET(EEOO2)=""&($GET(EEOO3)="")
GOTO QUIT
WRITE "??",!
+2 IF $GET(EEOO2)'=""
WRITE !,"*** The following fields must occur after the date entered above: *** ",!
SET E3=1
SET EO1=EEOO2
DO LIST
+3 if $GET(EEOO3)=""
GOTO QUIT
WRITE !!,"*** The following fields must be prior to the date entered above: ***",!
SET E3=1
SET EO1=EEOO3
LIST ;List the dates that are out of sequence
+1 FOR EEOX=2:1:4
Begin DoDot:1
+2 SET EEOO1=$PIECE(EO1,U,EEOX)
if EEOO1=""
QUIT
WRITE !," * ",EEOOE(EEOO1)
+3 if $PIECE($GET(EEOO(EEOO1)),U,3)'=""
WRITE $JUSTIFY($PIECE(EEOO(EEOO1),U,3),50-$LENGTH(EEOOE(EEOO1)))
+4 if $PIECE($GET(EEOO(EEOO1)),U,3)=""
WRITE $JUSTIFY($PIECE(EEOO(EEOO1),U,2),50-$LENGTH(EEOOE(EEOO1)))
End DoDot:1
QUIT ;kills variables, quits
+1 IF $GET(EEOO2)'=""!($GET(EEOO3)'="")
SET Y=X
DO DD^%DT
WRITE !!,EEOOE(EEOS)_": ("_Y_")"
+2 KILL EEOT,EEOO1,EEOS,EEOT,EEOR,EEOX,EEOOE,EEOO,EEOB,EEOA,EEOSCR,EOO,EEOO2,EEOO3,EEO("B"),EEOREV,EEOSEQ,EO
+3 QUIT
REV ;Comes here if Chronological sequence is different than field #'s order.
+1 SET EOO1=$PIECE($GET(EEOT),U,EEOB)
+2 if EOO'>0&(EOO1'>0)
QUIT
+3 IF EO>EEOS
IF X<EOO
IF EOO'=""
DO OOPS
+4 IF EO>EEOS&(X<EOO1)&(EOO="")
DO OOPS
+5 IF EO<EEOS
IF X>EOO
IF EOO'=""
DO OOPS
+6 IF EO<EEOS&(X>EOO1)&(EOO="")
DO OOPS
+7 QUIT
OOPS ;Checks for deleted records
+1 if $PIECE(EEOO(EO),U,4)["D"
QUIT
+2 if EO<EEOS
SET EEOO2=EEOO2_"^"_EO
if EO>EEOS
SET EEOO3=EEOO3_"^"_EO
QUIT