source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENSPSRT.m@ 699

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

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1ENSPSRT ;(WIRMFO)/DH-Sort by LOCATION ;6.18.97
2 ;;7.0;ENGINEERING;**35,42**;Aug 17, 1993
3GEN ; Full SORT
4 ; Builds ENSRT(x) array
5 N EN,ENI,I
6 S ENSRT("DIV")=0 I $D(^ENG(6928.3,"D")) S ENSRT("DIV")=1
7 I ENSRT("DIV") S DIR(0)="S^1:DIV, BLDG, WING, ROOM;2:DIV, WING, BLDG, ROOM;3:DIV, BLDG, ROOM;4:BLDG, WING, ROOM;5:WING, BLDG, ROOM;6:BLDG, ROOM;7:WING, ROOM;8:ROOM"
8 E S DIR(0)="S^1:BLDG, WING, ROOM;2:WING, BLDG, ROOM;3:BLDG, ROOM;4:WING, ROOM;5:ROOM"
9 S DIR("A")="Choose 'SELECT BY' Parameters",DIR("B")=$S(ENSRT("DIV"):3,1:1)
10 D ^DIR K DIR I $D(DIRUT) K ENSRT G EXIT
11 I ENSRT("DIV") S ENSRT("BY")=$S(Y=1:"DBWR",Y=2:"DWBR",Y=3:"DBR",Y=4:"BWR",Y=5:"WBR",Y=6:"BR",Y=7:"WR",Y=8:"R",1:"")
12 E S ENSRT("BY")=$S(Y=1:"BWR",Y=2:"WBR",Y=3:"BR",Y=4:"WR",Y=5:"R",1:"")
13 I ENSRT("BY")="" K ENSRT G EXIT ;Shouldn't happen
14 S DIR(0)="Y",DIR("A")="Would you like to specify a range of LOCATIONS",DIR("B")="NO"
15 S DIR("?",1)=" Enter 'YES' if you want only some "_$S(ENSRT("DIV"):"DIVISIONS, ",1:"")_"BUILDINGS, WINGS, or ROOMS."
16 S DIR("?")=" Enter 'NO' if you want to include all LOCATIONS."
17 D ^DIR K DIR I $D(DIRUT) K ENSRT G EXIT
18 S ENSRT("LOC","ALL")=$S(Y:0,1:1) G:ENSRT("LOC","ALL") EXIT
19 ;
20 F ENI=1:1:$L(ENSRT("BY")) S PARAM=$E(ENSRT("BY"),ENI) D @PARAM Q:$D(DIRUT)
21 G EXIT
22 ;
23D ; DIVISION range
24 S DIR("A",1)=""
25 S DIR("A",2)="Enter individual DIVISIONS (ex: "_$O(^ENG(6928.3,"D",0))_") separated by comas, or a range of"
26 S DIR("A",3)="DIVISIONS separated by a colon, or 'ALL' for all DIVISIONS. The '@'"
27 S DIR("A",4)="character represents the empty set (no DIVISION), and 'ALL' includes"
28 S DIR("A",5)="entries with no DIVISION."
29 S DIR("A",6)=""
30 S DIR("A",7)=" For example, 'OPC,JB:JBZ' would yield the OPC division and all divisions"
31 S DIR("A",8)=" beginning with JB. The ""@"" character (which must be enclosed in double"
32 S DIR("A",9)=" quotes) would yield entries having no division, and '@:C' would yield"
33 S DIR("A",10)=" entries having no division and entries with a division beginning with '0'"
34 S DIR("A",11)=" through '9' or 'A' through 'C' (numbers collate before letters)."
35 S DIR("A",12)=""
36 S DIR(0)="F^1:100",DIR("A")="Select DIVISION(S)"
37 D ^DIR K DIR Q:$D(DIRUT)
38 K EN F I=1:1 S EN(I)=$P(Y,",",I) Q:EN(I)=""
39 S I=0 F S I=$O(EN(I)) Q:EN(I)="" D
40 . I EN(I)="ALL" S ENSRT("DIV","ALL")="" Q
41 . I EN(I)'[":" S:EN(I)="""@""" EN(I)="NULL" S ENSRT("DIV","AIND",EN(I))="" Q
42 . I $P(EN(I),":",2)="@",$P(EN(I),":")'="@" Q
43 . I $P(EN(I),":")="@" D Q
44 .. S ENSRT("DIV","FR",I)=""
45 .. S ENSRT("DIV","TO",I)=$S($P(EN(I),":",2)="@":"",1:$P(EN(I),":",2)_"z")
46 . I $P(EN(I),":")']$P(EN(I),":",2) D
47 .. S ENSRT("DIV","FR",I)=$P(EN(I),":")
48 .. S ENSRT("DIV","TO",I)=$P(EN(I),":",2)
49 Q
50B ; BUILDING range
51 S DIR("A",1)=""
52 S DIR("A",2)="Enter individual BUILDINGS separated by comas, or a range of BUILDINGS"
53 S DIR("A",3)="separated by a colon, or 'ALL' for all BUILDINGS."
54 S DIR("A",4)=""
55 S DIR("A",5)=" For example, '13,100:114A,65' would yield buildings 13 and 65 and all"
56 S DIR("A",6)=" buildings from 100 thru 114A (inclusive)."
57 S DIR("A",7)=""
58 S DIR(0)="F^1:200",DIR("A")="Select BUILDING(S)",DIR("B")="ALL"
59 D ^DIR K DIR Q:$D(DIRUT)
60 K EN F I=1:1 S EN(I)=$P(Y,",",I) Q:EN(I)=""
61 S I=0 F S I=$O(EN(I)) Q:EN(I)="" D
62 . I EN(I)="ALL" S ENSRT("BLDG","ALL")="" Q
63 . I EN(I)'[":" S:EN(I)="""@""" EN(I)="NULL" S ENSRT("BLDG","AIND",EN(I))="" Q
64 . I $P(EN(I),":",2)="@",$P(EN(I),":")'="@" Q
65 . I $P(EN(I),":")="@" D Q
66 .. S ENSRT("BLDG","FR",I)=""
67 .. S ENSRT("BLDG","TO",I)=$S($P(EN(I),":",2)="@":"",1:$P(EN(I),":",2))
68 . I $P(EN(I),":")']$P(EN(I),":",2) D
69 .. S ENSRT("BLDG","FR",I)=$P(EN(I),":")
70 .. S ENSRT("BLDG","TO",I)=$P(EN(I),":",2)
71 Q
72W ; WING range
73 S DIR("A",1)=""
74 S DIR("A",2)="Enter individual WINGS separated by comas, or a range of WINGS separated"
75 S DIR("A",3)="by a colon, or 'ALL' for all WINGS. The ""@"" (double quotes are necessary)"
76 S DIR("A",4)="character represents null WINGS, and 'ALL' will include entries with no WING."
77 S DIR("A",5)=""
78 S DIR("A",6)=" For example, '4,3A:3C' would yield WINGS 4 and 3A through 3C (inclusive)."
79 S DIR("A",7)=" The ""@"" character would yield only those entries having no WING."
80 S DIR("A",8)=" Note that numbers collate before letters."
81 S DIR("A",9)=""
82 S DIR(0)="F^1:150",DIR("A")="Select WING(S)",DIR("B")="ALL"
83 D ^DIR K DIR Q:$D(DIRUT)
84 K EN F I=1:1 S EN(I)=$P(Y,",",I) Q:EN(I)=""
85 S I=0 F S I=$O(EN(I)) Q:EN(I)="" D
86 . I EN(I)="ALL" S ENSRT("WING","ALL")="" Q
87 . I EN(I)'[":" S:EN(I)="""@""" EN(I)="NULL" S ENSRT("WING","AIND",EN(I))="" Q
88 . I $P(EN(I),":",2)="@",$P(EN(I),":")'="@" Q
89 . I $P(EN(I),":")="@" D Q
90 .. S ENSRT("WING","FR",I)=""
91 .. S ENSRT("WING","TO",I)=$S($P(EN(I),":",2)="@":"",1:$P(EN(I),":",2)_"z")
92 . I $P(EN(I),":")']$P(EN(I),":",2) D
93 .. S ENSRT("WING","FR",I)=$P(EN(I),":")
94 .. S ENSRT("WING","TO",I)=$P(EN(I),":",2)
95 Q
96R ; ROOM range
97 S DIR("A",1)=""
98 S DIR("A",2)="Enter individual ROOMS separated by comas, or a range of ROOMS separated"
99 S DIR("A",3)="by a colon, or 'ALL' for all ROOMS. The ""@"" character will not be accepted"
100 S DIR("A",4)="because NULL ROOMS cannot exist."
101 S DIR("A",4)=""
102 S DIR("A",5)=" For example, '501,100:299' would yield all rooms numbered 501 and all"
103 S DIR("A",6)=" rooms whose first three characters are between 100 and 299 (inclusive)."
104 S DIR("A",7)=" Remember that numbers collate before letters."
105 S DIR("A",8)=""
106 S DIR(0)="F^1:200",DIR("A")="Select ROOM(S)",DIR("B")="ALL"
107 D ^DIR K DIR Q:$D(DIRUT)
108 K EN F I=1:1 S EN(I)=$P(Y,",",I) Q:EN(I)=""
109 S I=0 F S I=$O(EN(I)) Q:EN(I)="" D I Y["@" W !!,"The ROOM cannot possibly be NULL. Perhaps you mean 'ALL'." G R
110 . I Y="ALL" S ENSRT("ROOM","ALL")="" Q
111 . I Y["@" Q ;Can't have null ROOMS
112 . I Y'[":" S ENSRT("ROOM","AIND",EN(I))="" Q
113 . I $P(EN(I),":")']$P(EN(I),":",2) D
114 .. S ENSRT("ROOM","FR",I)=$P(EN(I),":")
115 .. S ENSRT("ROOM","TO",I)=$P(EN(I),":",2)_"z"
116 Q
117 ;
118EXIT K:$D(DIRUT) ENSRT
119 Q
120 ;ENSPSRT
Note: See TracBrowser for help on using the repository browser.