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

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

Initial Upload of Official WV CPRS 1.0.26.76

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