source: WorldVistAEHR/trunk/r/EEO_COMPLAINT_TRACKING-EEO/EEOEINP.m@ 1582

Last change on this file since 1582 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1EEOEINP ;HISC/JWR - DETERMINES THE PROPER SEQUENCE OF DATES ENTERED FOR CERTAIN FIELDS ;09/09/93 13:35
2 ;;2.0;EEO Complaint Tracking;;Apr 27, 1995
3 ;Compares sequenciality of dates being entered in edit sessions and provides help for improper order.
4 S (EEOO2,EEOO3)="",EO=EEOS D DD
5 I $D(EEOSEQ) F EEE=1:1 S EO=$P(EEOSEQ,U,EEE) Q:EO="" D DD,SEQ
6 I $D(EEOREV) F EEE=1:1 S EO=$P(EEOREV,U,EEE) Q:EO="" D DD,REV
7 G PRINT
8DD ;Gathers data dictionary information for fields being evaluated
9 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)
10DG ;Gathers information from this edit session for the field being tested.
11 K EOO S EEOA=$P(EEOO(EO),";"),EEOB=$P(EEOO(EO),";",2) S:$D(DG(EEOO(EO))) EOO=DG(EEOO(EO))
12GLOBE ;Gathers data from the EEOA node of the record being evaluated
13 S EEOT=$G(^EEO(785,D0,EEOA))
14 S EOO=$G(EOO) S:EOO="" $P(EEOO(EO),U,4)="D"
15 Q:$P(EEOT,U,EEOB)=""&(EOO)=""
16 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
17 Q
18SEQ ;Test the date entered against the other dates it is dependent on
19 S EOO1=$P($G(EEOT),U,EEOB)
20 Q:EOO'>0&(EOO1'>0)
21 I EO>EEOS,X>EOO,EOO'="" D BAD
22 I EO>EEOS&(X>EOO1)&(EOO="") D BAD
23 I EO<EEOS,X<EOO,EOO'="" D BAD
24 I EO<EEOS&(X<EOO1)&(EOO="") D BAD
25 Q
26BAD ;Makes a string of fields not matching the correct date sequence.
27 Q:EOO'>0&(EOO1'>0)
28 ;Q:$P(EEOO(EO),U,4)["D"
29 S:EO>EEOS EEOO2=EEOO2_"^"_EO S:EO<EEOS EEOO3=EEOO3_"^"_EO
30 Q
31PRINT ;Prints a list of dates that must occur either before or after the date entered in the edit session
32 G:$G(EEOO2)=""&($G(EEOO3)="") QUIT W "??",!
33 I $G(EEOO2)'="" W !,"*** The following fields must occur after the date entered above: *** ",! S E3=1,EO1=EEOO2 D LIST
34 G:$G(EEOO3)="" QUIT W !!,"*** The following fields must be prior to the date entered above: ***",! S E3=1,EO1=EEOO3
35LIST ;List the dates that are out of sequence
36 F EEOX=2:1:4 D
37 .S EEOO1=$P(EO1,U,EEOX) Q:EEOO1="" W !," * ",EEOOE(EEOO1)
38 .W:$P($G(EEOO(EEOO1)),U,3)'="" $J($P(EEOO(EEOO1),U,3),50-$L(EEOOE(EEOO1)))
39 .W:$P($G(EEOO(EEOO1)),U,3)="" $J($P(EEOO(EEOO1),U,2),50-$L(EEOOE(EEOO1)))
40QUIT ;kills variables, quits
41 I $G(EEOO2)'=""!($G(EEOO3)'="") S Y=X D DD^%DT W !!,EEOOE(EEOS)_": ("_Y_")"
42 K EEOT,EEOO1,EEOS,EEOT,EEOR,EEOX,EEOOE,EEOO,EEOB,EEOA,EEOSCR,EOO,EEOO2,EEOO3,EEO("B"),EEOREV,EEOSEQ,EO
43 Q
44REV ;Comes here if Chronological sequence is different than field #'s order.
45 S EOO1=$P($G(EEOT),U,EEOB)
46 Q:EOO'>0&(EOO1'>0)
47 I EO>EEOS,X<EOO,EOO'="" D OOPS
48 I EO>EEOS&(X<EOO1)&(EOO="") D OOPS
49 I EO<EEOS,X>EOO,EOO'="" D OOPS
50 I EO<EEOS&(X>EOO1)&(EOO="") D OOPS
51 Q
52OOPS ;Checks for deleted records
53 Q:$P(EEOO(EO),U,4)["D"
54 S:EO<EEOS EEOO2=EEOO2_"^"_EO S:EO>EEOS EEOO3=EEOO3_"^"_EO Q
Note: See TracBrowser for help on using the repository browser.