source: cprs/branches/foia-cprs/CPRS-Chart/Orders/fODAuto.pas@ 459

Last change on this file since 459 was 459, checked in by Kevin Toppenberg, 16 years ago

Adding foia-cprs branch

File size: 2.3 KB
Line 
1unit fODAuto;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fODBase, StdCtrls, ComCtrls, ExtCtrls, ORFn, ORCtrls;
8
9type
10 TfrmODAuto = class(TfrmODBase)
11 Label1: TLabel;
12 public
13 procedure InitDialog; override;
14 procedure SetupDialog(OrderAction: Integer; const ID: string); override;
15 procedure Validate(var AnErrMsg: string); override;
16 end;
17
18var
19 frmODAuto: TfrmODAuto;
20
21implementation
22
23{$R *.DFM}
24
25uses rODBase, rOrders, fTemplateDialog, uTemplateFields, rTemplates, uConst, uTemplates,
26 rConsults;
27
28procedure TfrmODAuto.InitDialog;
29begin
30 inherited;
31 // nothing for now
32end;
33
34procedure TfrmODAuto.Validate(var AnErrMsg: string);
35var
36 cptn, tmp, DocInfo: string;
37 TempSL: TStringList;
38 LType: TTemplateLinkType;
39 IEN: integer;
40
41begin
42 inherited;
43 DocInfo := '';
44 LType := DisplayGroupToLinkType(Responses.DisplayGroup);
45 tmp := Responses.EValueFor('COMMENT', 1);
46 if (LType <> ltNone) or HasTemplateField(tmp) then
47 begin
48 cptn := 'Reason for Request: ' + Responses.EValueFor('ORDERABLE', 1);
49 case LType of
50 ltConsult: IEN := StrToIntDef(GetServiceIEN(Responses.IValueFor('ORDERABLE', 1)),0);
51 ltProcedure: IEN := StrToIntDef(GetProcedureIEN(Responses.IValueFor('ORDERABLE', 1)),0);
52 else IEN := 0;
53 end;
54 if IEN <> 0 then
55 ExecuteTemplateOrBoilerPlate(tmp, IEN, LType, nil, cptn, DocInfo)
56 else
57 CheckBoilerplate4Fields(tmp, cptn);
58
59 if tmp <> '' then
60 Responses.Update('COMMENT', 1, TX_WPTYPE, tmp)
61 else
62 begin
63 TempSL := TStringList.Create;
64 try
65 TempSL.Text := Responses.EValueFor('COMMENT', 1);
66 Convert2LMText(TempSL);
67 Responses.Update('COMMENT', 1, TX_WPTYPE, TempSL.Text);
68 finally
69 TempSL.Free;
70 end;
71 end;
72 end;
73end;
74
75procedure TfrmODAuto.SetupDialog(OrderAction: Integer; const ID: string);
76var
77 DialogNames: TDialogNames;
78begin
79 inherited; // Responses is already loaded here
80 AutoAccept := True;
81 StatusText('Loading Dialog Definition');
82 FillerID := FillerIDForDialog(DialogIEN);
83 IdentifyDialog(DialogNames, DialogIEN);
84 Responses.Dialog := DialogNames.BaseName; // loads formatting info
85 StatusText('');
86end;
87
88end.
Note: See TracBrowser for help on using the repository browser.