1 | unit fConsultAct;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ORFN,
|
---|
7 | StdCtrls, ExtCtrls, ORCtrls, uCore, ComCtrls, ORDtTm, fBase508Form,
|
---|
8 | VA508AccessibilityManager;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfrmConsultAction = class(TfrmBase508Form)
|
---|
12 | lblActionBy: TOROffsetLabel;
|
---|
13 | calDateofAction: TORDateBox;
|
---|
14 | lblDateofAction: TOROffsetLabel;
|
---|
15 | cboPerson: TORComboBox;
|
---|
16 | memComments: TCaptionMemo;
|
---|
17 | lblComments: TOROffsetLabel;
|
---|
18 | lblToService: TOROffsetLabel;
|
---|
19 | cboAttentionOf: TORComboBox;
|
---|
20 | lblAttentionOf: TOROffsetLabel;
|
---|
21 | lblUrgency: TOROffsetLabel;
|
---|
22 | cmdOK: TORAlignButton;
|
---|
23 | cmdCancel: TORAlignButton;
|
---|
24 | cboUrgency: TORComboBox;
|
---|
25 | pnlBase: TPanel;
|
---|
26 | pnlForward: TPanel;
|
---|
27 | pnlOther: TPanel;
|
---|
28 | treService: TORTreeView;
|
---|
29 | pnlComments: TPanel;
|
---|
30 | pnlAllActions: TPanel;
|
---|
31 | grpSigFindings: TRadioGroup;
|
---|
32 | pnlSigFind: TPanel;
|
---|
33 | cboService: TORComboBox;
|
---|
34 | pnlAlert: TPanel;
|
---|
35 | ckAlert: TCheckBox;
|
---|
36 | Label1: TMemo;
|
---|
37 | lblAutoAlerts: TStaticText;
|
---|
38 | procedure cmdCancelClick(Sender: TObject);
|
---|
39 | procedure cmdOKClick(Sender: TObject);
|
---|
40 | procedure NewPersonNeedData(Sender: TObject; const StartFrom: string;
|
---|
41 | Direction, InsertAt: Integer);
|
---|
42 | procedure ProviderNeedData(Sender: TObject; const StartFrom: string;
|
---|
43 | Direction, InsertAt: Integer);
|
---|
44 | procedure ckAlertClick(Sender: TObject);
|
---|
45 | procedure treServiceChange(Sender: TObject; Node: TTreeNode);
|
---|
46 | procedure treServiceExit(Sender: TObject);
|
---|
47 | procedure cboServiceSelect(Sender: TObject); {**REV**}
|
---|
48 | private
|
---|
49 | FActionType: integer ;
|
---|
50 | FChanged: boolean ;
|
---|
51 | FActionBy: Int64;
|
---|
52 | FActionDate: TFMDateTime;
|
---|
53 | FToService: integer ;
|
---|
54 | FAttentionOf: int64 ;
|
---|
55 | FUrgency: integer ;
|
---|
56 | FSigFind: string;
|
---|
57 | FComments: TStrings ;
|
---|
58 | FAlert: integer ;
|
---|
59 | FAlertTo: string ;
|
---|
60 | FIsProcedure: boolean;
|
---|
61 | FProcIEN: integer;
|
---|
62 | FUserLevel: integer;
|
---|
63 | FUserIsRequester: boolean;
|
---|
64 | function SetupForward(IsProcedure: boolean; ProcIEN: integer): boolean;
|
---|
65 | procedure SetupAddComment;
|
---|
66 | procedure SetupAdminComplete;
|
---|
67 | procedure SetupSigFindings;
|
---|
68 | procedure SigFindPanelShow;
|
---|
69 | procedure SetupReceive;
|
---|
70 | procedure SetupSchedule;
|
---|
71 | procedure SetupOther;
|
---|
72 | procedure ShowAutoAlertText;
|
---|
73 | end;
|
---|
74 |
|
---|
75 | function SetActionContext(FontSize: Integer; ActionCode: integer; IsProcedure: boolean; ProcID: string; UserLevel: integer): boolean;
|
---|
76 |
|
---|
77 | var
|
---|
78 | frmConsultAction: TfrmConsultAction;
|
---|
79 | SvcList: TStrings ;
|
---|
80 | uChanging: Boolean;
|
---|
81 |
|
---|
82 | const
|
---|
83 | TX_FWD_NO_CSLT_SVCS_TEXT = 'There are no services that you can forward this consult to' ;
|
---|
84 | TX_FWD_NO_PROC_SVCS_TEXT = 'There are no additional services that can perform this procedure.' ;
|
---|
85 | TX_NOTTHISSVC_TEXT = 'Consults cannot be forwarded to this service. Please select a subspecialty' ;
|
---|
86 | TX_NOFORWARD_TEXT = 'Service must be specified.' ;
|
---|
87 | TX_NOFORWARD_SELF = 'A consult cannot be forwarded to the same service already responsible.';
|
---|
88 | TX_NOFORWARD_CAP = 'Unable to forward' ;
|
---|
89 | TX_NOURGENCY_TEXT = 'Urgency must be specified';
|
---|
90 | TX_PERSON_TEXT = 'Select a person to perform this action or press Cancel.';
|
---|
91 | TX_PERSON_CAP = 'Missing person';
|
---|
92 | TX_DATE_TEXT = 'Enter a valid date for this action.' ;
|
---|
93 | TX_DATE_CAP = 'Invalid date' ;
|
---|
94 | TX_FUTDATE_TEXT = 'Dates or times in the future are not allowed.';
|
---|
95 | TX_COMMENTS_TEXT = 'Comments are required for this action.' ;
|
---|
96 | TX_COMMENTS_CAP = 'No comments entered' ;
|
---|
97 | TX_SIGFIND_TEXT = 'A significant findings selection is required.' ;
|
---|
98 | TX_SIGFIND_CAP = 'No significant findings status entered' ;
|
---|
99 |
|
---|
100 | implementation
|
---|
101 |
|
---|
102 | {$R *.DFM}
|
---|
103 |
|
---|
104 | uses rCore, rConsults, uConsults, fConsults, fConsultAlertTo, rOrders;
|
---|
105 |
|
---|
106 | var
|
---|
107 | RecipientList: TRecipientList ;
|
---|
108 |
|
---|
109 | function SetActionContext(FontSize: Integer; ActionCode: integer; IsProcedure: boolean; ProcID: string; UserLevel: integer): boolean;
|
---|
110 | { displays action input form for consults and sets up broker calls }
|
---|
111 | begin
|
---|
112 | Result := False;
|
---|
113 | frmConsultAction := TfrmConsultAction.Create(Application);
|
---|
114 | try
|
---|
115 | ResizeAnchoredFormToFont(frmConsultAction);
|
---|
116 | with frmConsultAction do
|
---|
117 | begin
|
---|
118 | //I wish I knew why the resize wasn't working on the buttons
|
---|
119 | cmdCancel.Left := pnlAllActions.ClientWidth - cmdCancel.Width -7;
|
---|
120 | cmdOK.Left := cmdCancel.Left - cmdOK.Width - 10;
|
---|
121 | FChanged := False;
|
---|
122 | FActionType := ActionCode ;
|
---|
123 | FIsProcedure := IsProcedure;
|
---|
124 | FProcIEN := StrToIntDef(Piece(ProcID, ';', 1), 0);
|
---|
125 | FUserLevel := UserLevel;
|
---|
126 | FUserIsRequester := (User.DUZ = ConsultRec.SendingProvider);
|
---|
127 | Caption := ActionType[ActionCode] ;
|
---|
128 | RecipientList.Recipients := '' ;
|
---|
129 | RecipientList.Changed := False ;
|
---|
130 |
|
---|
131 | case FActionType of
|
---|
132 | CN_ACT_FORWARD: if not SetupForward(FIsProcedure, FProcIEN) then exit;
|
---|
133 | CN_ACT_ADD_CMT: SetupAddComment;
|
---|
134 | CN_ACT_ADMIN_COMPLETE: SetupAdminComplete;
|
---|
135 | CN_ACT_SIGFIND: SetupSigFindings;
|
---|
136 | CN_ACT_RECEIVE: SetupReceive;
|
---|
137 | CN_ACT_SCHEDULE: SetupSchedule;
|
---|
138 | else SetupOther;
|
---|
139 | end;
|
---|
140 |
|
---|
141 | ShowModal ;
|
---|
142 | Result := FChanged ;
|
---|
143 | end ;
|
---|
144 | finally
|
---|
145 | frmConsultAction.Release;
|
---|
146 | end;
|
---|
147 | end;
|
---|
148 |
|
---|
149 | //=================== Setup form for different actions ===========================
|
---|
150 |
|
---|
151 | function TfrmConsultAction.SetupForward(IsProcedure: boolean; ProcIEN: integer): boolean;
|
---|
152 | var
|
---|
153 | i: integer;
|
---|
154 | OrdItmIEN: integer;
|
---|
155 | begin
|
---|
156 | pnlSigFind.Visible := False;
|
---|
157 | with frmConsultAction do Height := Height - pnlSigFind.Height;
|
---|
158 | pnlComments.Visible := True;
|
---|
159 | memComments.Clear;
|
---|
160 | if IsProcedure then
|
---|
161 | begin
|
---|
162 | OrdItmIEN := GetOrderableIEN(IntToStr(ConsultRec.ORFileNumber));
|
---|
163 | FastAssign(GetProcedureServices(OrdItmIEN), SvcList);
|
---|
164 | //FastAssign(GetProcedureServices(ProcIEN), SvcList); RPC expects pointer to 101.43, NOT 123.3 (RV)
|
---|
165 | i := SvcList.IndexOf(IntToStr(ConsultRec.ToService) + U + Trim(ExternalName(ConsultRec.ToService, 123.5)));
|
---|
166 | if i > -1 then SvcList.Delete(i);
|
---|
167 | treService.Visible := False;
|
---|
168 | end
|
---|
169 | else
|
---|
170 | FastAssign(LoadServiceListWithSynonyms(CN_SVC_LIST_FWD, ConsultRec.IEN), SvcList); {RV}
|
---|
171 | if (IsProcedure and (SvcList.Count <= 0)) then
|
---|
172 | begin
|
---|
173 | InfoBox(TX_FWD_NO_PROC_SVCS_TEXT, TX_NOFORWARD_CAP, MB_OK or MB_ICONWARNING);
|
---|
174 | Result := False ;
|
---|
175 | Exit ;
|
---|
176 | end
|
---|
177 | else if ((not IsProcedure) and (Piece(SvcList.Strings[0],U,1) = '-1')) then
|
---|
178 | begin
|
---|
179 | InfoBox(TX_FWD_NO_CSLT_SVCS_TEXT, TX_NOFORWARD_CAP, MB_OK or MB_ICONWARNING);
|
---|
180 | Result := False ;
|
---|
181 | Exit ;
|
---|
182 | end
|
---|
183 | else
|
---|
184 | begin
|
---|
185 | SortByPiece(TStringList(SvcList), U, 2); {RV}
|
---|
186 | for i := 0 to SvcList.Count - 1 do
|
---|
187 | if (cboService.Items.IndexOf(Trim(Piece(SvcList.Strings[i], U, 2))) = -1) and {RV}
|
---|
188 | (Piece(SvcList.Strings[i], U, 5) <> '1') then
|
---|
189 | cboService.Items.Add(SvcList.Strings[i]);
|
---|
190 | if not IsProcedure then
|
---|
191 | begin
|
---|
192 | BuildServiceTree(treService, SvcList, '0', nil) ;
|
---|
193 | with treService do
|
---|
194 | for i:=0 to Items.Count-1 do
|
---|
195 | begin
|
---|
196 | if Items[i].Level > 0 then Items[i].Expanded := False
|
---|
197 | else Items[i].Expanded := True;
|
---|
198 | TopItem := Items[0] ;
|
---|
199 | Selected := Items[0] ;
|
---|
200 | end ;
|
---|
201 | end;
|
---|
202 | pnlForward.Visible := True ;
|
---|
203 | end ;
|
---|
204 | if cboService.Items.Count = 1 then cboService.ItemIndex := 0;
|
---|
205 | FToService := cboService.ItemIEN;
|
---|
206 | cboAttentionOf.InitLongList('') ;
|
---|
207 | with cboUrgency do
|
---|
208 | begin
|
---|
209 | FastAssign(SubsetofUrgencies(ConsultRec.IEN), cboUrgency.Items) ;
|
---|
210 | MixedCaseList(Items) ;
|
---|
211 | SelectByIEN(ConsultRec.Urgency);
|
---|
212 | if ItemIndex = -1 then
|
---|
213 | begin
|
---|
214 | for i := 0 to Items.Count-1 do
|
---|
215 | if DisplayText[i] = 'Routine' then break ;
|
---|
216 | ItemIndex := i ;
|
---|
217 | end;
|
---|
218 | end ;
|
---|
219 | FUrgency := cboUrgency.ItemIEN;
|
---|
220 | //lblActionBy.Caption := 'Responsible Clinician'; // v20.1 RV
|
---|
221 | //cboPerson.OnNeedData := ProviderNeedData; //
|
---|
222 | lblActionBy.Caption := 'Responsible Person'; //
|
---|
223 | cboPerson.Caption := lblActionBy.Caption;
|
---|
224 | cboPerson.OnNeedData := NewPersonNeedData; //
|
---|
225 | cboPerson.InitLongList(User.Name) ;
|
---|
226 | cboPerson.SelectByIEN(User.DUZ);
|
---|
227 | ckAlert.Visible := False ;
|
---|
228 | lblAutoAlerts.Visible := False;
|
---|
229 | Result := True;
|
---|
230 | end;
|
---|
231 |
|
---|
232 | procedure TfrmConsultAction.SetupAddComment;
|
---|
233 | begin
|
---|
234 | pnlForward.Visible := False ;
|
---|
235 | //with frmConsultAction do Width := Width - pnlForward.Width ;
|
---|
236 | pnlSigFind.Visible := False;
|
---|
237 | with frmConsultAction do Height := Height - pnlSigFind.Height;
|
---|
238 | ckAlert.Visible := True ;
|
---|
239 | lblAutoAlerts.Visible := True;
|
---|
240 | ShowAutoAlertText;
|
---|
241 | (* RecipientList.Recipients := '' ;
|
---|
242 | RecipientList.Changed := False ;*)
|
---|
243 | lblActionBy.Visible := False ;
|
---|
244 | cboPerson.Visible := False ;
|
---|
245 | pnlComments.Visible := True;
|
---|
246 | memComments.Clear;
|
---|
247 | ActiveControl := memComments ;
|
---|
248 | end;
|
---|
249 |
|
---|
250 | procedure TfrmConsultAction.SetupSchedule;
|
---|
251 | begin
|
---|
252 | pnlForward.Visible := False ;
|
---|
253 | //with frmConsultAction do Width := Width - pnlForward.Width ;
|
---|
254 | pnlSigFind.Visible := False;
|
---|
255 | with frmConsultAction do Height := Height - pnlSigFind.Height;
|
---|
256 | ckAlert.Visible := True ;
|
---|
257 | lblAutoAlerts.Visible := True;
|
---|
258 | ShowAutoAlertText;
|
---|
259 | (* RecipientList.Recipients := '' ;
|
---|
260 | RecipientList.Changed := False ;*)
|
---|
261 | lblActionBy.Visible := True ;
|
---|
262 | cboPerson.Visible := True ;
|
---|
263 | lblActionBy.Caption := 'Responsible Person';
|
---|
264 | cboPerson.Caption := lblActionBy.Caption;
|
---|
265 | cboPerson.OnNeedData := NewPersonNeedData;
|
---|
266 | cboPerson.InitLongList(User.Name) ;
|
---|
267 | cboPerson.SelectByIEN(User.DUZ);
|
---|
268 | pnlComments.Visible := True;
|
---|
269 | memComments.Clear;
|
---|
270 | ActiveControl := memComments ;
|
---|
271 | end;
|
---|
272 |
|
---|
273 | procedure TfrmConsultAction.SetupAdminComplete;
|
---|
274 | begin
|
---|
275 | SigFindPanelShow ;
|
---|
276 | pnlForward.Visible := False ;
|
---|
277 | //with frmConsultAction do Width := Width - pnlForward.Width ;
|
---|
278 | ckAlert.Visible := False ;
|
---|
279 | lblAutoAlerts.Visible := False;
|
---|
280 |
|
---|
281 | //lblActionBy.Caption := 'Responsible Provider';
|
---|
282 | //cboPerson.OnNeedData := ProviderNeedData; //RIC-0100-21228 - need ALL users here
|
---|
283 | //cboPerson.InitLongList('') ;
|
---|
284 | //cboPerson.ItemIndex := -1;
|
---|
285 | lblActionBy.Caption := 'Responsible Person';
|
---|
286 | cboPerson.Caption := lblActionBy.Caption;
|
---|
287 | cboPerson.OnNeedData := NewPersonNeedData;
|
---|
288 | cboPerson.InitLongList(User.Name) ;
|
---|
289 | cboPerson.SelectByIEN(User.DUZ);
|
---|
290 |
|
---|
291 | pnlComments.Visible := True;
|
---|
292 | memComments.Clear;
|
---|
293 | (* if not FUserIsRequester then RecipientList.Recipients := IntToStr(ConsultRec.SendingProvider);
|
---|
294 | RecipientList.Changed := not FUserIsRequester;*)
|
---|
295 | ActiveControl := memComments ;
|
---|
296 | end;
|
---|
297 |
|
---|
298 | procedure TfrmConsultAction.SetupSigFindings;
|
---|
299 | begin
|
---|
300 | SigFindPanelShow ;
|
---|
301 | pnlForward.Visible := False ;
|
---|
302 | //with frmConsultAction do Width := Width - pnlForward.Width ;
|
---|
303 | ckAlert.Visible := True ;
|
---|
304 | lblAutoAlerts.Visible := True;
|
---|
305 | ShowAutoAlertText;
|
---|
306 | (* RecipientList.Recipients := '' ;
|
---|
307 | RecipientList.Changed := False ;*)
|
---|
308 | lblActionBy.Visible := False ;
|
---|
309 | cboPerson.Visible := False ;
|
---|
310 | pnlComments.Visible := True;
|
---|
311 | memComments.Clear;
|
---|
312 | ActiveControl := memComments ;
|
---|
313 | end;
|
---|
314 |
|
---|
315 | procedure TfrmConsultAction.SigFindPanelShow;
|
---|
316 | var
|
---|
317 | i: integer;
|
---|
318 | begin
|
---|
319 | pnlSigFind.Visible := True;
|
---|
320 | with grpSigFindings do
|
---|
321 | begin
|
---|
322 | for i := 0 to 2 do if Copy(Items[i],1,1)=ConsultRec.Findings then ItemIndex := i ;
|
---|
323 | if ItemIndex = -1 then
|
---|
324 | begin
|
---|
325 | ItemIndex := 2;
|
---|
326 | Caption := Caption + 'Not yet entered';
|
---|
327 | end
|
---|
328 | else
|
---|
329 | Caption := Caption + Items[ItemIndex];
|
---|
330 | end;
|
---|
331 | end ;
|
---|
332 |
|
---|
333 | procedure TfrmConsultAction.SetupReceive;
|
---|
334 | begin
|
---|
335 | pnlForward.Visible := False ;
|
---|
336 | //with frmConsultAction do Width := Width - pnlForward.Width ;
|
---|
337 | pnlComments.Visible := True; // V14?
|
---|
338 | ckAlert.Visible := False ;
|
---|
339 | lblAutoAlerts.Visible := False;
|
---|
340 | pnlSigFind.Visible := False;
|
---|
341 | with frmConsultAction do Height := Height - pnlSigFind.Height;// - pnlComments.Height ; // V14?
|
---|
342 | cboPerson.OnNeedData := NewPersonNeedData;
|
---|
343 | cboPerson.InitLongList(User.Name) ;
|
---|
344 | cboPerson.SelectByIEN(User.DUZ);
|
---|
345 | ActiveControl := calDateOfAction;
|
---|
346 | end;
|
---|
347 |
|
---|
348 | procedure TfrmConsultAction.SetupOther;
|
---|
349 | begin
|
---|
350 | pnlForward.Visible := False ;
|
---|
351 | //with frmConsultAction do Width := Width - pnlForward.Width ;
|
---|
352 | pnlSigFind.Visible := False;
|
---|
353 | with frmConsultAction do Height := Height - pnlSigFind.Height;
|
---|
354 | lblActionBy.Caption := 'Action by';
|
---|
355 | cboPerson.Caption := lblActionBy.Caption;
|
---|
356 | cboPerson.OnNeedData := NewPersonNeedData;
|
---|
357 | cboPerson.InitLongList(User.Name) ;
|
---|
358 | cboPerson.SelectByIEN(User.DUZ);
|
---|
359 | ckAlert.Visible := False ;
|
---|
360 | lblAutoAlerts.Visible := False;
|
---|
361 | pnlComments.Visible := True;
|
---|
362 | memComments.Clear;
|
---|
363 | ActiveControl := memComments ;
|
---|
364 | end;
|
---|
365 |
|
---|
366 | // ============================= Control events ================================
|
---|
367 |
|
---|
368 | procedure TfrmConsultAction.NewPersonNeedData(Sender: TObject; const StartFrom: string;
|
---|
369 | Direction, InsertAt: Integer);
|
---|
370 | begin
|
---|
371 | inherited;
|
---|
372 | (Sender as TORComboBox).ForDataUse(SubSetOfPersons(StartFrom, Direction));
|
---|
373 | end;
|
---|
374 |
|
---|
375 | procedure TfrmConsultAction.ProviderNeedData(Sender: TObject; const StartFrom: string;
|
---|
376 | Direction, InsertAt: Integer);
|
---|
377 | begin
|
---|
378 | inherited;
|
---|
379 | (Sender as TORComboBox).ForDataUse(SubSetOfProviders(StartFrom, Direction));
|
---|
380 | end;
|
---|
381 |
|
---|
382 | procedure TfrmConsultAction.cmdCancelClick(Sender: TObject);
|
---|
383 | begin
|
---|
384 | FChanged := False ;
|
---|
385 | Close ;
|
---|
386 | end;
|
---|
387 |
|
---|
388 | procedure TfrmConsultAction.cmdOKClick(Sender: TObject);
|
---|
389 | var
|
---|
390 | Alist: TStringList;
|
---|
391 | begin
|
---|
392 | Alist := TStringList.Create ;
|
---|
393 | try
|
---|
394 | if (cboPerson.ItemIEN = 0)
|
---|
395 | and (FActionType <> CN_ACT_ADD_CMT)
|
---|
396 | and (FActionType <> CN_ACT_SIGFIND) then
|
---|
397 | begin
|
---|
398 | InfoBox(TX_PERSON_TEXT, TX_PERSON_CAP, MB_OK or MB_ICONWARNING);
|
---|
399 | Exit;
|
---|
400 | end;
|
---|
401 |
|
---|
402 | if ((FActionType = CN_ACT_SIGFIND) or (FActionType = CN_ACT_ADMIN_COMPLETE))
|
---|
403 | and (grpSigFindings.ItemIndex < 0) then
|
---|
404 | begin
|
---|
405 | InfoBox(TX_SIGFIND_TEXT, TX_SIGFIND_CAP, MB_OK or MB_ICONWARNING);
|
---|
406 | Exit;
|
---|
407 | end;
|
---|
408 |
|
---|
409 | if ((FActionType = CN_ACT_DENY)
|
---|
410 | or (FActionType = CN_ACT_DISCONTINUE)
|
---|
411 | or (FActionType = CN_ACT_ADD_CMT)
|
---|
412 | or (FActionType = CN_ACT_ADMIN_COMPLETE))
|
---|
413 | and (memComments.Lines.Count = 0) then
|
---|
414 | begin
|
---|
415 | InfoBox(TX_COMMENTS_TEXT, TX_COMMENTS_CAP, MB_OK or MB_ICONWARNING);
|
---|
416 | Exit;
|
---|
417 | end;
|
---|
418 |
|
---|
419 | if (FActionType = CN_ACT_FORWARD) then
|
---|
420 | begin
|
---|
421 | if (FIsProcedure and (cboService.ItemIndex = -1) and (FToService = 0 )) or
|
---|
422 | ((not FIsProcedure) and (treService.Selected = nil) and (FToService = 0 )) then
|
---|
423 | begin
|
---|
424 | InfoBox(TX_NOFORWARD_TEXT, TX_NOFORWARD_CAP, MB_OK or MB_ICONWARNING);
|
---|
425 | Exit;
|
---|
426 | end;
|
---|
427 | if (not FIsProcedure) and (cboService.ItemIEN = ConsultRec.ToService) then
|
---|
428 | begin
|
---|
429 | InfoBox(TX_NOFORWARD_SELF, TX_NOFORWARD_CAP, MB_OK or MB_ICONWARNING);
|
---|
430 | Exit;
|
---|
431 | end;
|
---|
432 | if cboUrgency.ItemIEN = 0 then
|
---|
433 | begin
|
---|
434 | InfoBox(TX_NOURGENCY_TEXT, TX_NOFORWARD_CAP, MB_OK or MB_ICONWARNING);
|
---|
435 | Exit;
|
---|
436 | end;
|
---|
437 | if (FIsProcedure and (Piece(cboService.Items[cboService.ItemIndex], U, 5) = '1')) or
|
---|
438 | ((not FIsProcedure) and (Piece(TORTreeNode(treService.Selected).StringData, U, 5) = '1')) then
|
---|
439 | begin
|
---|
440 | InfoBox(TX_NOTTHISSVC_TEXT, TX_NOFORWARD_CAP, MB_OK or MB_ICONWARNING);
|
---|
441 | Exit;
|
---|
442 | end;
|
---|
443 | end ;
|
---|
444 |
|
---|
445 | if calDateofAction.Text <> '' then
|
---|
446 | begin
|
---|
447 | FActionDate := StrToFMDateTime(calDateofAction.Text) ;
|
---|
448 | if FActionDate = -1 then
|
---|
449 | begin
|
---|
450 | InfoBox(TX_DATE_TEXT, TX_DATE_CAP, MB_OK or MB_ICONWARNING);
|
---|
451 | calDateofAction.SetFocus ;
|
---|
452 | exit ;
|
---|
453 | end
|
---|
454 | else if FActionDate > FMNow then
|
---|
455 | begin
|
---|
456 | InfoBox(TX_FUTDATE_TEXT, TX_DATE_CAP, MB_OK or MB_ICONWARNING);
|
---|
457 | calDateofAction.SetFocus ;
|
---|
458 | exit ;
|
---|
459 | end;
|
---|
460 | end
|
---|
461 | else
|
---|
462 | FActionDate := FMNow ;
|
---|
463 |
|
---|
464 | FActionBy := cboPerson.ItemIEN;
|
---|
465 | FAttentionOf := cboAttentionOf.ItemIEN ;
|
---|
466 | FUrgency := cboUrgency.ItemIEN ;
|
---|
467 | if (FActionType = CN_ACT_SIGFIND) or (FActionType = CN_ACT_ADMIN_COMPLETE) then
|
---|
468 | FSigFind := Copy(grpSigFindings.Items[grpSigFindings.ItemIndex],2,1);
|
---|
469 | LimitEditWidth(memComments, 74);
|
---|
470 | FComments := memComments.Lines ;
|
---|
471 | if ((ckAlert.Checked) (*or (FActionType = CN_ACT_ADMIN_COMPLETE)*))
|
---|
472 | and RecipientList.Changed then
|
---|
473 | begin
|
---|
474 | FAlert := 1 ;
|
---|
475 | FAlertTo := RecipientList.Recipients ;
|
---|
476 | end
|
---|
477 | else
|
---|
478 | begin
|
---|
479 | FAlert := 0;
|
---|
480 | FAlertTo := '';
|
---|
481 | end ;
|
---|
482 |
|
---|
483 | case FActionType of
|
---|
484 | CN_ACT_RECEIVE :
|
---|
485 | ReceiveConsult(Alist, ConsultRec.IEN, FActionBy, FActionDate, FComments) ;
|
---|
486 | CN_ACT_SCHEDULE :
|
---|
487 | ScheduleConsult(Alist, ConsultRec.IEN, FActionBy, FActionDate, FAlert, FAlertTo, FComments) ;
|
---|
488 | CN_ACT_DENY :
|
---|
489 | DenyConsult(Alist, ConsultRec.IEN, FActionBy, FActionDate, FComments) ;
|
---|
490 | CN_ACT_DISCONTINUE:
|
---|
491 | DiscontinueConsult(Alist, ConsultRec.IEN, FActionBy, FActionDate, FComments) ;
|
---|
492 | CN_ACT_FORWARD :
|
---|
493 | ForwardConsult(Alist, ConsultRec.IEN, FToService, FActionBy, FAttentionOf, FUrgency, FActionDate, FComments);
|
---|
494 | CN_ACT_ADD_CMT :
|
---|
495 | AddComment(Alist, ConsultRec.IEN, FComments, FActionDate, FAlert, FAlertTo) ;
|
---|
496 | CN_ACT_SIGFIND :
|
---|
497 | SigFindings(Alist, ConsultRec.IEN, FSigFind, FComments, FActionDate, FAlert, FAlertTo) ;
|
---|
498 | CN_ACT_ADMIN_COMPLETE :
|
---|
499 | AdminComplete(Alist,ConsultRec.IEN, FSigFind, FComments, FActionBy, FActionDate, FAlert, FAlertTo);
|
---|
500 | end ;
|
---|
501 | if AList.Count > 0 then
|
---|
502 | begin
|
---|
503 | if StrToInt(Piece(Alist[0],u,1)) > 0 then
|
---|
504 | begin
|
---|
505 | InfoBox(Piece(Alist[0],u,2), 'Unable to '+ActionType[FActionType], MB_OK or MB_ICONWARNING);
|
---|
506 | FChanged := False ;
|
---|
507 | end
|
---|
508 | else
|
---|
509 | FChanged := True;
|
---|
510 | end
|
---|
511 | else
|
---|
512 | FChanged := True ;
|
---|
513 | finally
|
---|
514 | Alist.Free ;
|
---|
515 | end ;
|
---|
516 | Close ;
|
---|
517 | end ;
|
---|
518 |
|
---|
519 | procedure TfrmConsultAction.ckAlertClick(Sender: TObject);
|
---|
520 | begin
|
---|
521 | if ckAlert.Checked then SelectRecipients(Font.Size, FActionType, RecipientList) ;
|
---|
522 | end;
|
---|
523 |
|
---|
524 |
|
---|
525 | procedure TfrmConsultAction.treServiceChange(Sender: TObject; Node: TTreeNode);
|
---|
526 | begin
|
---|
527 | if uChanging or FIsProcedure then Exit;
|
---|
528 | FToService := StrToIntDef(Piece(TORTreeNode(treService.Selected).StringData, U, 1), 0);
|
---|
529 | (* if (treService.Selected.Data <> nil) and (Piece(string(treService.Selected.Data), U, 5) <> '1') then
|
---|
530 | cboService.SelectByID(Piece(string(treService.Selected.Data), U, 1))*)
|
---|
531 | //cboService.SelectByID(Piece(string(treService.Selected.Data), U, 1));
|
---|
532 | cboService.ItemIndex := cboService.Items.IndexOf(Trim(treService.Selected.Text)); {RV}
|
---|
533 | ActiveControl := cboService; {RV}
|
---|
534 | end;
|
---|
535 |
|
---|
536 | procedure TfrmConsultAction.treServiceExit(Sender: TObject);
|
---|
537 | begin
|
---|
538 | (* if (Piece(TORTreeNode(treService.Selected).StringData, U, 5) = '1') then WHY IS THIS IN HERE? (rv - v15.5)
|
---|
539 | InfoBox(TX_NOTTHISSVC_TEXT, TX_NOFORWARD_CAP, MB_OK or MB_ICONWARNING);*)
|
---|
540 | end;
|
---|
541 |
|
---|
542 | procedure TfrmConsultAction.cboServiceSelect(Sender: TObject);
|
---|
543 | var
|
---|
544 | i: integer;
|
---|
545 | begin
|
---|
546 | if not FIsProcedure then
|
---|
547 | begin
|
---|
548 | uChanging := True;
|
---|
549 | with treService do for i := 0 to Items.Count-1 do
|
---|
550 | begin
|
---|
551 | if Piece(TORTreeNode(Items[i]).StringData, U, 1) = cboService.ItemID then
|
---|
552 | begin
|
---|
553 | Selected := Items[i];
|
---|
554 | //treServiceChange(Self, Items[i]);
|
---|
555 | break;
|
---|
556 | end;
|
---|
557 | end;
|
---|
558 | uChanging := False;
|
---|
559 | FToService := StrToIntDef(Piece(TORTreeNode(treService.Selected).StringData, U, 1), 0);
|
---|
560 | end
|
---|
561 | else
|
---|
562 | FToService := cboService.ItemIEN;
|
---|
563 | end;
|
---|
564 |
|
---|
565 | (*procedure TfrmConsultAction.ShowAutoAlertText; **** SEE BELOW FOR REPLACEMENT - v27.9 Phelps/Vertigan
|
---|
566 | const
|
---|
567 | TX_ALERT1 = 'An alert will automatically be sent to ';
|
---|
568 | TX_ALERT_PROVIDER = 'the ordering provider';
|
---|
569 | TX_ALERT_SVC_USERS = 'notification recipients for this service.';
|
---|
570 | TX_ALERT_NOBODY = 'No automatic alerts will be sent.'; // this should be rare to never
|
---|
571 | var
|
---|
572 | x: string;
|
---|
573 | begin
|
---|
574 | case FUserLevel of
|
---|
575 | UL_NONE, UL_REVIEW:
|
---|
576 | begin
|
---|
577 | if FUserIsRequester then
|
---|
578 | x := TX_ALERT1 + TX_ALERT_SVC_USERS
|
---|
579 | else
|
---|
580 | x := TX_ALERT1 + TX_ALERT_PROVIDER + ' and to ' + TX_ALERT_SVC_USERS;
|
---|
581 | end;
|
---|
582 | UL_UPDATE, UL_ADMIN, UL_UPDATE_AND_ADMIN:
|
---|
583 | begin
|
---|
584 | if FUserIsRequester then
|
---|
585 | x := TX_ALERT_NOBODY
|
---|
586 | else
|
---|
587 | x := TX_ALERT1 + TX_ALERT_PROVIDER + '.';
|
---|
588 | end;
|
---|
589 | end;
|
---|
590 | lblAutoAlerts.Caption := x;
|
---|
591 | end;*)
|
---|
592 |
|
---|
593 | procedure TfrmConsultAction.ShowAutoAlertText;
|
---|
594 | const
|
---|
595 | TX_ALERT1 = 'An alert will automatically be sent to ';
|
---|
596 | TX_ALERT_PROVIDER = 'the ordering provider';
|
---|
597 | TX_ALERT_SVC_USERS = 'notification recipients for this service.';
|
---|
598 | TX_ALERT_NOBODY = 'No automatic alerts will be sent.'; // this should be rare to never
|
---|
599 | var
|
---|
600 | x: string;
|
---|
601 | begin
|
---|
602 | case FUserLevel of
|
---|
603 | UL_NONE, UL_REVIEW:
|
---|
604 | begin
|
---|
605 | if FUserIsRequester then
|
---|
606 | x := TX_ALERT1 + TX_ALERT_SVC_USERS
|
---|
607 | else
|
---|
608 | x := TX_ALERT1 + TX_ALERT_PROVIDER + ' and to ' + TX_ALERT_SVC_USERS;
|
---|
609 | end;
|
---|
610 | UL_UPDATE, UL_ADMIN, UL_UPDATE_AND_ADMIN:
|
---|
611 | begin
|
---|
612 | if FUserIsRequester then
|
---|
613 | //x := TX_ALERT_NOBODY Replace with following line
|
---|
614 | x := TX_ALERT1 + TX_ALERT_SVC_USERS
|
---|
615 | else
|
---|
616 | x := TX_ALERT1 + TX_ALERT_PROVIDER + '.';
|
---|
617 | end;
|
---|
618 | UL_UNRESTRICTED:
|
---|
619 | begin
|
---|
620 | if FUserIsRequester then
|
---|
621 | x := TX_ALERT1 + TX_ALERT_SVC_USERS
|
---|
622 | else
|
---|
623 | x := TX_ALERT1 + TX_ALERT_PROVIDER + ' and to ' + TX_ALERT_SVC_USERS;
|
---|
624 | end;
|
---|
625 | end;
|
---|
626 | lblAutoAlerts.Caption := x;
|
---|
627 | end;
|
---|
628 |
|
---|
629 |
|
---|
630 | initialization
|
---|
631 | SvcList := TStringList.Create ;
|
---|
632 |
|
---|
633 | finalization
|
---|
634 | SvcList.Free ;
|
---|
635 |
|
---|
636 |
|
---|
637 | end.
|
---|