[829] | 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, fBase508Form,
|
---|
| 8 | VA508AccessibilityManager;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 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 |
|
---|
| 60 | var
|
---|
| 61 | frmOptionsOther: TfrmOptionsOther;
|
---|
| 62 |
|
---|
| 63 | const
|
---|
| 64 | ENC_MAX_LIMIT = 999;
|
---|
| 65 |
|
---|
| 66 | procedure DialogOptionsOther(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
|
---|
| 67 |
|
---|
| 68 | implementation
|
---|
| 69 |
|
---|
| 70 | {$R *.DFM}
|
---|
| 71 |
|
---|
| 72 | uses
|
---|
| 73 | rOptions, uOptions, rCore, rSurgery, uConst, fMeds, VAUtils;
|
---|
| 74 |
|
---|
| 75 | procedure DialogOptionsOther(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
|
---|
| 76 | // create the form and make it modal, return an action
|
---|
| 77 | var
|
---|
| 78 | frmOptionsOther: TfrmOptionsOther;
|
---|
| 79 | begin
|
---|
| 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;
|
---|
| 100 | end;
|
---|
| 101 |
|
---|
| 102 | procedure TfrmOptionsOther.FormShow(Sender: TObject);
|
---|
| 103 | // displays defaults
|
---|
| 104 | // opening tab^use last tab^autosave seconds^verify note title
|
---|
| 105 | var
|
---|
| 106 | last: integer;
|
---|
| 107 | values, tab: string;
|
---|
| 108 | begin
|
---|
| 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);
|
---|
| 137 | end;
|
---|
| 138 |
|
---|
| 139 | procedure TfrmOptionsOther.btnOKClick(Sender: TObject);
|
---|
| 140 | // opening tab^use last tab^autosave seconds^verify note title
|
---|
| 141 | var
|
---|
| 142 | values, theVal: string;
|
---|
| 143 | begin
|
---|
| 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;
|
---|
| 173 | end;
|
---|
| 174 |
|
---|
| 175 | procedure TfrmOptionsOther.FormCreate(Sender: TObject);
|
---|
| 176 | begin
|
---|
| 177 | FStartDT := 0;
|
---|
| 178 | FStopDT := 0;
|
---|
| 179 | end;
|
---|
| 180 |
|
---|
| 181 | procedure TfrmOptionsOther.dtStartExit(Sender: TObject);
|
---|
| 182 | begin
|
---|
| 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;
|
---|
| 190 | end;
|
---|
| 191 |
|
---|
| 192 | procedure TfrmOptionsOther.dtStopExit(Sender: TObject);
|
---|
| 193 | begin
|
---|
| 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;
|
---|
| 202 | end;
|
---|
| 203 |
|
---|
| 204 | procedure TfrmOptionsOther.dtStartChange(Sender: TObject);
|
---|
| 205 | begin
|
---|
| 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;
|
---|
| 213 | end;
|
---|
| 214 |
|
---|
| 215 | procedure TfrmOptionsOther.txtEncStartChange(Sender: TObject);
|
---|
| 216 | begin
|
---|
| 217 | with 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;
|
---|
| 232 | end;
|
---|
| 233 |
|
---|
| 234 | procedure TfrmOptionsOther.txtEncStopChange(Sender: TObject);
|
---|
| 235 | begin
|
---|
| 236 | with 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;
|
---|
| 251 | end;
|
---|
| 252 |
|
---|
| 253 | procedure TfrmOptionsOther.txtEncStartExit(Sender: TObject);
|
---|
| 254 | begin
|
---|
| 255 | with txtEncStart do
|
---|
| 256 | if Text = '' then
|
---|
| 257 | Text := '0';
|
---|
| 258 | end;
|
---|
| 259 |
|
---|
| 260 | procedure TfrmOptionsOther.txtEncStopExit(Sender: TObject);
|
---|
| 261 | begin
|
---|
| 262 | with txtEncStart do
|
---|
| 263 | if Text = '' then
|
---|
| 264 | Text := '0';
|
---|
| 265 | end;
|
---|
| 266 |
|
---|
| 267 | procedure TfrmOptionsOther.btnEncDefaultsClick(Sender: TObject);
|
---|
| 268 | begin
|
---|
| 269 | txtEncStart.Text := IntToStr(FEncDefStartDays);
|
---|
| 270 | txtEncStop.Text := IntToStr(FEncDefStopDays);
|
---|
| 271 | end;
|
---|
| 272 |
|
---|
| 273 | end.
|
---|