[453] | 1 | //kt -- Modified with SourceScanner on 8/8/2007
|
---|
| 2 | unit fOptionsOther;
|
---|
| 3 |
|
---|
| 4 | interface
|
---|
| 5 |
|
---|
| 6 | uses
|
---|
| 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 8 | StdCtrls, ExtCtrls, ComCtrls, ORCtrls, ORFn, rOrders, uCore, ORDtTm,
|
---|
| 9 | DKLang;
|
---|
| 10 |
|
---|
| 11 | type
|
---|
| 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 |
|
---|
| 62 | var
|
---|
| 63 | frmOptionsOther: TfrmOptionsOther;
|
---|
| 64 |
|
---|
| 65 | const
|
---|
| 66 | ENC_MAX_LIMIT = 999;
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | procedure DialogOptionsOther(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
|
---|
| 70 |
|
---|
| 71 | implementation
|
---|
| 72 |
|
---|
| 73 | {$R *.DFM}
|
---|
| 74 |
|
---|
| 75 | uses
|
---|
| 76 | rOptions, uOptions, rCore, rSurgery, uConst, fMeds;
|
---|
| 77 |
|
---|
| 78 | procedure DialogOptionsOther(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
|
---|
| 79 | // create the form and make it modal, return an action
|
---|
| 80 | var
|
---|
| 81 | frmOptionsOther: TfrmOptionsOther;
|
---|
| 82 | begin
|
---|
| 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;
|
---|
| 103 | end;
|
---|
| 104 |
|
---|
| 105 | procedure TfrmOptionsOther.FormShow(Sender: TObject);
|
---|
| 106 | // displays defaults
|
---|
| 107 | // opening tab^use last tab^autosave seconds^verify note title
|
---|
| 108 | var
|
---|
| 109 | last: integer;
|
---|
| 110 | values, tab: string;
|
---|
| 111 | begin
|
---|
| 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);
|
---|
| 142 | end;
|
---|
| 143 |
|
---|
| 144 | procedure TfrmOptionsOther.btnOKClick(Sender: TObject);
|
---|
| 145 | // opening tab^use last tab^autosave seconds^verify note title
|
---|
| 146 | var
|
---|
| 147 | values, theVal: string;
|
---|
| 148 | begin
|
---|
| 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;
|
---|
| 179 | end;
|
---|
| 180 |
|
---|
| 181 | procedure TfrmOptionsOther.FormCreate(Sender: TObject);
|
---|
| 182 | begin
|
---|
| 183 | FStartDT := 0;
|
---|
| 184 | FStopDT := 0;
|
---|
| 185 | end;
|
---|
| 186 |
|
---|
| 187 | procedure TfrmOptionsOther.dtStartExit(Sender: TObject);
|
---|
| 188 | begin
|
---|
| 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;
|
---|
| 197 | end;
|
---|
| 198 |
|
---|
| 199 | procedure TfrmOptionsOther.dtStopExit(Sender: TObject);
|
---|
| 200 | begin
|
---|
| 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;
|
---|
| 210 | end;
|
---|
| 211 |
|
---|
| 212 | procedure TfrmOptionsOther.dtStartChange(Sender: TObject);
|
---|
| 213 | begin
|
---|
| 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;
|
---|
| 222 | end;
|
---|
| 223 |
|
---|
| 224 | procedure TfrmOptionsOther.txtEncStartChange(Sender: TObject);
|
---|
| 225 | begin
|
---|
| 226 | with 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;
|
---|
| 242 | end;
|
---|
| 243 |
|
---|
| 244 | procedure TfrmOptionsOther.txtEncStopChange(Sender: TObject);
|
---|
| 245 | begin
|
---|
| 246 | with 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;
|
---|
| 262 | end;
|
---|
| 263 |
|
---|
| 264 | procedure TfrmOptionsOther.txtEncStartExit(Sender: TObject);
|
---|
| 265 | begin
|
---|
| 266 | with txtEncStart do
|
---|
| 267 | if Text = '' then
|
---|
| 268 | Text := '0';
|
---|
| 269 | end;
|
---|
| 270 |
|
---|
| 271 | procedure TfrmOptionsOther.txtEncStopExit(Sender: TObject);
|
---|
| 272 | begin
|
---|
| 273 | with txtEncStart do
|
---|
| 274 | if Text = '' then
|
---|
| 275 | Text := '0';
|
---|
| 276 | end;
|
---|
| 277 |
|
---|
| 278 | procedure TfrmOptionsOther.btnEncDefaultsClick(Sender: TObject);
|
---|
| 279 | begin
|
---|
| 280 | txtEncStart.Text := IntToStr(FEncDefStartDays);
|
---|
| 281 | txtEncStop.Text := IntToStr(FEncDefStopDays);
|
---|
| 282 | end;
|
---|
| 283 |
|
---|
| 284 | end.
|
---|