source: cprs/trunk/CPRS-Chart/Options/fOptionsOther.pas@ 1676

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

Upgrade to version 27

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