source: cprs/trunk/CPRS-Chart/Orders/fODAuto.pas@ 457

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

Initial Upload of Official WV CPRS 1.0.26.76

File size: 2.5 KB
RevLine 
[456]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, uCore, uODBase;
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 HasObjects: boolean;
41
42begin
43 inherited;
44 DocInfo := '';
45 LType := DisplayGroupToLinkType(Responses.DisplayGroup);
46 tmp := Responses.EValueFor('COMMENT', 1);
47 ExpandOrderObjects(tmp, HasObjects);
48 Responses.OrderContainsObjects := Responses.OrderContainsObjects or HasObjects;
49 if (LType <> ltNone) or HasTemplateField(tmp) then
50 begin
51 cptn := 'Reason for Request: ' + Responses.EValueFor('ORDERABLE', 1);
52 case LType of
53 ltConsult: IEN := StrToIntDef(GetServiceIEN(Responses.IValueFor('ORDERABLE', 1)),0);
54 ltProcedure: IEN := StrToIntDef(GetProcedureIEN(Responses.IValueFor('ORDERABLE', 1)),0);
55 else IEN := 0;
56 end;
57 if IEN <> 0 then
58 ExecuteTemplateOrBoilerPlate(tmp, IEN, LType, nil, cptn, DocInfo)
59 else
60 CheckBoilerplate4Fields(tmp, cptn);
61
62 if tmp <> '' then
63 Responses.Update('COMMENT', 1, TX_WPTYPE, tmp)
64 else
65 begin
66 TempSL := TStringList.Create;
67 try
68 TempSL.Text := Responses.EValueFor('COMMENT', 1);
69 Convert2LMText(TempSL);
70 Responses.Update('COMMENT', 1, TX_WPTYPE, TempSL.Text);
71 finally
72 TempSL.Free;
73 end;
74 end;
75 end;
76end;
77
78procedure TfrmODAuto.SetupDialog(OrderAction: Integer; const ID: string);
79var
80 DialogNames: TDialogNames;
81begin
82 inherited; // Responses is already loaded here
83 AutoAccept := True;
84 StatusText('Loading Dialog Definition');
85 FillerID := FillerIDForDialog(DialogIEN);
86 IdentifyDialog(DialogNames, DialogIEN);
87 Responses.Dialog := DialogNames.BaseName; // loads formatting info
88 StatusText('');
89end;
90
91end.
Note: See TracBrowser for help on using the repository browser.