Changeset 829 for cprs/trunk/CPRS-Chart/Orders/fODMedIV.pas
- Timestamp:
- Jul 7, 2010, 4:31:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Orders/fODMedIV.pas
r456 r829 5 5 uses 6 6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 7 fODBase, Grids, StdCtrls, ORCtrls, ComCtrls, ExtCtrls, Buttons, Menus, IdGlobal; 7 fODBase, Grids, StdCtrls, ORCtrls, ComCtrls, ExtCtrls, Buttons, Menus, IdGlobal, strUtils, 8 VA508AccessibilityManager, VAUtils, fIVRoutes; 8 9 9 10 type … … 19 20 txtSelected: TCaptionEdit; 20 21 cboSelected: TCaptionComboBox; 21 popDuration: TPopupMenu;22 popML: TMenuItem;23 popDays: TMenuItem;24 popHours: TMenuItem;25 popL: TMenuItem;26 22 pnlXDuration: TPanel; 27 23 txtXDuration: TCaptionEdit; 28 24 lblLimit: TLabel; 29 btnXDuration: TBitBtn;30 25 pnlCombo: TPanel; 31 26 cboAdditive: TORComboBox; … … 34 29 lblPriority: TLabel; 35 30 cboPriority: TORComboBox; 31 Label1: TLabel; 32 cboRoute: TORComboBox; 33 cboSchedule: TORComboBox; 34 lblRoute: TLabel; 35 lblSchedule: TLabel; 36 cboType: TComboBox; 37 lblType: TLabel; 38 chkPRN: TCheckBox; 39 txtNSS: TLabel; 40 chkDoseNow: TCheckBox; 41 cboInfusionTime: TComboBox; 42 cboDuration: TComboBox; 43 lblAdminTime: TVA508StaticText; 44 lblFirstDose: TVA508StaticText; 45 txtAllIVRoutes: TLabel; 46 lblTypeHelp: TLabel; 36 47 procedure FormCreate(Sender: TObject); 37 48 procedure tabFluidChange(Sender: TObject); 38 procedure cboAdditiveNeedData(Sender: TObject; const StartFrom: string; Direction,49 procedure cboAdditiveNeedData(Sender: TObject; const StartFrom: string; Direction, 39 50 InsertAt: Integer); 40 51 procedure cboSolutionNeedData(Sender: TObject; const StartFrom: string; Direction, … … 59 70 procedure grdSelectedMouseDown(Sender: TObject; Button: TMouseButton; 60 71 Shift: TShiftState; X, Y: Integer); 61 procedure btnXDurationClick(Sender: TObject);62 procedure popDurationClick(Sender: TObject);63 72 procedure txtXDurationChange(Sender: TObject); 64 73 procedure pnlXDurationEnter(Sender: TObject); 65 74 procedure txtXDurationExit(Sender: TObject); 66 procedure txtRateExit(Sender: TObject); 75 procedure cboScheduleChange(Sender: TObject); 76 procedure cboTypeChange(Sender: TObject); 77 procedure cboRouteChange(Sender: TObject); 78 procedure txtRateChange(Sender: TObject); 79 procedure cboPriorityChange(Sender: TObject); 80 procedure cboPriorityExit(Sender: TObject); 81 procedure cboRouteExit(Sender: TObject); 82 procedure txtNSSClick(Sender: TObject); 83 procedure cboScheduleClick(Sender: TObject); 84 procedure chkPRNClick(Sender: TObject); 85 procedure chkDoseNowClick(Sender: TObject); 86 procedure loadExpectFirstDose; 87 procedure SetSchedule(const x: string); 88 procedure cboScheduleExit(Sender: TObject); 89 procedure cboInfusionTimeChange(Sender: TObject); 90 procedure cboDurationChange(Sender: TObject); 91 procedure cboDurationEnter(Sender: TObject); 92 procedure cboInfusionTimeEnter(Sender: TObject); 93 procedure txtAllIVRoutesClick(Sender: TObject); 94 procedure cboRouteClick(Sender: TObject); 95 procedure lblTypeHelpClick(Sender: TObject); 67 96 private 68 97 FInpatient: Boolean; 98 FNSSAdminTime: string; 99 FNSSScheduleType: string; 100 OSolIEN: integer; 101 OAddIEN: integer; 102 OSchedule: string; 103 oAdmin: string; 104 Action: integer; 105 OrderIEN: string; 106 FAdminTimeText: string; 107 JAWSON: boolean; 108 FOriginalDurationType: integer; 109 FOriginalInfusionType: integer; 110 FInitialOrderID: boolean; 69 111 procedure SetValuesFromResponses; 70 112 procedure DoSetFontSize( FontSize: integer); 71 113 procedure ClickOnGridCell; 72 114 procedure SetLimitationControl(aValue: string); 115 function CreateOtherSchedule: string; 116 function CreateOtherRoute: string; 117 procedure UpdateRoute; 118 procedure DisplayDoseNow(Status: boolean); 119 procedure UpdateDuration(SchType: string); 120 procedure ClearAllFields; 73 121 public 74 122 procedure InitDialog; override; … … 76 124 procedure Validate(var AnErrMsg: string); override; 77 125 procedure SetFontSize( FontSize: integer); override; 126 function ValidateInfusionRate(Rate: string): string; 127 function IVTypeHelpText: string; 128 property NSSAdminTime: string read FNSSAdminTime write FNSSAdminTime; 129 property NSSScheduleType: string read FNSSScheduleType write FNSSScheduleType; 78 130 end; 79 131 … … 85 137 {$R *.DFM} 86 138 87 uses ORFn, uConst, rODMeds, rODBase, uAccessibleStringGrid, fFrame;139 uses ORFn, uConst, rODMeds, rODBase, fFrame, uCore, fOtherSchedule, rCore; 88 140 89 141 const … … 108 160 TX_NO_UNITS = 'Units must be entered for '; 109 161 TX_NO_RATE = 'An infusion rate must be entered.'; 110 TX_BAD_RATE = 'The infusion rate must be: # ml/hr or text@labels per day'; 162 //TX_BAD_RATE = 'The infusion rate must be: # ml/hr or text@labels per day'; 163 TX_BAD_RATE = 'Infusion rate can only be up to 4 digits long or' + CRLF + 'Infusion rate must be # ml/hr or text@labels per day'; 164 TX_NO_INFUSION_TIME = 'An Infusion length must be entered or the Unit of Time for the Infuse Over Time field needs to be cleared out.'; 165 TX_NO_SCHEDULE = 'A schedule is required for an intermittent order.'; 166 TX_BAD_SCHEDULE = 'Unable to resolve non-standard schedule.'; 167 TX_NO_INFUSION_UNIT = 'Invalid Unit of Time, select either "Minutes" or "Hours" for the Infusion Length'; 168 TX_BAD_ROUTE = 'Route cannot be free-text'; 169 TX_LEADING_NUMERIC = 'this additive must start with a leading numeric value'; 111 170 112 171 (* … … 131 190 begin 132 191 frmFrame.pnlVisit.Enabled := false; 192 //AutoSizeDisabled := true; 133 193 inherited; 134 194 AllowQuickOrder := True; … … 147 207 CtrlInits.LoadDefaults(ODForIVFluids); // ODForIVFluids returns TStrings with defaults 148 208 InitDialog; 149 TAccessibleStringGrid.WrapControl(grdSelected);150 209 end; 151 210 … … 154 213 i: Integer; 155 214 begin 156 TAccessibleStringGrid.UnwrapControl(grdSelected);157 215 with grdSelected do for i := 0 to RowCount - 1 do TIVComponent(Objects[0, i]).Free; 158 216 inherited; … … 161 219 162 220 procedure TfrmODMedIV.FormResize(Sender: TObject); 221 var 222 bottom: integer; 163 223 begin 164 224 inherited; … … 170 230 end; 171 231 lblAmount.Left := grdSelected.Left + grdSelected.ColWidths[0]; 232 self.cboType.SelLength := 0; 233 self.cboInfusionTime.SelLength := 0; 234 self.cboDuration.SelLength := 0; 235 bottom := self.cboPriority.Top + self.cboPriority.Height; 236 if self.chkDoseNow.Top < bottom then self.chkDoseNow.Top := bottom + 5; 237 self.txtRate.Height := self.cboInfusionTime.Height; 238 self.txtXDuration.Height := self.cboDuration.Height; 239 self.lblAdminTime.Height := TextHeightByFont(self.lblAdminTime.Font.Handle, 'A'); 240 self.lblFirstDose.Height := TextHeightByFont(self.lblFirstDose.Font.Handle, 'A'); 241 self.lblAdminTime.Width := TextWidthByFont(self.lblAdminTime.Font.Handle, self.lblAdminTime.Caption + ' '); 242 self.lblFirstDose.Width := TextWidthByFont(self.lblFirstDose.Font.Handle, self.lblFirstDose.Caption + ' '); 243 self.lblAdminTime.Top := self.chkDoseNow.Top + self.chkDoseNow.Height + 2; 244 self.lblFirstDose.Top := self.lblAdminTime.Top + self.lblAdminTime.Height + 2; 245 if self.Label1.Top < (self.lblFirstDose.Top + self.lblFirstDose.Height) then 246 begin 247 self.Label1.Top := self.lblFirstDose.Top + self.lblFirstDose.Height + 2; 248 self.memOrder.Top := self.Label1.Top + self.Label1.Height; 249 end; 172 250 end; 173 251 … … 182 260 inherited; 183 261 //grdSelected.Selection := NOSELECTION; 262 //FRouteConflict := False; 263 //lblTypeHelp.Hint := IVTypeHelpText; 264 lblType.Hint := IVTypeHelpText; 265 cboType.Hint := IVTYpeHelpText; 184 266 with grdSelected do for i := 0 to RowCount - 1 do 185 267 begin … … 194 276 cboSolution.InsertSeparator; 195 277 SetControl(cboPriority, 'Priorities'); 278 cboType.Items.Add('Continuous'); 279 cboType.Items.Add('Intermittent'); 280 cboType.ItemIndex := -1; 281 cboType.SelLength := 0; 282 //SetControl(cboRoute, 'Route'); 283 if (cboRoute.ItemIndex = -1) and (cboRoute.Text <> '') then cboRoute.Text := ''; 284 //SetControl(cboSchedule, 'Schedules'); 285 LoadSchedules(cboSchedule.Items, patient.Inpatient); 286 //if (Patient.Inpatient) and (cboSchedule.Items.IndexOfName('Other')<0) then 287 if cboSchedule.Items.IndexOf('Other') = -1 then cboSchedule.Items.Add('OTHER'); 288 289 cboSchedule.Enabled := False; 290 lblschedule.Enabled := False; 291 if cboInfusionTime.Items.Count = 0 then 292 begin 293 cboInfusionTime.Items.add('Minutes'); 294 cboInfusionTime.Items.Add('Hours'); 295 end; 296 cboInfusionTime.Enabled := false; 297 updateDuration(''); 298 if cboDuration.Items.Count = 0 then 299 begin 300 cboDuration.Items.Add('L'); 301 cboDuration.Items.Add('ml'); 302 cboDuration.Items.Add('days'); 303 cboDuration.Items.Add('hours'); 304 end; 305 cboDuration.ItemIndex := -1; 306 cboDuration.Text := ''; 307 if self.txtXDuration.Text <> '' then self.txtXDuration.Text := ''; 308 txtNSS.Visible := false; 309 if (chkDoseNow.Visible = true) and (chkDoseNow.Checked = true) then chkDoseNow.Checked := false; 310 chkDoseNow.Visible := false; 311 chkPRN.Enabled := false; 196 312 end; 197 313 tabFluid.TabIndex := 0; … … 199 315 cboSolution.InitLongList(''); 200 316 cboAdditive.InitLongList(''); 317 JAWSON := true; 318 if ScreenReaderActive = false then 319 begin 320 lblAdminTime.TabStop := false; 321 lblFirstDose.TabStop := false; 322 memOrder.TabStop := false; 323 JAWSON := false; 324 end; 201 325 ActiveControl := cboSolution; //SetFocusedControl(cboSolution); 202 326 StatusText(''); 327 OSolIEN := 0; 328 OAddIEN := 0; 329 OSchedule := ''; 330 oAdmin := ''; 331 self.txtAllIVRoutes.Visible := false; 332 end; 333 334 function TfrmODMedIV.IVTypeHelpText: string; 335 begin 336 result := 'Continuous Type:' + CRLF + ' IVs that run at a specified Rate ( __ml/hr, __mcg/kg/min, etc)' + 337 CRLF + CRLF + 'Intermittent Type:' + CRLF + 338 ' IVs administered at scheduled intervals (Q4H, QDay) or One-Time only, ' + 339 CRLF + ' over a specified time period (e.g. Infuse over 30 min.).' + CRLF + CRLF + 340 'Examples:' + CRLF + 'Continuous = Infusion/drip' + CRLF + 'Intermittent = IVP/IVPB'; 341 end; 342 343 procedure TfrmODMedIV.lblTypeHelpClick(Sender: TObject); 344 var 345 str: string; 346 begin 347 inherited; 348 str := IVTypeHelpText; 349 infoBox(str, 'Informational Help Text', MB_OK); 350 end; 351 352 353 procedure TfrmODMedIV.loadExpectFirstDose; 354 var 355 i: integer; 356 AnIVComponent: TIVComponent; 357 fAddIEN, fSolIEN, Interval, idx: integer; 358 AdminTime: TFMDateTime; 359 Admin, Duration, ShowText, SchTxt, SchType, IVType: string; 360 doseNow, calFirstDose: boolean; 361 begin 362 idx := self.cboSchedule.ItemIndex; 363 IVType := self.cboType.Items.Strings[self.cboType.itemindex]; 364 if idx = -1 then 365 begin 366 if IVType = 'Continuous' then 367 begin 368 self.lblFirstDose.Caption := ''; 369 self.lblFirstDose.Visible := false; 370 end; 371 exit; 372 end; 373 doseNow := true; 374 SchType := Piece(self.cboSchedule.Items.Strings[idx],U,3); 375 if self.EvtID > 0 then doseNow := false; 376 if (IVType = 'Continuous') or ((idx > -1) and ((SchType = 'P') or (SchType = 'O') or (SchType = 'OC')) or 377 (self.chkPRN.Checked = True)) then 378 begin 379 self.lblFirstDose.Caption := ''; 380 self.lblAdminTime.Caption := ''; 381 self.lblFirstDose.Visible := false; 382 self.lblAdminTime.Visible := false; 383 self.lblAdminTime.TabStop := false; 384 self.lblFirstDose.TabStop := false; 385 if (self.cboType.Text = 'Continuous') or (Piece(self.cboSchedule.Items.Strings[idx],U,3) = 'O') then doseNow := false; 386 if chkDoseNow.Checked = true then lblFirstDose.Visible := false; 387 if idx > -1 then oSchedule := Piece(self.cboSchedule.Items.Strings[idx],U,1); 388 if (self.chkPRN.Checked = True) and (idx > -1) and (LeftStr(Piece(self.cboSchedule.Items.Strings[idx],U,1),3)<> 'PRN') then 389 OSchedule := Piece(self.cboSchedule.Items.Strings[idx],U,1) + ' PRN'; 390 DisplayDoseNow(doseNow); 391 exit; 392 // end; 393 end 394 else if SchType <> 'O' then 395 begin 396 self.lblAdminTime.Visible := true; 397 if FAdminTimeText <> '' then self.lblAdminTime.Caption := 'Admin. Time: ' + FAdminTimeText 398 else if Piece(self.cboSchedule.Items[idx],U,4) <> '' then 399 self.lblAdminTime.Caption := 'Admin. Time: ' + Piece(self.cboSchedule.Items[idx],U,4) 400 else self.lblAdminTime.Caption := 'Admin. Time: Not Defined'; 401 end; 402 DisplayDoseNow(doseNow); 403 if chkDoseNow.Checked = true then 404 begin 405 lblFirstDose.Visible := false; 406 Exit; 407 end; 408 self.lblFirstDose.Visible := True; 409 fSolIEN := 0; 410 fAddIEN := 0; 411 for i := 0 to self.grdSelected.RowCount - 1 do 412 begin 413 AniVComponent := TIVComponent(self.grdSelected.Objects[0, i]); 414 if AnIVComponent = nil then Continue; 415 if (AnIVComponent.Fluid = 'B') and (fSolIEN = 0) then fSolIEN := AnIVComponent.IEN; 416 if (AnIVComponent.Fluid = 'A') and (fAddIEN = 0) then fAddIEN := AnIVComponent.IEN; 417 if (fSolIEN > 0) and (fAddIEN > 0) then break; 418 end; 419 SchTxt := self.cboSchedule.Text; 420 Admin := ''; 421 if (self.lblAdminTime.visible = True) and (self.lblAdminTime.Caption <> '') then 422 begin 423 Admin := Copy(self.lblAdminTime.Caption, 14, (Length(self.lblAdminTime.Caption)-1)); 424 if not (Admin[1] in ['0'..'9']) then Admin := ''; 425 end; 426 if (fSolIEN = oSolIEN) and (fAddIEN = oAddIEN) and (OSchedule = SchTxt) and (oAdmin = Admin) then CalFirstDose := false 427 else 428 begin 429 CalFirstDose := True; 430 oSolIEN := fSolIEN; 431 oAddIEN := fAddIEN; 432 oSchedule := SchTxt; 433 oAdmin := Admin; 434 end; 435 if CalFirstDose = True then 436 begin 437 if fAddIEN > 0 then LoadAdminInfo(';' + schTxt, fAddIEN, ShowText, AdminTime, Duration, Admin) 438 else LoadAdminInfo(';' + schTxt, fSolIEN, ShowText, AdminTime, Duration, Admin); 439 if AdminTime > 0 then 440 begin 441 ShowText := 'Expected First Dose: '; 442 Interval := Trunc(FMDateTimeToDateTime(AdminTime) - FMDateTimeToDateTime(FMToday)); 443 case Interval of 444 0: ShowText := ShowText + 'TODAY ' + FormatFMDateTime('(mmm dd, yy) at hh:nn', AdminTime); 445 1: ShowText := ShowText + 'TOMORROW ' + FormatFMDateTime('(mmm dd, yy) at hh:nn', AdminTime); 446 else ShowText := ShowText + FormatFMDateTime('mmm dd, yy at hh:nn', AdminTime); 447 end; 448 end; 449 self.lblFirstDose.Caption := ShowText; 450 end; 451 if (self.lblFirstDose.Visible = true) and (self.lblFirstDose.Caption <> '') and (JAWSON = true) then self.lblFirstDose.TabStop := true 452 else self.lblFirstDose.TabStop := false; 453 if (self.lblAdminTime.Visible = true) and (self.lblAdminTime.Caption <> '') and (JAWSON = true) then self.lblAdminTime.TabStop := true 454 else self.lblAdminTime.TabStop := false; 203 455 end; 204 456 205 457 procedure TfrmODMedIV.Validate(var AnErrMsg: string); 206 458 var 207 ItemOK: Boolean;208 x: string;209 i: Integer;459 DispWarning, ItemOK, Result: Boolean; 460 LDec,RDec,x, tempStr, iunit, infError: string; 461 digits, i, j, Len, temp, Value: Integer; 210 462 211 463 procedure SetError(const x: string); … … 221 473 ItemOK := False; 222 474 for i := 0 to RowCount - 1 do 223 if TIVComponent(Objects[0, i]).Fluid = 'B' then ItemOK := True; 224 if not ItemOK then SetError(TX_NO_BASE); 475 if (Objects[0,i] <> nil) and (TIVComponent(Objects[0, i]).Fluid = 'B') then ItemOK := True; 476 if (not ItemOK) and ((self.cboType.ItemIndex = -1) or (MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Continuous')) then 477 SetError(TX_NO_BASE); 225 478 for i := 0 to RowCount - 1 do 226 479 begin … … 229 482 if (Objects[0, i] <> nil) and (Length(Cells[2, i]) = 0) 230 483 then SetError(TX_NO_UNITS + Cells[0, i]); 231 end; 232 end; 233 if Length(txtRate.Text) = 0 then SetError(TX_NO_RATE) else 234 begin 235 x := Trim(txtRate.Text); 236 ValidateIVRate(x); 237 if Length(x) = 0 then SetError(TX_BAD_RATE) else Responses.Update('RATE', 1, x, x); 238 end; 484 if (Objects[0,i] <> nil) and (TIVComponent(Objects[0, i]).Fluid = 'A') then 485 begin 486 temp := Pos('.', Cells[1, i]); 487 if temp > 0 then 488 begin 489 tempStr := Cells[1, i]; 490 if temp = 1 then 491 begin 492 SetError(cells[0, i] + TX_LEADING_NUMERIC); 493 Exit; 494 end; 495 for j := 1 to temp -1 do if not (tempStr[j] in ['0'..'9']) then 496 begin 497 SetError(cells[0, i] + TX_LEADING_NUMERIC); 498 Exit; 499 end; 500 end; 501 end; 502 end; 503 end; 504 if Pos(U, self.memComments.Text) > 0 then SetError('Comments cannot contain a "^".'); 505 if cboSchedule.ItemIndex > -1 then updateDuration(Piece(cboSchedule.Items.Strings[cboSchedule.itemIndex], U, 3)); 506 if self.cboPriority.Text = '' then SetError('Priority is required'); 507 if (cboRoute.ItemIndex = -1) and (cboRoute.Text <> '') then SetError(TX_BAD_ROUTE); 508 if (cboRoute.ItemIndex > -1) and (cboRoute.ItemIndex = cboRoute.Items.IndexOf('OTHER')) then 509 SetError('A valid route must be selected'); 510 if self.cboRoute.Text = '' then SetError('Route is required'); 511 if (self.txtXDuration.Text <> '') and (self.cboduration.Items.IndexOf(SELF.cboDuration.Text) = -1) then 512 SetError('A valid duration type is required'); 513 if (self.txtXDuration.Text = '') and (self.cboduration.Items.IndexOf(SELF.cboDuration.Text) > -1) then 514 SetError('Cannot have a duration type without a duration value'); 515 516 if self.cboType.ItemIndex = -1 then 517 begin 518 SetError('IV Type is required'); 519 Exit; 520 end; 521 if MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Continuous' then 522 begin 523 if Length(txtRate.Text) = 0 then SetError(TX_NO_RATE) else 524 begin 525 x := Trim(txtRate.Text); 526 if pos('@', X) > 0 then 527 begin 528 LDec := Piece(x, '@', 1); 529 RDec := Piece(x, '@', 2); 530 if (Length(RDec) = 0) or (Length(RDec) > 2) then x := ''; 531 end 532 else if Pos('.',X)>0 then 533 begin 534 LDec := Piece(x, '.', 1); 535 RDec := Piece(x, '.', 2); 536 if Length(LDec) = 0 then SetError('Infusion Rate required a leading numeric value'); 537 if Length(RDec) > 1 then SetError('Infusion Rate cannot exceed one decimal place'); 538 end 539 else if LeftStr(txtRate.Text, 1) = '0' then 540 SetError('Infusion Rate cannot start with a zero.'); 541 if ( Pos('@',x)=0) then 542 begin 543 if (Length(x) > 4) then 544 begin 545 seterror(TX_BAD_RATE); 546 exit; 547 end; 548 for i := 1 to Length(x) do 549 begin 550 if not (x[i] in ['0'..'9']) and (x[i] <> '.') then 551 begin 552 SetError(TX_BAD_RATE); 553 exit; 554 end; 555 end; 556 end; 557 if (pos('ml/hr', X) = 0) and (Length(x) > 0) and (pos('@', X) = 0) then X := X + ' ml/hr'; 558 if Length(x) = 0 then SetError(TX_BAD_RATE) else Responses.Update('RATE', 1, x, x); 559 end; 560 if cboduration.text = 'doses' then SetError('Continuous Orders cannot have "doses" as a duration type'); 561 end 562 else if MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Intermittent' then 563 begin 564 if (cboInfusionTime.ItemIndex = -1) and (txtRate.Text <> '') then SetError(TX_NO_INFUSION_UNIT); 565 if (txtRate.Text = '') and (cboInfusionTime.ItemIndex > -1) then SetError(TX_NO_INFUSION_TIME); 566 if (txtRate.Text <> '') then 567 begin 568 infError := ''; 569 InfError := ValidateInfusionRate(txtRate.Text); 570 if infError <> '' then SetError(InfError); 571 Len := Length(txtRate.Text); 572 iunit := MixedCase(self.cboInfusionTime.Items.Strings[cboInfusionTime.ItemIndex]); 573 if (iunit = 'Minutes') and (Len > 4) then setError('Infuse Over Time cannot exceed 4 spaces for ' + iunit) 574 else if (iunit = 'Hours') and (Len > 2) then setError('Infuse Over Time cannot exceed 2 spaces for ' + iunit); 575 end; 576 if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text = '') then SetError(TX_NO_SCHEDULE); 577 if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text <> '') then SetError(TX_BAD_SCHEDULE); 578 end; 579 if txtXDuration.Text = '' then 580 begin 581 if AnErrMsg = '' then self.FInitialOrderID := True; 582 exit; 583 end; 584 Len := Length(txtXDuration.Text); 585 if LeftStr(txtXDuration.Text,1) <> '.' then 586 begin 587 DispWarning := false; 588 Digits := 2; 589 if cboDuration.text = 'ml' then digits := 4; 590 if ((cboDuration.text = 'days') or (cboDuration.text = 'hours')) and (Len > digits) then 591 DispWarning := true 592 else if (cboduration.text = 'ml') and (Len > digits) then DispWarning := true 593 else if (cboduration.text = 'L') and (Len > digits) and (Pos('.',txtXDuration.Text) = 0) then DispWarning := True; 594 if DispWarning = true then SetError('Duration for ' + cboduration.text + ' cannot be greater than ' + InttoStr(digits) + ' digits.'); 595 end; 596 if (Pos('.', txtXDuration.Text)>0) then 597 begin 598 SetError('Invalid Duration, please enter a whole numbers for a duration.'); 599 end 600 else if LeftStr(txtXDuration.text, 1) = '0' then 601 SetError('Duration cannot start with a zero.'); 602 if (cboduration.text = 'doses') then 603 begin 604 if TryStrToInt(txtXDuration.Text, Value) = false then 605 SetError('Duration with a unit of "doses" must be a whole number between 0 and 2000000') 606 else if (Value < 0) or (Value > 2000000) then 607 SetError('Duration with a unit of "doses" must be greater then 0 and less then 2000000'); 608 end; 609 if AnErrMsg = '' then self.FInitialOrderID := True; 610 611 end; 612 613 function TFrmODMedIV.ValidateInfusionRate(Rate: string): string; 614 var 615 Temp: Boolean; 616 i: integer; 617 begin 618 Temp := False; 619 if Pos('.',Rate) >0 then 620 begin 621 Result := 'Infuse Over Time can only be a whole number'; 622 exit; 623 end 624 else if LeftStr(Rate, 1) = '0' then Result := 'Infuse Over Time cannot start with a zero.'; 625 for i := 1 to Length(Rate) do if not (Rate[i] in ['0'..'9']) then Temp := True; 626 if Temp = True then Result := 'The Infusion time can only be a whole number'; 239 627 end; 240 628 241 629 procedure TfrmODMedIV.SetValuesFromResponses; 242 630 var 243 x : string;244 AnInstance : Integer;631 x, addRoute, tempSch, AdminTime, TempOrder, tmpSch, tempIRoute, tempRoute: string; 632 AnInstance, i, idx: Integer; 245 633 AResponse: TResponse; 246 634 AnIVComponent: TIVComponent; 635 AllIVRoute: TStringList; 636 PQO: boolean; 247 637 begin 248 638 Changing := True; 639 self.FInitialOrderID := false; 249 640 with Responses do 250 641 begin … … 265 656 InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); 266 657 cboAdditive.Text := ''; 658 AbortOrder := True; 267 659 Exit; 268 660 end; … … 273 665 InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); 274 666 cboAdditive.Text := ''; 667 AbortOrder := True; 275 668 Exit; 276 669 end; … … 310 703 InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); 311 704 cboAdditive.Text := ''; 705 AbortOrder := True; 312 706 Exit; 313 707 end; … … 318 712 InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); 319 713 cboAdditive.Text := ''; 714 AbortOrder := true; 320 715 Exit; 321 716 end; … … 342 737 AnInstance := NextInstance('ADDITIVE', AnInstance); 343 738 end; {while AnInstance - ADDITIVE} 344 SetControl(txtRate, 'RATE', 1); 345 if LowerCase(Copy(ReverseStr(txtRate.Text), 1, 6)) = 'rh/lm ' {*kcm*} 346 then txtRate.Text := Copy(txtRate.Text, 1, Length(txtRate.Text) - 6); 739 SetControl(cboType, 'TYPE', 1); 740 if self.grdSelected.RowCount > 0 then self.txtAllIVRoutes.Visible := True; 741 updateRoute; 742 AResponse := FindResponseByName('ROUTE', 1); 743 if AResponse <> nil then 744 begin 745 tempRoute := AResponse.EValue; 746 if tempRoute <> '' then 747 begin 748 idx := self.cboRoute.Items.IndexOf(tempRoute); 749 if idx > -1 then self.cboRoute.ItemIndex := idx 750 else begin 751 tempIRoute := AResponse.IValue; 752 if tempIRoute <> '' then 753 begin 754 AllIVRoute := TStringList.Create; 755 LoadAllIVRoutes(AllIVRoute); 756 idx := -1; 757 for i := 0 to AllIVRoute.Count - 1 do 758 begin 759 if Piece(AllIVRoute.Strings[i], U, 1) = tempIRoute then 760 begin 761 idx := i; 762 break; 763 end; 764 end; 765 if idx > -1 then 766 begin 767 self.cboRoute.Items.Add(AllIVRoute.Strings[idx]); 768 idx := self.cboRoute.Items.IndexOf(tempRoute); 769 if idx > -1 then self.cboRoute.ItemIndex := idx; 770 end; 771 AllIVRoute.Free; 772 //if Pos(U, tempIRoute) = 0 then tempIRoute := tempIRoute + U + tempRoute; 773 //self.cboRoute.Items.Add(tempIRoute); 774 //idx := self.cboRoute.Items.IndexOf(tempRoute); 775 //if idx > -1 then self.cboRoute.ItemIndex := idx; 776 end; 777 end; 778 end; 779 end; 780 //SetControl(cboRoute, 'ROUTE', 1); 781 if (cboRoute.ItemIndex = -1) and (cboRoute.Text <> '') then cboRoute.Text := ''; 782 if self.cboType.Text = 'Intermittent' then 783 begin 784 lblInfusionRate.Caption := 'Infuse Over Time (Optional)'; 785 lblSchedule.Enabled := True; 786 cboschedule.Enabled := True; 787 //if popDuration.Items.IndexOf(popDoses) = -1 then popDuration.Items.Add(popDoses); 788 if cboDuration.Items.IndexOf('doses') = -1 then cboDuration.Items.Add('doses'); 789 txtNss.Visible := true; 790 chkDoseNow.Visible := true; 791 chkPRN.Enabled := True; 792 tempSch := ''; 793 AdminTime := ''; 794 AResponse := FindResponseByName('SCHEDULE', 1); 795 if AResponse <> nil then tempSch := AResponse.EValue; 796 lblAdminTime.Visible := True; 797 lblAdminTime.Hint := AdminTimeHelpText; 798 lblAdminTime.ShowHint := True; 799 //AResponse := Responses.FindResponseByName('ADMIN', 1); 800 //if AResponse <> nil then AdminTime := AResponse.EValue; 801 //if Action = Order_Copy then FOriginalAdminTime := AdminTime; 802 SetSchedule(tempSch); 803 //if (cboSchedule.ItemIndex > -1) then lblAdminTime.Caption := 'Admin. Time: ' + Piece(cboSchedule.Items.strings[cboSchedule.itemindex],U,5); 804 //if (cboSchedule.ItemIndex > -1) and (Piece(lblAdminTime.Caption, ':' ,2) = ' ') then lblAdminTime.Caption := 'Admin. Time: ' + AdminTime; 805 if (Action in [ORDER_COPY, ORDER_EDIT]) then 806 begin 807 TempOrder := Piece(OrderIEN,';',1); 808 TempOrder := Copy(tempOrder, 2, Length(tempOrder)); 809 if DifferentOrderLocations(tempOrder, Patient.Location) = false then 810 begin 811 AResponse := Responses.FindResponseByName('ADMIN', 1); 812 if AResponse <> nil then AdminTime := AResponse.EValue; 813 //lblAdminTime.Caption := 'Admin. Time: ' + AdminTime; 814 if cboSchedule.ItemIndex > -1 then 815 begin 816 tmpSch := cboSchedule.Items.Strings[cboSchedule.itemindex]; 817 setPiece(tmpSch,U,4,AdminTime); 818 cboSchedule.Items.Strings[cboSchedule.ItemIndex] := tmpSch; 819 end; 820 end; 821 end; 822 //if Piece(lblAdminTime.Caption, ':' ,2) = ' ' then lblAdminTime.Caption := 'Admin. Time: Not Defined'; 823 SetControl(txtRate, 'RATE', 1); 824 cboInfusionTime.Enabled := true; 825 PQO := false; 826 if Pos('INFUSE OVER',UpperCase(txtRate.Text)) > 0 then 827 begin 828 txtRate.Text := Copy(txtRate.Text,Length('Infuse over ')+1,Length(txtRate.text)); 829 PQO := True; 830 end; 831 if Pos('MINUTE',UpperCase(txtRate.Text))>0 then 832 begin 833 cboInfusionTime.Text := 'Minutes'; 834 cboInfusionTime.itemindex := 0; 835 //txtRate.Text := Copy(txtRate.Text,Length('Infuse over ')+1,Length(txtRate.text)); 836 txtRate.Text := Copy(txtRate.Text, 1, Length(txtRate.Text) - 8); 837 end 838 else if Pos('HOUR',UpperCase(txtRate.Text))>0 then 839 begin 840 cboInfusionTime.Text := 'Hours'; 841 cboInfusionTime.ItemIndex := 1; 842 //txtRate.Text := Copy(txtRate.Text,Length('Infuse over ')+1,Length(txtRate.text)); 843 txtRate.Text := Copy(txtRate.Text, 1, Length(txtRate.Text) - 6); 844 end 845 else if (txtRate.Text <> '') and (PQO = false) and (ValidateInfusionRate(txtRate.Text) ='') then 846 begin 847 cboInfusionTime.Text := 'Minutes'; 848 cboInfusionTime.itemindex := 0; 849 end; 850 end 851 else 852 begin 853 lblSchedule.Enabled := false; 854 cboSchedule.ItemIndex := -1; 855 cboSchedule.Enabled := false; 856 if chkDoseNow.Visible = true then chkDoseNow.Checked := false; 857 chkDoseNow.Visible := false; 858 txtNSS.Visible := false; 859 cboInfusionTime.ItemIndex := -1; 860 cboInfusionTime.Text := ''; 861 cboInfusionTime.Enabled := false; 862 chkPRN.Checked := false; 863 chkPRN.Enabled := false; 864 txtRate.Text := ''; 865 cboDuration.ItemIndex := -1; 866 cboDuration.Text := ''; 867 txtXDuration.Text := ''; 868 SetControl(txtRate, 'RATE', 1); 869 if LowerCase(Copy(ReverseStr(txtRate.Text), 1, 6)) = 'rh/lm ' {*kcm*} 870 then txtRate.Text := Copy(txtRate.Text, 1, Length(txtRate.Text) - 6); 871 end; 347 872 SetControl(cboPriority, 'URGENCY', 1); 348 873 SetControl(memComments, 'COMMENT', 1); … … 357 882 end; {if...with Responses} 358 883 Changing := False; 884 if self.cboSchedule.ItemIndex > -1 then updateDuration(Piece(cboSchedule.Items.Strings[cboSchedule.itemindex],U,3)); 885 loadExpectFirstDose; 359 886 ControlChange(Self); 360 887 end; … … 363 890 begin 364 891 inherited; 365 if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then SetValuesFromResponses; 892 Action := OrderAction; 893 OrderIEN := id; 894 self.FInitialOrderID := True; 895 if self.EvtID > 0 then FAdminTimeText := 'To Be Determined'; 896 if (isIMO) or ((patient.Inpatient = true) and (encounter.Location <> patient.Location)) and (FAdminTimeText = '') then 897 FAdminTimeText := 'Not defined for Clinic Locations'; 898 if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then 899 begin 900 901 SetValuesFromResponses; 902 end; 366 903 end; 367 904 … … 400 937 end; 401 938 939 procedure TfrmODMedIV.cbotypeChange(Sender: TObject); 940 begin 941 inherited; 942 //if (self.cbotype.Text = 'Intermittent') or (self.cboType.itemIndex = 1) then 943 if (self.cboType.itemIndex = 1) then 944 begin 945 cboSchedule.ItemIndex := -1; 946 lblAdminTime.Caption := ''; 947 lblAdminTime.Visible := false; 948 lblschedule.Enabled := True; 949 cboSchedule.Enabled := True; 950 txtNSS.Visible := true; 951 chkDoseNow.Checked := false; 952 chkDoseNow.Visible := true; 953 chkPRN.Checked := false; 954 chkPRN.Enabled := True; 955 lblInfusionRate.Caption := 'Infuse Over Time (Optional)'; 956 cboInfusionTime.Enabled := true; 957 cboDuration.Items.Add('doses'); 958 end 959 //else if (self.cbotype.Text = 'Continuous') or (self.cboType.itemIndex = 0) then 960 else 961 begin 962 lblschedule.Enabled := False; 963 cboSchedule.ItemIndex := -1; 964 cboSchedule.Enabled := False; 965 txtNSS.Visible := false; 966 chkPRN.Checked := false; 967 chkPRN.Enabled := false; 968 if chkDoseNow.Visible = true then chkDoseNow.Checked := false; 969 chkDoseNow.Visible := false; 970 lblInfusionRate.Caption := 'Infusion Rate (ml/hr)*'; 971 cboInfusionTime.ItemIndex := -1; 972 cboInfusionTime.Text := ''; 973 cboInfusionTime.Enabled := false; 974 lblAdminTime.Visible := false; 975 updateDuration(''); 976 cboduration.Items.Delete(cboDuration.Items.IndexOf('doses')); 977 end; 978 self.txtRate.Text := ''; 979 ControlChange(Sender); 980 end; 981 982 procedure TfrmODMedIV.chkDoseNowClick(Sender: TObject); 983 Const 984 T = '"'; 985 T1 = 'By checking the "Give additional dose now" box, you have actually entered two orders for the same medication.'; 986 T2 = #13#13'The first order''s administrative schedule is "'; 987 T3 = #13'The second order''s administrative schedule is "'; 988 T4 = #13#13'Do you want to continue?'; 989 T1A = 'By checking the "Give additional dose now" box, you have actually entered a new order with the schedule "NOW"'; 990 T2A = ' in addition to the one you are placing for the same medication.'; 991 var 992 medNm: string; 993 theSch: string; 994 //SchID: integer; 995 begin 996 inherited; 997 if (chkDoseNow.Checked) then 998 begin 999 medNm := 'Test'; 1000 //SchID := cboSchedule.ItemIndex; 1001 theSch := cboSchedule.Text; 1002 if length(theSch)>0 then 1003 begin 1004 //if (InfoBox(T1+medNm+T+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then 1005 if (InfoBox(T1+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then 1006 begin 1007 chkDoseNow.Checked := False; 1008 Exit; 1009 end; 1010 end else 1011 begin 1012 //if InfoBox(T1A+T2A+medNm+T+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL then 1013 if InfoBox(T1A+T2A+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL then 1014 begin 1015 chkDoseNow.Checked := False; 1016 Exit; 1017 end; 1018 end; 1019 end; 1020 ControlChange(self); 1021 end; 1022 1023 procedure TfrmODMedIV.chkPRNClick(Sender: TObject); 1024 begin 1025 inherited; 1026 ControlChange(Self); 1027 end; 1028 402 1029 procedure TfrmODMedIV.cboSolutionMouseClick(Sender: TObject); 403 1030 var 404 1031 AnIVComponent: TIVComponent; 405 x: string; 1032 x,routeIEN: string; 1033 i: integer; 406 1034 begin 407 1035 inherited; 408 1036 if CharAt(cboSolution.ItemID, 1) = 'Q' then // setup quick order 409 1037 begin 1038 //Clear pre-existing values 1039 for i := 0 to self.grdSelected.RowCount do 1040 begin 1041 if self.grdSelected.Objects[0,i] <> nil then 1042 begin 1043 TIVComponent(self.grdSelected.Objects[0,i]).Free; 1044 self.grdSelected.Rows[i].Clear; 1045 end 1046 else self.grdSelected.Rows[i].clear; 1047 end; 1048 self.grdSelected.RowCount := 0; 1049 ControlChange(Sender); 410 1050 Responses.QuickOrder := ExtractInteger(cboSolution.ItemID); 411 1051 SetValuesFromResponses; … … 432 1072 end; 433 1073 end; 434 1074 RouteIEN := Piece(cboSolution.Items.Strings[cboSolution.itemindex],U,4); 435 1075 x := AmountsForIVFluid(cboSolution.ItemIEN, 'B'); 436 1076 AnIVComponent := TIVComponent.Create; … … 459 1099 Application.ProcessMessages; //CQ: 10157 460 1100 ClickOnGridCell; 1101 updateRoute; 461 1102 ControlChange(Sender); 1103 //updateRoute(routeIEN); 462 1104 end; 463 1105 … … 465 1107 begin 466 1108 inherited; 467 if cboSolution.ItemIEN > 0 then cboSolutionMouseClick(Self); 1109 if EnterIsPressed then //CQ: 15097 1110 if (cboSolution.ItemIEN > 0) or 1111 ((cboSolution.ItemIEN = 0) and (CharAt(cboSolution.ItemID, 1) = 'Q')) then 1112 cboSolutionMouseClick(Self); 468 1113 end; 469 1114 … … 481 1126 end; 482 1127 1128 procedure TfrmODMedIV.cboDurationChange(Sender: TObject); 1129 begin 1130 inherited; 1131 if (FOriginalDurationType > -1) and (FOriginalDurationType <> cboDuration.ItemIndex) then 1132 begin 1133 self.txtXDuration.Text := ''; 1134 FOriginalDurationType := cboDuration.ItemIndex; 1135 end; 1136 if (FOriginalDurationType = -1) and (cboDuration.ItemIndex > -1) then FOriginalDurationType := cboDuration.ItemIndex; 1137 controlchange(sender); 1138 end; 1139 1140 procedure TfrmODMedIV.cboDurationEnter(Sender: TObject); 1141 begin 1142 inherited; 1143 FOriginalDurationType := cboDuration.ItemIndex; 1144 end; 1145 1146 1147 procedure TfrmODMedIV.cboInfusionTimeChange(Sender: TObject); 1148 begin 1149 inherited; 1150 if (FOriginalInfusionType > -1) and (FOriginalInfusionType <> cboInfusionTime.ItemIndex) then 1151 begin 1152 self.txtRate.Text := ''; 1153 FOriginalInfusionType := cboInfusionTime.ItemIndex; 1154 end; 1155 if (FOriginalInfusionType = -1) and (cboInfusionTime.ItemIndex > -1) then FOriginalInfusionType := cboInfusionTime.ItemIndex; 1156 ControlChange(Sender); 1157 end; 1158 1159 procedure TfrmODMedIV.cboInfusionTimeEnter(Sender: TObject); 1160 begin 1161 inherited; 1162 FOriginalInfusionType := self.cboInfusionTime.ItemIndex; 1163 end; 1164 1165 procedure TfrmODMedIV.cboPriorityChange(Sender: TObject); 1166 begin 1167 inherited; 1168 ControlChange(sender); 1169 end; 1170 1171 procedure TfrmODMedIV.cboPriorityExit(Sender: TObject); 1172 begin 1173 inherited; 1174 if cboPriority.Text = '' then 1175 begin 1176 infoBox('Priority must have a value assigned to it', 'Warning', MB_OK); 1177 cboPriority.SetFocus; 1178 end; 1179 end; 1180 1181 procedure TfrmODMedIV.cboRouteChange(Sender: TObject); 1182 begin 1183 inherited; 1184 if cboRoute.ItemIndex = cboRoute.Items.IndexOf('OTHER') then cboRouteClick(cboRoute); 1185 ControlChange(sender); 1186 end; 1187 1188 procedure TfrmODMedIV.cboRouteClick(Sender: TObject); 1189 var 1190 otherRoute, temp: string; 1191 idx, oidx: integer; 1192 begin 1193 inherited; 1194 oidx := cboRoute.Items.IndexOf('OTHER'); 1195 if oidx = -1 then exit; 1196 1197 if cboRoute.ItemIndex = oidx then 1198 begin 1199 otherRoute := CreateOtherRoute; 1200 if length(otherRoute) > 1 then 1201 begin 1202 idx := cboRoute.Items.IndexOf(Piece(OtherRoute, U, 2)); 1203 if idx > -1 then 1204 begin 1205 temp := cboRoute.Items.Strings[idx]; 1206 //setPiece(temp,U,5,'1'); 1207 cboRoute.Items.Strings[idx] := temp; 1208 end 1209 else 1210 begin 1211 cboRoute.Items.Add(otherRoute); 1212 idx := cboRoute.Items.IndexOf(Piece(OtherRoute, U, 2)); 1213 end; 1214 cboRoute.ItemIndex := idx; 1215 end 1216 else 1217 begin 1218 cboRoute.ItemIndex := -1; 1219 cboRoute.SetFocus; 1220 end; 1221 end; 1222 end; 1223 1224 procedure TfrmODMedIV.cboRouteExit(Sender: TObject); 1225 begin 1226 inherited; 1227 (* if (cboRoute.Text <> '') and (cboRoute.ItemIndex = -1) then 1228 begin 1229 infoBox(TX_BAD_ROUTE,'Warning',MB_OK); 1230 cboRoute.SetFocus; 1231 end; *) 1232 end; 1233 483 1234 procedure TfrmODMedIV.cboAdditiveMouseClick(Sender: TObject); 484 1235 var 485 1236 AnIVComponent: TIVComponent; 486 x : string;1237 x, routeIEN: string; 487 1238 begin 488 1239 inherited; … … 506 1257 end; 507 1258 end; 1259 routeIEN := Piece(cboAdditive.Items.Strings[cboAdditive.itemindex],U,4); 508 1260 x := AmountsForIVFluid(cboAdditive.ItemIEN, 'A'); 509 1261 AnIVComponent := TIVComponent.Create; … … 526 1278 Application.ProcessMessages; //CQ: 10157 527 1279 ClickOnGridCell; 1280 updateRoute; 528 1281 ControlChange(Sender); 1282 //UpdateRoute(RouteIEN); 529 1283 end; 530 1284 … … 532 1286 begin 533 1287 inherited; 534 if cboAdditive.ItemIEN > 0 then cboAdditiveMouseClick(Self); 1288 if (cboAdditive.ItemIEN > 0) and (EnterIsPressed) then 1289 cboAdditiveMouseClick(Self); 535 1290 end; 536 1291 537 1292 { grdSelected events } 1293 1294 procedure TfrmODMedIV.ClearAllFields; 1295 begin 1296 self.cboType.ItemIndex := -1; 1297 self.cboType.Text := ''; 1298 self.memComments.Text := ''; 1299 self.txtRate.Text := ''; 1300 self.txtXDuration.text := ''; 1301 self.cboDuration.ItemIndex := -1; 1302 self.cboDuration.Text := ''; 1303 self.txtAllIVRoutes.Visible := false; 1304 self.FInitialOrderID := True; 1305 cbotypeChange(self.cboType); 1306 if self.cboroute.Items.Count > 0 then self.cboRoute.Clear; 1307 end; 538 1308 539 1309 procedure TfrmODMedIV.ClickOnGridCell; … … 608 1378 end; 609 1379 1380 procedure TfrmODMedIV.cboScheduleChange(Sender: TObject); 1381 begin 1382 inherited; 1383 if self.txtXDuration.Enabled = true then 1384 begin 1385 self.txtXDuration.Text := ''; 1386 self.cboDuration.ItemIndex := -1; 1387 end; 1388 if self.cboSchedule.ItemIndex > -1 then updateDuration(Piece(cboSchedule.Items.Strings[cboSchedule.itemindex],U,3)); 1389 ControlChange(sender); 1390 end; 1391 1392 procedure TfrmODMedIV.cboScheduleClick(Sender: TObject); 1393 var 1394 othSch: string; 1395 idx, i : integer; 1396 begin 1397 inherited; 1398 if cboSchedule.ItemIndex = cboSchedule.Items.IndexOf('Other') then 1399 begin 1400 othSch := CreateOtherSchedule; 1401 if length(trim(othSch)) > 1 then 1402 begin 1403 cboSchedule.Items.Add(othSch + U + U + NSSScheduleType + U + NSSAdminTime); 1404 idx := -1; 1405 for I := 0 to cboSchedule.Items.Count - 1 do 1406 if Piece(cboSchedule.Items.Strings[i], U, 1) = othSch then 1407 begin 1408 idx := i; 1409 break; 1410 end; 1411 //idx := cboSchedule.Items.IndexOfName(othSch); 1412 cboSchedule.ItemIndex := idx; 1413 end; 1414 end 1415 else 1416 begin 1417 NSSAdminTime := ''; 1418 NSSScheduleType := ''; 1419 end; 1420 end; 1421 1422 procedure TfrmODMedIV.cboScheduleExit(Sender: TObject); 1423 begin 1424 inherited; 1425 if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text <> '') then 1426 begin 1427 infoBox('Please select a valid schedule from the list.'+ CRLF + CRLF + 1428 'If you would like to create a Day-of-Week schedule please select ''OTHER'' from the list.', 1429 'Incorrect Schedule.', MB_OK); 1430 cboSchedule.Text := ''; 1431 cboSchedule.SetFocus; 1432 end; 1433 end; 1434 610 1435 procedure TfrmODMedIV.cboSelectedChange(Sender: TObject); // combo editor for grid 611 1436 begin … … 632 1457 procedure TfrmODMedIV.cmdRemoveClick(Sender: TObject); // remove button for grid 633 1458 var 634 i : Integer;1459 i, stRow, stRowCount: Integer; 635 1460 begin 636 1461 inherited; … … 638 1463 begin 639 1464 if Row < 0 then Exit; 1465 stRow := Row; 1466 stRowCount := RowCount; 640 1467 if Objects[0, Row] <> nil then TIVComponent(Objects[0, Row]).Free; 641 1468 for i := Row to RowCount - 2 do Rows[i] := Rows[i + 1]; … … 643 1470 RowCount := RowCount - 1; 644 1471 end; 1472 updateRoute; 1473 if (stRowCount = 1) and (stRow = 0) then 1474 begin 1475 //self.cboRoute.ItemIndex := -1; 1476 ClearAllFields; 1477 end; 645 1478 ControlChange(Sender); 646 1479 end; … … 650 1483 procedure TfrmODMedIV.ControlChange(Sender: TObject); 651 1484 var 652 i, CurAdd, CurBase : Integer;653 x,xlimIn,xLimEx,eSch,iSch: string;1485 i, CurAdd, CurBase, idx: Integer; 1486 adminTime,x,xlimIn,xLimEx,eSch,iSch,iType, tmpdur, tmpSch, tmpRate: string; 654 1487 AnIVComponent: TIVComponent; 655 1488 FQOSchedule: TResponse; … … 666 1499 inherited; 667 1500 if Changing then Exit; 1501 loadExpectFirstDose; 668 1502 // FQOSchedule := TResponse.Create; 669 1503 FQOSchedule := Responses.FindResponseByName('SCHEDULE',1); … … 676 1510 Responses.Clear; // want this to clear even after SetupDialog in case instances don't match 677 1511 CurAdd := 1; CurBase := 1; 1512 tmpRate := ''; 678 1513 with grdSelected do for i := 0 to RowCount - 1 do 679 1514 begin … … 702 1537 if length(txtXDuration.Text) > 0 then 703 1538 begin 704 if (btnXDuration.Caption = 'L') or (btnXDuration.Caption = 'ml') then 705 begin 706 xlimEx := 'with total volume ' + txtXDuration.Text + btnXDuration.Caption; 707 xlimIn := 'with total volume ' + txtXDuration.Text + btnXDuration.Caption; 1539 tmpDur := LowerCase(cboDuration.Text); 1540 if (tmpDur = 'l') or (tmpDur = 'ml') then 1541 begin 1542 xlimEx := 'with total volume ' + txtXDuration.Text + self.cboDuration.items.strings[self.cboDuration.itemindex]; 1543 xlimIn := 'with total volume ' + txtXDuration.Text + self.cboDuration.items.strings[self.cboDuration.itemindex]; 708 1544 end 709 else if (btnXDuration.Caption = 'days') or (btnXDuration.Caption = 'hours') then 710 begin 711 xlimEx := 'for ' + txtXDuration.Text + ' ' + btnXDuration.Caption; 712 xlimIn := 'for ' + txtXDuration.Text + ' ' + btnXDuration.Caption; 713 end else 714 begin 1545 else if (tmpDur = 'days') or (tmpDur = 'hours') then 1546 begin 1547 xlimEx := 'for ' + txtXDuration.Text + ' ' + self.cboDuration.items.strings[self.cboDuration.itemindex]; 1548 xlimIn := 'for ' + txtXDuration.Text + ' ' + self.cboDuration.items.strings[self.cboDuration.itemindex]; 1549 end 1550 else if tmpDur = 'doses' then 1551 begin 1552 xlimEx := 'for a total of ' + txtXDuration.Text + ' ' + self.cboDuration.items.strings[self.cboDuration.itemindex]; 1553 xlimIn := 'for a total of ' + txtXDuration.Text + ' ' + self.cboDuration.items.strings[self.cboDuration.itemindex]; 1554 end 1555 else begin 715 1556 xlimIn := ''; 716 1557 xlimEx := ''; 717 1558 end; 718 1559 end; 719 //if x = IntToStr(StrToIntDef(x, -1)) then x := x + ' ml/hr'; 720 if IsNumericRate(x) then x := x + ' ml/hr'; 721 if (Pos('@',x)>0) and (Piece(x,'@',1) = IntToStr(StrToIntDef(Piece(x,'@',1), -1))) 722 then x := Piece(x,'@',1) + ' ml/hr@' + Copy(x, Pos('@',x) + 1, Length(x)); 723 with txtRate do if (Length(Text) > 0) then Responses.Update('RATE', 1, x, x); 1560 if cboType.Text = 'Intermittent' then iType := 'I' 1561 else iType := 'C'; 1562 Responses.Update('TYPE',1,iType,cboType.Text); 1563 Responses.Update('ROUTE',1,cboRoute.ItemID,cboRoute.Text); 1564 tmpSch := UpperCase(Trim(cboSchedule.Text)); 1565 if chkPRN.Checked then tmpSch := tmpSch + ' PRN'; 1566 if UpperCase(Copy(tmpSch, Length(tmpSch) - 6, Length(tmpSch))) = 'PRN PRN' 1567 then tmpSch := Copy(tmpSch, 1, Length(tmpSch) - 4); 1568 Responses.Update('SCHEDULE',1,tmpSch,tmpSch); 1569 (*adminTime := Piece(lblAdminTime.Caption,':',2); 1570 adminTime := Copy(adminTime,1,Length(adminTime)); 1571 if (Action in [ORDER_COPY, ORDER_EDIT]) and ((FAdminTimeDelay <> '') or (FAdminTimeClinic <> '')) and 1572 (cboSchedule.ItemIndex = FOriginalScheduleIndex) then Responses.Update('ADMIN',1,FOriginalAdminTime,FOriginalAdminTime) 1573 else Responses.Update('ADMIN',1,adminTime,adminTime);*) 1574 idx := self.cboSchedule.ItemIndex; 1575 if idx > -1 then 1576 begin 1577 adminTime := Piece(lblAdminTime.Caption,':',2); 1578 adminTime := Copy(adminTime,2,Length(adminTime)); 1579 if FAdminTimeText <> '' then AdminTime := ''; 1580 if AdminTime = 'Not Defined' then AdminTime := ''; 1581 Responses.Update('ADMIN',1,adminTime,adminTime); 1582 end; 1583 if IsNumericRate(x) then 1584 begin 1585 if cboInfusionTime.Enabled = true then 1586 begin 1587 idx := cboInfusionTime.Items.IndexOf(cboInfusionTime.Text); 1588 if idx > -1 then x := x + ' ' + cboInfusionTime.Items.Strings[idx]; 1589 tmpRate := 'Infuse Over ' + x; 1590 end 1591 else 1592 if pos('ml/hr', x)= 0 then x := x + ' ml/hr'; 1593 end; 1594 if (Pos('@',x)>0) and (Piece(x,'@',1) = IntToStr(StrToIntDef(Piece(x,'@',1), -1))) and (cboInfusionTime.Enabled = false) then 1595 begin 1596 if Pos('ml/hr', x) = 0 then 1597 x := Piece(x,'@',1) + ' ml/hr@' + Copy(x, Pos('@',x) + 1, Length(x)); 1598 end; 1599 with txtRate do if (Length(Text) > 0) then 1600 begin 1601 if tmpRate = '' then Responses.Update('RATE', 1, x, x) 1602 else Responses.Update('RATE', 1, 'INFUSE OVER ' + x, tmpRate); 1603 end; 724 1604 with cboPriority do if ItemIndex > -1 then Responses.Update('URGENCY', 1, ItemID, Text); 725 1605 if Length(xlimIn)>0 then Responses.Update('DAYS',1, xlimIn, xlimEx); 726 1606 with memComments do if GetTextLen > 0 then Responses.Update('COMMENT', 1, TX_WPTYPE, Text); 1607 if (chkDoseNow.Visible = True) and (chkDoseNow.Checked = True) then 1608 Responses.Update('NOW', 1, '1', 'NOW') 1609 else Responses.Update('NOW', 1, '', ''); 727 1610 memOrder.Text := Responses.OrderText; 728 if (Length(eSch)>0) or (Length(iSch)>0) then 729 Responses.Update('SCHEDULE',1,iSch,eSch); 1611 (* (Length(eSch)>0) or (Length(iSch)>0) then 1612 Responses.Update('SCHEDULE',1,iSch,eSch); *) 1613 end; 1614 1615 function TfrmODMedIV.CreateOtherRoute: string; 1616 var 1617 aRoute: string; 1618 begin 1619 aRoute := ''; 1620 Result := ''; 1621 if not ShowOtherRoutes(aRoute) then 1622 begin 1623 cboRoute.ItemIndex := -1; 1624 cboRoute.Text := ''; 1625 end 1626 else 1627 begin 1628 Result := aRoute; 1629 end; 1630 end; 1631 1632 function TfrmODMedIV.CreateOtherSchedule: string; 1633 var 1634 aSchedule: string; 1635 begin 1636 aSchedule := ''; 1637 if not ShowOtherSchedule(aSchedule) then 1638 begin 1639 cboSchedule.ItemIndex := -1; 1640 cboSchedule.Text := ''; 1641 end 1642 else 1643 begin 1644 Result := Piece(aSchedule,U,1); 1645 NSSAdminTime := Piece(aschedule,u,2); 1646 NSSScheduleType := Piece(ASchedule, U, 3); 1647 end; 730 1648 end; 731 1649 … … 748 1666 inherited SetFontSize( FontSize ); 749 1667 DoSetFontSize( FontSize ); 1668 end; 1669 1670 procedure TfrmODMedIV.DisplayDoseNow(Status: boolean); 1671 begin 1672 if self.EvtID > 0 then Status := false; 1673 if status = false then 1674 begin 1675 if (self.chkDoseNow.Visible = true) and (self.chkDoseNow.Checked = true) then self.chkDoseNow.Checked := false; 1676 self.chkDoseNow.Visible := false; 1677 end; 1678 if status = true then self.chkDoseNow.Visible := true; 750 1679 end; 751 1680 … … 782 1711 end; 783 1712 784 procedure TfrmODMedIV.btnXDurationClick(Sender: TObject);785 var786 APoint: TPoint;787 begin788 inherited;789 txtXDuration.SetFocus;790 with TSpeedButton(Sender) do APoint := ClientToScreen(Point(0, Height));791 popDuration.Popup(APoint.X, APoint.Y);792 end;793 794 procedure TfrmODMedIV.popDurationClick(Sender: TObject);795 var796 x: string;797 begin798 inherited;799 with TMenuItem(Sender) do800 begin801 x := Caption;802 {if Length(Trim(txtXDuration.Text)) > 0 then803 if AnsiCompareStr(btnXduration.Caption,x) <> 0 then804 txtXDuration.Text := '';}805 end;806 btnXDuration.Caption := x;807 txtXDurationChange(Sender);808 ControlChange(Sender);809 end;810 811 1713 procedure TfrmODMedIV.txtXDurationChange(Sender: TObject); 812 1714 begin … … 815 1717 ControlChange(Sender); 816 1718 end; 1719 817 1720 818 1721 procedure TfrmODMedIV.pnlXDurationEnter(Sender: TObject); … … 829 1732 limitValue := ''; 830 1733 tempVal := ''; 831 if ( CharAt(aValue,1)= 'f') or ( CharAt(aValue,1)= 'F') then //days, hours 1734 if pos('dose',AValue)>0 then 1735 begin 1736 limitValue := Piece(aValue,' ',5); 1737 limitUnit := 'doses'; 1738 end; 1739 if (( CharAt(aValue,1)= 'f') or ( CharAt(aValue,1)= 'F')) and (pos('dose',aValue)=0) then //days, hours 832 1740 begin 833 1741 limitValue := Piece(aValue,' ',2); … … 842 1750 if isNumeric(CharAt(aValue,1)) then 843 1751 begin 1752 if LeftStr(avalue,1) = '0' then AValue := Copy(aValue,2,Length(aValue)); 844 1753 limitValue := FloatToStr(ExtractFloat(aValue)); 845 1754 limitUnit := Copy(aValue,length(limitValue)+1,Length(aValue)); … … 853 1762 if Trim(UpperCase(limitUnit))='CC' then 854 1763 limitUnit := 'ml'; 855 btnXDuration.Caption := limitUnit; 856 end; 857 858 end; 1764 cboduration.text := limitUnit; 1765 if cboDuration.Text <> '' then cboDuration.ItemIndex := cboDuration.Items.IndexOf(cboDuration.Text) 1766 end; 1767 1768 end; 1769 1770 procedure TfrmODMedIV.SetSchedule(const x: string); 1771 var 1772 NonPRNPart,tempSch: string; 1773 idx: integer; 1774 begin 1775 cboSchedule.ItemIndex := -1; 1776 chkPRN.Checked := False; 1777 //Check to see if schedule is already define in the schedule list 1778 idx := cboSchedule.Items.IndexOf(X); 1779 if idx > -1 then 1780 begin 1781 cboSchedule.ItemIndex := idx; 1782 exit; 1783 end; 1784 //Check to see if schedule is a Day-of-Week Schedule (MO-WE-FR@BID) 1785 if (Pos('@', x) > 0) then 1786 begin 1787 tempSch := Piece(x, '@', 2); 1788 idx := cboSchedule.Items.IndexOf(tempSch); 1789 if idx > -1 then 1790 begin 1791 //tempSch := U + Piece(x, '@', 1) + '@' + Pieces(cboSchedule.Items.Strings[idx], U, 2, 5); 1792 tempSch := Piece(x, '@', 1) + '@' + cboSchedule.Items.Strings[idx]; 1793 cboSchedule.Items.Add(tempSch); 1794 cboSchedule.Text := (Piece(tempSch,U,1)); 1795 cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(Piece(tempSch,U,1)); 1796 EXIT; 1797 end; 1798 //Check to see if schedule is a Day-of-Week PRN Schedule (MO-WE-FR@BID PRN) 1799 if Pos('PRN', tempSch) > 0 then 1800 begin 1801 NonPRNPart := Trim(Copy(tempSch, 1, Pos('PRN', tempSch) - 1)); 1802 idx := cboSchedule.Items.IndexOf(NonPRNPart); 1803 if idx > -1 then 1804 begin 1805 //tempSch := U + Piece(x, '@', 1) + '@' + Pieces(cboSchedule.Items.Strings[idx], U, 2, 5); 1806 tempSch := Piece(x, '@', 1) + '@' + cboSchedule.Items.Strings[idx]; 1807 cboSchedule.Items.Add(tempSch); 1808 cboSchedule.Text := (Piece(tempSch,U,1)); 1809 cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(Piece(tempSch, U, 1)); 1810 chkPRN.Checked := True; 1811 EXIT; 1812 end 1813 else 1814 //Add Day-of-Week PRN schedule built off Time Prompt (MO-WE-FR@0800-1000 PRN) 1815 begin 1816 NonPRNPart := Trim(Copy(X, 1, Pos('PRN', X) - 1)); 1817 chkPRN.Checked := True; 1818 //cboSchedule.Items.Add(U + NonPRNPart + U + U + U + AdminTime); 1819 //cboSchedule.Items.Add(U + NonPRNPart + U + U + U + Piece(NonPRNPart, '@', 2)); 1820 cboSchedule.Items.Add(NonPRNPart + U + U + U + Piece(NonPRNPart, '@', 2)); 1821 cboSchedule.Text := NonPRNPart; 1822 cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(NonPRNPart); 1823 EXIT; 1824 end; 1825 end; 1826 //Add Non PRN Day-of-Week Schedule built off Time Prompt (MO-WE-FR@0800-1000) 1827 //cboSchedule.Items.Add(U + x + U + U + U + AdminTime); 1828 //cboSchedule.Items.Add(U + x + U + U + U + tempSch); 1829 cboSchedule.Items.Add(x + U + U + U + tempSch); 1830 cboSchedule.Text := x; 1831 cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(X); 1832 end 1833 else 1834 begin 1835 //Handle standard schedule mark as PRN (Q4H PRN) 1836 if Pos('PRN', X) > 0 then 1837 begin 1838 NonPRNPart := Trim(Copy(X, 1, Pos('PRN', X) - 1)); 1839 idx := cboSchedule.Items.IndexOf(NonPRNPart); 1840 if idx > -1 then 1841 begin 1842 cboSchedule.ItemIndex := idx; 1843 tempSch := cboSchedule.Items.Strings[idx]; 1844 //setPiece(tempSch,U,5,AdminTime); 1845 cboSchedule.Items.Strings[idx] := tempSch; 1846 chkPRN.Checked := True; 1847 exit; 1848 end; 1849 end; 1850 end; 1851 end; 1852 859 1853 860 1854 procedure TfrmODMedIV.txtXDurationExit(Sender: TObject); 861 1855 var 862 Len: Integer;863 1856 Code: double; 864 Digits, Warning: string; 865 begin 866 inherited; 867 if Changing then Exit; 868 //AGP Change 26.15 HIN-1203-42283 Added additional check to make sure the user can only enter the correct duration 869 Len := Length(txtXDuration.Text); 870 if (Len > 0) and (Pos('.', txtXDuration.Text)=0) then 871 begin 872 Warning := '0'; 873 Digits := '2'; 874 if ((btnXDuration.Caption = 'days') or (btnXDuration.Caption = 'hours') or (btnXDuration.Caption = 'L')) and (Len > 2) then Warning := '1'; 875 if (btnXDuration.Caption = 'ml') and (Len > 4) then Warning := '1'; 876 if Warning = '1' then 877 begin 878 if btnXduration.Caption = 'ml' then Digits := '4'; 879 ShowMessage('Invalid Value.' + #13#10 + 'Reason: Duration for ' + btnXDuration.Caption + ' cannot be greater than ' + digits + ' digits.'); 880 txtXDuration.Text := ''; 881 txtXDuration.SetFocus; 882 Exit; 883 end; 884 end; 885 if (Pos('.', txtXDuration.Text)>0) and 886 ((btnXduration.Caption = 'days') or (btnXduration.Caption = 'hours')) then 887 begin 888 ShowMessage('Can not save order.' + #13#10 889 + 'Reason: Invalid Duration, please enter an integer value for days or hours.'); 890 txtXDuration.Text := ''; 891 txtXDuration.SetFocus; 892 Exit; 893 end; 1857 begin 1858 inherited; 894 1859 if (txtXDuration.Text <> '0') and (txtXDuration.Text <> '') then 895 1860 begin … … 901 1866 if code < 0.0001 then 902 1867 begin 903 ShowM essage('Can not save order.' + #13#10 + 'Reason: Invalid Duration or Total Volume!');1868 ShowMsg('Can not save order.' + #13#10 + 'Reason: Invalid Duration or Total Volume!'); 904 1869 txtXDuration.Text := ''; 905 1870 txtXDuration.SetFocus; … … 910 1875 if (Length(txtXDuration.Text)>0) and (StrToFloat(txtXDuration.Text)<0) then 911 1876 begin 912 ShowM essage('Can not save order.' + #13#10 + 'Reason: Invalid Duration or total volume!');1877 ShowMsg('Can not save order.' + #13#10 + 'Reason: Invalid Duration or total volume!'); 913 1878 txtXDuration.Text := ''; 914 1879 txtXDuration.SetFocus; … … 921 1886 end; 922 1887 923 procedure TfrmODMedIV.txtRateExit(Sender: TObject); 924 var 925 ErrorText, LDec,RDec: string; 926 i: Integer; 927 Result: boolean; 928 begin 929 inherited; 930 //AGP Change 26.28 for CQ # 7598 add infusion rate check for valid value 931 ErrorText := 'The Infusion Rate must be in one of the following formats:' + CRLF + CRLF + 'nnnn.nn ml/hr or text@per labels per day'; 932 Result := False; 933 if pos('@',Self.txtRate.Text)>0 then exit; 934 if pos('.',Self.txtRate.Text)>0 then 935 begin 936 LDec := Piece(Self.txtRate.Text,'.',1); 937 RDec := Piece(Self.txtRate.Text,'.',2); 938 if Length(LDec)>4 then Result := True; 939 if Length(RDec)>2 then Result := True; 940 end 941 else if Length(Self.txtRate.Text)>4 then Result := True; 942 if (Result = False) and (pos('.',Self.txtRate.Text)=0) then 943 begin 944 for i := 1 to Length(Self.txtRate.Text) do if not (Self.txtRate.Text[i] in ['0'..'9']) then Result := True 945 end; 946 if Result = True then 947 begin 948 InfoBox(ErrorText,'Warning - Invalid Infusion Rate', MB_OK); 949 Self.txtRate.Text := ''; 950 Self.txtRate.SetFocus; 951 end; 1888 procedure TfrmODMedIV.UpdateDuration(SchType: string); 1889 begin 1890 if SchType = 'O' then 1891 begin 1892 self.cboDuration.ItemIndex := -1; 1893 self.txtXDuration.Text := ''; 1894 self.cboDuration.Enabled := false; 1895 self.txtXDuration.Enabled := false; 1896 self.lblLimit.Enabled := false; 1897 end 1898 else 1899 begin 1900 self.cboDuration.Enabled := true; 1901 self.txtXDuration.Enabled := true; 1902 self.lblLimit.Enabled := true; 1903 end; 1904 end; 1905 1906 procedure TfrmODMedIV.UpdateRoute; 1907 var 1908 AnIVComponent: TIVComponent; 1909 i: integer; 1910 OrderIds, TempIVRoute: TStringList; 1911 Default: boolean; 1912 begin 1913 if self.grdSelected.RowCount > 0 then self.txtAllIVRoutes.Visible := True; 1914 TempIVRoute := TStringList.Create; 1915 for I := (self.cboRoute.Items.Count -1) downto 0 do 1916 begin 1917 if Piece(self.cboRoute.Items.Strings[i], U, 5) = '1' then 1918 TempIVRoute.Add(self.cboRoute.Items.Strings[i]); 1919 self.cboRoute.Items.Delete(i); 1920 end; 1921 if self.cboRoute.ItemIndex = -1 then self.cboRoute.Text := ''; 1922 OrderIds := TStringList.Create; 1923 for i := 0 to self.grdSelected.RowCount -1 do 1924 begin 1925 AniVComponent := TIVComponent(self.grdSelected.Objects[0, i]); 1926 if AnIVComponent <> nil then orderIds.Add(InttoStr(AniVComponent.IEN)); 1927 end; 1928 if OrderIds.Count > 0 then 1929 begin 1930 if (self.FInitialOrderID = True) and (self.grdSelected.RowCount = 1) then Default := True 1931 else Default := False; 1932 LoadDosageFormIVRoutes(self.cboRoute.Items, OrderIds, Default); 1933 if default = True then 1934 begin 1935 for I := 0 to cboRoute.items.Count - 1 do 1936 if Piece(cboRoute.Items.Strings[i], U, 5) = 'D' then 1937 begin 1938 cboRoute.ItemIndex := i; 1939 break; 1940 end; 1941 self.FInitialOrderID := false; 1942 end; 1943 OrderIds.Free; 1944 end; 1945 if TempIVRoute.Count > 0 then 1946 begin 1947 for I := 0 to tempIVRoute.Count - 1 do cboRoute.Items.Add(tempIVRoute.Strings[i]); 1948 TempIVRoute.Free; 1949 end; 1950 cboRoute.Items.Add(U + 'OTHER'); 1951 end; 1952 1953 1954 procedure TfrmODMedIV.txtAllIVRoutesClick(Sender: TObject); 1955 var 1956 i: integer; 1957 begin 1958 inherited; 1959 if MessageDlg('You can also select "OTHER" from the Route list' 1960 + ' to select a Route from the Expanded Med Route List.' 1961 + #13#10 + 'Click OK to launch the Expanded Med Route List.', 1962 mtInformation, [mbOK, mbCancel],0) = mrOK then 1963 begin 1964 for I := 0 to cboRoute.Items.Count - 1 do if cboRoute.Items.Strings[i] = U + 'OTHER' then break; 1965 cboRoute.ItemIndex := i; 1966 cboRouteClick(self); 1967 cboRouteChange(self.cboRoute); 1968 end; 1969 end; 1970 1971 procedure TfrmODMedIV.txtNSSClick(Sender: TObject); 1972 var 1973 i: integer; 1974 begin 1975 inherited; 1976 if MessageDlg('You can also select ' + '"' + 'Other' + '"' + ' from the schedule list' 1977 + ' to create a day-of-week schedule.' 1978 + #13#10 + 'Click OK to launch schedule builder', 1979 mtInformation, [mbOK, mbCancel],0) = mrOK then 1980 begin 1981 //cboSchedule.Items.Add(U + 'OTHER'); 1982 for I := 0 to cboSchedule.Items.Count - 1 do if cboSchedule.Items.Strings[i] = 'OTHER' then break; 1983 cboSchedule.ItemIndex := i; 1984 //cboSchedule.SelectByID(U+'OTHER'); 1985 cboScheduleClick(Self); 1986 cboScheduleChange(self.cboSchedule); 1987 end; 1988 end; 1989 1990 procedure TfrmODMedIV.txtRateChange(Sender: TObject); 1991 begin 1992 inherited; 1993 if Changing then Exit; 1994 ControlChange(Sender); 952 1995 end; 953 1996
Note:
See TracChangeset
for help on using the changeset viewer.