source: cprs/branches/tmg-cprs/CPRS-Chart/fSurgeryView.pas@ 1547

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 4.6 KB
Line 
1//kt -- Modified with SourceScanner on 8/7/2007
2unit fSurgeryView;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ORFN,
8 StdCtrls, ExtCtrls, ORCtrls, ComCtrls, ORDtTm, Spin, rSurgery, DKLang;
9
10type
11 TfrmSurgeryView = class(TForm)
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 DKLanguageController1: TDKLanguageController;
27 procedure cmdOKClick(Sender: TObject);
28 procedure cmdCancelClick(Sender: TObject);
29 procedure cmdClearClick(Sender: TObject);
30 private
31 FChanged: Boolean;
32 FBeginDate: string;
33 FFMBeginDate: TFMDateTime;
34 FEndDate: string;
35 FFMEndDate: TFMDateTime;
36 FOpProc: string;
37 FMaxDocs: integer;
38 FGroupBy: string;
39 FTreeAscending: Boolean;
40 FCurrentContext: TSurgCaseContext;
41 end;
42
43function SelectSurgeryView(FontSize: Integer; ShowForm: Boolean; CurrentContext: TSurgCaseContext;
44 var SurgeryContext: TSurgCaseContext): boolean ;
45
46implementation
47
48{$R *.DFM}
49
50uses rCore, uCore;
51
52//const
53// TX_DATE_ERR = 'Enter valid beginning and ending dates or press Cancel.'; <-- original line. //kt 8/7/2007
54// TX_DATE_ERR_CAP = 'Error in Date Range'; <-- original line. //kt 8/7/2007
55
56var
57 TX_DATE_ERR : string; //kt
58 TX_DATE_ERR_CAP : string; //kt
59
60
61procedure SetupVars;
62//kt Added entire function to replace constant declarations 8/7/2007
63begin
64 TX_DATE_ERR := DKLangConstW('fSurgeryView_Enter_valid_beginning_and_ending_dates_or_press_Cancelx');
65 TX_DATE_ERR_CAP := DKLangConstW('fSurgeryView_Error_in_Date_Range');
66end;
67
68function SelectSurgeryView(FontSize: Integer; ShowForm: Boolean; CurrentContext: TSurgCaseContext;
69 var SurgeryContext: TSurgCaseContext): boolean ;
70var
71 frmSurgeryView: TfrmSurgeryView;
72 W, H: Integer;
73begin
74 frmSurgeryView := TfrmSurgeryView.Create(Application);
75 try
76 with frmSurgeryView do
77 begin
78 Font.Size := FontSize;
79 W := ClientWidth;
80 H := ClientHeight;
81 ResizeToFont(FontSize, W, H);
82 ClientWidth := W; pnlBase.Width := W;
83 ClientHeight := H; pnlBase.Height := H;
84 FChanged := False;
85 FCurrentContext := CurrentContext;
86 calBeginDate.Text := CurrentContext.BeginDate;
87 calEndDate.Text := CurrentContext.EndDate;
88 if calEndDate.Text = '' then calEndDate.Text := 'TODAY';
89 if CurrentContext.MaxDocs > 0 then
90 edMaxDocs.Text := IntToStr(CurrentContext.MaxDocs)
91 else
92 edMaxDocs.Text := '';
93 FMaxDocs := StrToIntDef(edMaxDocs.Text, 0);
94 radTreeSort.ItemIndex := 0;
95 cboGroupBy.SelectByID(CurrentContext.GroupBy);
96 if ShowForm then ShowModal else cmdOKClick(frmSurgeryView);
97
98 with SurgeryContext do
99 begin
100 Changed := FChanged;
101 OpProc := FOpProc;
102 BeginDate := FBeginDate;
103 FMBeginDate := FFMBeginDate;
104 EndDate := FEndDate;
105 FMEndDate := FFMEndDate;
106 MaxDocs := FMaxDocs;
107 GroupBy := FGroupBy;
108 TreeAscending := FTreeAscending;
109 Result := Changed ;
110 end;
111
112 end; {with frmSurgeryView}
113 finally
114 frmSurgeryView.Release;
115 end;
116end;
117
118procedure TfrmSurgeryView.cmdOKClick(Sender: TObject);
119var
120 bdate, edate: TFMDateTime;
121begin
122 SetupVars; //kt added 8/7/2007 to replace constants with vars.
123 if calBeginDate.Text <> '' then
124 bdate := StrToFMDateTime(calBeginDate.Text)
125 else
126 bdate := 0 ;
127
128 if calEndDate.Text <> '' then
129 edate := StrToFMDateTime(calEndDate.Text)
130 else
131 edate := 0 ;
132
133 if (bdate <= edate) then
134 begin
135 FBeginDate := calBeginDate.Text;
136 FFMBeginDate := bdate;
137 FEndDate := calEndDate.Text;
138 FFMEndDate := edate;
139 end
140 else
141 begin
142 InfoBox(TX_DATE_ERR, TX_DATE_ERR_CAP, MB_OK or MB_ICONWARNING);
143 Exit;
144 end;
145
146 FTreeAscending := (radTreeSort.ItemIndex = 0);
147 FMaxDocs := StrToIntDef(edMaxDocs.Text, 0);
148 if cboGroupBy.ItemID <> '' then
149 FGroupBy := cboGroupBy.ItemID
150 else
151 FGroupBy := '';
152 FChanged := True;
153 Close;
154end;
155
156procedure TfrmSurgeryView.cmdCancelClick(Sender: TObject);
157begin
158 FChanged := False;
159 Close;
160end;
161
162procedure TfrmSurgeryView.cmdClearClick(Sender: TObject);
163begin
164 cboGroupBy.ItemIndex := -1;
165 radTreeSort.ItemIndex := 0;
166end;
167
168end.
Note: See TracBrowser for help on using the repository browser.