Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: EEOEINP

EEOEINP.m

Go to the documentation of this file.
  1. 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
  1. ;Compares sequenciality of dates being entered in edit sessions and provides help for improper order.
  1. S (EEOO2,EEOO3)="",EO=EEOS D DD
  1. I $D(EEOSEQ) F EEE=1:1 S EO=$P(EEOSEQ,U,EEE) Q:EO="" D DD,SEQ
  1. I $D(EEOREV) F EEE=1:1 S EO=$P(EEOREV,U,EEE) Q:EO="" D DD,REV
  1. G PRINT
  1. DD ;Gathers data dictionary information for fields being evaluated
  1. 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)
  1. DG ;Gathers information from this edit session for the field being tested.
  1. K EOO S EEOA=$P(EEOO(EO),";"),EEOB=$P(EEOO(EO),";",2) S:$D(DG(EEOO(EO))) EOO=DG(EEOO(EO))
  1. GLOBE ;Gathers data from the EEOA node of the record being evaluated
  1. S EEOT=$G(^EEO(785,D0,EEOA))
  1. S EOO=$G(EOO) S:EOO="" $P(EEOO(EO),U,4)="D"
  1. Q:$P(EEOT,U,EEOB)=""&(EOO)=""
  1. 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
  1. Q
  1. SEQ ;Test the date entered against the other dates it is dependent on
  1. S EOO1=$P($G(EEOT),U,EEOB)
  1. Q:EOO'>0&(EOO1'>0)
  1. I EO>EEOS,X>EOO,EOO'="" D BAD
  1. I EO>EEOS&(X>EOO1)&(EOO="") D BAD
  1. I EO<EEOS,X<EOO,EOO'="" D BAD
  1. I EO<EEOS&(X<EOO1)&(EOO="") D BAD
  1. Q
  1. BAD ;Makes a string of fields not matching the correct date sequence.
  1. Q:EOO'>0&(EOO1'>0)
  1. ;Q:$P(EEOO(EO),U,4)["D"
  1. S:EO>EEOS EEOO2=EEOO2_"^"_EO S:EO<EEOS EEOO3=EEOO3_"^"_EO
  1. Q
  1. PRINT ;Prints a list of dates that must occur either before or after the date entered in the edit session
  1. G:$G(EEOO2)=""&($G(EEOO3)="") QUIT W "??",!
  1. I $G(EEOO2)'="" W !,"*** The following fields must occur after the date entered above: *** ",! S E3=1,EO1=EEOO2 D LIST
  1. G:$G(EEOO3)="" QUIT W !!,"*** The following fields must be prior to the date entered above: ***",! S E3=1,EO1=EEOO3
  1. LIST ;List the dates that are out of sequence
  1. F EEOX=2:1:4 D
  1. .S EEOO1=$P(EO1,U,EEOX) Q:EEOO1="" W !," * ",EEOOE(EEOO1)
  1. .W:$P($G(EEOO(EEOO1)),U,3)'="" $J($P(EEOO(EEOO1),U,3),50-$L(EEOOE(EEOO1)))
  1. .W:$P($G(EEOO(EEOO1)),U,3)="" $J($P(EEOO(EEOO1),U,2),50-$L(EEOOE(EEOO1)))
  1. QUIT ;kills variables, quits
  1. I $G(EEOO2)'=""!($G(EEOO3)'="") S Y=X D DD^%DT W !!,EEOOE(EEOS)_": ("_Y_")"
  1. K EEOT,EEOO1,EEOS,EEOT,EEOR,EEOX,EEOOE,EEOO,EEOB,EEOA,EEOSCR,EOO,EEOO2,EEOO3,EEO("B"),EEOREV,EEOSEQ,EO
  1. Q
  1. REV ;Comes here if Chronological sequence is different than field #'s order.
  1. S EOO1=$P($G(EEOT),U,EEOB)
  1. Q:EOO'>0&(EOO1'>0)
  1. I EO>EEOS,X<EOO,EOO'="" D OOPS
  1. I EO>EEOS&(X<EOO1)&(EOO="") D OOPS
  1. I EO<EEOS,X>EOO,EOO'="" D OOPS
  1. I EO<EEOS&(X>EOO1)&(EOO="") D OOPS
  1. Q
  1. OOPS ;Checks for deleted records
  1. Q:$P(EEOO(EO),U,4)["D"
  1. S:EO<EEOS EEOO2=EEOO2_"^"_EO S:EO>EEOS EEOO3=EEOO3_"^"_EO Q