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