1 | ORWTPN ; SLC/STAFF Personal Preference - Notes ;2/21/01 08:11 [1/29/04 2:32pm]
|
---|
2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**85,149,187,195**;Dec 17, 1997
|
---|
3 | ;
|
---|
4 | GETSUB(VALUE,USER) ; from ORWTPP
|
---|
5 | ; get Ask for Subject on notes for user
|
---|
6 | N NODE
|
---|
7 | S NODE=+$O(^TIU(8926,"B",USER,0))
|
---|
8 | S VALUE=+$P($G(^TIU(8926,NODE,0)),U,8)
|
---|
9 | Q
|
---|
10 | ;
|
---|
11 | SETSUB(OK,VALUE,USER) ; from ORWTPP
|
---|
12 | ; set Ask for Subject on note for user
|
---|
13 | N DA,DIE,DIK,DR,NODE,NUM
|
---|
14 | S OK=1
|
---|
15 | S VALUE=+$G(VALUE),VALUE=$S(VALUE=1:1,VALUE=0:0,1:"")
|
---|
16 | I VALUE="" S OK=0 Q
|
---|
17 | S NODE=+$O(^TIU(8926,"B",USER,0))
|
---|
18 | I 'NODE D Q ; make new entry if user does not have TIU preferences
|
---|
19 | .I 'VALUE Q ; no need to set since default for no user preference is 0
|
---|
20 | .L +^TIU(8926,0):5 I '$T S OK=0 Q
|
---|
21 | .S NUM=1+$P(^TIU(8926,0),U,3)
|
---|
22 | .F Q:'$D(^TIU(8926,NUM,0)) S NUM=NUM+1
|
---|
23 | .S $P(^(0),U,4)=1+$P(^TIU(8926,0),U,4),$P(^(0),U,3)=NUM
|
---|
24 | .S ^TIU(8926,NUM,0)=USER_"^^^^^^^1"
|
---|
25 | .L -^TIU(8926,0)
|
---|
26 | .S DA=NUM,DIK="^TIU(8926,"
|
---|
27 | .D IX1^DIK
|
---|
28 | I USER'=+$G(^TIU(8926,NODE,0)) Q
|
---|
29 | S DA=NODE,DIE="^TIU(8926,",DR=".08///"_VALUE
|
---|
30 | D ^DIE
|
---|
31 | Q
|
---|
32 | ;
|
---|
33 | GETCOS(ORY,ORUSER,ORFROM,ORDIR,ORVIZ) ; Get cosigners for user (from ORWTPP).
|
---|
34 | ; (Keep this code matched with NP1^ORWU1 / NEWPERS^ORWU.)
|
---|
35 | ;
|
---|
36 | ; Params:
|
---|
37 | ; .ORY=returned list, ORFROM=text to $O from, ORDIR=$O direction.
|
---|
38 | ; ORDIR=Direction to move through x-ref.
|
---|
39 | ; ORFROM=Starting value to use.
|
---|
40 | ; ORUSER=User seeking a Cosigner.
|
---|
41 | ; ORVIZ=If true, includes RDV users; otherwise not (optional).
|
---|
42 | ;
|
---|
43 | N OR1DIV,ORCNT,ORDATE,ORDD,ORDIV,ORDUP,ORGOOD,ORI,ORIEN1,ORIEN2,ORKEY,ORLAST,ORMAX,ORMRK,ORMULTI,ORNODE,ORPREV,ORSRV,ORTTL
|
---|
44 | ;
|
---|
45 | S ORI=0,ORMAX=44,(ORLAST,ORPREV)="",ORKEY=$G(ORKEY),ORDATE=$G(ORDATE)
|
---|
46 | S ORMULTI=$$ALL^VASITE ; Do once at beginning of call.
|
---|
47 | ;
|
---|
48 | ; NP3^ORWU1 tag includes visitors, uses full "B" x-ref.
|
---|
49 | I +$G(ORVIZ)=1 D NP3^ORWU1(1) Q ; Use alt. version, skip rest.
|
---|
50 | ;
|
---|
51 | F Q:ORI'<ORMAX S ORFROM=$O(^VA(200,"AUSER",ORFROM),ORDIR) Q:ORFROM="" D
|
---|
52 | .S ORIEN1=""
|
---|
53 | .F S ORIEN1=$O(^VA(200,"AUSER",ORFROM,ORIEN1),ORDIR) Q:'ORIEN1 D
|
---|
54 | ..;
|
---|
55 | ..; Screen default cosigner selection:
|
---|
56 | ..I '$$SCRDFCS^TIULA3(ORUSER,ORIEN1) Q
|
---|
57 | ..S ORNODE=$P($G(^VA(200,ORIEN1,0)),U)
|
---|
58 | ..I '$L(ORNODE) Q
|
---|
59 | ..S ORI=ORI+1,ORY(ORI)=ORIEN1_"^"_$$NAMEFMT^XLFNAME(ORFROM,"F","DcMPC")
|
---|
60 | ..S ORDUP=0 ; Init flag, check dupe.
|
---|
61 | ..I ($P(ORPREV_" "," ")=$P(ORFROM_" "," ")) S ORDUP=1
|
---|
62 | ..;
|
---|
63 | ..; Append Title if not duplicated:
|
---|
64 | ..I 'ORDUP D
|
---|
65 | ...S ORIEN2=ORIEN1
|
---|
66 | ...D NP4^ORWU1(0) ; Get Title.
|
---|
67 | ...I ORTTL="" Q
|
---|
68 | ...S ORY(ORI)=ORY(ORI)_U_"- "_ORTTL
|
---|
69 | ..;
|
---|
70 | ..; Get data in case of dupes:
|
---|
71 | ..I ORDUP D
|
---|
72 | ...S ORIEN2=ORLAST ; Prev IEN for NP2^ORWU1 call.
|
---|
73 | ...;
|
---|
74 | ...; Reset, use previous array element, call for extended data:
|
---|
75 | ...S ORI=ORI-1,ORY(ORI)=$P(ORY(ORI),U)_U_$P(ORY(ORI),U,2) D NP2^ORWU1
|
---|
76 | ...;
|
---|
77 | ...; Then return to current user for second extended data call:
|
---|
78 | ...S ORIEN2=ORIEN1,ORI=ORI+1 D NP2^ORWU1
|
---|
79 | ..S ORLAST=ORIEN1,ORPREV=ORFROM ; Reassign vars for next pass.
|
---|
80 | ;
|
---|
81 | Q
|
---|
82 | ;
|
---|
83 | GETDCOS(VALUE,USER) ; from ORWTPP
|
---|
84 | ; get default cosigner for user
|
---|
85 | N IEN,NAME,NODE
|
---|
86 | S NODE=+$O(^TIU(8926,"B",USER,0))
|
---|
87 | S IEN=+$P($G(^TIU(8926,NODE,0)),U,9)
|
---|
88 | S NAME=$P($G(^VA(200,IEN,0)),U)
|
---|
89 | S VALUE=IEN_U_NAME
|
---|
90 | Q
|
---|
91 | ;
|
---|
92 | SETDCOS(OK,VALUE,USER) ; from ORWTPP
|
---|
93 | ; set default cosigner for user
|
---|
94 | N DA,DIE,DIK,DR,NODE,NUM
|
---|
95 | S OK=1
|
---|
96 | S VALUE=+$G(VALUE)
|
---|
97 | I 'VALUE S VALUE="@"
|
---|
98 | S NODE=+$O(^TIU(8926,"B",USER,0))
|
---|
99 | I 'NODE D Q ; make new entry if user does not have TIU preferences
|
---|
100 | .I 'VALUE Q
|
---|
101 | .I '$$SCRDFCS^TIULA3(USER,VALUE) Q
|
---|
102 | .L +^TIU(8926,0):5 I '$T S OK=0 Q
|
---|
103 | .S NUM=1+$P(^TIU(8926,0),U,3)
|
---|
104 | .F Q:'$D(^TIU(8926,NUM,0)) S NUM=NUM+1
|
---|
105 | .S $P(^(0),U,4)=1+$P(^TIU(8926,0),U,4),$P(^(0),U,3)=NUM
|
---|
106 | .S ^TIU(8926,NUM,0)=USER_"^^^^^^^^"_VALUE
|
---|
107 | .L -^TIU(8926,0)
|
---|
108 | .S DA=NUM,DIK="^TIU(8926,"
|
---|
109 | .D IX1^DIK
|
---|
110 | I USER'=+$G(^TIU(8926,NODE,0)) Q
|
---|
111 | S DA=NODE,DIE="^TIU(8926,",DR=".09///"_$S(VALUE:"`"_VALUE,1:"@")
|
---|
112 | D ^DIE
|
---|
113 | Q
|
---|
114 | ;
|
---|
115 | GETCLASS(VALUES) ; RPC
|
---|
116 | ; get available document classes
|
---|
117 | N CNT,NODE,NUM K VALUES
|
---|
118 | S CNT=0
|
---|
119 | S NUM=0 F S NUM=$O(^TIU(8925.1,"AT","CL",NUM)) Q:NUM<1 D
|
---|
120 | .I '$$CLASPICK^TIULA4(38,NUM,"CL") Q
|
---|
121 | .S NODE=$G(^TIU(8925.1,NUM,0))
|
---|
122 | .I '$L(NODE) Q
|
---|
123 | .S CNT=CNT+1
|
---|
124 | .S VALUES(CNT)=NUM_U_NODE
|
---|
125 | Q
|
---|
126 | ;
|
---|
127 | GETTC(VALUES,CLASS,FROM,DIR) ; RPC
|
---|
128 | ; get titles for a class
|
---|
129 | N CNT,IEN,NODE,NUM K VALUES
|
---|
130 | S CNT=44,NUM=0
|
---|
131 | F Q:NUM>CNT S FROM=$O(^TIU(8925.1,"B",FROM),DIR) Q:FROM="" D
|
---|
132 | .S IEN=0 F S IEN=$O(^TIU(8925.1,"B",FROM,IEN)) Q:IEN<1 D
|
---|
133 | ..I '$D(^TIU(8925.1,"AT","DOC",IEN)) Q
|
---|
134 | ..I '$$ISA^TIULX(IEN,CLASS) Q
|
---|
135 | ..I '$$CANPICK^TIULP(IEN) Q
|
---|
136 | ..I '$$CANENTR^TIULP(IEN) Q
|
---|
137 | ..S NODE=$G(^TIU(8925.1,IEN,0))
|
---|
138 | ..I '$L(NODE) Q
|
---|
139 | ..S NUM=NUM+1
|
---|
140 | ..S VALUES(NUM)=IEN_U_NODE
|
---|
141 | Q
|
---|
142 | ;
|
---|
143 | GETTU(VALUES,CLASS,USER) ; from ORWTPP
|
---|
144 | ; get titles for a user
|
---|
145 | N CNT,IEN,NUM,NUM1,NODE K VALUES
|
---|
146 | S CNT=0
|
---|
147 | S NUM=+$O(^TIU(8925.98,"AC",USER,CLASS,0))
|
---|
148 | I 'NUM Q
|
---|
149 | S NUM1=0 F S NUM1=$O(^TIU(8925.98,NUM,10,NUM1)) Q:NUM1<1 D
|
---|
150 | .S IEN=+$G(^TIU(8925.98,NUM,10,NUM1,0))
|
---|
151 | .S NODE=$P($G(^TIU(8925.1,IEN,0)),U)
|
---|
152 | .I '$L(NODE) Q
|
---|
153 | .S CNT=CNT+1
|
---|
154 | .S VALUES(CNT)=IEN_U_NODE_U_(.0000001*$P(^TIU(8925.98,NUM,10,NUM1,0),U,2))_U_$P(^(0),U,3)
|
---|
155 | Q
|
---|
156 | ;
|
---|
157 | GETTD(VALUE,CLASS,USER) ; from ORWTPP
|
---|
158 | ; get default title for user
|
---|
159 | N IEN,NUM,NODE
|
---|
160 | S VALUE=-1,USER=+$G(USER)
|
---|
161 | S NUM=+$O(^TIU(8925.98,"AC",USER,CLASS,0))
|
---|
162 | I 'NUM Q
|
---|
163 | S IEN=+$P($G(^TIU(8925.98,NUM,0)),U,3)
|
---|
164 | S NODE=$G(^TIU(8925.1,IEN,0))
|
---|
165 | I '$L(NODE) Q
|
---|
166 | S VALUE=IEN
|
---|
167 | Q
|
---|
168 | ;
|
---|
169 | SAVET(OK,CLASS,DEFAULT,VALUES,USER) ; from ORWTPP
|
---|
170 | ; save titles for user
|
---|
171 | N CNT,DA,DIK,IEN,NUM,VALUE K DA
|
---|
172 | S CLASS=+$G(CLASS),DEFAULT=+$G(DEFAULT),OK=1
|
---|
173 | I DEFAULT'>0 S DEFAULT=""
|
---|
174 | S IEN=+$O(^TIU(8925.98,"AC",USER,CLASS,0))
|
---|
175 | I IEN D Q
|
---|
176 | .S DA(1)=IEN
|
---|
177 | .S DIK="^TIU(8925.98,"_DA(1)_",10,"
|
---|
178 | .L +^TIU(8925.98,IEN):5 I '$T S OK=0 Q
|
---|
179 | .S DA=0 F S DA=$O(^TIU(8925.98,IEN,10,DA)) Q:DA<1 D
|
---|
180 | ..D ^DIK
|
---|
181 | .S CNT=0
|
---|
182 | .S NUM=0 F S NUM=$O(VALUES(NUM)) Q:NUM<1 D
|
---|
183 | ..S VALUE=+VALUES(NUM) I 'VALUE Q
|
---|
184 | ..S CNT=CNT+1
|
---|
185 | ..S ^TIU(8925.98,IEN,10,CNT,0)=VALUE_U_CNT_U_$P(VALUES(NUM),U,4)
|
---|
186 | .S ^TIU(8925.98,IEN,10,0)="^8925.9801IP^"_CNT_U_CNT
|
---|
187 | .S $P(^TIU(8925.98,IEN,0),U,3)=DEFAULT
|
---|
188 | .K DA S DA=IEN,DIK="^TIU(8925.98,"
|
---|
189 | .D IX1^DIK
|
---|
190 | .L -^TIU(8925.98,IEN)
|
---|
191 | S DA=1+$P(^TIU(8925.98,0),U,3)
|
---|
192 | L +^TIU(8925.98,0):5 I '$T S OK=0 Q
|
---|
193 | F Q:'$D(^TIU(8925.98,DA)) S DA=DA+1
|
---|
194 | S ^TIU(8925.98,DA,0)=USER_U_CLASS_U_DEFAULT
|
---|
195 | S $P(^(0),U,4)=1+$P(^TIU(8925.98,0),U,4),$P(^(0),U,3)=DA
|
---|
196 | L -^TIU(8925.98,0)
|
---|
197 | S CNT=0
|
---|
198 | S NUM=0 F S NUM=$O(VALUES(NUM)) Q:NUM<1 D
|
---|
199 | .S VALUE=+VALUES(NUM)
|
---|
200 | .I 'VALUE Q
|
---|
201 | .S CNT=CNT+1
|
---|
202 | .S ^TIU(8925.98,DA,10,CNT,0)=VALUE
|
---|
203 | S ^TIU(8925.98,DA,10,0)="^8925.9801IP^"_CNT_U_CNT
|
---|
204 | S DIK="^TIU(8925.98,"
|
---|
205 | D IX1^DIK
|
---|
206 | Q
|
---|