1 | unit fTIUView;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ORFN,
|
---|
7 | StdCtrls, ExtCtrls, ORCtrls, ComCtrls, ORDtTm, Spin, uTIU, fBase508Form,
|
---|
8 | VA508AccessibilityManager;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfrmTIUView = class(TfrmBase508Form)
|
---|
12 | pnlBase: TORAutoPanel;
|
---|
13 | lblBeginDate: TLabel;
|
---|
14 | calBeginDate: TORDateBox;
|
---|
15 | lblEndDate: TLabel;
|
---|
16 | calEndDate: TORDateBox;
|
---|
17 | lblStatus: TLabel;
|
---|
18 | lstStatus: TORListBox;
|
---|
19 | lblAuthor: TLabel;
|
---|
20 | cmdOK: TButton;
|
---|
21 | cmdCancel: TButton;
|
---|
22 | cboAuthor: TORComboBox;
|
---|
23 | lblMaxDocs: TLabel;
|
---|
24 | edMaxDocs: TCaptionEdit;
|
---|
25 | lblContains: TLabel;
|
---|
26 | txtKeyword: TCaptionEdit;
|
---|
27 | Bevel1: TBevel;
|
---|
28 | grpListView: TGroupBox;
|
---|
29 | radListSort: TRadioGroup;
|
---|
30 | lblSortBy: TLabel;
|
---|
31 | cboSortBy: TORComboBox;
|
---|
32 | grpTreeView: TGroupBox;
|
---|
33 | lblGroupBy: TOROffsetLabel;
|
---|
34 | cboGroupBy: TORComboBox;
|
---|
35 | radTreeSort: TRadioGroup;
|
---|
36 | Bevel2: TBevel;
|
---|
37 | cmdClear: TButton;
|
---|
38 | ckShowSubject: TCheckBox;
|
---|
39 | grpWhereEitherOf: TGroupBox;
|
---|
40 | ckTitle: TCheckBox;
|
---|
41 | ckSubject: TCheckBox;
|
---|
42 | procedure cmdOKClick(Sender: TObject);
|
---|
43 | procedure cmdCancelClick(Sender: TObject);
|
---|
44 | procedure lstStatusSelect(Sender: TObject);
|
---|
45 | procedure cboAuthorNeedData(Sender: TObject; const StartFrom: String;
|
---|
46 | Direction, InsertAt: Integer);
|
---|
47 | procedure cmdClearClick(Sender: TObject);
|
---|
48 | private
|
---|
49 | FChanged: Boolean;
|
---|
50 | FBeginDate: string;
|
---|
51 | FFMBeginDate: TFMDateTime;
|
---|
52 | FEndDate: string;
|
---|
53 | FFMEndDate: TFMDateTime;
|
---|
54 | FStatus: string;
|
---|
55 | FAuthor: Int64;
|
---|
56 | FMaxDocs: integer;
|
---|
57 | FShowSubject: Boolean;
|
---|
58 | FSortBy: string;
|
---|
59 | FListAscending: Boolean;
|
---|
60 | FGroupBy: string;
|
---|
61 | FTreeAscending: Boolean;
|
---|
62 | FSearchField: string;
|
---|
63 | FKeyWord: string;
|
---|
64 | FFiltered: Boolean;
|
---|
65 | FCurrentContext: TTIUContext;
|
---|
66 | end;
|
---|
67 |
|
---|
68 | function SelectTIUView(FontSize: Integer; ShowForm: Boolean; CurrentContext: TTIUContext; var TIUContext: TTIUContext): boolean ;
|
---|
69 |
|
---|
70 | implementation
|
---|
71 |
|
---|
72 | {$R *.DFM}
|
---|
73 |
|
---|
74 | uses rCore, uCore, rTIU(*, fNotes, fDCSumm, rDCSumm*);
|
---|
75 |
|
---|
76 | const
|
---|
77 | TX_DATE_ERR = 'Enter valid beginning and ending dates or press Cancel.';
|
---|
78 | TX_DATE_ERR_CAP = 'Error in Date Range';
|
---|
79 | TX_AUTH_ERR = 'You must select an author for this retrieval method.';
|
---|
80 | TX_AUTH_ERR_CAP = 'No author selected';
|
---|
81 |
|
---|
82 | function SelectTIUView(FontSize: Integer; ShowForm: Boolean; CurrentContext: TTIUContext; var TIUContext: TTIUContext): boolean ;
|
---|
83 | { displays select form for Notes and returns a record of the selection }
|
---|
84 | var
|
---|
85 | frmTIUView: TfrmTIUView;
|
---|
86 | W, H: Integer;
|
---|
87 | CurrentAuthor: Int64;
|
---|
88 | CurrentStatus: string;
|
---|
89 | begin
|
---|
90 | frmTIUView := TfrmTIUView.Create(Application);
|
---|
91 | try
|
---|
92 | with frmTIUView do
|
---|
93 | begin
|
---|
94 | Font.Size := FontSize;
|
---|
95 | W := ClientWidth;
|
---|
96 | H := ClientHeight;
|
---|
97 | ResizeToFont(FontSize, W, H);
|
---|
98 | ClientWidth := W; pnlBase.Width := W;
|
---|
99 | ClientHeight := H; pnlBase.Height := H;
|
---|
100 | FChanged := False;
|
---|
101 | FFiltered := False;
|
---|
102 | FCurrentContext := CurrentContext;
|
---|
103 | calBeginDate.Text := CurrentContext.BeginDate;
|
---|
104 | calEndDate.Text := CurrentContext.EndDate;
|
---|
105 | if calEndDate.Text = '' then calEndDate.Text := 'TODAY';
|
---|
106 | CurrentStatus := CurrentContext.Status;
|
---|
107 | with lstStatus do
|
---|
108 | if CurrentStatus <> '' then
|
---|
109 | SelectByID(CurrentStatus)
|
---|
110 | else
|
---|
111 | SelectByID('1');
|
---|
112 | //lstStatusSelect(frmTIUView); moved down - v24.1 (RV)
|
---|
113 | CurrentAuthor := CurrentContext.Author;
|
---|
114 | with cboAuthor do
|
---|
115 | if CurrentAuthor > 0 then
|
---|
116 | begin
|
---|
117 | InitLongList(ExternalName(CurrentAuthor, 200));
|
---|
118 | if Enabled then SelectByIEN(CurrentAuthor);
|
---|
119 | FAuthor := CurrentAuthor;
|
---|
120 | end
|
---|
121 | else
|
---|
122 | begin
|
---|
123 | InitLongList(User.Name);
|
---|
124 | SelectByIEN(User.DUZ);
|
---|
125 | FAuthor := ItemIEN;
|
---|
126 | end;
|
---|
127 | if CurrentContext.MaxDocs > 0 then
|
---|
128 | edMaxDocs.Text := IntToStr(CurrentContext.MaxDocs)
|
---|
129 | else
|
---|
130 | edMaxDocs.Text := '';
|
---|
131 | FMaxDocs := StrToIntDef(edMaxDocs.Text, 0);
|
---|
132 | txtKeyword.Text := CurrentContext.Keyword;
|
---|
133 | if CurrentContext.SearchField <> '' then
|
---|
134 | begin
|
---|
135 | ckTitle.Checked := (CurrentContext.SearchField[1] in ['T','B']) and (CurrentContext.Keyword <> '');
|
---|
136 | ckSubject.Checked := (CurrentContext.SearchField[1] in ['S','B'])and (CurrentContext.Keyword <> '');
|
---|
137 | end;
|
---|
138 | ckShowSubject.Checked := CurrentContext.ShowSubject;
|
---|
139 | //with radTreeSort do if SortNotesAscending then ItemIndex := 1 else ItemIndex := 0;
|
---|
140 | with radTreeSort do if CurrentContext.TreeAscending then ItemIndex := 0 else ItemIndex := 1;
|
---|
141 | with radListSort do if CurrentContext.ListAscending then ItemIndex := 0 else ItemIndex := 1;
|
---|
142 | cboSortBy.SelectByID(CurrentContext.SortBy);
|
---|
143 | cboGroupBy.SelectByID(CurrentContext.GroupBy);
|
---|
144 | lstStatusSelect(frmTIUView); // from above in v24.1, (RV)
|
---|
145 |
|
---|
146 | if ShowForm then ShowModal else cmdOKClick(frmTIUView);
|
---|
147 |
|
---|
148 | with TIUContext do
|
---|
149 | begin
|
---|
150 | Changed := FChanged;
|
---|
151 | BeginDate := FBeginDate;
|
---|
152 | FMBeginDate := FFMBeginDate;
|
---|
153 | EndDate := FEndDate;
|
---|
154 | FMEndDate := FFMEndDate;
|
---|
155 | Status := FStatus;
|
---|
156 | Author := FAuthor;
|
---|
157 | MaxDocs := FMaxDocs;
|
---|
158 | ShowSubject := FShowSubject;
|
---|
159 | SortBy := FSortBy;
|
---|
160 | ListAscending := FListAscending;
|
---|
161 | GroupBy := FGroupBy;
|
---|
162 | TreeAscending := FTreeAscending;
|
---|
163 | SearchField := FSearchField;
|
---|
164 | KeyWord := FKeyWord;
|
---|
165 | Filtered := FFiltered;
|
---|
166 | Result := Changed ;
|
---|
167 | end;
|
---|
168 |
|
---|
169 | end; {with frmTIUView}
|
---|
170 | finally
|
---|
171 | frmTIUView.Release;
|
---|
172 | end;
|
---|
173 | end;
|
---|
174 |
|
---|
175 | procedure TfrmTIUView.cmdOKClick(Sender: TObject);
|
---|
176 | var
|
---|
177 | bdate, edate: TFMDateTime;
|
---|
178 | begin
|
---|
179 | FStatus := lstStatus.ItemID;
|
---|
180 |
|
---|
181 | if calBeginDate.Text <> '' then
|
---|
182 | bdate := StrToFMDateTime(calBeginDate.Text)
|
---|
183 | else
|
---|
184 | bdate := 0 ;
|
---|
185 |
|
---|
186 | if calEndDate.Text <> '' then
|
---|
187 | edate := StrToFMDateTime(calEndDate.Text)
|
---|
188 | else
|
---|
189 | edate := 0 ;
|
---|
190 |
|
---|
191 | if (bdate <= edate) then
|
---|
192 | begin
|
---|
193 | FBeginDate := calBeginDate.Text;
|
---|
194 | FFMBeginDate := bdate;
|
---|
195 | FEndDate := calEndDate.Text;
|
---|
196 | FFMEndDate := edate;
|
---|
197 | end
|
---|
198 | else
|
---|
199 | begin
|
---|
200 | InfoBox(TX_DATE_ERR, TX_DATE_ERR_CAP, MB_OK or MB_ICONWARNING);
|
---|
201 | Exit;
|
---|
202 | end;
|
---|
203 |
|
---|
204 | FAuthor := cboAuthor.ItemIEN;
|
---|
205 | if (FStatus = '4') and (FAuthor = 0) then
|
---|
206 | begin
|
---|
207 | InfoBox(TX_AUTH_ERR, TX_AUTH_ERR_CAP, MB_OK or MB_ICONWARNING);
|
---|
208 | Exit;
|
---|
209 | end;
|
---|
210 |
|
---|
211 | FSortBy := cboSortBy.ItemID;
|
---|
212 | if FSortBy = '' then FSortBy := 'R';
|
---|
213 | FListAscending := (radListSort.ItemIndex = 0);
|
---|
214 | FTreeAscending := (radTreeSort.ItemIndex = 0);
|
---|
215 |
|
---|
216 | FKeyWord := txtKeyWord.Text;
|
---|
217 | if (ckTitle.Checked) and (ckSubject.Checked) then
|
---|
218 | FSearchField := 'B'
|
---|
219 | else if ckTitle.Checked then
|
---|
220 | FSearchField := 'T'
|
---|
221 | else if ckSubject.Checked then
|
---|
222 | FSearchField := 'S'
|
---|
223 | else if not (ckTitle.Checked or ckSubject.Checked) then
|
---|
224 | begin
|
---|
225 | FKeyWord := '';
|
---|
226 | FSearchField := '';
|
---|
227 | end;
|
---|
228 | if (FKeyword <> '') then
|
---|
229 | FFiltered := True;
|
---|
230 |
|
---|
231 | if ckSubject.Checked then ckShowSubject.Checked := True;
|
---|
232 | FShowSubject := ckShowSubject.Checked;
|
---|
233 | FMaxDocs := StrToIntDef(edMaxDocs.Text, 0);
|
---|
234 | if cboGroupBy.ItemID <> '' then
|
---|
235 | FGroupBy := cboGroupBy.ItemID
|
---|
236 | else
|
---|
237 | FGroupBy := '';
|
---|
238 | FChanged := True;
|
---|
239 | Close;
|
---|
240 | end;
|
---|
241 |
|
---|
242 | procedure TfrmTIUView.cmdCancelClick(Sender: TObject);
|
---|
243 | begin
|
---|
244 | FChanged := False;
|
---|
245 | Close;
|
---|
246 | end;
|
---|
247 |
|
---|
248 | procedure TfrmTIUView.lstStatusSelect(Sender: TObject);
|
---|
249 | var
|
---|
250 | EnableDates: Boolean;
|
---|
251 | begin
|
---|
252 | EnableDates := (lstStatus.ItemID <> '1');
|
---|
253 | lblBeginDate.Enabled := EnableDates;
|
---|
254 | calBeginDate.Enabled := EnableDates;
|
---|
255 | lblEndDate.Enabled := EnableDates;
|
---|
256 | calEndDate.Enabled := EnableDates;
|
---|
257 | if not EnableDates then
|
---|
258 | begin
|
---|
259 | calBeginDate.Text := '';
|
---|
260 | calEndDate.Text := '';
|
---|
261 | end
|
---|
262 | else
|
---|
263 | begin
|
---|
264 | calBeginDate.Text := FCurrentContext.BeginDate;
|
---|
265 | calEndDate.Text := FCurrentContext.EndDate;
|
---|
266 | if FCurrentContext.EndDate = '' then calEndDate.FMDateTime := FMToday;
|
---|
267 | end;
|
---|
268 | if lstStatus.ItemID = '3' then
|
---|
269 | lblAuthor.Caption := 'Expected Cosigner:'
|
---|
270 | else
|
---|
271 | lblAuthor.Caption := 'Author:';
|
---|
272 | cboAuthor.Caption := lblAuthor.Caption;
|
---|
273 | if (lstStatus.ItemID = '1') or (lstStatus.ItemID = '5') then
|
---|
274 | begin
|
---|
275 | cboAuthor.ItemIndex := -1;
|
---|
276 | cboAuthor.Enabled := False;
|
---|
277 | lblAuthor.Enabled := False;
|
---|
278 | if FMaxDocs > 0 then
|
---|
279 | edMaxDocs.Text := IntToStr(FMaxDocs)
|
---|
280 | else
|
---|
281 | edMaxDocs.Text := '';
|
---|
282 | edMaxDocs.Enabled := True;
|
---|
283 | lblMaxDocs.Enabled := True;
|
---|
284 | end
|
---|
285 | else
|
---|
286 | begin
|
---|
287 | cboAuthor.Enabled := True;
|
---|
288 | cboAuthor.SelectByIEN(FAuthor);
|
---|
289 | lblAuthor.Enabled := True;
|
---|
290 | edMaxDocs.Text := '';
|
---|
291 | edMaxDocs.Enabled := False;
|
---|
292 | lblMaxDocs.Enabled := False;
|
---|
293 | end;
|
---|
294 | end;
|
---|
295 |
|
---|
296 |
|
---|
297 | procedure TfrmTIUView.cboAuthorNeedData(Sender: TObject;
|
---|
298 | const StartFrom: string; Direction, InsertAt: Integer);
|
---|
299 | begin
|
---|
300 | cboAuthor.ForDataUse(SubSetOfActiveAndInactivePersons(StartFrom, Direction));
|
---|
301 | end;
|
---|
302 |
|
---|
303 | procedure TfrmTIUView.cmdClearClick(Sender: TObject);
|
---|
304 | begin
|
---|
305 | cboSortBy.ItemIndex := -1;
|
---|
306 | cboGroupBy.ItemIndex := -1;
|
---|
307 | ckTitle.Checked := False;
|
---|
308 | ckSubject.Checked := False;
|
---|
309 | txtKeyWord.Text := '';
|
---|
310 | radTreeSort.ItemIndex := 1;
|
---|
311 | radListSort.ItemIndex := 1;
|
---|
312 | end;
|
---|
313 |
|
---|
314 | end.
|
---|