source: cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptionsOther.pas@ 470

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 9.0 KB
Line 
1//kt -- Modified with SourceScanner on 8/8/2007
2unit fOptionsOther;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 StdCtrls, ExtCtrls, ComCtrls, ORCtrls, ORFn, rOrders, uCore, ORDtTm,
9 DKLang;
10
11type
12 TfrmOptionsOther = class(TForm)
13 pnlBottom: TPanel;
14 btnOK: TButton;
15 btnCancel: TButton;
16 bvlBottom: TBevel;
17 stStart: TStaticText;
18 stStop: TStaticText;
19 dtStart: TORDateBox;
20 dtStop: TORDateBox;
21 lblMedsTab: TLabel;
22 lblTabDefault: TStaticText;
23 lblTab: TLabel;
24 cboTab: TORComboBox;
25 chkLastTab: TCheckBox;
26 Bevel1: TBevel;
27 lblEncAppts: TLabel;
28 stStartEncAppts: TStaticText;
29 txtTodayMinus: TStaticText;
30 txtEncStart: TCaptionEdit;
31 txtDaysMinus: TStaticText;
32 spnEncStart: TUpDown;
33 txtDaysPlus: TStaticText;
34 spnEncStop: TUpDown;
35 txtEncStop: TCaptionEdit;
36 txtTodayPlus: TStaticText;
37 stStopEncAppts: TStaticText;
38 Bevel2: TBevel;
39 btnEncDefaults: TButton;
40 DKLanguageController1: TDKLanguageController;
41 procedure FormShow(Sender: TObject);
42 procedure btnOKClick(Sender: TObject);
43 procedure FormCreate(Sender: TObject);
44 procedure dtStartExit(Sender: TObject);
45 procedure dtStopExit(Sender: TObject);
46 procedure dtStartChange(Sender: TObject);
47 procedure txtEncStartChange(Sender: TObject);
48 procedure txtEncStopChange(Sender: TObject);
49 procedure txtEncStartExit(Sender: TObject);
50 procedure txtEncStopExit(Sender: TObject);
51 procedure btnEncDefaultsClick(Sender: TObject);
52 private
53 { Private declarations }
54 FstartDt: TFMDateTime;
55 FstopDt: TFMDateTime;
56 FEncStartDays, FEncStopDays, FEncDefStartDays, FEncDefStopDays: integer;
57 //FDefaultEvent: string;
58 public
59 { Public declarations }
60 end;
61
62var
63 frmOptionsOther: TfrmOptionsOther;
64
65const
66 ENC_MAX_LIMIT = 999;
67
68
69procedure DialogOptionsOther(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
70
71implementation
72
73{$R *.DFM}
74
75uses
76 rOptions, uOptions, rCore, rSurgery, uConst, fMeds;
77
78procedure DialogOptionsOther(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
79// create the form and make it modal, return an action
80var
81 frmOptionsOther: TfrmOptionsOther;
82begin
83 frmOptionsOther := TfrmOptionsOther.Create(Application);
84 actiontype := 0;
85 try
86 with frmOptionsOther do
87 begin
88 if (topvalue < 0) or (leftvalue < 0) then
89 Position := poScreenCenter
90 else
91 begin
92 Position := poDesigned;
93 Top := topvalue;
94 Left := leftvalue;
95 end;
96 ResizeAnchoredFormToFont(frmOptionsOther);
97 ShowModal;
98 actiontype := btnOK.Tag;
99 end;
100 finally
101 frmOptionsOther.Release;
102 end;
103end;
104
105procedure TfrmOptionsOther.FormShow(Sender: TObject);
106// displays defaults
107// opening tab^use last tab^autosave seconds^verify note title
108var
109 last: integer;
110 values, tab: string;
111begin
112 cboTab.Items.Assign(rpcGetOtherTabs);
113//if (cboTab.Items.IndexOf('Surgery') > -1) and (not ShowSurgeryTab) then <-- original line. //kt 8/8/2007
114 if (cboTab.Items.IndexOf(DKLangConstW('fOptionsOther_Surgery')) > -1) and (not ShowSurgeryTab) then //kt added 8/8/2007
115// cboTab.Items.Delete(cboTab.Items.IndexOf('Surgery')); <-- original line. //kt 8/8/2007
116 cboTab.Items.Delete(cboTab.Items.IndexOf(DKLangConstW('fOptionsOther_Surgery'))); //kt added 8/8/2007
117 values := rpcGetOther;
118 tab := Piece(values, '^', 1);
119 last := strtointdef(Piece(values, '^', 2), 0);
120 cboTab.SelectByID(tab);
121 cboTab.Tag := strtointdef(tab, -1);
122 chkLastTab.Checked := last = 1;
123 chkLastTab.Tag := last;
124 cboTab.SetFocus;
125 rpcGetRangeForMeds(FstartDt, FstopDt);
126 if FstartDt > 1 then
127 dtStart.Text := FormatFMDateTime('mmm d, yyyy',FstartDt);
128 if FstopDt > 1 then
129 dtStop.Text := FormatFMDateTime('mmm d, yyyy', FstopDt);
130 rpcGetRangeForEncs(FEncDefStartDays, FEncDefStopDays, True); // True gets params settings above User/Service level.
131 if FEncDefStartDays < 1 then
132 FEncDefStartDays := 0;
133 if FEncDefStopDays < 1 then
134 FEncDefStopDays := 0;
135 rpcGetRangeForEncs(FEncStartDays, FEncStopDays, False); // False gets User/Service params.
136 if ((FEncStartDays < 0) and (FEncStartDays <> 0)) then
137 FEncStartDays := FEncDefStartDays;
138 txtEncStart.Text := IntToStr(FEncStartDays);
139 if ((FEncStopDays < 0) and (FEncStopDays <> 0)) then
140 FEncStopDays := FEncDefStopDays;
141 txtEncStop.Text := IntToStr(FEncStopDays);
142end;
143
144procedure TfrmOptionsOther.btnOKClick(Sender: TObject);
145// opening tab^use last tab^autosave seconds^verify note title
146var
147 values, theVal: string;
148begin
149 values := '';
150 if cboTab.ItemIEN <> cboTab.Tag then
151 values := values + cboTab.ItemID;
152 values := values + '^';
153 if chkLastTab.Checked then
154 if chkLastTab.Tag <> 1 then
155 values := values + '1';
156 if not chkLastTab.Checked then
157 if chkLastTab.Tag <> 0 then
158 values := values + '0';
159 values := values + '^^';
160 rpcSetOther(values);
161 if (dtStop.FMDateTime > 0) and (dtStart.FMDateTime > 0) then
162 begin
163 if dtStop.FMDateTime < dtStart.FMDateTime then
164 begin
165// ShowMessage('The stop time can not prior to the start time.'); <-- original line. //kt 8/8/2007
166 ShowMessage(DKLangConstW('fOptionsOther_The_stop_time_can_not_prior_to_the_start_timex')); //kt added 8/8/2007
167 dtStop.FMDateTime := FMToday;
168 dtStop.SetFocus;
169 Exit;
170 end;
171 theVal := dtStart.RelativeTime + ';' + dtStop.RelativeTime;
172 rpcPutRangeForMeds(theVal);
173 end;
174 if (dtStart.Text = '') and (dtStop.Text = '') then
175 rpcPutRangeForMeds('');
176 rpcPutRangeForEncs(txtEncStart.Text, txtEncStop.Text);
177 if frmMeds <> nil then
178 frmMeds.RefreshMedLists;
179end;
180
181procedure TfrmOptionsOther.FormCreate(Sender: TObject);
182begin
183 FStartDT := 0;
184 FStopDT := 0;
185end;
186
187procedure TfrmOptionsOther.dtStartExit(Sender: TObject);
188begin
189 if dtStart.FMDateTime > FMToday then
190 begin
191// ShowMessage('Start time can not greater than today.'); <-- original line. //kt 8/8/2007
192 ShowMessage(DKLangConstW('fOptionsOther_Start_time_can_not_greater_than_todayx')); //kt added 8/8/2007
193 dtStart.FMDateTime := FMToday;
194 dtStart.SetFocus;
195 Exit;
196 end;
197end;
198
199procedure TfrmOptionsOther.dtStopExit(Sender: TObject);
200begin
201 if (dtStop.FMDateTime > 0) and (dtStart.FMDateTime > 0) then
202 if (dtStop.FMDateTime < dtStart.FMDateTime) then
203 begin
204// ShowMessage('Stop time can not prior to start time'); <-- original line. //kt 8/8/2007
205 ShowMessage(DKLangConstW('fOptionsOther_Stop_time_can_not_prior_to_start_time')); //kt added 8/8/2007
206 dtStop.FMDateTime := FMToday;
207 dtStop.SetFocus;
208 Exit;
209 end;
210end;
211
212procedure TfrmOptionsOther.dtStartChange(Sender: TObject);
213begin
214 if (dtStart.FMDateTime > FMToday) then
215 begin
216// ShowMessage('Start time can not greater than today.'); <-- original line. //kt 8/8/2007
217 ShowMessage(DKLangConstW('fOptionsOther_Start_time_can_not_greater_than_todayx')); //kt added 8/8/2007
218 dtStart.FMDateTime := FMToday;
219 dtStart.SetFocus;
220 Exit;
221 end;
222end;
223
224procedure TfrmOptionsOther.txtEncStartChange(Sender: TObject);
225begin
226with txtEncStart do
227 begin
228 if Text = '' then
229 Exit;
230 if Text = ' ' then
231 Text := '0';
232 if StrToInt(Text) < 0 then
233 Text := '0';
234 if StrToIntDef(Text, ENC_MAX_LIMIT) > ENC_MAX_LIMIT then
235 begin
236 Text := IntToStr(ENC_MAX_LIMIT);
237 Beep;
238// InfoBox('Number must be < ' + IntToStr(ENC_MAX_LIMIT), 'Warning', MB_OK or MB_ICONWARNING); <-- original line. //kt 8/8/2007
239 InfoBox(DKLangConstW('fOptionsOther_Number_must_be_x')+' ' + IntToStr(ENC_MAX_LIMIT), DKLangConstW('fOptionsOther_Warning'), MB_OK or MB_ICONWARNING); //kt added 8/8/2007
240 end;
241 end;
242end;
243
244procedure TfrmOptionsOther.txtEncStopChange(Sender: TObject);
245begin
246with txtEncStop do
247 begin
248 if Text = '' then
249 Exit;
250 if Text = ' ' then
251 Text := '0';
252 if StrToInt(Text) < 0 then
253 Text := '0';
254 if StrToIntDef(Text, ENC_MAX_LIMIT) > ENC_MAX_LIMIT then
255 begin
256 Text := IntToStr(ENC_MAX_LIMIT);
257 Beep;
258// InfoBox('Number must be < ' + IntToStr(ENC_MAX_LIMIT), 'Warning', MB_OK or MB_ICONWARNING); <-- original line. //kt 8/8/2007
259 InfoBox(DKLangConstW('fOptionsOther_Number_must_be_x') + IntToStr(ENC_MAX_LIMIT), DKLangConstW('fOptionsOther_Warning'), MB_OK or MB_ICONWARNING); //kt added 8/8/2007
260 end;
261 end;
262end;
263
264procedure TfrmOptionsOther.txtEncStartExit(Sender: TObject);
265begin
266with txtEncStart do
267 if Text = '' then
268 Text := '0';
269end;
270
271procedure TfrmOptionsOther.txtEncStopExit(Sender: TObject);
272begin
273with txtEncStart do
274 if Text = '' then
275 Text := '0';
276end;
277
278procedure TfrmOptionsOther.btnEncDefaultsClick(Sender: TObject);
279begin
280txtEncStart.Text := IntToStr(FEncDefStartDays);
281txtEncStop.Text := IntToStr(FEncDefStopDays);
282end;
283
284end.
Note: See TracBrowser for help on using the repository browser.