Procedure

TfrmOptionsOther.btnOKClick

Module

fOptionsOther

Last Modified

7/15/2014 3:26:40 PM

Comments

Opening tab^use last tab^autosave seconds^verify note title

Visibility

Public/Published

Owner

TfrmOptionsOther

Declaration

procedure btnOKClick(Sender: TObject);

Calls Hierarchy


TfrmOptionsOther.btnOKClick
 ├rpcSetOther
 ├FMToday
 │ └FMNow
 ├rpcPutRangeForMeds
 ├rpcPutRangeForEncs
 └TfrmMeds.RefreshMedLists
   ├TfrmFrame.GetTimedOut
   │ └TimedOut
   ├LoadActiveMedLists
   │ ├ClearMedList
   │ └SetMedFields
   ├TfrmMeds.SetViewCaption
   └TfrmMeds.GetPlainText
     ├TfrmMeds.GetMedList
     ├TfrmMeds.GetHeader
     └TfrmMeds.GetListText
       ├TfrmMeds.GetActionText
       └TfrmMeds.GetInstructText

Calls

Name Declaration Comments
FMToday function FMToday: TFMDateTime; -
TfrmMeds.RefreshMedLists procedure RefreshMedLists; -
rpcPutRangeForEncs procedure rpcPutRangeForEncs(StartDays, StopDays: string); -
rpcPutRangeForMeds procedure rpcPutRangeForMeds(TheVal: string); -
rpcSetOther procedure rpcSetOther(info: String); -


Source

143   procedure TfrmOptionsOther.btnOKClick(Sender: TObject);
144   // opening tab^use last tab^autosave seconds^verify note title
145   var
146     values, theVal: string;
147   begin
148     OK2Closed := True;
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 (dtStart.Text = '') and (dtStop.Text = '') then
162       begin
163         if InfoBox('A date range is not set for the meds tab. Continue?', 'No Date Range Defined', MB_YESNO) = ID_NO then
164         begin
165            dtStart.SetFocus;
166            OK2Closed := false;
167            Exit;
168         end;
169       end
170     else if (dtStart.Text = '') or (dtStop.Text = '') then
171       begin
172         ShowMsg('A complete date range needs to be set. ');
173         if dtStart.Text = '' then dtStart.SetFocus
174         else dtStop.SetFocus;
175         OK2Closed := false;
176         Exit;
177       end;
178     //if Pos('Y', Uppercase(dtStart.Text))>0 then
179     if Uppercase(Copy(dtStart.Text, Length(dtStart.Text), Length(dtStart.Text))) = 'Y' then
180   
181       begin
182         ShowMsg('Start Date relative date cannot have a Y');
183         OK2Closed := false;
184         dtStart.SetFocus;
185         Exit;
186       end;
187     //if Pos('Y', Uppercase(dtStop.Text))>0 then
188     if Uppercase(Copy(dtStop.Text, Length(dtStop.Text), Length(dtStop.Text))) = 'Y' then
189       begin
190         ShowMsg('Stop Date relative date cannot have a Y');
191         OK2Closed := false;
192         dtStart.SetFocus;
193         Exit;
194       end;
195     if (dtStop.FMDateTime > 0) and (dtStart.FMDateTime > 0) then
196     begin
197       if dtStop.FMDateTime < dtStart.FMDateTime then
198       begin
199         ShowMsg('The stop time can not prior to the start time.');
200         dtStop.FMDateTime := FMToday;
201         dtStop.SetFocus;
202         OK2Closed := false;
203         Exit;
204       end;
205       theVal := dtStart.RelativeTime + ';' + dtStop.RelativeTime;
206       rpcPutRangeForMeds(theVal);
207     end;
208     if (dtStart.Text = '') and (dtStop.Text = '') then
209       rpcPutRangeForMeds('');
210     rpcPutRangeForEncs(txtEncStart.Text, txtEncStop.Text);
211     if frmMeds <> nil then
212       frmMeds.RefreshMedLists;
213   end;