source: cprs/trunk/CPRS-Chart/fSurgeryView.pas@ 877

Last change on this file since 877 was 830, checked in by Kevin Toppenberg, 14 years ago

Upgrading to version 27

File size: 4.1 KB
RevLine 
[456]1unit fSurgeryView;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ORFN,
[830]7 StdCtrls, ExtCtrls, ORCtrls, ComCtrls, ORDtTm, Spin, rSurgery, fBase508Form,
8 VA508AccessibilityManager;
[456]9
10type
[830]11 TfrmSurgeryView = class(TfrmBase508Form)
[456]12 pnlBase: TORAutoPanel;
13 lblBeginDate: TLabel;
14 calBeginDate: TORDateBox;
15 lblEndDate: TLabel;
16 calEndDate: TORDateBox;
17 cmdOK: TButton;
18 cmdCancel: TButton;
19 lblMaxDocs: TLabel;
20 edMaxDocs: TCaptionEdit;
21 grpTreeView: TGroupBox;
22 lblGroupBy: TOROffsetLabel;
23 cboGroupBy: TORComboBox;
24 radTreeSort: TRadioGroup;
25 cmdClear: TButton;
26 procedure cmdOKClick(Sender: TObject);
27 procedure cmdCancelClick(Sender: TObject);
28 procedure cmdClearClick(Sender: TObject);
29 private
30 FChanged: Boolean;
31 FBeginDate: string;
32 FFMBeginDate: TFMDateTime;
33 FEndDate: string;
34 FFMEndDate: TFMDateTime;
35 FOpProc: string;
36 FMaxDocs: integer;
37 FGroupBy: string;
38 FTreeAscending: Boolean;
39 FCurrentContext: TSurgCaseContext;
40 end;
41
42function SelectSurgeryView(FontSize: Integer; ShowForm: Boolean; CurrentContext: TSurgCaseContext;
43 var SurgeryContext: TSurgCaseContext): boolean ;
44
45implementation
46
47{$R *.DFM}
48
49uses rCore, uCore;
50
51const
52 TX_DATE_ERR = 'Enter valid beginning and ending dates or press Cancel.';
53 TX_DATE_ERR_CAP = 'Error in Date Range';
54
55function SelectSurgeryView(FontSize: Integer; ShowForm: Boolean; CurrentContext: TSurgCaseContext;
56 var SurgeryContext: TSurgCaseContext): boolean ;
57var
58 frmSurgeryView: TfrmSurgeryView;
59 W, H: Integer;
60begin
61 frmSurgeryView := TfrmSurgeryView.Create(Application);
62 try
63 with frmSurgeryView do
64 begin
65 Font.Size := FontSize;
66 W := ClientWidth;
67 H := ClientHeight;
68 ResizeToFont(FontSize, W, H);
69 ClientWidth := W; pnlBase.Width := W;
70 ClientHeight := H; pnlBase.Height := H;
71 FChanged := False;
72 FCurrentContext := CurrentContext;
73 calBeginDate.Text := CurrentContext.BeginDate;
74 calEndDate.Text := CurrentContext.EndDate;
75 if calEndDate.Text = '' then calEndDate.Text := 'TODAY';
76 if CurrentContext.MaxDocs > 0 then
77 edMaxDocs.Text := IntToStr(CurrentContext.MaxDocs)
78 else
79 edMaxDocs.Text := '';
80 FMaxDocs := StrToIntDef(edMaxDocs.Text, 0);
81 radTreeSort.ItemIndex := 0;
82 cboGroupBy.SelectByID(CurrentContext.GroupBy);
83 if ShowForm then ShowModal else cmdOKClick(frmSurgeryView);
84
85 with SurgeryContext do
86 begin
87 Changed := FChanged;
88 OpProc := FOpProc;
89 BeginDate := FBeginDate;
90 FMBeginDate := FFMBeginDate;
91 EndDate := FEndDate;
92 FMEndDate := FFMEndDate;
93 MaxDocs := FMaxDocs;
94 GroupBy := FGroupBy;
95 TreeAscending := FTreeAscending;
96 Result := Changed ;
97 end;
98
99 end; {with frmSurgeryView}
100 finally
101 frmSurgeryView.Release;
102 end;
103end;
104
105procedure TfrmSurgeryView.cmdOKClick(Sender: TObject);
106var
107 bdate, edate: TFMDateTime;
108begin
109 if calBeginDate.Text <> '' then
110 bdate := StrToFMDateTime(calBeginDate.Text)
111 else
112 bdate := 0 ;
113
114 if calEndDate.Text <> '' then
115 edate := StrToFMDateTime(calEndDate.Text)
116 else
117 edate := 0 ;
118
119 if (bdate <= edate) then
120 begin
121 FBeginDate := calBeginDate.Text;
122 FFMBeginDate := bdate;
123 FEndDate := calEndDate.Text;
124 FFMEndDate := edate;
125 end
126 else
127 begin
128 InfoBox(TX_DATE_ERR, TX_DATE_ERR_CAP, MB_OK or MB_ICONWARNING);
129 Exit;
130 end;
131
132 FTreeAscending := (radTreeSort.ItemIndex = 0);
133 FMaxDocs := StrToIntDef(edMaxDocs.Text, 0);
134 if cboGroupBy.ItemID <> '' then
135 FGroupBy := cboGroupBy.ItemID
136 else
137 FGroupBy := '';
138 FChanged := True;
139 Close;
140end;
141
142procedure TfrmSurgeryView.cmdCancelClick(Sender: TObject);
143begin
144 FChanged := False;
145 Close;
146end;
147
148procedure TfrmSurgeryView.cmdClearClick(Sender: TObject);
149begin
150 cboGroupBy.ItemIndex := -1;
151 radTreeSort.ItemIndex := 0;
152end;
153
154end.
Note: See TracBrowser for help on using the repository browser.