| [456] | 1 | unit fODMedIV; | 
|---|
|  | 2 |  | 
|---|
|  | 3 | interface | 
|---|
|  | 4 |  | 
|---|
|  | 5 | uses | 
|---|
|  | 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, | 
|---|
| [829] | 7 | fODBase, Grids, StdCtrls, ORCtrls, ComCtrls, ExtCtrls, Buttons, Menus, IdGlobal, strUtils, | 
|---|
|  | 8 | VA508AccessibilityManager, VAUtils, fIVRoutes; | 
|---|
| [456] | 9 |  | 
|---|
|  | 10 | type | 
|---|
|  | 11 | TfrmODMedIV = class(TfrmODBase) | 
|---|
|  | 12 | lblInfusionRate: TLabel; | 
|---|
|  | 13 | txtRate: TCaptionEdit; | 
|---|
|  | 14 | lblComponent: TLabel; | 
|---|
|  | 15 | lblAmount: TLabel; | 
|---|
|  | 16 | grdSelected: TCaptionStringGrid; | 
|---|
|  | 17 | cmdRemove: TButton; | 
|---|
|  | 18 | lblComments: TLabel; | 
|---|
|  | 19 | memComments: TCaptionMemo; | 
|---|
|  | 20 | txtSelected: TCaptionEdit; | 
|---|
|  | 21 | cboSelected: TCaptionComboBox; | 
|---|
|  | 22 | pnlXDuration: TPanel; | 
|---|
|  | 23 | txtXDuration: TCaptionEdit; | 
|---|
|  | 24 | lblLimit: TLabel; | 
|---|
|  | 25 | pnlCombo: TPanel; | 
|---|
|  | 26 | cboAdditive: TORComboBox; | 
|---|
|  | 27 | tabFluid: TTabControl; | 
|---|
|  | 28 | cboSolution: TORComboBox; | 
|---|
|  | 29 | lblPriority: TLabel; | 
|---|
|  | 30 | cboPriority: TORComboBox; | 
|---|
| [829] | 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; | 
|---|
| [1679] | 47 | cboAddFreq: TCaptionComboBox; | 
|---|
|  | 48 | lblAddFreq: TLabel; | 
|---|
|  | 49 | lblPrevAddFreq: TLabel; | 
|---|
|  | 50 | lbl508Required: TVA508StaticText; | 
|---|
|  | 51 | VA508CompOrderSig: TVA508ComponentAccessibility; | 
|---|
|  | 52 | VA508CompRoute: TVA508ComponentAccessibility; | 
|---|
|  | 53 | VA508CompType: TVA508ComponentAccessibility; | 
|---|
|  | 54 | VA508CompSchedule: TVA508ComponentAccessibility; | 
|---|
|  | 55 | VA508CompGrdSelected: TVA508ComponentAccessibility; | 
|---|
| [456] | 56 | procedure FormCreate(Sender: TObject); | 
|---|
|  | 57 | procedure tabFluidChange(Sender: TObject); | 
|---|
| [829] | 58 | procedure  cboAdditiveNeedData(Sender: TObject; const StartFrom: string; Direction, | 
|---|
| [456] | 59 | InsertAt: Integer); | 
|---|
|  | 60 | procedure cboSolutionNeedData(Sender: TObject; const StartFrom: string; Direction, | 
|---|
|  | 61 | InsertAt: Integer); | 
|---|
|  | 62 | procedure cboAdditiveMouseClick(Sender: TObject); | 
|---|
|  | 63 | procedure cboAdditiveExit(Sender: TObject); | 
|---|
|  | 64 | procedure cboSolutionMouseClick(Sender: TObject); | 
|---|
|  | 65 | procedure cboSolutionExit(Sender: TObject); | 
|---|
|  | 66 | procedure FormDestroy(Sender: TObject); | 
|---|
|  | 67 | procedure cmdRemoveClick(Sender: TObject); | 
|---|
|  | 68 | procedure FormResize(Sender: TObject); | 
|---|
|  | 69 | procedure txtSelectedExit(Sender: TObject); | 
|---|
|  | 70 | procedure ControlChange(Sender: TObject); | 
|---|
|  | 71 | procedure txtSelectedChange(Sender: TObject); | 
|---|
|  | 72 | procedure grdSelectedDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; | 
|---|
|  | 73 | State: TGridDrawState); | 
|---|
|  | 74 | procedure FormKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 75 | Shift: TShiftState); | 
|---|
|  | 76 | procedure grdSelectedKeyPress(Sender: TObject; var Key: Char); | 
|---|
|  | 77 | procedure grdSelectedMouseDown(Sender: TObject; Button: TMouseButton; | 
|---|
|  | 78 | Shift: TShiftState; X, Y: Integer); | 
|---|
|  | 79 | procedure txtXDurationChange(Sender: TObject); | 
|---|
|  | 80 | procedure pnlXDurationEnter(Sender: TObject); | 
|---|
|  | 81 | procedure txtXDurationExit(Sender: TObject); | 
|---|
| [829] | 82 | procedure cboScheduleChange(Sender: TObject); | 
|---|
|  | 83 | procedure cboTypeChange(Sender: TObject); | 
|---|
|  | 84 | procedure cboRouteChange(Sender: TObject); | 
|---|
|  | 85 | procedure txtRateChange(Sender: TObject); | 
|---|
|  | 86 | procedure cboPriorityChange(Sender: TObject); | 
|---|
|  | 87 | procedure cboPriorityExit(Sender: TObject); | 
|---|
|  | 88 | procedure cboRouteExit(Sender: TObject); | 
|---|
|  | 89 | procedure txtNSSClick(Sender: TObject); | 
|---|
|  | 90 | procedure cboScheduleClick(Sender: TObject); | 
|---|
|  | 91 | procedure chkPRNClick(Sender: TObject); | 
|---|
|  | 92 | procedure chkDoseNowClick(Sender: TObject); | 
|---|
|  | 93 | procedure loadExpectFirstDose; | 
|---|
|  | 94 | procedure SetSchedule(const x: string); | 
|---|
|  | 95 | procedure cboScheduleExit(Sender: TObject); | 
|---|
|  | 96 | procedure cboInfusionTimeChange(Sender: TObject); | 
|---|
|  | 97 | procedure cboDurationChange(Sender: TObject); | 
|---|
|  | 98 | procedure cboDurationEnter(Sender: TObject); | 
|---|
|  | 99 | procedure cboInfusionTimeEnter(Sender: TObject); | 
|---|
|  | 100 | procedure txtAllIVRoutesClick(Sender: TObject); | 
|---|
|  | 101 | procedure cboRouteClick(Sender: TObject); | 
|---|
|  | 102 | procedure lblTypeHelpClick(Sender: TObject); | 
|---|
| [1679] | 103 | procedure cboSelectedCloseUp(Sender: TObject); | 
|---|
|  | 104 | procedure cboRouteKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); | 
|---|
|  | 105 | procedure cboScheduleKeyUp(Sender: TObject; var Key: Word; | 
|---|
|  | 106 | Shift: TShiftState); | 
|---|
|  | 107 | procedure cboPriorityKeyUp(Sender: TObject; var Key: Word; | 
|---|
|  | 108 | Shift: TShiftState); | 
|---|
|  | 109 | procedure cboAddFreqKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 110 | Shift: TShiftState); | 
|---|
|  | 111 | procedure cboAddFreqCloseUp(Sender: TObject); | 
|---|
|  | 112 | procedure FormKeyPress(Sender: TObject; var Key: Char); | 
|---|
|  | 113 | procedure txtSelectedKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 114 | Shift: TShiftState); | 
|---|
|  | 115 | procedure cboSelectedKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 116 | Shift: TShiftState); | 
|---|
|  | 117 | procedure cboTypeKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 118 | Shift: TShiftState); | 
|---|
|  | 119 | procedure cboRouteKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 120 | Shift: TShiftState); | 
|---|
|  | 121 | procedure cboScheduleKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 122 | Shift: TShiftState); | 
|---|
|  | 123 | procedure VA508CompOrderSigStateQuery(Sender: TObject; var Text: string); | 
|---|
|  | 124 | procedure VA508CompRouteInstructionsQuery(Sender: TObject; | 
|---|
|  | 125 | var Text: string); | 
|---|
|  | 126 | procedure VA508CompTypeInstructionsQuery(Sender: TObject; var Text: string); | 
|---|
|  | 127 | procedure VA508CompScheduleInstructionsQuery(Sender: TObject; | 
|---|
|  | 128 | var Text: string); | 
|---|
|  | 129 | procedure VA508CompGrdSelectedCaptionQuery(Sender: TObject; | 
|---|
|  | 130 | var Text: string); | 
|---|
| [456] | 131 | private | 
|---|
|  | 132 | FInpatient: Boolean; | 
|---|
| [829] | 133 | FNSSAdminTime: string; | 
|---|
|  | 134 | FNSSScheduleType: string; | 
|---|
|  | 135 | OSolIEN: integer; | 
|---|
|  | 136 | OAddIEN: integer; | 
|---|
|  | 137 | OSchedule: string; | 
|---|
|  | 138 | oAdmin: string; | 
|---|
|  | 139 | OrderIEN: string; | 
|---|
|  | 140 | FAdminTimeText: string; | 
|---|
|  | 141 | JAWSON: boolean; | 
|---|
|  | 142 | FOriginalDurationType: integer; | 
|---|
|  | 143 | FOriginalInfusionType: integer; | 
|---|
| [1679] | 144 | FIVTypeDefined: boolean; | 
|---|
|  | 145 | //FInitialOrderID: boolean; | 
|---|
| [456] | 146 | procedure SetValuesFromResponses; | 
|---|
|  | 147 | procedure DoSetFontSize( FontSize: integer); | 
|---|
|  | 148 | procedure ClickOnGridCell; | 
|---|
|  | 149 | procedure SetLimitationControl(aValue: string); | 
|---|
| [829] | 150 | function CreateOtherSchedule: string; | 
|---|
|  | 151 | function CreateOtherRoute: string; | 
|---|
|  | 152 | procedure UpdateRoute; | 
|---|
|  | 153 | procedure DisplayDoseNow(Status: boolean); | 
|---|
|  | 154 | procedure UpdateDuration(SchType: string); | 
|---|
|  | 155 | procedure ClearAllFields; | 
|---|
| [1679] | 156 | function UpdateAddFreq(OI: integer): string; | 
|---|
|  | 157 | function IsAltCtrl_L_Pressed(Shift : TShiftState; Key : Word) : Boolean; | 
|---|
|  | 158 | procedure SetCtrlAlt_L_LabelAccessText(var Text: string; theLabel : TLabel); | 
|---|
| [456] | 159 | public | 
|---|
| [1679] | 160 | OrdAction: integer; | 
|---|
| [456] | 161 | procedure InitDialog; override; | 
|---|
|  | 162 | procedure SetupDialog(OrderAction: Integer; const ID: string); override; | 
|---|
|  | 163 | procedure Validate(var AnErrMsg: string); override; | 
|---|
|  | 164 | procedure SetFontSize( FontSize: integer); override; | 
|---|
| [829] | 165 | function ValidateInfusionRate(Rate: string): string; | 
|---|
|  | 166 | function IVTypeHelpText: string; | 
|---|
|  | 167 | property NSSAdminTime: string read FNSSAdminTime write FNSSAdminTime; | 
|---|
|  | 168 | property NSSScheduleType: string read FNSSScheduleType write FNSSScheduleType; | 
|---|
| [456] | 169 | end; | 
|---|
|  | 170 |  | 
|---|
|  | 171 | var | 
|---|
|  | 172 | frmODMedIV: TfrmODMedIV; | 
|---|
|  | 173 |  | 
|---|
|  | 174 | implementation | 
|---|
|  | 175 |  | 
|---|
|  | 176 | {$R *.DFM} | 
|---|
|  | 177 |  | 
|---|
| [829] | 178 | uses ORFn, uConst, rODMeds, rODBase, fFrame, uCore, fOtherSchedule, rCore; | 
|---|
| [456] | 179 |  | 
|---|
|  | 180 | const | 
|---|
|  | 181 | TX_NO_DEA     = 'Provider must have a DEA# or VA# to order this medication'; | 
|---|
|  | 182 | TC_NO_DEA     = 'DEA# Required'; | 
|---|
|  | 183 |  | 
|---|
|  | 184 | type | 
|---|
|  | 185 | TIVComponent = class | 
|---|
|  | 186 | private | 
|---|
|  | 187 | IEN: Integer; | 
|---|
|  | 188 | Name: string; | 
|---|
|  | 189 | Fluid: Char; | 
|---|
|  | 190 | Amount: Integer; | 
|---|
|  | 191 | Units: string; | 
|---|
|  | 192 | Volumes: string; | 
|---|
| [1679] | 193 | AddFreq: string; | 
|---|
| [456] | 194 | end; | 
|---|
|  | 195 |  | 
|---|
|  | 196 | const | 
|---|
|  | 197 | TC_RESTRICT  = 'Ordering Restrictions'; | 
|---|
|  | 198 | TX_NO_BASE   = 'A solution must be selected.'; | 
|---|
|  | 199 | TX_NO_AMOUNT = 'A valid strength or volume must be entered for '; | 
|---|
|  | 200 | TX_NO_UNITS  = 'Units must be entered for '; | 
|---|
|  | 201 | TX_NO_RATE   = 'An infusion rate must be entered.'; | 
|---|
| [829] | 202 | //TX_BAD_RATE  = 'The infusion rate must be:  # ml/hr  or  text@labels per day'; | 
|---|
|  | 203 | 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'; | 
|---|
|  | 204 | 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.'; | 
|---|
|  | 205 | TX_NO_SCHEDULE = 'A schedule is required for an intermittent order.'; | 
|---|
|  | 206 | TX_BAD_SCHEDULE = 'Unable to resolve non-standard schedule.'; | 
|---|
|  | 207 | TX_NO_INFUSION_UNIT = 'Invalid Unit of Time, select either "Minutes" or "Hours" for the Infusion Length'; | 
|---|
|  | 208 | TX_BAD_ROUTE = 'Route cannot be free-text'; | 
|---|
|  | 209 | TX_LEADING_NUMERIC = 'this additive must start with a leading numeric value'; | 
|---|
| [1679] | 210 | TX_BAD_BAG = 'A valid additive frequency must be entered for '; | 
|---|
|  | 211 | Tx_BAG_NO_COMMENTS ='"See Comments" entered for additive '; | 
|---|
|  | 212 | TX_BAG_NO_COMMENTS1 = ' no comments defined for this order.'; | 
|---|
| [456] | 213 |  | 
|---|
|  | 214 | (* | 
|---|
|  | 215 | { TIVComponent methods } | 
|---|
|  | 216 |  | 
|---|
|  | 217 | procedure TIVComponent.Clear; | 
|---|
|  | 218 | begin | 
|---|
|  | 219 | IEN     := 0; | 
|---|
|  | 220 | Name    := ''; | 
|---|
|  | 221 | Fluid   := #0; | 
|---|
|  | 222 | Amount  := 0; | 
|---|
|  | 223 | Units   := ''; | 
|---|
|  | 224 | Volumes := ''; | 
|---|
|  | 225 | end; | 
|---|
|  | 226 | *) | 
|---|
|  | 227 |  | 
|---|
|  | 228 | { Form methods } | 
|---|
|  | 229 |  | 
|---|
|  | 230 | procedure TfrmODMedIV.FormCreate(Sender: TObject); | 
|---|
|  | 231 | var | 
|---|
|  | 232 | Restriction: string; | 
|---|
|  | 233 | begin | 
|---|
|  | 234 | frmFrame.pnlVisit.Enabled := false; | 
|---|
| [829] | 235 | //AutoSizeDisabled := true; | 
|---|
| [456] | 236 | inherited; | 
|---|
|  | 237 | AllowQuickOrder := True; | 
|---|
|  | 238 | CheckAuthForMeds(Restriction); | 
|---|
|  | 239 | if Length(Restriction) > 0 then | 
|---|
|  | 240 | begin | 
|---|
|  | 241 | InfoBox(Restriction, TC_RESTRICT, MB_OK); | 
|---|
|  | 242 | Close; | 
|---|
|  | 243 | Exit; | 
|---|
|  | 244 | end; | 
|---|
| [1679] | 245 | OrdAction := -1; | 
|---|
| [456] | 246 | DoSetFontSize(MainFontSize); | 
|---|
|  | 247 | FillerID := 'PSIV';                            // does 'on Display' order check **KCM** | 
|---|
|  | 248 | StatusText('Loading Dialog Definition'); | 
|---|
|  | 249 | Responses.Dialog := 'PSJI OR PAT FLUID OE';    // loads formatting info | 
|---|
|  | 250 | StatusText('Loading Default Values'); | 
|---|
|  | 251 | CtrlInits.LoadDefaults(ODForIVFluids);         // ODForIVFluids returns TStrings with defaults | 
|---|
|  | 252 | InitDialog; | 
|---|
|  | 253 | end; | 
|---|
|  | 254 |  | 
|---|
|  | 255 | procedure TfrmODMedIV.FormDestroy(Sender: TObject); | 
|---|
|  | 256 | var | 
|---|
|  | 257 | i: Integer; | 
|---|
|  | 258 | begin | 
|---|
|  | 259 | with grdSelected do for i := 0 to RowCount - 1 do TIVComponent(Objects[0, i]).Free; | 
|---|
|  | 260 | inherited; | 
|---|
|  | 261 | frmFrame.pnlVisit.Enabled := True; | 
|---|
|  | 262 | end; | 
|---|
|  | 263 |  | 
|---|
|  | 264 | procedure TfrmODMedIV.FormResize(Sender: TObject); | 
|---|
| [829] | 265 | var | 
|---|
|  | 266 | bottom: integer; | 
|---|
| [1679] | 267 | isNewOrder: boolean; | 
|---|
| [456] | 268 | begin | 
|---|
|  | 269 | inherited; | 
|---|
| [1679] | 270 | if OrdAction in [ORDER_COPY, ORDER_EDIT] then isNewOrder := false | 
|---|
|  | 271 | else isNewOrder := True; | 
|---|
| [456] | 272 | with grdSelected do | 
|---|
|  | 273 | begin | 
|---|
|  | 274 | ColWidths[1] := Canvas.TextWidth(' 10000 ') + GetSystemMetrics(SM_CXVSCROLL); | 
|---|
|  | 275 | ColWidths[2] := Canvas.TextWidth('meq.') + GetSystemMetrics(SM_CXVSCROLL); | 
|---|
| [1679] | 276 | //AGP ADDITIVE FREQUENCY CHANGES | 
|---|
|  | 277 | ColWidths[3] := Canvas.TextWidth(lblAddFreq.Caption + '  ') + GetSystemMetrics(SM_CXVSCROLL); | 
|---|
|  | 278 | if IsNewOrder = false then | 
|---|
|  | 279 | begin | 
|---|
|  | 280 | ColWidths[4] := Canvas.TextWidth(lblPrevAddFreq.Caption) + GetSystemMetrics(SM_CXVSCROLL); | 
|---|
|  | 281 | ColWidths[0] := ClientWidth - ColWidths[1] - ColWidths[2] - ColWidths[3] - ColWidths[4] - 5; | 
|---|
|  | 282 | end | 
|---|
|  | 283 | else | 
|---|
|  | 284 | begin | 
|---|
|  | 285 | ColWidths[4] := 0; | 
|---|
|  | 286 | ColWidths[0] := ClientWidth - ColWidths[1] - ColWidths[2] - ColWidths[3] - ColWidths[4] - 25; | 
|---|
|  | 287 | end; | 
|---|
| [456] | 288 | end; | 
|---|
|  | 289 | lblAmount.Left := grdSelected.Left + grdSelected.ColWidths[0]; | 
|---|
| [1679] | 290 | lblAddFreq.Left := grdSelected.Left +  grdSelected.ColWidths[0] +  grdSelected.ColWidths[1] + grdSelected.ColWidths[2]; | 
|---|
|  | 291 | if isNewOrder = false then | 
|---|
|  | 292 | begin | 
|---|
|  | 293 | lblPrevAddFreq.Visible := True; | 
|---|
|  | 294 | lblPrevAddFreq.Left := grdSelected.Left +  grdSelected.ColWidths[0] +  grdSelected.ColWidths[1] + grdSelected.ColWidths[2] + grdSelected.ColWidths[3]; | 
|---|
|  | 295 | end | 
|---|
|  | 296 | else lblPrevAddFreq.Visible := False; | 
|---|
| [829] | 297 | self.cboType.SelLength := 0; | 
|---|
|  | 298 | self.cboInfusionTime.SelLength := 0; | 
|---|
|  | 299 | self.cboDuration.SelLength := 0; | 
|---|
|  | 300 | bottom := self.cboPriority.Top + self.cboPriority.Height; | 
|---|
|  | 301 | if self.chkDoseNow.Top < bottom then self.chkDoseNow.Top := bottom + 5; | 
|---|
|  | 302 | self.txtRate.Height := self.cboInfusionTime.Height; | 
|---|
|  | 303 | self.txtXDuration.Height := self.cboDuration.Height; | 
|---|
|  | 304 | self.lblAdminTime.Height := TextHeightByFont(self.lblAdminTime.Font.Handle, 'A'); | 
|---|
|  | 305 | self.lblFirstDose.Height := TextHeightByFont(self.lblFirstDose.Font.Handle, 'A'); | 
|---|
|  | 306 | self.lblAdminTime.Width := TextWidthByFont(self.lblAdminTime.Font.Handle, self.lblAdminTime.Caption + '  '); | 
|---|
|  | 307 | self.lblFirstDose.Width := TextWidthByFont(self.lblFirstDose.Font.Handle, self.lblFirstDose.Caption + '  '); | 
|---|
|  | 308 | self.lblAdminTime.Top := self.chkDoseNow.Top + self.chkDoseNow.Height + 2; | 
|---|
|  | 309 | self.lblFirstDose.Top := self.lblAdminTime.Top + self.lblAdminTime.Height + 2; | 
|---|
| [1679] | 310 | self.lbl508Required.Top := self.lblFirstDose.Top + self.lblFirstDose.Height + 5; | 
|---|
|  | 311 | if self.Label1.Top < (self.lbl508Required.Top + self.lbl508Required.Height) then | 
|---|
| [829] | 312 | begin | 
|---|
| [1679] | 313 | self.Label1.Top := self.lbl508Required.Top + self.lbl508Required.Height + 5; | 
|---|
| [829] | 314 | self.memOrder.Top := self.Label1.Top + self.Label1.Height; | 
|---|
|  | 315 | end; | 
|---|
| [456] | 316 | end; | 
|---|
|  | 317 |  | 
|---|
|  | 318 | { TfrmODBase overrides } | 
|---|
|  | 319 |  | 
|---|
|  | 320 | procedure TfrmODMedIV.InitDialog; | 
|---|
|  | 321 | const | 
|---|
|  | 322 | NOSELECTION: TGridRect = (Left: -1; Top: -1; Right: -1; Bottom: -1); | 
|---|
|  | 323 | var | 
|---|
|  | 324 | i: Integer; | 
|---|
|  | 325 | begin | 
|---|
|  | 326 | inherited; | 
|---|
|  | 327 | //grdSelected.Selection := NOSELECTION; | 
|---|
| [829] | 328 | //FRouteConflict := False; | 
|---|
|  | 329 | //lblTypeHelp.Hint := IVTypeHelpText; | 
|---|
| [1679] | 330 | ClearAllFields; | 
|---|
|  | 331 | //FIVTypeDefined := false; | 
|---|
| [829] | 332 | lblType.Hint := IVTypeHelpText; | 
|---|
|  | 333 | cboType.Hint := IVTYpeHelpText; | 
|---|
| [456] | 334 | with grdSelected do for i := 0 to RowCount - 1 do | 
|---|
|  | 335 | begin | 
|---|
|  | 336 | TIVComponent(Objects[0, i]).Free; | 
|---|
|  | 337 | Rows[i].Clear; | 
|---|
|  | 338 | end; | 
|---|
|  | 339 | grdSelected.RowCount := 1; | 
|---|
|  | 340 | //txtRate.Text := ' ml/hr';   {*kcm*} | 
|---|
|  | 341 | with CtrlInits do | 
|---|
|  | 342 | begin | 
|---|
|  | 343 | SetControl(cboSolution, 'ShortList'); | 
|---|
|  | 344 | cboSolution.InsertSeparator; | 
|---|
|  | 345 | SetControl(cboPriority, 'Priorities'); | 
|---|
| [829] | 346 | cboType.Items.Add('Continuous'); | 
|---|
|  | 347 | cboType.Items.Add('Intermittent'); | 
|---|
|  | 348 | cboType.ItemIndex := -1; | 
|---|
|  | 349 | cboType.SelLength := 0; | 
|---|
|  | 350 | //SetControl(cboRoute, 'Route'); | 
|---|
|  | 351 | if (cboRoute.ItemIndex = -1) and (cboRoute.Text <> '') then cboRoute.Text := ''; | 
|---|
|  | 352 | //SetControl(cboSchedule, 'Schedules'); | 
|---|
|  | 353 | LoadSchedules(cboSchedule.Items, patient.Inpatient); | 
|---|
|  | 354 | //if (Patient.Inpatient) and (cboSchedule.Items.IndexOfName('Other')<0) then | 
|---|
|  | 355 | if cboSchedule.Items.IndexOf('Other') = -1 then cboSchedule.Items.Add('OTHER'); | 
|---|
|  | 356 | cboSchedule.Enabled := False; | 
|---|
|  | 357 | lblschedule.Enabled := False; | 
|---|
|  | 358 | if cboInfusionTime.Items.Count = 0 then | 
|---|
|  | 359 | begin | 
|---|
|  | 360 | cboInfusionTime.Items.add('Minutes'); | 
|---|
|  | 361 | cboInfusionTime.Items.Add('Hours'); | 
|---|
|  | 362 | end; | 
|---|
|  | 363 | cboInfusionTime.Enabled := false; | 
|---|
|  | 364 | updateDuration(''); | 
|---|
|  | 365 | if cboDuration.Items.Count = 0 then | 
|---|
|  | 366 | begin | 
|---|
|  | 367 | cboDuration.Items.Add('L'); | 
|---|
|  | 368 | cboDuration.Items.Add('ml'); | 
|---|
|  | 369 | cboDuration.Items.Add('days'); | 
|---|
|  | 370 | cboDuration.Items.Add('hours'); | 
|---|
|  | 371 | end; | 
|---|
|  | 372 | cboDuration.ItemIndex := -1; | 
|---|
|  | 373 | cboDuration.Text := ''; | 
|---|
|  | 374 | if self.txtXDuration.Text <> '' then self.txtXDuration.Text := ''; | 
|---|
|  | 375 | txtNSS.Visible := false; | 
|---|
|  | 376 | if (chkDoseNow.Visible = true) and (chkDoseNow.Checked = true) then chkDoseNow.Checked := false; | 
|---|
|  | 377 | chkDoseNow.Visible := false; | 
|---|
|  | 378 | chkPRN.Enabled := false; | 
|---|
| [1679] | 379 | //AGP ADDITIVE FREQUENCY CHANGES | 
|---|
|  | 380 | if cboAddFreq.Items.Count = 0 then | 
|---|
|  | 381 | begin | 
|---|
|  | 382 | cboAddFreq.Items.Add('1 Bag/Day'); | 
|---|
|  | 383 | cboAddFreq.Items.Add('All Bags'); | 
|---|
|  | 384 | cboAddFreq.Items.Add('See Comments'); | 
|---|
|  | 385 | end; | 
|---|
| [456] | 386 | end; | 
|---|
|  | 387 | tabFluid.TabIndex := 0; | 
|---|
|  | 388 | tabFluidChange(Self);            // this makes cboSolution visible | 
|---|
|  | 389 | cboSolution.InitLongList(''); | 
|---|
|  | 390 | cboAdditive.InitLongList(''); | 
|---|
| [829] | 391 | JAWSON := true; | 
|---|
|  | 392 | if ScreenReaderActive = false then | 
|---|
|  | 393 | begin | 
|---|
|  | 394 | lblAdminTime.TabStop := false; | 
|---|
|  | 395 | lblFirstDose.TabStop := false; | 
|---|
|  | 396 | memOrder.TabStop := false; | 
|---|
|  | 397 | JAWSON := false; | 
|---|
|  | 398 | end; | 
|---|
| [456] | 399 | ActiveControl := cboSolution;  //SetFocusedControl(cboSolution); | 
|---|
|  | 400 | StatusText(''); | 
|---|
| [829] | 401 | OSolIEN := 0; | 
|---|
|  | 402 | OAddIEN := 0; | 
|---|
|  | 403 | OSchedule := ''; | 
|---|
|  | 404 | oAdmin := ''; | 
|---|
|  | 405 | self.txtAllIVRoutes.Visible := false; | 
|---|
| [1679] | 406 | memorder.text := ''; | 
|---|
|  | 407 | memOrder.Lines.Clear; | 
|---|
| [456] | 408 | end; | 
|---|
|  | 409 |  | 
|---|
| [829] | 410 | function TfrmODMedIV.IVTypeHelpText: string; | 
|---|
|  | 411 | begin | 
|---|
|  | 412 | result := 'Continuous Type:' + CRLF + '     IVs that run at a specified Rate ( __ml/hr, __mcg/kg/min, etc)' + | 
|---|
|  | 413 | CRLF + CRLF + 'Intermittent Type:' + CRLF + | 
|---|
|  | 414 | '     IVs administered at scheduled intervals (Q4H, QDay) or One-Time only, ' + | 
|---|
|  | 415 | CRLF + '     over a specified time period (e.g. Infuse over 30 min.).' + CRLF + CRLF + | 
|---|
|  | 416 | 'Examples:' + CRLF + 'Continuous = Infusion/drip' + CRLF + 'Intermittent = IVP/IVPB'; | 
|---|
|  | 417 | end; | 
|---|
|  | 418 |  | 
|---|
| [1679] | 419 | procedure TfrmODMedIV.SetCtrlAlt_L_LabelAccessText(var Text: string; theLabel : TLabel); | 
|---|
|  | 420 | begin | 
|---|
|  | 421 | if theLabel.Visible then | 
|---|
|  | 422 | Text := 'Press Ctrl + Alt + L to access ' + theLabel.Caption; | 
|---|
|  | 423 | end; | 
|---|
|  | 424 |  | 
|---|
| [829] | 425 | procedure TfrmODMedIV.lblTypeHelpClick(Sender: TObject); | 
|---|
|  | 426 | var | 
|---|
|  | 427 | str: string; | 
|---|
|  | 428 | begin | 
|---|
|  | 429 | inherited; | 
|---|
|  | 430 | str := IVTypeHelpText; | 
|---|
|  | 431 | infoBox(str, 'Informational Help Text', MB_OK); | 
|---|
|  | 432 | end; | 
|---|
|  | 433 |  | 
|---|
|  | 434 |  | 
|---|
|  | 435 | procedure TfrmODMedIV.loadExpectFirstDose; | 
|---|
|  | 436 | var | 
|---|
|  | 437 | i: integer; | 
|---|
|  | 438 | AnIVComponent: TIVComponent; | 
|---|
|  | 439 | fAddIEN, fSolIEN, Interval, idx: integer; | 
|---|
|  | 440 | AdminTime:    TFMDateTime; | 
|---|
|  | 441 | Admin, Duration, ShowText, SchTxt, SchType, IVType: string; | 
|---|
|  | 442 | doseNow, calFirstDose: boolean; | 
|---|
|  | 443 | begin | 
|---|
|  | 444 | idx := self.cboSchedule.ItemIndex; | 
|---|
|  | 445 | IVType := self.cboType.Items.Strings[self.cboType.itemindex]; | 
|---|
|  | 446 | if idx = -1 then | 
|---|
|  | 447 | begin | 
|---|
|  | 448 | if IVType = 'Continuous' then | 
|---|
|  | 449 | begin | 
|---|
|  | 450 | self.lblFirstDose.Caption := ''; | 
|---|
|  | 451 | self.lblFirstDose.Visible := false; | 
|---|
|  | 452 | end; | 
|---|
|  | 453 | exit; | 
|---|
|  | 454 | end; | 
|---|
|  | 455 | doseNow := true; | 
|---|
|  | 456 | SchType := Piece(self.cboSchedule.Items.Strings[idx],U,3); | 
|---|
|  | 457 | if self.EvtID > 0 then doseNow := false; | 
|---|
|  | 458 | if (IVType = 'Continuous') or ((idx > -1) and ((SchType = 'P') or (SchType = 'O') or (SchType = 'OC')) or | 
|---|
|  | 459 | (self.chkPRN.Checked = True))  then | 
|---|
|  | 460 | begin | 
|---|
|  | 461 | self.lblFirstDose.Caption := ''; | 
|---|
|  | 462 | self.lblAdminTime.Caption := ''; | 
|---|
|  | 463 | self.lblFirstDose.Visible := false; | 
|---|
|  | 464 | self.lblAdminTime.Visible := false; | 
|---|
|  | 465 | self.lblAdminTime.TabStop := false; | 
|---|
|  | 466 | self.lblFirstDose.TabStop := false; | 
|---|
|  | 467 | if (self.cboType.Text = 'Continuous') or (Piece(self.cboSchedule.Items.Strings[idx],U,3) = 'O') then doseNow := false; | 
|---|
|  | 468 | if chkDoseNow.Checked = true then lblFirstDose.Visible := false; | 
|---|
|  | 469 | if idx > -1 then oSchedule := Piece(self.cboSchedule.Items.Strings[idx],U,1); | 
|---|
|  | 470 | if (self.chkPRN.Checked = True) and (idx > -1) and (LeftStr(Piece(self.cboSchedule.Items.Strings[idx],U,1),3)<> 'PRN') then | 
|---|
|  | 471 | OSchedule := Piece(self.cboSchedule.Items.Strings[idx],U,1) + ' PRN'; | 
|---|
|  | 472 | DisplayDoseNow(doseNow); | 
|---|
|  | 473 | exit; | 
|---|
|  | 474 | //  end; | 
|---|
|  | 475 | end | 
|---|
|  | 476 | else if SchType <> 'O' then | 
|---|
|  | 477 | begin | 
|---|
|  | 478 | self.lblAdminTime.Visible := true; | 
|---|
|  | 479 | if FAdminTimeText <> '' then self.lblAdminTime.Caption := 'Admin. Time: ' + FAdminTimeText | 
|---|
|  | 480 | else if Piece(self.cboSchedule.Items[idx],U,4) <> '' then | 
|---|
|  | 481 | self.lblAdminTime.Caption := 'Admin. Time: ' + Piece(self.cboSchedule.Items[idx],U,4) | 
|---|
|  | 482 | else self.lblAdminTime.Caption := 'Admin. Time: Not Defined'; | 
|---|
|  | 483 | end; | 
|---|
|  | 484 | DisplayDoseNow(doseNow); | 
|---|
|  | 485 | if chkDoseNow.Checked = true then | 
|---|
|  | 486 | begin | 
|---|
|  | 487 | lblFirstDose.Visible := false; | 
|---|
|  | 488 | Exit; | 
|---|
|  | 489 | end; | 
|---|
|  | 490 | self.lblFirstDose.Visible := True; | 
|---|
|  | 491 | fSolIEN := 0; | 
|---|
|  | 492 | fAddIEN := 0; | 
|---|
|  | 493 | for i := 0 to self.grdSelected.RowCount - 1 do | 
|---|
|  | 494 | begin | 
|---|
|  | 495 | AniVComponent := TIVComponent(self.grdSelected.Objects[0, i]); | 
|---|
|  | 496 | if AnIVComponent = nil then Continue; | 
|---|
|  | 497 | if (AnIVComponent.Fluid = 'B') and (fSolIEN = 0) then fSolIEN := AnIVComponent.IEN; | 
|---|
|  | 498 | if (AnIVComponent.Fluid = 'A') and (fAddIEN = 0) then fAddIEN := AnIVComponent.IEN; | 
|---|
|  | 499 | if (fSolIEN > 0) and (fAddIEN > 0) then break; | 
|---|
|  | 500 | end; | 
|---|
|  | 501 | SchTxt := self.cboSchedule.Text; | 
|---|
|  | 502 | Admin := ''; | 
|---|
|  | 503 | if (self.lblAdminTime.visible = True) and (self.lblAdminTime.Caption <> '') then | 
|---|
|  | 504 | begin | 
|---|
|  | 505 | Admin := Copy(self.lblAdminTime.Caption,  14, (Length(self.lblAdminTime.Caption)-1)); | 
|---|
|  | 506 | if not (Admin[1] in ['0'..'9']) then Admin := ''; | 
|---|
|  | 507 | end; | 
|---|
|  | 508 | if (fSolIEN = oSolIEN) and (fAddIEN = oAddIEN) and (OSchedule = SchTxt) and (oAdmin = Admin) then CalFirstDose := false | 
|---|
|  | 509 | else | 
|---|
|  | 510 | begin | 
|---|
|  | 511 | CalFirstDose := True; | 
|---|
|  | 512 | oSolIEN := fSolIEN; | 
|---|
|  | 513 | oAddIEN := fAddIEN; | 
|---|
|  | 514 | oSchedule := SchTxt; | 
|---|
|  | 515 | oAdmin := Admin; | 
|---|
|  | 516 | end; | 
|---|
|  | 517 | if CalFirstDose = True then | 
|---|
|  | 518 | begin | 
|---|
|  | 519 | if fAddIEN > 0 then LoadAdminInfo(';' + schTxt, fAddIEN, ShowText, AdminTime, Duration, Admin) | 
|---|
|  | 520 | else LoadAdminInfo(';' + schTxt, fSolIEN, ShowText, AdminTime, Duration, Admin); | 
|---|
|  | 521 | if AdminTime > 0 then | 
|---|
|  | 522 | begin | 
|---|
|  | 523 | ShowText := 'Expected First Dose: '; | 
|---|
|  | 524 | Interval := Trunc(FMDateTimeToDateTime(AdminTime) - FMDateTimeToDateTime(FMToday)); | 
|---|
|  | 525 | case Interval of | 
|---|
|  | 526 | 0: ShowText := ShowText + 'TODAY ' + FormatFMDateTime('(mmm dd, yy) at hh:nn', AdminTime); | 
|---|
|  | 527 | 1: ShowText := ShowText + 'TOMORROW ' + FormatFMDateTime('(mmm dd, yy) at hh:nn', AdminTime); | 
|---|
|  | 528 | else ShowText := ShowText + FormatFMDateTime('mmm dd, yy at hh:nn', AdminTime); | 
|---|
|  | 529 | end; | 
|---|
|  | 530 | end; | 
|---|
|  | 531 | self.lblFirstDose.Caption := ShowText; | 
|---|
|  | 532 | end; | 
|---|
|  | 533 | if (self.lblFirstDose.Visible = true) and (self.lblFirstDose.Caption <> '') and (JAWSON = true) then self.lblFirstDose.TabStop := true | 
|---|
|  | 534 | else self.lblFirstDose.TabStop := false; | 
|---|
|  | 535 | if (self.lblAdminTime.Visible = true) and (self.lblAdminTime.Caption <> '') and (JAWSON = true) then self.lblAdminTime.TabStop := true | 
|---|
|  | 536 | else self.lblAdminTime.TabStop := false; | 
|---|
|  | 537 | end; | 
|---|
|  | 538 |  | 
|---|
| [1679] | 539 | procedure TfrmODMedIV.VA508CompRouteInstructionsQuery( | 
|---|
|  | 540 | Sender: TObject; var Text: string); | 
|---|
|  | 541 | begin | 
|---|
|  | 542 | inherited; | 
|---|
|  | 543 | SetCtrlAlt_L_LabelAccessText(Text, txtAllIVRoutes); | 
|---|
|  | 544 | end; | 
|---|
|  | 545 |  | 
|---|
|  | 546 | procedure TfrmODMedIV.VA508CompScheduleInstructionsQuery(Sender: TObject; | 
|---|
|  | 547 | var Text: string); | 
|---|
|  | 548 | begin | 
|---|
|  | 549 | inherited; | 
|---|
|  | 550 | SetCtrlAlt_L_LabelAccessText(Text, txtNSS); | 
|---|
|  | 551 | end; | 
|---|
|  | 552 |  | 
|---|
|  | 553 | procedure TfrmODMedIV.VA508CompTypeInstructionsQuery(Sender: TObject; | 
|---|
|  | 554 | var Text: string); | 
|---|
|  | 555 | begin | 
|---|
|  | 556 | inherited; | 
|---|
|  | 557 | SetCtrlAlt_L_LabelAccessText(Text, lblTypeHelp); | 
|---|
|  | 558 | end; | 
|---|
|  | 559 |  | 
|---|
|  | 560 | procedure TfrmODMedIV.VA508CompGrdSelectedCaptionQuery(Sender: TObject; | 
|---|
|  | 561 | var Text: string); | 
|---|
|  | 562 | begin | 
|---|
|  | 563 | inherited; | 
|---|
|  | 564 | if grdSelected.Col = 0 then | 
|---|
|  | 565 | Text := lblComponent.Caption | 
|---|
|  | 566 | else if grdSelected.Col = 1 then | 
|---|
|  | 567 | Text := lblAmount.Caption | 
|---|
|  | 568 | else if grdSelected.Col = 2 then | 
|---|
|  | 569 | Text := lblAmount.Caption + ', Unit' | 
|---|
|  | 570 | else if grdSelected.Col = 3 then | 
|---|
|  | 571 | Text := lblAddFreq.Caption | 
|---|
|  | 572 | else if grdSelected.Col = 4 then | 
|---|
|  | 573 | Text := lblPrevAddFreq.Caption; | 
|---|
|  | 574 | end; | 
|---|
|  | 575 |  | 
|---|
|  | 576 | procedure TfrmODMedIV.VA508CompOrderSigStateQuery(Sender: TObject; | 
|---|
|  | 577 | var Text: string); | 
|---|
|  | 578 | begin | 
|---|
|  | 579 | inherited; | 
|---|
|  | 580 | Text := memOrder.Text; | 
|---|
|  | 581 | end; | 
|---|
|  | 582 |  | 
|---|
| [456] | 583 | procedure TfrmODMedIV.Validate(var AnErrMsg: string); | 
|---|
|  | 584 | var | 
|---|
| [829] | 585 | DispWarning, ItemOK, Result: Boolean; | 
|---|
| [1679] | 586 | LDec,RDec,x, tempStr, iunit, infError, Bag: string; | 
|---|
| [829] | 587 | digits, i, j, Len, temp, Value: Integer; | 
|---|
| [456] | 588 |  | 
|---|
|  | 589 | procedure SetError(const x: string); | 
|---|
|  | 590 | begin | 
|---|
|  | 591 | if Length(AnErrMsg) > 0 then AnErrMsg := AnErrMsg + CRLF; | 
|---|
|  | 592 | AnErrMsg := AnErrMsg + x; | 
|---|
|  | 593 | end; | 
|---|
|  | 594 |  | 
|---|
|  | 595 | begin | 
|---|
|  | 596 | inherited; | 
|---|
|  | 597 | with grdSelected do | 
|---|
|  | 598 | begin | 
|---|
|  | 599 | ItemOK := False; | 
|---|
|  | 600 | for i := 0 to RowCount - 1 do | 
|---|
| [829] | 601 | if (Objects[0,i] <> nil) and (TIVComponent(Objects[0, i]).Fluid = 'B') then ItemOK := True; | 
|---|
|  | 602 | if (not ItemOK) and ((self.cboType.ItemIndex = -1) or (MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Continuous')) then | 
|---|
|  | 603 | SetError(TX_NO_BASE); | 
|---|
| [456] | 604 | for i := 0 to RowCount - 1 do | 
|---|
|  | 605 | begin | 
|---|
|  | 606 | if (Objects[0, i] <> nil) and ((Length(Cells[1, i]) = 0) or (StrToFloat(Cells[1,i])=0)) | 
|---|
|  | 607 | then SetError(TX_NO_AMOUNT + Cells[0, i]); | 
|---|
|  | 608 | if (Objects[0, i] <> nil) and (Length(Cells[2, i]) = 0) | 
|---|
|  | 609 | then SetError(TX_NO_UNITS + Cells[0, i]); | 
|---|
| [829] | 610 | if (Objects[0,i] <> nil) and (TIVComponent(Objects[0, i]).Fluid = 'A') then | 
|---|
|  | 611 | begin | 
|---|
|  | 612 | temp := Pos('.', Cells[1, i]); | 
|---|
|  | 613 | if temp > 0 then | 
|---|
|  | 614 | begin | 
|---|
|  | 615 | tempStr := Cells[1, i]; | 
|---|
|  | 616 | if temp = 1 then | 
|---|
|  | 617 | begin | 
|---|
|  | 618 | SetError(cells[0, i] + TX_LEADING_NUMERIC); | 
|---|
|  | 619 | Exit; | 
|---|
|  | 620 | end; | 
|---|
|  | 621 | for j := 1 to temp -1 do if not (tempStr[j] in ['0'..'9']) then | 
|---|
|  | 622 | begin | 
|---|
|  | 623 | SetError(cells[0, i] + TX_LEADING_NUMERIC); | 
|---|
|  | 624 | Exit; | 
|---|
|  | 625 | end; | 
|---|
|  | 626 | end; | 
|---|
| [1679] | 627 | //AGP ADDITIVE FREQUENCY CHANGES | 
|---|
|  | 628 | if MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Continuous' then | 
|---|
|  | 629 | begin | 
|---|
|  | 630 | Bag := (Cells[3, i]); | 
|---|
|  | 631 | if Length(Bag) = 0 then | 
|---|
|  | 632 | begin | 
|---|
|  | 633 | SetError(TX_BAD_BAG + cells[0, i]); | 
|---|
|  | 634 | end | 
|---|
|  | 635 | else if cboAddFreq.Items.IndexOf(Bag) = -1 then | 
|---|
|  | 636 | begin | 
|---|
|  | 637 | SetError(TX_BAD_BAG + cells[0, i]); | 
|---|
|  | 638 | end | 
|---|
|  | 639 | else if (MixedCase(Bag) = 'See Comments') and ((self.memComments.Text = '') or (self.memComments.Text = CRLF)) then | 
|---|
|  | 640 | begin | 
|---|
|  | 641 | SetError(Tx_BAG_NO_COMMENTS + cells[0,i] + Tx_BAG_NO_COMMENTS1); | 
|---|
|  | 642 | end; | 
|---|
|  | 643 |  | 
|---|
|  | 644 | end; | 
|---|
| [829] | 645 | end; | 
|---|
|  | 646 | end; | 
|---|
|  | 647 | end; | 
|---|
|  | 648 | if Pos(U, self.memComments.Text) > 0 then SetError('Comments cannot contain a "^".'); | 
|---|
|  | 649 | if cboSchedule.ItemIndex > -1 then updateDuration(Piece(cboSchedule.Items.Strings[cboSchedule.itemIndex], U, 3)); | 
|---|
|  | 650 | if self.cboPriority.Text = '' then SetError('Priority is required'); | 
|---|
|  | 651 | if (cboRoute.ItemIndex = -1) and (cboRoute.Text <> '') then SetError(TX_BAD_ROUTE); | 
|---|
|  | 652 | if (cboRoute.ItemIndex > -1) and (cboRoute.ItemIndex = cboRoute.Items.IndexOf('OTHER')) then | 
|---|
|  | 653 | SetError('A valid route must be selected'); | 
|---|
|  | 654 | if self.cboRoute.Text = '' then SetError('Route is required'); | 
|---|
|  | 655 | if (self.txtXDuration.Text <> '') and (self.cboduration.Items.IndexOf(SELF.cboDuration.Text) = -1) then | 
|---|
|  | 656 | SetError('A valid duration type is required'); | 
|---|
|  | 657 | if (self.txtXDuration.Text = '') and (self.cboduration.Items.IndexOf(SELF.cboDuration.Text) > -1) then | 
|---|
|  | 658 | SetError('Cannot have a duration type without a duration value'); | 
|---|
|  | 659 |  | 
|---|
|  | 660 | if self.cboType.ItemIndex = -1 then | 
|---|
|  | 661 | begin | 
|---|
|  | 662 | SetError('IV Type is required'); | 
|---|
|  | 663 | Exit; | 
|---|
| [456] | 664 | end; | 
|---|
| [829] | 665 | if MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Continuous' then | 
|---|
|  | 666 | begin | 
|---|
|  | 667 | if Length(txtRate.Text) = 0 then SetError(TX_NO_RATE) else | 
|---|
|  | 668 | begin | 
|---|
|  | 669 | x := Trim(txtRate.Text); | 
|---|
|  | 670 | if pos('@', X) > 0 then | 
|---|
|  | 671 | begin | 
|---|
|  | 672 | LDec := Piece(x, '@', 1); | 
|---|
|  | 673 | RDec := Piece(x, '@', 2); | 
|---|
|  | 674 | if (Length(RDec) = 0) or (Length(RDec) > 2) then x := ''; | 
|---|
|  | 675 | end | 
|---|
|  | 676 | else if Pos('.',X)>0 then | 
|---|
|  | 677 | begin | 
|---|
|  | 678 | LDec := Piece(x, '.', 1); | 
|---|
|  | 679 | RDec := Piece(x, '.', 2); | 
|---|
|  | 680 | if Length(LDec) = 0 then SetError('Infusion Rate required a leading numeric value'); | 
|---|
|  | 681 | if Length(RDec) > 1 then SetError('Infusion Rate cannot exceed one decimal place'); | 
|---|
|  | 682 | end | 
|---|
|  | 683 | else if LeftStr(txtRate.Text, 1) = '0' then | 
|---|
|  | 684 | SetError('Infusion Rate cannot start with a zero.'); | 
|---|
|  | 685 | if ( Pos('@',x)=0) then | 
|---|
|  | 686 | begin | 
|---|
|  | 687 | if (Length(x) > 4) then | 
|---|
|  | 688 | begin | 
|---|
|  | 689 | seterror(TX_BAD_RATE); | 
|---|
|  | 690 | exit; | 
|---|
|  | 691 | end; | 
|---|
|  | 692 | for i := 1 to Length(x) do | 
|---|
|  | 693 | begin | 
|---|
|  | 694 | if  not (x[i] in ['0'..'9']) and (x[i] <> '.') then | 
|---|
|  | 695 | begin | 
|---|
|  | 696 | SetError(TX_BAD_RATE); | 
|---|
|  | 697 | exit; | 
|---|
|  | 698 | end; | 
|---|
|  | 699 | end; | 
|---|
|  | 700 | end; | 
|---|
|  | 701 | if (pos('ml/hr', X) = 0) and (Length(x) > 0) and (pos('@', X) = 0) then X := X + ' ml/hr'; | 
|---|
|  | 702 | if Length(x) = 0 then SetError(TX_BAD_RATE) else Responses.Update('RATE', 1, x, x); | 
|---|
|  | 703 | end; | 
|---|
|  | 704 | if cboduration.text = 'doses' then SetError('Continuous Orders cannot have "doses" as a duration type'); | 
|---|
|  | 705 | end | 
|---|
|  | 706 | else if MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Intermittent' then | 
|---|
|  | 707 | begin | 
|---|
|  | 708 | if (cboInfusionTime.ItemIndex = -1) and (txtRate.Text <> '') then SetError(TX_NO_INFUSION_UNIT); | 
|---|
|  | 709 | if (txtRate.Text = '') and (cboInfusionTime.ItemIndex > -1) then SetError(TX_NO_INFUSION_TIME); | 
|---|
|  | 710 | if (txtRate.Text <> '') then | 
|---|
|  | 711 | begin | 
|---|
|  | 712 | infError := ''; | 
|---|
|  | 713 | InfError := ValidateInfusionRate(txtRate.Text); | 
|---|
|  | 714 | if infError <> '' then SetError(InfError); | 
|---|
|  | 715 | Len := Length(txtRate.Text); | 
|---|
|  | 716 | iunit := MixedCase(self.cboInfusionTime.Items.Strings[cboInfusionTime.ItemIndex]); | 
|---|
|  | 717 | if (iunit = 'Minutes') and (Len > 4) then setError('Infuse Over Time cannot exceed 4 spaces for ' + iunit) | 
|---|
|  | 718 | else if (iunit = 'Hours') and (Len > 2) then setError('Infuse Over Time cannot exceed 2 spaces for ' + iunit); | 
|---|
|  | 719 | end; | 
|---|
| [1679] | 720 | if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text = '') and (chkPRN.Checked = false) then SetError(TX_NO_SCHEDULE); | 
|---|
|  | 721 | if (cboSchedule.ItemIndex > -1) and (cboSchedule.Text = '') then | 
|---|
|  | 722 | begin | 
|---|
|  | 723 | cboSchedule.ItemIndex := -1; | 
|---|
|  | 724 | SetError(TX_NO_SCHEDULE) | 
|---|
|  | 725 | end; | 
|---|
| [829] | 726 | if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text <> '') then SetError(TX_BAD_SCHEDULE); | 
|---|
|  | 727 | end; | 
|---|
|  | 728 | if txtXDuration.Text = '' then | 
|---|
|  | 729 | begin | 
|---|
| [1679] | 730 | if AnErrMsg = '' then exit; | 
|---|
|  | 731 | //if AnErrMsg = '' then self.FInitialOrderID := True; | 
|---|
|  | 732 | //exit; | 
|---|
| [829] | 733 | end; | 
|---|
|  | 734 | Len := Length(txtXDuration.Text); | 
|---|
|  | 735 | if LeftStr(txtXDuration.Text,1) <> '.' then | 
|---|
|  | 736 | begin | 
|---|
|  | 737 | DispWarning := false; | 
|---|
|  | 738 | Digits := 2; | 
|---|
|  | 739 | if cboDuration.text = 'ml' then digits := 4; | 
|---|
|  | 740 | if ((cboDuration.text = 'days') or (cboDuration.text = 'hours')) and (Len > digits) then | 
|---|
|  | 741 | DispWarning := true | 
|---|
|  | 742 | else if (cboduration.text = 'ml') and (Len > digits) then  DispWarning := true | 
|---|
|  | 743 | else if (cboduration.text = 'L') and (Len > digits) and (Pos('.',txtXDuration.Text) = 0) then DispWarning := True; | 
|---|
|  | 744 | if DispWarning = true then SetError('Duration for ' + cboduration.text + ' cannot be greater than ' + InttoStr(digits) + ' digits.'); | 
|---|
|  | 745 | end; | 
|---|
|  | 746 | if (Pos('.', txtXDuration.Text)>0)  then | 
|---|
| [456] | 747 | begin | 
|---|
| [829] | 748 | SetError('Invalid Duration, please enter a whole numbers for a duration.'); | 
|---|
|  | 749 | end | 
|---|
|  | 750 | else if LeftStr(txtXDuration.text, 1) = '0' then | 
|---|
|  | 751 | SetError('Duration cannot start with a zero.'); | 
|---|
|  | 752 | if (cboduration.text = 'doses') then | 
|---|
|  | 753 | begin | 
|---|
|  | 754 | if TryStrToInt(txtXDuration.Text, Value) = false then | 
|---|
|  | 755 | SetError('Duration with a unit of "doses" must be a whole number between 0 and 2000000') | 
|---|
|  | 756 | else if (Value < 0) or (Value > 2000000) then | 
|---|
|  | 757 | SetError('Duration with a unit of "doses" must be greater then 0 and less then 2000000'); | 
|---|
|  | 758 | end; | 
|---|
| [1679] | 759 | //if AnErrMsg = '' then self.FInitialOrderID := True; | 
|---|
| [829] | 760 |  | 
|---|
| [456] | 761 | end; | 
|---|
|  | 762 |  | 
|---|
| [829] | 763 | function TFrmODMedIV.ValidateInfusionRate(Rate: string): string; | 
|---|
|  | 764 | var | 
|---|
|  | 765 | Temp: Boolean; | 
|---|
|  | 766 | i: integer; | 
|---|
|  | 767 | begin | 
|---|
|  | 768 | Temp := False; | 
|---|
|  | 769 | if Pos('.',Rate) >0 then | 
|---|
|  | 770 | begin | 
|---|
|  | 771 | Result := 'Infuse Over Time can only be a whole number'; | 
|---|
|  | 772 | exit; | 
|---|
|  | 773 | end | 
|---|
|  | 774 | else if LeftStr(Rate, 1) = '0' then Result := 'Infuse Over Time cannot start with a zero.'; | 
|---|
|  | 775 | for i := 1 to Length(Rate) do if not (Rate[i] in ['0'..'9']) then Temp := True; | 
|---|
|  | 776 | if Temp = True then Result := 'The Infusion time can only be a whole number'; | 
|---|
|  | 777 | end; | 
|---|
|  | 778 |  | 
|---|
| [456] | 779 | procedure TfrmODMedIV.SetValuesFromResponses; | 
|---|
|  | 780 | var | 
|---|
| [1679] | 781 | x, addRoute, tempSch, AdminTime, TempOrder, tmpSch, tempIRoute, tempRoute, PreAddFreq: string; | 
|---|
|  | 782 | AnInstance, i, idx, j: Integer; | 
|---|
|  | 783 | AResponse, AddFreqResp: TResponse; | 
|---|
| [456] | 784 | AnIVComponent: TIVComponent; | 
|---|
| [829] | 785 | AllIVRoute: TStringList; | 
|---|
|  | 786 | PQO: boolean; | 
|---|
| [456] | 787 | begin | 
|---|
|  | 788 | Changing := True; | 
|---|
| [1679] | 789 | //self.FInitialOrderID := false; | 
|---|
| [456] | 790 | with Responses do | 
|---|
|  | 791 | begin | 
|---|
| [1679] | 792 | SetControl(cboType, 'TYPE', 1); | 
|---|
|  | 793 | if cboType.ItemIndex > -1 then  FIVTypeDefined := True; | 
|---|
| [456] | 794 | FInpatient := OrderForInpatient; | 
|---|
|  | 795 | AnInstance := NextInstance('ORDERABLE', 0); | 
|---|
|  | 796 | while AnInstance > 0 do | 
|---|
|  | 797 | begin | 
|---|
|  | 798 | AResponse := FindResponseByName('ORDERABLE', AnInstance); | 
|---|
|  | 799 | if AResponse <> nil then | 
|---|
|  | 800 | begin | 
|---|
|  | 801 | x := AmountsForIVFluid(StrToIntDef(AResponse.IValue, 0), 'B'); | 
|---|
|  | 802 | AnIVComponent := TIVComponent.Create; | 
|---|
|  | 803 | AnIVComponent.IEN     := StrToIntDef(AResponse.IValue, 0); | 
|---|
|  | 804 | if not FInpatient then | 
|---|
|  | 805 | begin | 
|---|
|  | 806 | if DEACheckFailedForIVOnOutPatient(AnIVComponent.IEN,'S') then | 
|---|
|  | 807 | begin | 
|---|
|  | 808 | InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); | 
|---|
|  | 809 | cboAdditive.Text := ''; | 
|---|
| [829] | 810 | AbortOrder := True; | 
|---|
| [456] | 811 | Exit; | 
|---|
|  | 812 | end; | 
|---|
|  | 813 | end else | 
|---|
|  | 814 | begin | 
|---|
|  | 815 | if DEACheckFailed(AnIVComponent.IEN, FInpatient) then | 
|---|
|  | 816 | begin | 
|---|
|  | 817 | InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); | 
|---|
|  | 818 | cboAdditive.Text := ''; | 
|---|
| [829] | 819 | AbortOrder := True; | 
|---|
| [456] | 820 | Exit; | 
|---|
|  | 821 | end; | 
|---|
|  | 822 | end; | 
|---|
|  | 823 | AnIVComponent.Name    := AResponse.EValue; | 
|---|
|  | 824 | AnIVComponent.Fluid   := 'B'; | 
|---|
|  | 825 | AnIVComponent.Amount  := StrToIntDef(Piece(x, U, 2), 0); | 
|---|
|  | 826 | AnIVComponent.Units   := Piece(x, U, 1); | 
|---|
|  | 827 | AnIVComponent.Volumes := Copy(x, Pos(U, x) + 1, Length(x)); | 
|---|
|  | 828 | with grdSelected do | 
|---|
|  | 829 | begin | 
|---|
|  | 830 | if Objects[0, RowCount - 1] <> nil then RowCount := RowCount + 1; | 
|---|
|  | 831 | Objects[0, RowCount - 1] := AnIVComponent; | 
|---|
|  | 832 | Cells[0, RowCount - 1] := AnIVComponent.Name; | 
|---|
|  | 833 | if AnIVComponent.Amount <> 0 then | 
|---|
|  | 834 | Cells[1, RowCount - 1] := IntToStr(AnIVComponent.Amount); | 
|---|
|  | 835 | Cells[2, RowCount - 1] := AnIVComponent.Units; | 
|---|
| [1679] | 836 | Cells[3, RowCount - 1] := 'N/A'; | 
|---|
| [456] | 837 | end; | 
|---|
|  | 838 | end; | 
|---|
|  | 839 | AResponse := FindResponseByName('VOLUME', AnInstance); | 
|---|
|  | 840 | if AResponse <> nil then with grdSelected do Cells[1, RowCount - 1] := AResponse.EValue; | 
|---|
|  | 841 | AnInstance := NextInstance('ORDERABLE', AnInstance); | 
|---|
|  | 842 | end; {while AnInstance - ORDERABLE} | 
|---|
|  | 843 | AnInstance := NextInstance('ADDITIVE', 0); | 
|---|
|  | 844 | while AnInstance > 0 do | 
|---|
|  | 845 | begin | 
|---|
|  | 846 | AResponse := FindResponseByName('ADDITIVE', AnInstance); | 
|---|
|  | 847 | if AResponse <> nil then | 
|---|
|  | 848 | begin | 
|---|
|  | 849 | x := AmountsForIVFluid(StrToIntDef(AResponse.IValue, 0), 'A'); | 
|---|
|  | 850 | AnIVComponent := TIVComponent.Create; | 
|---|
|  | 851 | AnIVComponent.IEN     := StrToIntDef(AResponse.IValue, 0); | 
|---|
|  | 852 | if not FInpatient then | 
|---|
|  | 853 | begin | 
|---|
|  | 854 | if DEACheckFailedForIVOnOutPatient(AnIVComponent.IEN,'A') then | 
|---|
|  | 855 | begin | 
|---|
|  | 856 | InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); | 
|---|
|  | 857 | cboAdditive.Text := ''; | 
|---|
| [829] | 858 | AbortOrder := True; | 
|---|
| [456] | 859 | Exit; | 
|---|
|  | 860 | end; | 
|---|
|  | 861 | end else | 
|---|
|  | 862 | begin | 
|---|
|  | 863 | if DEACheckFailed(AnIVComponent.IEN, FInpatient) then | 
|---|
|  | 864 | begin | 
|---|
|  | 865 | InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); | 
|---|
|  | 866 | cboAdditive.Text := ''; | 
|---|
| [829] | 867 | AbortOrder := true; | 
|---|
| [456] | 868 | Exit; | 
|---|
|  | 869 | end; | 
|---|
|  | 870 | end; | 
|---|
|  | 871 | AnIVComponent.Name    := AResponse.EValue; | 
|---|
|  | 872 | AnIVComponent.Fluid   := 'A'; | 
|---|
|  | 873 | AnIVComponent.Amount  := StrToIntDef(Piece(x, U, 2), 0); | 
|---|
|  | 874 | AnIVComponent.Units   := Piece(x, U, 1); | 
|---|
|  | 875 | AnIVComponent.Volumes := Copy(x, Pos(U, x) + 1, Length(x)); | 
|---|
| [1679] | 876 | //AGP ADDITIVE FREQUENCY CHANGES | 
|---|
|  | 877 | AnIVComponent.AddFreq := ''; | 
|---|
|  | 878 | PreAddFreq := ''; | 
|---|
|  | 879 | AddFreqResp := FindResponseByName('ADDFREQ', AnInstance); | 
|---|
|  | 880 | if AddFreqResp <> nil then | 
|---|
|  | 881 | begin | 
|---|
|  | 882 | if cboAddFreq.Items.IndexOf(AddFreqResp.IValue) = -1 then | 
|---|
|  | 883 | begin | 
|---|
|  | 884 | AnIvComponent.AddFreq := ''; | 
|---|
|  | 885 | end | 
|---|
|  | 886 | else AnIvComponent.AddFreq := AddFreqResp.IValue; | 
|---|
|  | 887 | PreAddFreq := AddFreqResp.IValue; | 
|---|
|  | 888 | end; | 
|---|
| [456] | 889 | with grdSelected do | 
|---|
|  | 890 | begin | 
|---|
|  | 891 | if Objects[0, RowCount - 1] <> nil then RowCount := RowCount + 1; | 
|---|
|  | 892 | Objects[0, RowCount - 1] := AnIVComponent; | 
|---|
|  | 893 | Cells[0, RowCount - 1] := AnIVComponent.Name; | 
|---|
|  | 894 | if AnIVComponent.Amount <> 0 then | 
|---|
|  | 895 | Cells[1, RowCount - 1] := IntToStr(AnIVComponent.Amount); | 
|---|
|  | 896 | Cells[2, RowCount - 1] := AnIVComponent.Units; | 
|---|
| [1679] | 897 | Cells[3, RowCount -1] := AnIVComponent.AddFreq; | 
|---|
|  | 898 | if OrdAction in [ORDER_COPY, ORDER_EDIT] then Cells[4, RowCount -1] := PreAddFreq; | 
|---|
| [456] | 899 | end; | 
|---|
|  | 900 | end; | 
|---|
|  | 901 | AResponse := FindResponseByName('STRENGTH', AnInstance); | 
|---|
|  | 902 | if AResponse <> nil then with grdSelected do Cells[1, RowCount - 1] := AResponse.EValue; | 
|---|
|  | 903 | AResponse := FindResponseByName('UNITS', AnInstance); | 
|---|
|  | 904 | if AResponse <> nil then with grdSelected do Cells[2, RowCount - 1] := AResponse.EValue; | 
|---|
|  | 905 | AnInstance := NextInstance('ADDITIVE', AnInstance); | 
|---|
|  | 906 | end; {while AnInstance - ADDITIVE} | 
|---|
| [829] | 907 | SetControl(cboType, 'TYPE', 1); | 
|---|
|  | 908 | if self.grdSelected.RowCount > 0 then self.txtAllIVRoutes.Visible := True; | 
|---|
|  | 909 | updateRoute; | 
|---|
|  | 910 | AResponse := FindResponseByName('ROUTE', 1); | 
|---|
|  | 911 | if AResponse <> nil then | 
|---|
|  | 912 | begin | 
|---|
|  | 913 | tempRoute := AResponse.EValue; | 
|---|
|  | 914 | if tempRoute <> '' then | 
|---|
|  | 915 | begin | 
|---|
|  | 916 | idx := self.cboRoute.Items.IndexOf(tempRoute); | 
|---|
|  | 917 | if idx > -1 then self.cboRoute.ItemIndex := idx | 
|---|
|  | 918 | else begin | 
|---|
|  | 919 | tempIRoute := AResponse.IValue; | 
|---|
|  | 920 | if tempIRoute <> '' then | 
|---|
|  | 921 | begin | 
|---|
|  | 922 | AllIVRoute := TStringList.Create; | 
|---|
|  | 923 | LoadAllIVRoutes(AllIVRoute); | 
|---|
|  | 924 | idx := -1; | 
|---|
|  | 925 | for i := 0 to AllIVRoute.Count - 1 do | 
|---|
|  | 926 | begin | 
|---|
|  | 927 | if Piece(AllIVRoute.Strings[i], U, 1) = tempIRoute then | 
|---|
|  | 928 | begin | 
|---|
|  | 929 | idx := i; | 
|---|
|  | 930 | break; | 
|---|
|  | 931 | end; | 
|---|
|  | 932 | end; | 
|---|
|  | 933 | if idx > -1 then | 
|---|
|  | 934 | begin | 
|---|
|  | 935 | self.cboRoute.Items.Add(AllIVRoute.Strings[idx]); | 
|---|
|  | 936 | idx := self.cboRoute.Items.IndexOf(tempRoute); | 
|---|
|  | 937 | if idx > -1 then self.cboRoute.ItemIndex := idx; | 
|---|
|  | 938 | end; | 
|---|
|  | 939 | AllIVRoute.Free; | 
|---|
|  | 940 | //if Pos(U, tempIRoute) = 0 then tempIRoute := tempIRoute + U + tempRoute; | 
|---|
|  | 941 | //self.cboRoute.Items.Add(tempIRoute); | 
|---|
|  | 942 | //idx := self.cboRoute.Items.IndexOf(tempRoute); | 
|---|
|  | 943 | //if idx > -1 then self.cboRoute.ItemIndex := idx; | 
|---|
|  | 944 | end; | 
|---|
|  | 945 | end; | 
|---|
|  | 946 | end; | 
|---|
|  | 947 | end; | 
|---|
|  | 948 | //SetControl(cboRoute, 'ROUTE', 1); | 
|---|
|  | 949 | if (cboRoute.ItemIndex = -1) and (cboRoute.Text <> '') then cboRoute.Text := ''; | 
|---|
|  | 950 | if self.cboType.Text = 'Intermittent' then | 
|---|
|  | 951 | begin | 
|---|
|  | 952 | lblInfusionRate.Caption := 'Infuse Over Time (Optional)'; | 
|---|
|  | 953 | lblSchedule.Enabled := True; | 
|---|
|  | 954 | cboschedule.Enabled := True; | 
|---|
|  | 955 | //if popDuration.Items.IndexOf(popDoses) = -1 then popDuration.Items.Add(popDoses); | 
|---|
|  | 956 | if cboDuration.Items.IndexOf('doses') = -1 then cboDuration.Items.Add('doses'); | 
|---|
|  | 957 | txtNss.Visible := true; | 
|---|
|  | 958 | chkDoseNow.Visible := true; | 
|---|
|  | 959 | chkPRN.Enabled := True; | 
|---|
|  | 960 | tempSch := ''; | 
|---|
|  | 961 | AdminTime := ''; | 
|---|
|  | 962 | AResponse := FindResponseByName('SCHEDULE', 1); | 
|---|
|  | 963 | if AResponse <> nil then tempSch := AResponse.EValue; | 
|---|
|  | 964 | lblAdminTime.Visible := True; | 
|---|
|  | 965 | lblAdminTime.Hint := AdminTimeHelpText; | 
|---|
|  | 966 | lblAdminTime.ShowHint := True; | 
|---|
|  | 967 | //AResponse := Responses.FindResponseByName('ADMIN', 1); | 
|---|
|  | 968 | //if AResponse <> nil then AdminTime := AResponse.EValue; | 
|---|
|  | 969 | //if Action = Order_Copy then FOriginalAdminTime := AdminTime; | 
|---|
|  | 970 | SetSchedule(tempSch); | 
|---|
|  | 971 | //if (cboSchedule.ItemIndex > -1) then lblAdminTime.Caption := 'Admin. Time: ' + Piece(cboSchedule.Items.strings[cboSchedule.itemindex],U,5); | 
|---|
|  | 972 | //if (cboSchedule.ItemIndex > -1) and (Piece(lblAdminTime.Caption, ':' ,2) = ' ') then lblAdminTime.Caption := 'Admin. Time: ' + AdminTime; | 
|---|
| [1679] | 973 | if (OrdAction in [ORDER_COPY, ORDER_EDIT])  then | 
|---|
| [829] | 974 | begin | 
|---|
|  | 975 | TempOrder := Piece(OrderIEN,';',1); | 
|---|
|  | 976 | TempOrder := Copy(tempOrder, 2, Length(tempOrder)); | 
|---|
|  | 977 | if DifferentOrderLocations(tempOrder, Patient.Location) = false then | 
|---|
|  | 978 | begin | 
|---|
|  | 979 | AResponse := Responses.FindResponseByName('ADMIN', 1); | 
|---|
|  | 980 | if AResponse <> nil then AdminTime := AResponse.EValue; | 
|---|
|  | 981 | //lblAdminTime.Caption := 'Admin. Time: ' + AdminTime; | 
|---|
| [1679] | 982 | if (cboSchedule.ItemIndex > -1) and (AdminTime <> '') then | 
|---|
| [829] | 983 | begin | 
|---|
|  | 984 | tmpSch := cboSchedule.Items.Strings[cboSchedule.itemindex]; | 
|---|
|  | 985 | setPiece(tmpSch,U,4,AdminTime); | 
|---|
|  | 986 | cboSchedule.Items.Strings[cboSchedule.ItemIndex] := tmpSch; | 
|---|
|  | 987 | end; | 
|---|
|  | 988 | end; | 
|---|
|  | 989 | end; | 
|---|
|  | 990 | //if Piece(lblAdminTime.Caption, ':' ,2) = ' ' then lblAdminTime.Caption := 'Admin. Time: Not Defined'; | 
|---|
|  | 991 | SetControl(txtRate,     'RATE',    1); | 
|---|
|  | 992 | cboInfusionTime.Enabled := true; | 
|---|
|  | 993 | PQO := false; | 
|---|
|  | 994 | if Pos('INFUSE OVER',UpperCase(txtRate.Text)) > 0 then | 
|---|
|  | 995 | begin | 
|---|
|  | 996 | txtRate.Text := Copy(txtRate.Text,Length('Infuse over ')+1,Length(txtRate.text)); | 
|---|
|  | 997 | PQO := True; | 
|---|
|  | 998 | end; | 
|---|
|  | 999 | if Pos('MINUTE',UpperCase(txtRate.Text))>0 then | 
|---|
|  | 1000 | begin | 
|---|
|  | 1001 | cboInfusionTime.Text := 'Minutes'; | 
|---|
|  | 1002 | cboInfusionTime.itemindex := 0; | 
|---|
|  | 1003 | //txtRate.Text := Copy(txtRate.Text,Length('Infuse over ')+1,Length(txtRate.text)); | 
|---|
|  | 1004 | txtRate.Text := Copy(txtRate.Text, 1, Length(txtRate.Text) - 8); | 
|---|
|  | 1005 | end | 
|---|
|  | 1006 | else if Pos('HOUR',UpperCase(txtRate.Text))>0 then | 
|---|
|  | 1007 | begin | 
|---|
|  | 1008 | cboInfusionTime.Text := 'Hours'; | 
|---|
|  | 1009 | cboInfusionTime.ItemIndex := 1; | 
|---|
|  | 1010 | //txtRate.Text := Copy(txtRate.Text,Length('Infuse over ')+1,Length(txtRate.text)); | 
|---|
|  | 1011 | txtRate.Text := Copy(txtRate.Text, 1, Length(txtRate.Text) - 6); | 
|---|
|  | 1012 | end | 
|---|
|  | 1013 | else if (txtRate.Text <> '') and (PQO = false) and (ValidateInfusionRate(txtRate.Text) ='') then | 
|---|
|  | 1014 | begin | 
|---|
|  | 1015 | cboInfusionTime.Text := 'Minutes'; | 
|---|
|  | 1016 | cboInfusionTime.itemindex := 0; | 
|---|
|  | 1017 | end; | 
|---|
| [1679] | 1018 | For j := 0 to grdSelected.RowCount -1 do | 
|---|
|  | 1019 | grdSelected.Cells[3,j] := 'N/A'; | 
|---|
| [829] | 1020 | end | 
|---|
|  | 1021 | else | 
|---|
|  | 1022 | begin | 
|---|
|  | 1023 | lblSchedule.Enabled := false; | 
|---|
|  | 1024 | cboSchedule.ItemIndex := -1; | 
|---|
|  | 1025 | cboSchedule.Enabled := false; | 
|---|
|  | 1026 | if chkDoseNow.Visible = true then  chkDoseNow.Checked := false; | 
|---|
|  | 1027 | chkDoseNow.Visible := false; | 
|---|
|  | 1028 | txtNSS.Visible := false; | 
|---|
|  | 1029 | cboInfusionTime.ItemIndex := -1; | 
|---|
|  | 1030 | cboInfusionTime.Text := ''; | 
|---|
|  | 1031 | cboInfusionTime.Enabled := false; | 
|---|
|  | 1032 | chkPRN.Checked := false; | 
|---|
|  | 1033 | chkPRN.Enabled := false; | 
|---|
|  | 1034 | txtRate.Text := ''; | 
|---|
|  | 1035 | cboDuration.ItemIndex := -1; | 
|---|
|  | 1036 | cboDuration.Text := ''; | 
|---|
|  | 1037 | txtXDuration.Text := ''; | 
|---|
|  | 1038 | SetControl(txtRate,     'RATE',    1); | 
|---|
|  | 1039 | if LowerCase(Copy(ReverseStr(txtRate.Text), 1, 6)) = 'rh/lm '             {*kcm*} | 
|---|
|  | 1040 | then txtRate.Text := Copy(txtRate.Text, 1, Length(txtRate.Text) - 6); | 
|---|
|  | 1041 | end; | 
|---|
| [456] | 1042 | SetControl(cboPriority, 'URGENCY', 1); | 
|---|
|  | 1043 | SetControl(memComments, 'COMMENT', 1); | 
|---|
|  | 1044 |  | 
|---|
|  | 1045 | AnInstance := NextInstance('DAYS', 0); | 
|---|
|  | 1046 | if AnInstance > 0 then | 
|---|
|  | 1047 | begin | 
|---|
|  | 1048 | AResponse := FindResponseByName('DAYS', AnInstance); | 
|---|
|  | 1049 | if AResponse <> nil then | 
|---|
|  | 1050 | SetLimitationControl(AResponse.EValue); | 
|---|
|  | 1051 | end; | 
|---|
|  | 1052 | end; {if...with Responses} | 
|---|
|  | 1053 | Changing := False; | 
|---|
| [829] | 1054 | if self.cboSchedule.ItemIndex > -1 then updateDuration(Piece(cboSchedule.Items.Strings[cboSchedule.itemindex],U,3)); | 
|---|
|  | 1055 | loadExpectFirstDose; | 
|---|
| [456] | 1056 | ControlChange(Self); | 
|---|
|  | 1057 | end; | 
|---|
|  | 1058 |  | 
|---|
|  | 1059 | procedure TfrmODMedIV.SetupDialog(OrderAction: Integer; const ID: string); | 
|---|
|  | 1060 | begin | 
|---|
|  | 1061 | inherited; | 
|---|
| [1679] | 1062 | OrdAction := OrderAction; | 
|---|
| [829] | 1063 | OrderIEN := id; | 
|---|
| [1679] | 1064 | //self.FInitialOrderID := True; | 
|---|
| [829] | 1065 | if self.EvtID > 0 then FAdminTimeText := 'To Be Determined'; | 
|---|
| [1679] | 1066 | if isIMO = true then self.Caption := 'Clinic ' + self.Caption; | 
|---|
| [829] | 1067 | if (isIMO) or ((patient.Inpatient = true) and (encounter.Location <> patient.Location)) and (FAdminTimeText = '') then | 
|---|
|  | 1068 | FAdminTimeText := 'Not defined for Clinic Locations'; | 
|---|
|  | 1069 | if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then | 
|---|
|  | 1070 | begin | 
|---|
|  | 1071 | SetValuesFromResponses; | 
|---|
|  | 1072 | end; | 
|---|
| [456] | 1073 | end; | 
|---|
|  | 1074 |  | 
|---|
|  | 1075 | { tabFluid events } | 
|---|
|  | 1076 |  | 
|---|
|  | 1077 | procedure TfrmODMedIV.tabFluidChange(Sender: TObject); | 
|---|
|  | 1078 | begin | 
|---|
|  | 1079 | inherited; | 
|---|
|  | 1080 | case TabFluid.TabIndex of | 
|---|
|  | 1081 | 0: begin | 
|---|
|  | 1082 | cboSolution.Visible := True; | 
|---|
|  | 1083 | cboAdditive.Visible := False; | 
|---|
|  | 1084 | end; | 
|---|
|  | 1085 | 1: begin | 
|---|
|  | 1086 | cboAdditive.Visible := True; | 
|---|
|  | 1087 | cboSolution.Visible := False; | 
|---|
|  | 1088 | end; | 
|---|
|  | 1089 | end; | 
|---|
|  | 1090 | if cboSolution.Visible then | 
|---|
|  | 1091 | ActiveControl := cboSolution; | 
|---|
|  | 1092 | if cboAdditive.Visible then | 
|---|
|  | 1093 | ActiveControl := cboAdditive; | 
|---|
|  | 1094 | end; | 
|---|
|  | 1095 |  | 
|---|
|  | 1096 | { cboSolution events } | 
|---|
|  | 1097 |  | 
|---|
|  | 1098 | procedure TfrmODMedIV.cboSolutionNeedData(Sender: TObject; const StartFrom: string; | 
|---|
|  | 1099 | Direction, InsertAt: Integer); | 
|---|
|  | 1100 | begin | 
|---|
| [1679] | 1101 | cboSolution.ForDataUse(SubSetOfOrderItems(StartFrom, Direction, 'S.IVB RX')); | 
|---|
| [456] | 1102 | end; | 
|---|
|  | 1103 |  | 
|---|
| [829] | 1104 | procedure TfrmODMedIV.cbotypeChange(Sender: TObject); | 
|---|
| [1679] | 1105 | var | 
|---|
|  | 1106 | i: integer; | 
|---|
| [829] | 1107 | begin | 
|---|
|  | 1108 | inherited; | 
|---|
|  | 1109 | //if (self.cbotype.Text = 'Intermittent') or (self.cboType.itemIndex = 1) then | 
|---|
|  | 1110 | if (self.cboType.itemIndex = 1) then | 
|---|
|  | 1111 | begin | 
|---|
|  | 1112 | cboSchedule.ItemIndex := -1; | 
|---|
|  | 1113 | lblAdminTime.Caption := ''; | 
|---|
|  | 1114 | lblAdminTime.Visible := false; | 
|---|
|  | 1115 | lblschedule.Enabled := True; | 
|---|
|  | 1116 | cboSchedule.Enabled := True; | 
|---|
|  | 1117 | txtNSS.Visible := true; | 
|---|
|  | 1118 | chkDoseNow.Checked := false; | 
|---|
|  | 1119 | chkDoseNow.Visible := true; | 
|---|
|  | 1120 | chkPRN.Checked := false; | 
|---|
|  | 1121 | chkPRN.Enabled := True; | 
|---|
|  | 1122 | lblInfusionRate.Caption := 'Infuse Over Time (Optional)'; | 
|---|
|  | 1123 | cboInfusionTime.Enabled := true; | 
|---|
| [1679] | 1124 | if cboDuration.items.IndexOf('doses') = -1 then cboDuration.Items.Add('doses'); | 
|---|
|  | 1125 | //AGP ADDITIVE FREQUECNY CHANGES | 
|---|
|  | 1126 | lblAddFreq.Caption := 'Additive Frequency'; | 
|---|
|  | 1127 | for i := 0 to grdselected.RowCount - 1 do | 
|---|
|  | 1128 | begin | 
|---|
|  | 1129 | if (TIVComponent(grdselected.Objects[0, i]) <> nil) and (TIVComponent(grdselected.Objects[0, i]).Fluid = 'A') then | 
|---|
|  | 1130 | begin | 
|---|
|  | 1131 | grdSelected.Cells[3, i] := 'N/A'; | 
|---|
|  | 1132 | end; | 
|---|
|  | 1133 | end; | 
|---|
| [829] | 1134 | end | 
|---|
|  | 1135 | //else if (self.cbotype.Text = 'Continuous') or (self.cboType.itemIndex = 0) then | 
|---|
|  | 1136 | else | 
|---|
|  | 1137 | begin | 
|---|
|  | 1138 | lblschedule.Enabled := False; | 
|---|
|  | 1139 | cboSchedule.ItemIndex := -1; | 
|---|
|  | 1140 | cboSchedule.Enabled := False; | 
|---|
|  | 1141 | txtNSS.Visible := false; | 
|---|
|  | 1142 | chkPRN.Checked := false; | 
|---|
|  | 1143 | chkPRN.Enabled := false; | 
|---|
|  | 1144 | if chkDoseNow.Visible = true then chkDoseNow.Checked := false; | 
|---|
|  | 1145 | chkDoseNow.Visible := false; | 
|---|
|  | 1146 | lblInfusionRate.Caption := 'Infusion Rate (ml/hr)*'; | 
|---|
|  | 1147 | cboInfusionTime.ItemIndex := -1; | 
|---|
|  | 1148 | cboInfusionTime.Text := ''; | 
|---|
|  | 1149 | cboInfusionTime.Enabled := false; | 
|---|
|  | 1150 | lblAdminTime.Visible := false; | 
|---|
|  | 1151 | updateDuration(''); | 
|---|
|  | 1152 | cboduration.Items.Delete(cboDuration.Items.IndexOf('doses')); | 
|---|
| [1679] | 1153 | lblAddFreq.Caption := 'Additive Frequency*'; | 
|---|
|  | 1154 | if FIVTypeDefined = True then | 
|---|
|  | 1155 | begin | 
|---|
|  | 1156 | for i := 0 to grdselected.RowCount - 1 do | 
|---|
|  | 1157 | begin | 
|---|
|  | 1158 | if (TIVComponent(grdselected.Objects[0, i]) <> nil) and (TIVComponent(grdselected.Objects[0, i]).Fluid = 'A') then | 
|---|
|  | 1159 | begin | 
|---|
|  | 1160 | grdSelected.Cells[3, i] := ''; | 
|---|
|  | 1161 | end; | 
|---|
|  | 1162 | end; | 
|---|
|  | 1163 | end; | 
|---|
| [829] | 1164 | end; | 
|---|
| [1679] | 1165 | FIVTypeDefined := True; | 
|---|
| [829] | 1166 | self.txtRate.Text := ''; | 
|---|
|  | 1167 | ControlChange(Sender); | 
|---|
|  | 1168 | end; | 
|---|
|  | 1169 |  | 
|---|
| [1679] | 1170 | procedure TfrmODMedIV.cboTypeKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 1171 | Shift: TShiftState); | 
|---|
|  | 1172 | begin | 
|---|
|  | 1173 | inherited; | 
|---|
|  | 1174 | if IsAltCtrl_L_Pressed(Shift, Key) then | 
|---|
|  | 1175 | lblTypeHelpClick(lblTypeHelp); | 
|---|
|  | 1176 | end; | 
|---|
|  | 1177 |  | 
|---|
|  | 1178 | function TfrmODMedIV.IsAltCtrl_L_Pressed(Shift : TShiftState; Key : Word) : Boolean; | 
|---|
|  | 1179 | begin | 
|---|
|  | 1180 | Result := (ssCtrl in Shift) and (ssAlt in Shift) and (Key = Ord('L')); | 
|---|
|  | 1181 | end; | 
|---|
|  | 1182 |  | 
|---|
| [829] | 1183 | procedure TfrmODMedIV.chkDoseNowClick(Sender: TObject); | 
|---|
|  | 1184 | Const | 
|---|
|  | 1185 | T  = '"'; | 
|---|
|  | 1186 | T1 = 'By checking the "Give additional dose now" box, you have actually entered two orders for the same medication.'; | 
|---|
|  | 1187 | T2 = #13#13'The first order''s administrative schedule is "'; | 
|---|
|  | 1188 | T3 = #13'The second order''s administrative schedule is "'; | 
|---|
| [1679] | 1189 | T4 = #13#13'Do you want to continue?'; | 
|---|
|  | 1190 | T5 = '" and a priority of "'; | 
|---|
| [829] | 1191 | T1A = 'By checking the "Give additional dose now" box, you have actually entered a new order with the schedule "NOW"'; | 
|---|
|  | 1192 | T2A = ' in addition to the one you are placing for the same medication.'; | 
|---|
|  | 1193 | var | 
|---|
|  | 1194 | medNm: string; | 
|---|
|  | 1195 | theSch: string; | 
|---|
| [1679] | 1196 | ordPriority: string; | 
|---|
| [829] | 1197 | //SchID: integer; | 
|---|
|  | 1198 | begin | 
|---|
|  | 1199 | inherited; | 
|---|
|  | 1200 | if (chkDoseNow.Checked) then | 
|---|
|  | 1201 | begin | 
|---|
|  | 1202 | medNm := 'Test'; | 
|---|
|  | 1203 | //SchID := cboSchedule.ItemIndex; | 
|---|
|  | 1204 | theSch := cboSchedule.Text; | 
|---|
| [1679] | 1205 | ordPriority := cboPriority.SelText; | 
|---|
| [829] | 1206 | if length(theSch)>0 then | 
|---|
|  | 1207 | begin | 
|---|
|  | 1208 | //if (InfoBox(T1+medNm+T+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then | 
|---|
| [1679] | 1209 | //if (InfoBox(T1+T2+theSch+T+T3+'NOW"'+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then | 
|---|
|  | 1210 | if (InfoBox(T1+T2+'NOW'+T5+ordPriority+T+T3+theSch+T5+ordPriority+T+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL)then | 
|---|
| [829] | 1211 | begin | 
|---|
|  | 1212 | chkDoseNow.Checked := False; | 
|---|
|  | 1213 | Exit; | 
|---|
|  | 1214 | end; | 
|---|
|  | 1215 | end else | 
|---|
|  | 1216 | begin | 
|---|
|  | 1217 | //if InfoBox(T1A+T2A+medNm+T+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL then | 
|---|
|  | 1218 | if InfoBox(T1A+T2A+T4, 'Warning', MB_OKCANCEL or MB_ICONWARNING) = IDCANCEL then | 
|---|
|  | 1219 | begin | 
|---|
|  | 1220 | chkDoseNow.Checked := False; | 
|---|
|  | 1221 | Exit; | 
|---|
|  | 1222 | end; | 
|---|
|  | 1223 | end; | 
|---|
|  | 1224 | end; | 
|---|
|  | 1225 | ControlChange(self); | 
|---|
|  | 1226 | end; | 
|---|
|  | 1227 |  | 
|---|
|  | 1228 | procedure TfrmODMedIV.chkPRNClick(Sender: TObject); | 
|---|
|  | 1229 | begin | 
|---|
|  | 1230 | inherited; | 
|---|
|  | 1231 | ControlChange(Self); | 
|---|
|  | 1232 | end; | 
|---|
|  | 1233 |  | 
|---|
| [456] | 1234 | procedure TfrmODMedIV.cboSolutionMouseClick(Sender: TObject); | 
|---|
|  | 1235 | var | 
|---|
|  | 1236 | AnIVComponent: TIVComponent; | 
|---|
| [829] | 1237 | x,routeIEN: string; | 
|---|
|  | 1238 | i: integer; | 
|---|
| [456] | 1239 | begin | 
|---|
|  | 1240 | inherited; | 
|---|
|  | 1241 | if CharAt(cboSolution.ItemID, 1) = 'Q' then              // setup quick order | 
|---|
|  | 1242 | begin | 
|---|
| [829] | 1243 | //Clear pre-existing values | 
|---|
|  | 1244 | for i := 0 to self.grdSelected.RowCount do | 
|---|
|  | 1245 | begin | 
|---|
|  | 1246 | if self.grdSelected.Objects[0,i] <> nil then | 
|---|
|  | 1247 | begin | 
|---|
|  | 1248 | TIVComponent(self.grdSelected.Objects[0,i]).Free; | 
|---|
|  | 1249 | self.grdSelected.Rows[i].Clear; | 
|---|
|  | 1250 | end | 
|---|
|  | 1251 | else self.grdSelected.Rows[i].clear; | 
|---|
|  | 1252 | end; | 
|---|
|  | 1253 | self.grdSelected.RowCount := 0; | 
|---|
|  | 1254 | ControlChange(Sender); | 
|---|
| [456] | 1255 | Responses.QuickOrder := ExtractInteger(cboSolution.ItemID); | 
|---|
|  | 1256 | SetValuesFromResponses; | 
|---|
|  | 1257 | cboSolution.ItemIndex := -1; | 
|---|
|  | 1258 | Exit; | 
|---|
|  | 1259 | end; | 
|---|
|  | 1260 | if cboSolution.ItemIEN <= 0 then Exit;                   // process selection of solution | 
|---|
|  | 1261 | FInpatient := OrderForInpatient; | 
|---|
|  | 1262 | if not FInpatient then | 
|---|
|  | 1263 | begin | 
|---|
|  | 1264 | if DEACheckFailedForIVOnOutPatient(cboSolution.ItemIEN,'S') then | 
|---|
|  | 1265 | begin | 
|---|
|  | 1266 | InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); | 
|---|
|  | 1267 | cboSolution.Text := ''; | 
|---|
|  | 1268 | Exit; | 
|---|
|  | 1269 | end; | 
|---|
|  | 1270 | end else | 
|---|
|  | 1271 | begin | 
|---|
|  | 1272 | if DEACheckFailed(cboSolution.ItemIEN, FInpatient) then | 
|---|
|  | 1273 | begin | 
|---|
|  | 1274 | InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); | 
|---|
|  | 1275 | cboSolution.Text := ''; | 
|---|
|  | 1276 | Exit; | 
|---|
|  | 1277 | end; | 
|---|
|  | 1278 | end; | 
|---|
| [829] | 1279 | RouteIEN := Piece(cboSolution.Items.Strings[cboSolution.itemindex],U,4); | 
|---|
| [456] | 1280 | x := AmountsForIVFluid(cboSolution.ItemIEN, 'B'); | 
|---|
|  | 1281 | AnIVComponent := TIVComponent.Create; | 
|---|
|  | 1282 | AnIVComponent.IEN     := cboSolution.ItemIEN; | 
|---|
|  | 1283 | AnIVComponent.Name    := Piece(cboSolution.Items[cboSolution.ItemIndex], U, 3); | 
|---|
|  | 1284 | AnIVComponent.Fluid   := 'B'; | 
|---|
|  | 1285 | AnIVComponent.Amount  := StrToIntDef(Piece(x, U, 2), 0); | 
|---|
|  | 1286 | AnIVComponent.Units   := Piece(x, U, 1); | 
|---|
|  | 1287 | AnIVComponent.Volumes := Copy(x, Pos(U, x) + 1, Length(x)); | 
|---|
|  | 1288 | cboSolution.ItemIndex := -1; | 
|---|
|  | 1289 | with grdSelected do | 
|---|
|  | 1290 | begin | 
|---|
|  | 1291 | if Objects[0, RowCount - 1] <> nil then RowCount := RowCount + 1; | 
|---|
|  | 1292 | Objects[0, RowCount - 1] := AnIVComponent; | 
|---|
|  | 1293 | Cells[0, RowCount - 1] := AnIVComponent.Name; | 
|---|
|  | 1294 | Cells[1, RowCount - 1] := IntToStr(AnIVComponent.Amount); | 
|---|
|  | 1295 | Cells[2, RowCount - 1] := AnIVComponent.Units; | 
|---|
| [1679] | 1296 | Cells[3, RowCount - 1] := 'N/A'; | 
|---|
| [456] | 1297 | Row := RowCount - 1; | 
|---|
|  | 1298 | if Length(Piece(AnIVComponent.Volumes, U, 2)) > 0 then Col := 1 else Col := 0; | 
|---|
| [1679] | 1299 | (*  if RowCount = 1 then        // switch to additives after 1st IV | 
|---|
| [456] | 1300 | begin | 
|---|
|  | 1301 | tabFluid.TabIndex := 1; | 
|---|
|  | 1302 | tabFluidChange(Self); | 
|---|
| [1679] | 1303 | end;  *) | 
|---|
| [456] | 1304 | end; | 
|---|
|  | 1305 | Application.ProcessMessages;         //CQ: 10157 | 
|---|
| [1679] | 1306 | updateRoute; | 
|---|
| [456] | 1307 | ClickOnGridCell; | 
|---|
| [1679] | 1308 | //updateRoute; | 
|---|
| [456] | 1309 | ControlChange(Sender); | 
|---|
| [829] | 1310 | //updateRoute(routeIEN); | 
|---|
| [456] | 1311 | end; | 
|---|
|  | 1312 |  | 
|---|
|  | 1313 | procedure TfrmODMedIV.cboSolutionExit(Sender: TObject); | 
|---|
|  | 1314 | begin | 
|---|
|  | 1315 | inherited; | 
|---|
| [829] | 1316 | if EnterIsPressed then //CQ: 15097 | 
|---|
|  | 1317 | if (cboSolution.ItemIEN > 0) or | 
|---|
|  | 1318 | ((cboSolution.ItemIEN = 0) and (CharAt(cboSolution.ItemID, 1) = 'Q')) then | 
|---|
|  | 1319 | cboSolutionMouseClick(Self); | 
|---|
| [456] | 1320 | end; | 
|---|
|  | 1321 |  | 
|---|
|  | 1322 | { cboAdditive events } | 
|---|
|  | 1323 |  | 
|---|
|  | 1324 | procedure TfrmODMedIV.cboAdditiveNeedData(Sender: TObject; const StartFrom: string; | 
|---|
|  | 1325 | Direction, InsertAt: Integer); | 
|---|
|  | 1326 | begin | 
|---|
| [1679] | 1327 | cboAdditive.ForDataUse(SubSetOfOrderItems(StartFrom, Direction, 'S.IVA RX')); | 
|---|
|  | 1328 | end; | 
|---|
|  | 1329 |  | 
|---|
|  | 1330 | procedure TfrmODMedIV.cboAddFreqCloseUp(Sender: TObject); | 
|---|
|  | 1331 | begin | 
|---|
| [456] | 1332 | inherited; | 
|---|
| [1679] | 1333 | with cboAddFreq do | 
|---|
|  | 1334 | begin | 
|---|
|  | 1335 | if tag < 0 then exit; | 
|---|
|  | 1336 | grdSelected.Cells[Tag div 256, Tag mod 256] := MixedCase(items.Strings[itemindex]); | 
|---|
|  | 1337 | Tag := -1; | 
|---|
|  | 1338 | Hide; | 
|---|
|  | 1339 | ControlChange(Sender); | 
|---|
|  | 1340 | TControl(self.grdSelected).Enabled := True; | 
|---|
|  | 1341 | ActiveControl := self.grdSelected; | 
|---|
|  | 1342 | end; | 
|---|
|  | 1343 | grdSelected.Refresh; | 
|---|
| [456] | 1344 | end; | 
|---|
|  | 1345 |  | 
|---|
| [1679] | 1346 | procedure TfrmODMedIV.cboAddFreqKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 1347 | Shift: TShiftState); | 
|---|
|  | 1348 | begin | 
|---|
|  | 1349 | inherited; | 
|---|
|  | 1350 | if (Key = VK_RETURN) or (Key = VK_Tab) then | 
|---|
|  | 1351 | begin | 
|---|
|  | 1352 | cboAddFreqCloseUp(cboAddFreq); | 
|---|
|  | 1353 | Key := 0; | 
|---|
|  | 1354 | end; | 
|---|
|  | 1355 | end; | 
|---|
|  | 1356 |  | 
|---|
| [829] | 1357 | procedure TfrmODMedIV.cboDurationChange(Sender: TObject); | 
|---|
|  | 1358 | begin | 
|---|
|  | 1359 | inherited; | 
|---|
|  | 1360 | if (FOriginalDurationType > -1) and (FOriginalDurationType <> cboDuration.ItemIndex) then | 
|---|
|  | 1361 | begin | 
|---|
|  | 1362 | self.txtXDuration.Text := ''; | 
|---|
|  | 1363 | FOriginalDurationType := cboDuration.ItemIndex; | 
|---|
|  | 1364 | end; | 
|---|
|  | 1365 | if (FOriginalDurationType = -1) and (cboDuration.ItemIndex > -1) then FOriginalDurationType := cboDuration.ItemIndex; | 
|---|
|  | 1366 | controlchange(sender); | 
|---|
|  | 1367 | end; | 
|---|
|  | 1368 |  | 
|---|
|  | 1369 | procedure TfrmODMedIV.cboDurationEnter(Sender: TObject); | 
|---|
|  | 1370 | begin | 
|---|
|  | 1371 | inherited; | 
|---|
|  | 1372 | FOriginalDurationType := cboDuration.ItemIndex; | 
|---|
|  | 1373 | end; | 
|---|
|  | 1374 |  | 
|---|
|  | 1375 |  | 
|---|
|  | 1376 | procedure TfrmODMedIV.cboInfusionTimeChange(Sender: TObject); | 
|---|
|  | 1377 | begin | 
|---|
|  | 1378 | inherited; | 
|---|
|  | 1379 | if (FOriginalInfusionType > -1) and (FOriginalInfusionType <> cboInfusionTime.ItemIndex) then | 
|---|
|  | 1380 | begin | 
|---|
|  | 1381 | self.txtRate.Text := ''; | 
|---|
|  | 1382 | FOriginalInfusionType := cboInfusionTime.ItemIndex; | 
|---|
|  | 1383 | end; | 
|---|
|  | 1384 | if (FOriginalInfusionType = -1) and (cboInfusionTime.ItemIndex > -1) then FOriginalInfusionType := cboInfusionTime.ItemIndex; | 
|---|
|  | 1385 | ControlChange(Sender); | 
|---|
|  | 1386 | end; | 
|---|
|  | 1387 |  | 
|---|
|  | 1388 | procedure TfrmODMedIV.cboInfusionTimeEnter(Sender: TObject); | 
|---|
|  | 1389 | begin | 
|---|
|  | 1390 | inherited; | 
|---|
|  | 1391 | FOriginalInfusionType := self.cboInfusionTime.ItemIndex; | 
|---|
|  | 1392 | end; | 
|---|
|  | 1393 |  | 
|---|
|  | 1394 | procedure TfrmODMedIV.cboPriorityChange(Sender: TObject); | 
|---|
|  | 1395 | begin | 
|---|
|  | 1396 | inherited; | 
|---|
|  | 1397 | ControlChange(sender); | 
|---|
|  | 1398 | end; | 
|---|
|  | 1399 |  | 
|---|
|  | 1400 | procedure TfrmODMedIV.cboPriorityExit(Sender: TObject); | 
|---|
|  | 1401 | begin | 
|---|
|  | 1402 | inherited; | 
|---|
|  | 1403 | if cboPriority.Text = '' then | 
|---|
|  | 1404 | begin | 
|---|
|  | 1405 | infoBox('Priority must have a value assigned to it', 'Warning', MB_OK); | 
|---|
|  | 1406 | cboPriority.SetFocus; | 
|---|
|  | 1407 | end; | 
|---|
|  | 1408 | end; | 
|---|
|  | 1409 |  | 
|---|
| [1679] | 1410 | procedure TfrmODMedIV.cboPriorityKeyUp(Sender: TObject; var Key: Word; | 
|---|
|  | 1411 | Shift: TShiftState); | 
|---|
|  | 1412 | begin | 
|---|
|  | 1413 | inherited; | 
|---|
|  | 1414 | if (Key = VK_BACK) and (cboPriority.Text = '') then cboPriority.ItemIndex := -1; | 
|---|
|  | 1415 | end; | 
|---|
|  | 1416 |  | 
|---|
| [829] | 1417 | procedure TfrmODMedIV.cboRouteChange(Sender: TObject); | 
|---|
|  | 1418 | begin | 
|---|
|  | 1419 | inherited; | 
|---|
|  | 1420 | if cboRoute.ItemIndex = cboRoute.Items.IndexOf('OTHER') then cboRouteClick(cboRoute); | 
|---|
|  | 1421 | ControlChange(sender); | 
|---|
|  | 1422 | end; | 
|---|
|  | 1423 |  | 
|---|
|  | 1424 | procedure TfrmODMedIV.cboRouteClick(Sender: TObject); | 
|---|
|  | 1425 | var | 
|---|
|  | 1426 | otherRoute, temp: string; | 
|---|
|  | 1427 | idx, oidx: integer; | 
|---|
|  | 1428 | begin | 
|---|
|  | 1429 | inherited; | 
|---|
|  | 1430 | oidx := cboRoute.Items.IndexOf('OTHER'); | 
|---|
|  | 1431 | if oidx = -1 then exit; | 
|---|
|  | 1432 |  | 
|---|
|  | 1433 | if cboRoute.ItemIndex = oidx then | 
|---|
|  | 1434 | begin | 
|---|
|  | 1435 | otherRoute := CreateOtherRoute; | 
|---|
|  | 1436 | if length(otherRoute) > 1 then | 
|---|
|  | 1437 | begin | 
|---|
|  | 1438 | idx := cboRoute.Items.IndexOf(Piece(OtherRoute, U, 2)); | 
|---|
|  | 1439 | if idx > -1 then | 
|---|
|  | 1440 | begin | 
|---|
|  | 1441 | temp := cboRoute.Items.Strings[idx]; | 
|---|
|  | 1442 | //setPiece(temp,U,5,'1'); | 
|---|
|  | 1443 | cboRoute.Items.Strings[idx] := temp; | 
|---|
|  | 1444 | end | 
|---|
|  | 1445 | else | 
|---|
|  | 1446 | begin | 
|---|
|  | 1447 | cboRoute.Items.Add(otherRoute); | 
|---|
|  | 1448 | idx := cboRoute.Items.IndexOf(Piece(OtherRoute, U, 2)); | 
|---|
|  | 1449 | end; | 
|---|
|  | 1450 | cboRoute.ItemIndex := idx; | 
|---|
|  | 1451 | end | 
|---|
|  | 1452 | else | 
|---|
|  | 1453 | begin | 
|---|
|  | 1454 | cboRoute.ItemIndex := -1; | 
|---|
|  | 1455 | cboRoute.SetFocus; | 
|---|
|  | 1456 | end; | 
|---|
|  | 1457 | end; | 
|---|
|  | 1458 | end; | 
|---|
|  | 1459 |  | 
|---|
|  | 1460 | procedure TfrmODMedIV.cboRouteExit(Sender: TObject); | 
|---|
|  | 1461 | begin | 
|---|
|  | 1462 | inherited; | 
|---|
|  | 1463 | (*  if (cboRoute.Text <> '') and (cboRoute.ItemIndex = -1)  then | 
|---|
|  | 1464 | begin | 
|---|
|  | 1465 | infoBox(TX_BAD_ROUTE,'Warning',MB_OK); | 
|---|
|  | 1466 | cboRoute.SetFocus; | 
|---|
|  | 1467 | end; *) | 
|---|
|  | 1468 | end; | 
|---|
|  | 1469 |  | 
|---|
| [1679] | 1470 | procedure TfrmODMedIV.cboRouteKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 1471 | Shift: TShiftState); | 
|---|
|  | 1472 | begin | 
|---|
|  | 1473 | inherited; | 
|---|
|  | 1474 | if IsAltCtrl_L_Pressed(Shift, Key) then | 
|---|
|  | 1475 | txtAllIVRoutesClick(txtAllIVRoutes); | 
|---|
|  | 1476 | end; | 
|---|
|  | 1477 |  | 
|---|
|  | 1478 | procedure TfrmODMedIV.cboRouteKeyUp(Sender: TObject; var Key: Word; | 
|---|
|  | 1479 | Shift: TShiftState); | 
|---|
|  | 1480 | begin | 
|---|
|  | 1481 | inherited; | 
|---|
|  | 1482 | if (Key = VK_BACK) and (cboRoute.Text = '') then cboRoute.ItemIndex := -1; | 
|---|
|  | 1483 | end; | 
|---|
|  | 1484 |  | 
|---|
| [456] | 1485 | procedure TfrmODMedIV.cboAdditiveMouseClick(Sender: TObject); | 
|---|
|  | 1486 | var | 
|---|
|  | 1487 | AnIVComponent: TIVComponent; | 
|---|
| [829] | 1488 | x, routeIEN: string; | 
|---|
| [456] | 1489 | begin | 
|---|
|  | 1490 | inherited; | 
|---|
|  | 1491 | if cboAdditive.ItemIEN <= 0 then Exit; | 
|---|
|  | 1492 | FInpatient := OrderForInpatient; | 
|---|
|  | 1493 | if not FInpatient then | 
|---|
|  | 1494 | begin | 
|---|
|  | 1495 | if DEACheckFailedForIVOnOutPatient(cboAdditive.ItemIEN,'A') then | 
|---|
|  | 1496 | begin | 
|---|
|  | 1497 | InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); | 
|---|
|  | 1498 | cboAdditive.Text := ''; | 
|---|
|  | 1499 | Exit; | 
|---|
|  | 1500 | end; | 
|---|
|  | 1501 | end else | 
|---|
|  | 1502 | begin | 
|---|
|  | 1503 | if DEACheckFailed(cboAdditive.ItemIEN, FInpatient) then | 
|---|
|  | 1504 | begin | 
|---|
|  | 1505 | InfoBox(TX_NO_DEA, TC_NO_DEA, MB_OK); | 
|---|
|  | 1506 | cboAdditive.Text := ''; | 
|---|
|  | 1507 | Exit; | 
|---|
|  | 1508 | end; | 
|---|
|  | 1509 | end; | 
|---|
| [829] | 1510 | routeIEN := Piece(cboAdditive.Items.Strings[cboAdditive.itemindex],U,4); | 
|---|
| [456] | 1511 | x := AmountsForIVFluid(cboAdditive.ItemIEN, 'A'); | 
|---|
|  | 1512 | AnIVComponent := TIVComponent.Create; | 
|---|
|  | 1513 | AnIVComponent.IEN     := cboAdditive.ItemIEN; | 
|---|
|  | 1514 | AnIVComponent.Name    := Piece(cboAdditive.Items[cboAdditive.ItemIndex], U, 3); | 
|---|
|  | 1515 | AnIVComponent.Fluid   := 'A'; | 
|---|
|  | 1516 | AnIVComponent.Amount  := 0; | 
|---|
|  | 1517 | AnIVComponent.Units   := Piece(x, U, 1); | 
|---|
|  | 1518 | AnIVComponent.Volumes := ''; | 
|---|
|  | 1519 | cboAdditive.ItemIndex := -1; | 
|---|
|  | 1520 | with grdSelected do | 
|---|
|  | 1521 | begin | 
|---|
|  | 1522 | if Objects[0, RowCount - 1] <> nil then RowCount := RowCount + 1; | 
|---|
|  | 1523 | Objects[0, RowCount - 1] := AnIVComponent; | 
|---|
|  | 1524 | Cells[0, RowCount - 1] := AnIVComponent.Name; | 
|---|
|  | 1525 | Cells[2, RowCount - 1] := AnIVComponent.Units; | 
|---|
| [1679] | 1526 | Cells[3, RowCount -1] :=  UpdateAddFreq(AnIVComponent.IEN); | 
|---|
| [456] | 1527 | Row := RowCount - 1; | 
|---|
|  | 1528 | Col := 1; | 
|---|
|  | 1529 | end; | 
|---|
|  | 1530 | Application.ProcessMessages;         //CQ: 10157 | 
|---|
|  | 1531 | ClickOnGridCell; | 
|---|
| [829] | 1532 | updateRoute; | 
|---|
| [456] | 1533 | ControlChange(Sender); | 
|---|
| [829] | 1534 | //UpdateRoute(RouteIEN); | 
|---|
| [456] | 1535 | end; | 
|---|
|  | 1536 |  | 
|---|
|  | 1537 | procedure TfrmODMedIV.cboAdditiveExit(Sender: TObject); | 
|---|
|  | 1538 | begin | 
|---|
|  | 1539 | inherited; | 
|---|
| [829] | 1540 | if (cboAdditive.ItemIEN > 0) and (EnterIsPressed) then | 
|---|
|  | 1541 | cboAdditiveMouseClick(Self); | 
|---|
| [456] | 1542 | end; | 
|---|
|  | 1543 |  | 
|---|
|  | 1544 | { grdSelected events } | 
|---|
|  | 1545 |  | 
|---|
| [829] | 1546 | procedure TfrmODMedIV.ClearAllFields; | 
|---|
|  | 1547 | begin | 
|---|
|  | 1548 | self.cboType.ItemIndex := -1; | 
|---|
|  | 1549 | self.cboType.Text := ''; | 
|---|
|  | 1550 | self.memComments.Text := ''; | 
|---|
|  | 1551 | self.txtRate.Text := ''; | 
|---|
|  | 1552 | self.txtXDuration.text := ''; | 
|---|
|  | 1553 | self.cboDuration.ItemIndex := -1; | 
|---|
|  | 1554 | self.cboDuration.Text := ''; | 
|---|
|  | 1555 | self.txtAllIVRoutes.Visible := false; | 
|---|
| [1679] | 1556 | //self.FInitialOrderID := True; | 
|---|
| [829] | 1557 | cbotypeChange(self.cboType); | 
|---|
|  | 1558 | if self.cboroute.Items.Count > 0 then self.cboRoute.Clear; | 
|---|
| [1679] | 1559 | FIVTypeDefined := false; | 
|---|
| [829] | 1560 | end; | 
|---|
|  | 1561 |  | 
|---|
| [456] | 1562 | procedure TfrmODMedIV.ClickOnGridCell; | 
|---|
|  | 1563 | var | 
|---|
|  | 1564 | AnIVComponent: TIVComponent; | 
|---|
|  | 1565 |  | 
|---|
|  | 1566 | procedure PlaceControl(AControl: TWinControl); | 
|---|
|  | 1567 | var | 
|---|
|  | 1568 | ARect: TRect; | 
|---|
|  | 1569 | begin | 
|---|
|  | 1570 | with AControl do | 
|---|
|  | 1571 | begin | 
|---|
|  | 1572 | ARect := grdSelected.CellRect(grdSelected.Col, grdSelected.Row); | 
|---|
|  | 1573 | SetBounds(ARect.Left + grdSelected.Left + 1,  ARect.Top  + grdSelected.Top + 1, | 
|---|
|  | 1574 | ARect.Right - ARect.Left + 1,       ARect.Bottom - ARect.Top + 1); | 
|---|
|  | 1575 | BringToFront; | 
|---|
|  | 1576 | Show; | 
|---|
|  | 1577 | SetFocus; | 
|---|
|  | 1578 | if AControl is TComboBox then                    //CQ: 10157 | 
|---|
| [1679] | 1579 | begin | 
|---|
|  | 1580 | TComboBox(AControl).DroppedDown := True; | 
|---|
|  | 1581 | TControl(self.grdSelected).Enabled := false; | 
|---|
|  | 1582 | end; | 
|---|
| [456] | 1583 | end; | 
|---|
|  | 1584 | end; | 
|---|
|  | 1585 |  | 
|---|
|  | 1586 | begin | 
|---|
|  | 1587 | AnIVComponent := TIVComponent(grdSelected.Objects[0, grdSelected.Row]); | 
|---|
| [1679] | 1588 | if (AnIVComponent = nil) or (grdSelected.Col = 0) then | 
|---|
|  | 1589 | begin | 
|---|
|  | 1590 | if (AnIVComponent <> nil) and (grdSelected.Col = 0) then grdSelected.Refresh; | 
|---|
|  | 1591 | Exit; | 
|---|
|  | 1592 | end; | 
|---|
| [456] | 1593 | // allow selection if more the 1 unit to choose from | 
|---|
|  | 1594 | if (grdSelected.Col = 2) and (Length(Piece(AnIVComponent.Units, U, 2)) > 0) then | 
|---|
|  | 1595 | begin | 
|---|
|  | 1596 | PiecesToList(AnIVComponent.Units, U, cboSelected.Items); | 
|---|
|  | 1597 | cboSelected.ItemIndex := cboSelected.Items.IndexOf(grdSelected.Cells[grdSelected.Col, grdSelected.Row]); | 
|---|
|  | 1598 | cboSelected.Tag  := (grdSelected.Col * 256) + grdSelected.Row; | 
|---|
|  | 1599 | PlaceControl(cboSelected); | 
|---|
|  | 1600 | end; | 
|---|
|  | 1601 | // allow selection if more than 1 volume to choose from | 
|---|
|  | 1602 | if (grdSelected.Col = 1) and (Length(Piece(AnIVComponent.Volumes, U, 2)) > 0) then | 
|---|
|  | 1603 | begin | 
|---|
|  | 1604 | PiecesToList(AnIVComponent.Volumes, U, cboSelected.Items); | 
|---|
|  | 1605 | cboSelected.ItemIndex := cboSelected.Items.IndexOf(grdSelected.Cells[grdSelected.Col, grdSelected.Row]); | 
|---|
|  | 1606 | cboSelected.Tag  := (grdSelected.Col * 256) + grdSelected.Row; | 
|---|
|  | 1607 | PlaceControl(cboSelected); | 
|---|
|  | 1608 | end; | 
|---|
|  | 1609 | // display text box to enter strength if the entry is an additive | 
|---|
|  | 1610 | if (grdSelected.Col = 1) and (AnIVComponent.Fluid = 'A') then | 
|---|
|  | 1611 | begin | 
|---|
|  | 1612 | txtSelected.Text := grdSelected.Cells[grdSelected.Col, grdSelected.Row]; | 
|---|
|  | 1613 | txtSelected.Tag  := (grdSelected.Col * 256) + grdSelected.Row; | 
|---|
|  | 1614 | PlaceControl(txtSelected); | 
|---|
|  | 1615 | end; | 
|---|
| [1679] | 1616 | // AGP ADDITIVE FREQUENCY CHANGES | 
|---|
|  | 1617 | if (Self.cboType.ItemIndex < 1) and (grdSelected.Col = 3) and (AnIVComponent.Fluid = 'A') then | 
|---|
|  | 1618 | begin | 
|---|
|  | 1619 | cboAddFreq.ItemIndex := cboAddFreq.Items.IndexOf(grdSelected.Cells[grdSelected.Col, grdSelected.Row]); | 
|---|
|  | 1620 | cboAddFreq.Tag  := (grdSelected.Col * 256) + grdSelected.Row; | 
|---|
|  | 1621 | PlaceControl(cboAddFreq); | 
|---|
|  | 1622 | end; | 
|---|
| [456] | 1623 | end; | 
|---|
|  | 1624 |  | 
|---|
|  | 1625 | procedure TfrmODMedIV.txtSelectedChange(Sender: TObject);   // text editor for grid | 
|---|
|  | 1626 | begin | 
|---|
|  | 1627 | inherited; | 
|---|
|  | 1628 | with txtSelected do | 
|---|
|  | 1629 | begin | 
|---|
|  | 1630 | if Tag < 0 then Exit; | 
|---|
|  | 1631 | grdSelected.Cells[Tag div 256, Tag mod 256] := Text; | 
|---|
|  | 1632 | end; | 
|---|
|  | 1633 | ControlChange(Sender); | 
|---|
|  | 1634 | end; | 
|---|
|  | 1635 |  | 
|---|
|  | 1636 | procedure TfrmODMedIV.txtSelectedExit(Sender: TObject); | 
|---|
|  | 1637 | begin | 
|---|
|  | 1638 | inherited; | 
|---|
|  | 1639 | with txtSelected do | 
|---|
|  | 1640 | begin | 
|---|
|  | 1641 | grdSelected.Cells[Tag div 256, Tag mod 256] := Text; | 
|---|
|  | 1642 | Tag := -1; | 
|---|
|  | 1643 | Hide; | 
|---|
|  | 1644 | end; | 
|---|
| [1679] | 1645 | grdSelected.Refresh; | 
|---|
| [456] | 1646 | end; | 
|---|
|  | 1647 |  | 
|---|
| [1679] | 1648 |  | 
|---|
|  | 1649 |  | 
|---|
|  | 1650 | procedure TfrmODMedIV.txtSelectedKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 1651 | Shift: TShiftState); | 
|---|
|  | 1652 | begin | 
|---|
|  | 1653 | inherited; | 
|---|
|  | 1654 | if (Key = VK_RETURN) or (Key = VK_Tab) then | 
|---|
|  | 1655 | begin | 
|---|
|  | 1656 | ActiveControl := grdSelected; | 
|---|
|  | 1657 | Key := 0; | 
|---|
|  | 1658 | end; | 
|---|
|  | 1659 | end; | 
|---|
|  | 1660 |  | 
|---|
| [829] | 1661 | procedure TfrmODMedIV.cboScheduleChange(Sender: TObject); | 
|---|
| [1679] | 1662 | var | 
|---|
|  | 1663 | othSch: string; | 
|---|
|  | 1664 | idx: integer; | 
|---|
| [829] | 1665 | begin | 
|---|
|  | 1666 | inherited; | 
|---|
|  | 1667 | if self.txtXDuration.Enabled = true then | 
|---|
|  | 1668 | begin | 
|---|
|  | 1669 | self.txtXDuration.Text := ''; | 
|---|
|  | 1670 | self.cboDuration.ItemIndex := -1; | 
|---|
|  | 1671 | end; | 
|---|
| [1679] | 1672 | if self.cboSchedule.ItemIndex > -1 then | 
|---|
|  | 1673 | begin | 
|---|
|  | 1674 | if cboSchedule.ItemIndex = cboSchedule.Items.IndexOf('Other') then | 
|---|
|  | 1675 | begin | 
|---|
|  | 1676 | othSch := CreateOtherSchedule; | 
|---|
|  | 1677 | if length(trim(othSch)) > 1 then | 
|---|
|  | 1678 | begin | 
|---|
|  | 1679 | cboSchedule.Items.Add(othSch + U + U + NSSScheduleType + U + NSSAdminTime); | 
|---|
|  | 1680 | idx := cboSchedule.Items.IndexOf(Piece(OthSch, U, 1)); | 
|---|
|  | 1681 | cboSchedule.ItemIndex := idx; | 
|---|
|  | 1682 | end | 
|---|
|  | 1683 | else cboSchedule.itemindex := -1; | 
|---|
|  | 1684 | end; | 
|---|
|  | 1685 | if cboSchedule.itemIndex > -1  then  updateDuration(Piece(cboSchedule.Items.Strings[cboSchedule.itemindex],U,3)); | 
|---|
|  | 1686 | end; | 
|---|
| [829] | 1687 | ControlChange(sender); | 
|---|
|  | 1688 | end; | 
|---|
|  | 1689 |  | 
|---|
|  | 1690 | procedure TfrmODMedIV.cboScheduleClick(Sender: TObject); | 
|---|
|  | 1691 | var | 
|---|
|  | 1692 | othSch: string; | 
|---|
| [1679] | 1693 | idx: integer; | 
|---|
| [829] | 1694 | begin | 
|---|
|  | 1695 | inherited; | 
|---|
|  | 1696 | if cboSchedule.ItemIndex = cboSchedule.Items.IndexOf('Other') then | 
|---|
|  | 1697 | begin | 
|---|
|  | 1698 | othSch := CreateOtherSchedule; | 
|---|
|  | 1699 | if length(trim(othSch)) > 1 then | 
|---|
|  | 1700 | begin | 
|---|
|  | 1701 | cboSchedule.Items.Add(othSch + U + U + NSSScheduleType + U + NSSAdminTime); | 
|---|
| [1679] | 1702 | idx := cboSchedule.Items.IndexOf(Piece(OthSch, U, 1)); | 
|---|
| [829] | 1703 | cboSchedule.ItemIndex := idx; | 
|---|
|  | 1704 | end; | 
|---|
|  | 1705 | end | 
|---|
|  | 1706 | else | 
|---|
|  | 1707 | begin | 
|---|
|  | 1708 | NSSAdminTime := ''; | 
|---|
|  | 1709 | NSSScheduleType := ''; | 
|---|
|  | 1710 | end; | 
|---|
|  | 1711 | end; | 
|---|
|  | 1712 |  | 
|---|
|  | 1713 | procedure TfrmODMedIV.cboScheduleExit(Sender: TObject); | 
|---|
|  | 1714 | begin | 
|---|
|  | 1715 | inherited; | 
|---|
|  | 1716 | if (cboSchedule.ItemIndex = -1) and (cboSchedule.Text <> '') then | 
|---|
|  | 1717 | begin | 
|---|
|  | 1718 | infoBox('Please select a valid schedule from the list.'+ CRLF + CRLF + | 
|---|
|  | 1719 | 'If you would like to create a Day-of-Week schedule please select ''OTHER'' from the list.', | 
|---|
|  | 1720 | 'Incorrect Schedule.', MB_OK); | 
|---|
|  | 1721 | cboSchedule.Text := ''; | 
|---|
|  | 1722 | cboSchedule.SetFocus; | 
|---|
|  | 1723 | end; | 
|---|
| [1679] | 1724 | if (cboSchedule.ItemIndex > -1) and (cboSchedule.Text = '') then cboSchedule.ItemIndex := -1; | 
|---|
| [829] | 1725 | end; | 
|---|
|  | 1726 |  | 
|---|
| [1679] | 1727 | procedure TfrmODMedIV.cboScheduleKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 1728 | Shift: TShiftState); | 
|---|
| [456] | 1729 | begin | 
|---|
|  | 1730 | inherited; | 
|---|
| [1679] | 1731 | if IsAltCtrl_L_Pressed(Shift, Key) then | 
|---|
|  | 1732 | txtNSSClick(txtNSS); | 
|---|
| [456] | 1733 | end; | 
|---|
|  | 1734 |  | 
|---|
| [1679] | 1735 | procedure TfrmODMedIV.cboScheduleKeyUp(Sender: TObject; var Key: Word; | 
|---|
|  | 1736 | Shift: TShiftState); | 
|---|
| [456] | 1737 | begin | 
|---|
|  | 1738 | inherited; | 
|---|
| [1679] | 1739 | if (Key = VK_BACK) and (cboSchedule.Text = '') then cboSchedule.ItemIndex := -1; | 
|---|
|  | 1740 | end; | 
|---|
|  | 1741 |  | 
|---|
|  | 1742 | procedure TfrmODMedIV.cboSelectedCloseUp(Sender: TObject); | 
|---|
|  | 1743 | begin | 
|---|
|  | 1744 | inherited; | 
|---|
| [456] | 1745 | with cboSelected do | 
|---|
|  | 1746 | begin | 
|---|
| [1679] | 1747 | if tag < 0 then exit; | 
|---|
|  | 1748 | grdSelected.Cells[Tag div 256, Tag mod 256] := MixedCase(items.Strings[itemindex]); | 
|---|
| [456] | 1749 | Tag := -1; | 
|---|
|  | 1750 | Hide; | 
|---|
| [1679] | 1751 | ControlChange(Sender); | 
|---|
|  | 1752 | TControl(self.grdSelected).Enabled := True; | 
|---|
|  | 1753 | ActiveControl := self.grdSelected; | 
|---|
| [456] | 1754 | end; | 
|---|
| [1679] | 1755 | grdSelected.Refresh; | 
|---|
| [456] | 1756 | end; | 
|---|
|  | 1757 |  | 
|---|
| [1679] | 1758 | procedure TfrmODMedIV.cboSelectedKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 1759 | Shift: TShiftState); | 
|---|
|  | 1760 | begin | 
|---|
|  | 1761 | inherited; | 
|---|
|  | 1762 | if (Key = VK_RETURN) or (Key = VK_Tab) then | 
|---|
|  | 1763 | begin | 
|---|
|  | 1764 | cboSelectedCloseUp(cboSelected); | 
|---|
|  | 1765 | Key := 0; | 
|---|
|  | 1766 | end; | 
|---|
|  | 1767 | end; | 
|---|
|  | 1768 |  | 
|---|
| [456] | 1769 | procedure TfrmODMedIV.cmdRemoveClick(Sender: TObject);  // remove button for grid | 
|---|
|  | 1770 | var | 
|---|
| [829] | 1771 | i, stRow, stRowCount: Integer; | 
|---|
| [456] | 1772 | begin | 
|---|
|  | 1773 | inherited; | 
|---|
|  | 1774 | with grdSelected do | 
|---|
|  | 1775 | begin | 
|---|
|  | 1776 | if Row < 0 then Exit; | 
|---|
| [829] | 1777 | stRow := Row; | 
|---|
|  | 1778 | stRowCount := RowCount; | 
|---|
| [456] | 1779 | if Objects[0, Row] <> nil then TIVComponent(Objects[0, Row]).Free; | 
|---|
|  | 1780 | for i := Row to RowCount - 2 do Rows[i] := Rows[i + 1]; | 
|---|
|  | 1781 | Rows[RowCount - 1].Clear; | 
|---|
|  | 1782 | RowCount := RowCount - 1; | 
|---|
|  | 1783 | end; | 
|---|
| [829] | 1784 | updateRoute; | 
|---|
|  | 1785 | if (stRowCount = 1) and (stRow = 0) then | 
|---|
|  | 1786 | begin | 
|---|
|  | 1787 | //self.cboRoute.ItemIndex := -1; | 
|---|
|  | 1788 | ClearAllFields; | 
|---|
|  | 1789 | end; | 
|---|
| [456] | 1790 | ControlChange(Sender); | 
|---|
|  | 1791 | end; | 
|---|
|  | 1792 |  | 
|---|
|  | 1793 | { update Responses & Create Order Text } | 
|---|
|  | 1794 |  | 
|---|
|  | 1795 | procedure TfrmODMedIV.ControlChange(Sender: TObject); | 
|---|
|  | 1796 | var | 
|---|
| [829] | 1797 | i, CurAdd, CurBase, idx: Integer; | 
|---|
|  | 1798 | adminTime,x,xlimIn,xLimEx,eSch,iSch,iType, tmpdur, tmpSch, tmpRate: string; | 
|---|
| [456] | 1799 | AnIVComponent: TIVComponent; | 
|---|
|  | 1800 | FQOSchedule: TResponse; | 
|---|
|  | 1801 |  | 
|---|
|  | 1802 | function IsNumericRate(const x: string): Boolean; | 
|---|
|  | 1803 | var | 
|---|
|  | 1804 | i: Integer; | 
|---|
|  | 1805 | begin | 
|---|
|  | 1806 | Result := True; | 
|---|
|  | 1807 | for i := 1 to Length(x) do if not (x[i] in ['0'..'9','.']) then Result := False; | 
|---|
|  | 1808 | end; | 
|---|
|  | 1809 |  | 
|---|
|  | 1810 | begin | 
|---|
|  | 1811 | inherited; | 
|---|
|  | 1812 | if Changing then Exit; | 
|---|
| [829] | 1813 | loadExpectFirstDose; | 
|---|
| [456] | 1814 | //  FQOSchedule := TResponse.Create; | 
|---|
|  | 1815 | FQOSchedule := Responses.FindResponseByName('SCHEDULE',1); | 
|---|
|  | 1816 | if FQOSchedule <> nil then | 
|---|
|  | 1817 | begin | 
|---|
|  | 1818 | eSch := FQOSchedule.EValue; | 
|---|
|  | 1819 | iSch := FQOSchedule.IValue; | 
|---|
|  | 1820 | end; | 
|---|
|  | 1821 | //if Sender <> Self then Responses.Clear;       // Sender=Self when called from SetupDialog | 
|---|
|  | 1822 | Responses.Clear;   // want this to clear even after SetupDialog in case instances don't match | 
|---|
|  | 1823 | CurAdd := 1; CurBase := 1; | 
|---|
| [829] | 1824 | tmpRate := ''; | 
|---|
| [456] | 1825 | with grdSelected do for i := 0 to RowCount - 1 do | 
|---|
|  | 1826 | begin | 
|---|
|  | 1827 | AnIVComponent := TIVComponent(Objects[0, i]); | 
|---|
|  | 1828 | if AnIVComponent = nil then Continue; | 
|---|
|  | 1829 | with AnIVComponent do | 
|---|
|  | 1830 | begin | 
|---|
|  | 1831 | if Fluid = 'B' then                        // Solutions | 
|---|
|  | 1832 | begin | 
|---|
|  | 1833 | if IEN > 0                then Responses.Update('ORDERABLE', CurBase, IntToStr(IEN), Name); | 
|---|
|  | 1834 | if Length(Cells[1,i]) > 0 then Responses.Update('VOLUME',    CurBase, Cells[1,i], Cells[1,i]); | 
|---|
|  | 1835 | Inc(CurBase); | 
|---|
|  | 1836 | end; {if Fluid B} | 
|---|
|  | 1837 | if Fluid = 'A' then                        // Additives | 
|---|
|  | 1838 | begin | 
|---|
|  | 1839 | if IEN > 0                then Responses.Update('ADDITIVE', CurAdd, IntToStr(IEN), Name); | 
|---|
|  | 1840 | if Length(Cells[1,i]) > 0 then Responses.Update('STRENGTH', CurAdd, Cells[1,i], Cells[1,i]); | 
|---|
|  | 1841 | if Length(Cells[2,i]) > 0 then Responses.Update('UNITS',    CurAdd, Cells[2,i], Cells[2,i]); | 
|---|
| [1679] | 1842 | //AGP ADDITIVE FREQUECNY CHANGES | 
|---|
|  | 1843 | if (Length(Cells[3,i]) > 0) and (Cells[3,i] <> 'N/A') then Responses.Update('ADDFREQ',    CurAdd, Cells[3,i], Cells[3,i]); | 
|---|
| [456] | 1844 | Inc(CurAdd); | 
|---|
|  | 1845 | end; {if Fluid A} | 
|---|
|  | 1846 | end; {with AnIVComponent} | 
|---|
|  | 1847 | end; {with grdSelected} | 
|---|
|  | 1848 | x := txtRate.Text; | 
|---|
|  | 1849 | xlimIn := ''; | 
|---|
|  | 1850 | xlimEx := ''; | 
|---|
|  | 1851 | if length(txtXDuration.Text) > 0 then | 
|---|
|  | 1852 | begin | 
|---|
| [829] | 1853 | tmpDur := LowerCase(cboDuration.Text); | 
|---|
|  | 1854 | if (tmpDur = 'l') or (tmpDur = 'ml') then | 
|---|
| [456] | 1855 | begin | 
|---|
| [829] | 1856 | xlimEx := 'with total volume ' +  txtXDuration.Text + self.cboDuration.items.strings[self.cboDuration.itemindex]; | 
|---|
|  | 1857 | xlimIn := 'with total volume ' +  txtXDuration.Text + self.cboDuration.items.strings[self.cboDuration.itemindex]; | 
|---|
| [456] | 1858 | end | 
|---|
| [829] | 1859 | else if (tmpDur = 'days') or (tmpDur = 'hours') then | 
|---|
| [456] | 1860 | begin | 
|---|
| [829] | 1861 | xlimEx := 'for ' + txtXDuration.Text + ' ' +  self.cboDuration.items.strings[self.cboDuration.itemindex]; | 
|---|
|  | 1862 | xlimIn := 'for ' + txtXDuration.Text + ' ' +  self.cboDuration.items.strings[self.cboDuration.itemindex]; | 
|---|
|  | 1863 | end | 
|---|
|  | 1864 | else if tmpDur = 'doses' then | 
|---|
|  | 1865 | begin | 
|---|
|  | 1866 | xlimEx := 'for a total of ' + txtXDuration.Text + ' ' +  self.cboDuration.items.strings[self.cboDuration.itemindex]; | 
|---|
|  | 1867 | xlimIn := 'for a total of ' + txtXDuration.Text + ' ' +  self.cboDuration.items.strings[self.cboDuration.itemindex]; | 
|---|
|  | 1868 | end | 
|---|
|  | 1869 | else  begin | 
|---|
| [456] | 1870 | xlimIn := ''; | 
|---|
|  | 1871 | xlimEx := ''; | 
|---|
|  | 1872 | end; | 
|---|
|  | 1873 | end; | 
|---|
| [1679] | 1874 | if (cboType.ItemIndex > -1) and (cboType.Items.Strings[cboType.ItemIndex] = 'Intermittent') then iType := 'I' | 
|---|
|  | 1875 | else if (cboType.ItemIndex > -1) and (cboType.Items.Strings[cboType.ItemIndex] = 'Continuous') then iType := 'C' | 
|---|
|  | 1876 | else iType := ''; | 
|---|
| [829] | 1877 | Responses.Update('TYPE',1,iType,cboType.Text); | 
|---|
|  | 1878 | Responses.Update('ROUTE',1,cboRoute.ItemID,cboRoute.Text); | 
|---|
|  | 1879 | tmpSch := UpperCase(Trim(cboSchedule.Text)); | 
|---|
|  | 1880 | if chkPRN.Checked then tmpSch := tmpSch + ' PRN'; | 
|---|
|  | 1881 | if UpperCase(Copy(tmpSch, Length(tmpSch) - 6, Length(tmpSch))) = 'PRN PRN' | 
|---|
|  | 1882 | then tmpSch := Copy(tmpSch, 1, Length(tmpSch) - 4); | 
|---|
|  | 1883 | Responses.Update('SCHEDULE',1,tmpSch,tmpSch); | 
|---|
|  | 1884 | (*adminTime := Piece(lblAdminTime.Caption,':',2); | 
|---|
|  | 1885 | adminTime := Copy(adminTime,1,Length(adminTime)); | 
|---|
|  | 1886 | if (Action in [ORDER_COPY, ORDER_EDIT]) and ((FAdminTimeDelay <> '') or (FAdminTimeClinic <> '')) and | 
|---|
|  | 1887 | (cboSchedule.ItemIndex = FOriginalScheduleIndex) then  Responses.Update('ADMIN',1,FOriginalAdminTime,FOriginalAdminTime) | 
|---|
|  | 1888 | else Responses.Update('ADMIN',1,adminTime,adminTime);*) | 
|---|
|  | 1889 | idx := self.cboSchedule.ItemIndex; | 
|---|
|  | 1890 | if idx > -1 then | 
|---|
|  | 1891 | begin | 
|---|
|  | 1892 | adminTime := Piece(lblAdminTime.Caption,':',2); | 
|---|
|  | 1893 | adminTime := Copy(adminTime,2,Length(adminTime)); | 
|---|
|  | 1894 | if FAdminTimeText <> '' then AdminTime :=  ''; | 
|---|
|  | 1895 | if AdminTime = 'Not Defined' then AdminTime := ''; | 
|---|
|  | 1896 | Responses.Update('ADMIN',1,adminTime,adminTime); | 
|---|
|  | 1897 | end; | 
|---|
|  | 1898 | if IsNumericRate(x) then | 
|---|
|  | 1899 | begin | 
|---|
|  | 1900 | if cboInfusionTime.Enabled = true then | 
|---|
|  | 1901 | begin | 
|---|
|  | 1902 | idx := cboInfusionTime.Items.IndexOf(cboInfusionTime.Text); | 
|---|
|  | 1903 | if idx > -1 then x := x + ' ' + cboInfusionTime.Items.Strings[idx]; | 
|---|
|  | 1904 | tmpRate := 'Infuse Over ' + x; | 
|---|
|  | 1905 | end | 
|---|
|  | 1906 | else | 
|---|
|  | 1907 | if pos('ml/hr', x)= 0 then  x := x + ' ml/hr'; | 
|---|
|  | 1908 | end; | 
|---|
|  | 1909 | if (Pos('@',x)>0) and (Piece(x,'@',1) = IntToStr(StrToIntDef(Piece(x,'@',1), -1))) and (cboInfusionTime.Enabled = false) then | 
|---|
|  | 1910 | begin | 
|---|
|  | 1911 | if Pos('ml/hr', x) = 0 then | 
|---|
|  | 1912 | x := Piece(x,'@',1) + ' ml/hr@' + Copy(x, Pos('@',x) + 1, Length(x)); | 
|---|
|  | 1913 | end; | 
|---|
|  | 1914 | with txtRate     do if (Length(Text) > 0) then | 
|---|
|  | 1915 | begin | 
|---|
|  | 1916 | if tmpRate = '' then Responses.Update('RATE', 1, x, x) | 
|---|
|  | 1917 | else Responses.Update('RATE', 1, 'INFUSE OVER ' + x, tmpRate); | 
|---|
|  | 1918 | end; | 
|---|
| [456] | 1919 | with cboPriority do if ItemIndex > -1     then Responses.Update('URGENCY', 1, ItemID, Text); | 
|---|
|  | 1920 | if Length(xlimIn)>0 then Responses.Update('DAYS',1, xlimIn, xlimEx); | 
|---|
|  | 1921 | with memComments do if GetTextLen > 0     then Responses.Update('COMMENT', 1, TX_WPTYPE, Text); | 
|---|
| [829] | 1922 | if (chkDoseNow.Visible = True) and (chkDoseNow.Checked = True) then | 
|---|
|  | 1923 | Responses.Update('NOW', 1, '1', 'NOW') | 
|---|
|  | 1924 | else Responses.Update('NOW', 1, '', ''); | 
|---|
| [456] | 1925 | memOrder.Text := Responses.OrderText; | 
|---|
| [829] | 1926 | (* (Length(eSch)>0) or (Length(iSch)>0) then | 
|---|
|  | 1927 | Responses.Update('SCHEDULE',1,iSch,eSch);  *) | 
|---|
| [456] | 1928 | end; | 
|---|
|  | 1929 |  | 
|---|
| [829] | 1930 | function TfrmODMedIV.CreateOtherRoute: string; | 
|---|
|  | 1931 | var | 
|---|
|  | 1932 | aRoute: string; | 
|---|
|  | 1933 | begin | 
|---|
|  | 1934 | aRoute := ''; | 
|---|
|  | 1935 | Result := ''; | 
|---|
|  | 1936 | if not ShowOtherRoutes(aRoute) then | 
|---|
|  | 1937 | begin | 
|---|
|  | 1938 | cboRoute.ItemIndex := -1; | 
|---|
|  | 1939 | cboRoute.Text := ''; | 
|---|
|  | 1940 | end | 
|---|
|  | 1941 | else | 
|---|
|  | 1942 | begin | 
|---|
|  | 1943 | Result := aRoute; | 
|---|
|  | 1944 | end; | 
|---|
|  | 1945 | end; | 
|---|
|  | 1946 |  | 
|---|
|  | 1947 | function TfrmODMedIV.CreateOtherSchedule: string; | 
|---|
|  | 1948 | var | 
|---|
|  | 1949 | aSchedule: string; | 
|---|
|  | 1950 | begin | 
|---|
|  | 1951 | aSchedule := ''; | 
|---|
| [1679] | 1952 | cboSchedule.ItemIndex := -1; | 
|---|
|  | 1953 | cboSchedule.Text      := ''; | 
|---|
|  | 1954 | cboSchedule.DroppedDown := false; | 
|---|
|  | 1955 | if ShowOtherSchedule(aSchedule) then | 
|---|
| [829] | 1956 | begin | 
|---|
|  | 1957 | Result := Piece(aSchedule,U,1); | 
|---|
|  | 1958 | NSSAdminTime := Piece(aschedule,u,2); | 
|---|
|  | 1959 | NSSScheduleType := Piece(ASchedule, U, 3); | 
|---|
|  | 1960 | end; | 
|---|
|  | 1961 | end; | 
|---|
|  | 1962 |  | 
|---|
| [456] | 1963 | procedure TfrmODMedIV.grdSelectedDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; | 
|---|
|  | 1964 | State: TGridDrawState); | 
|---|
|  | 1965 | begin | 
|---|
|  | 1966 | inherited; | 
|---|
| [1679] | 1967 | //if Sender = ActiveControl then Exit; | 
|---|
|  | 1968 | //if not (gdSelected in State) then Exit; | 
|---|
| [456] | 1969 | with Sender as TStringGrid do | 
|---|
|  | 1970 | begin | 
|---|
| [1679] | 1971 | if State = [gdSelected..gdFocused] then | 
|---|
|  | 1972 | begin | 
|---|
|  | 1973 | Canvas.Font.Color := Get508CompliantColor(clWhite); | 
|---|
|  | 1974 | Canvas.Brush.Color := clHighlight; | 
|---|
|  | 1975 | //Canvas.Font.Color := clHighlightText; | 
|---|
|  | 1976 | Canvas.Font.Style := [fsBold]; | 
|---|
|  | 1977 | Canvas.MoveTo(Rect.Left,Rect.top); | 
|---|
|  | 1978 | end | 
|---|
|  | 1979 | else | 
|---|
|  | 1980 | begin | 
|---|
|  | 1981 | if (ACol = 4) and (ColWidths[4] > 0) then | 
|---|
|  | 1982 | Canvas.Brush.Color := clInactiveBorder | 
|---|
|  | 1983 | else  Canvas.Brush.Color := clWindow; | 
|---|
|  | 1984 | Canvas.Font := Font; | 
|---|
|  | 1985 | end; | 
|---|
|  | 1986 | Canvas.FillRect(Rect); | 
|---|
|  | 1987 | //Canvas.Brush.Color := Color; | 
|---|
|  | 1988 |  | 
|---|
| [456] | 1989 | Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[ACol, ARow]); | 
|---|
|  | 1990 | end; | 
|---|
|  | 1991 | end; | 
|---|
|  | 1992 |  | 
|---|
|  | 1993 | procedure TfrmODMedIV.SetFontSize( FontSize: integer); | 
|---|
|  | 1994 | begin | 
|---|
|  | 1995 | inherited SetFontSize( FontSize ); | 
|---|
|  | 1996 | DoSetFontSize( FontSize ); | 
|---|
|  | 1997 | end; | 
|---|
|  | 1998 |  | 
|---|
| [829] | 1999 | procedure TfrmODMedIV.DisplayDoseNow(Status: boolean); | 
|---|
|  | 2000 | begin | 
|---|
|  | 2001 | if self.EvtID > 0 then Status := false; | 
|---|
|  | 2002 | if status = false then | 
|---|
|  | 2003 | begin | 
|---|
|  | 2004 | if (self.chkDoseNow.Visible = true) and (self.chkDoseNow.Checked = true) then self.chkDoseNow.Checked := false; | 
|---|
|  | 2005 | self.chkDoseNow.Visible := false; | 
|---|
|  | 2006 | end; | 
|---|
|  | 2007 | if status = true then self.chkDoseNow.Visible := true; | 
|---|
|  | 2008 | end; | 
|---|
|  | 2009 |  | 
|---|
| [456] | 2010 | procedure TfrmODMedIV.DoSetFontSize( FontSize: integer); | 
|---|
|  | 2011 | begin | 
|---|
|  | 2012 | tabFluid.TabHeight := Abs(Font.Height) + 4; | 
|---|
|  | 2013 | grdSelected.DefaultRowHeight := Abs(Font.Height) + 8; | 
|---|
|  | 2014 | end; | 
|---|
|  | 2015 |  | 
|---|
|  | 2016 | procedure TfrmODMedIV.FormKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 2017 | Shift: TShiftState); | 
|---|
|  | 2018 | begin | 
|---|
|  | 2019 | inherited; | 
|---|
|  | 2020 | if (Key = VK_TAB) and (ssCtrl in Shift) then | 
|---|
|  | 2021 | begin | 
|---|
|  | 2022 | //Back-tab works the same as forward-tab because there are only two tabs. | 
|---|
|  | 2023 | tabFluid.TabIndex := (tabFluid.TabIndex + 1) mod tabFluid.Tabs.Count; | 
|---|
|  | 2024 | Key := 0; | 
|---|
|  | 2025 | tabFluidChange(tabFluid); | 
|---|
|  | 2026 | end; | 
|---|
|  | 2027 | end; | 
|---|
|  | 2028 |  | 
|---|
| [1679] | 2029 | procedure TfrmODMedIV.FormKeyPress(Sender: TObject; var Key: Char); | 
|---|
|  | 2030 | begin | 
|---|
|  | 2031 | if (Key = #13) and (ActiveControl = grdSelected) then | 
|---|
|  | 2032 | Key := #0;   //Don't let the base class turn it into a forward tab! | 
|---|
|  | 2033 | inherited; | 
|---|
|  | 2034 | end; | 
|---|
|  | 2035 |  | 
|---|
| [456] | 2036 | procedure TfrmODMedIV.grdSelectedKeyPress(Sender: TObject; var Key: Char); | 
|---|
|  | 2037 | begin | 
|---|
|  | 2038 | inherited; | 
|---|
|  | 2039 | ClickOnGridCell; | 
|---|
|  | 2040 | end; | 
|---|
|  | 2041 |  | 
|---|
|  | 2042 | procedure TfrmODMedIV.grdSelectedMouseDown(Sender: TObject; | 
|---|
|  | 2043 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
|---|
|  | 2044 | begin | 
|---|
|  | 2045 | inherited; | 
|---|
|  | 2046 | ClickOnGridCell; | 
|---|
|  | 2047 | end; | 
|---|
|  | 2048 |  | 
|---|
|  | 2049 | procedure TfrmODMedIV.txtXDurationChange(Sender: TObject); | 
|---|
|  | 2050 | begin | 
|---|
|  | 2051 | inherited; | 
|---|
|  | 2052 | if Changing then Exit; | 
|---|
|  | 2053 | ControlChange(Sender); | 
|---|
|  | 2054 | end; | 
|---|
|  | 2055 |  | 
|---|
| [829] | 2056 |  | 
|---|
| [456] | 2057 | procedure TfrmODMedIV.pnlXDurationEnter(Sender: TObject); | 
|---|
|  | 2058 | begin | 
|---|
|  | 2059 | inherited; | 
|---|
|  | 2060 | txtXDuration.SetFocus; | 
|---|
|  | 2061 | end; | 
|---|
|  | 2062 |  | 
|---|
|  | 2063 | procedure TfrmODMedIV.SetLimitationControl(aValue: string); | 
|---|
|  | 2064 | var | 
|---|
|  | 2065 | limitUnit,limitValue,tempval: string; | 
|---|
|  | 2066 | begin | 
|---|
|  | 2067 | limitUnit  := ''; | 
|---|
|  | 2068 | limitValue := ''; | 
|---|
|  | 2069 | tempVal := ''; | 
|---|
| [829] | 2070 | if pos('dose',AValue)>0 then | 
|---|
|  | 2071 | begin | 
|---|
|  | 2072 | limitValue := Piece(aValue,' ',5); | 
|---|
|  | 2073 | limitUnit := 'doses'; | 
|---|
|  | 2074 | end; | 
|---|
|  | 2075 | if (( CharAt(aValue,1)= 'f') or ( CharAt(aValue,1)= 'F')) and (pos('dose',aValue)=0) then  //days, hours | 
|---|
| [456] | 2076 | begin | 
|---|
|  | 2077 | limitValue := Piece(aValue,' ',2); | 
|---|
|  | 2078 | limitUnit  := Piece(aValue,' ',3); | 
|---|
|  | 2079 | end; | 
|---|
|  | 2080 | if (CharAt(aValue,1)= 'w') or (CharAt(aValue,1)= 'W') then  //L, ml | 
|---|
|  | 2081 | begin | 
|---|
|  | 2082 | tempval  := Piece(aValue,' ',4); | 
|---|
|  | 2083 | limitValue := FloatToStr(ExtractFloat(tempVal)); | 
|---|
|  | 2084 | limitUnit  := Copy(tempVal,length(limitValue)+1,Length(tempVal)); | 
|---|
|  | 2085 | end; | 
|---|
|  | 2086 | if isNumeric(CharAt(aValue,1)) then | 
|---|
|  | 2087 | begin | 
|---|
| [829] | 2088 | if LeftStr(avalue,1) = '0' then AValue := Copy(aValue,2,Length(aValue)); | 
|---|
| [456] | 2089 | limitValue := FloatToStr(ExtractFloat(aValue)); | 
|---|
|  | 2090 | limitUnit  := Copy(aValue,length(limitValue)+1,Length(aValue)); | 
|---|
|  | 2091 | if limitUnit = 'D' then limitUnit := 'days' | 
|---|
|  | 2092 | else if limitUnit = 'H' then limitUnit := 'hours' | 
|---|
|  | 2093 | else if limitUnit = 'ML' then limitUnit := 'ml'; | 
|---|
|  | 2094 | end; | 
|---|
|  | 2095 | if ( Length(limitUnit)> 0)  and ( (Length(limitValue) > 0 ) ) then | 
|---|
|  | 2096 | begin | 
|---|
|  | 2097 | txtXDuration.Text := limitValue; | 
|---|
|  | 2098 | if Trim(UpperCase(limitUnit))='CC' then | 
|---|
|  | 2099 | limitUnit := 'ml'; | 
|---|
| [829] | 2100 | cboduration.text := limitUnit; | 
|---|
|  | 2101 | if cboDuration.Text <> '' then cboDuration.ItemIndex := cboDuration.Items.IndexOf(cboDuration.Text) | 
|---|
| [456] | 2102 | end; | 
|---|
|  | 2103 |  | 
|---|
|  | 2104 | end; | 
|---|
|  | 2105 |  | 
|---|
| [829] | 2106 | procedure TfrmODMedIV.SetSchedule(const x: string); | 
|---|
|  | 2107 | var | 
|---|
|  | 2108 | NonPRNPart,tempSch: string; | 
|---|
|  | 2109 | idx: integer; | 
|---|
|  | 2110 | begin | 
|---|
|  | 2111 | cboSchedule.ItemIndex := -1; | 
|---|
|  | 2112 | chkPRN.Checked := False; | 
|---|
|  | 2113 | //Check to see if schedule is already define in the schedule list | 
|---|
|  | 2114 | idx := cboSchedule.Items.IndexOf(X); | 
|---|
|  | 2115 | if idx > -1 then | 
|---|
|  | 2116 | begin | 
|---|
|  | 2117 | cboSchedule.ItemIndex := idx; | 
|---|
|  | 2118 | exit; | 
|---|
|  | 2119 | end; | 
|---|
| [1679] | 2120 | //if PRN schedule than set the checkbox than exit | 
|---|
|  | 2121 | if (X = ' PRN') or (X = 'PRN') then | 
|---|
|  | 2122 | begin | 
|---|
|  | 2123 | chkPRN.Checked := True; | 
|---|
|  | 2124 | Exit; | 
|---|
|  | 2125 | end; | 
|---|
| [829] | 2126 | //Check to see if schedule is a Day-of-Week Schedule (MO-WE-FR@BID) | 
|---|
|  | 2127 | if (Pos('@', x) > 0) then | 
|---|
|  | 2128 | begin | 
|---|
|  | 2129 | tempSch := Piece(x, '@', 2); | 
|---|
|  | 2130 | idx := cboSchedule.Items.IndexOf(tempSch); | 
|---|
|  | 2131 | if idx > -1 then | 
|---|
|  | 2132 | begin | 
|---|
|  | 2133 | //tempSch := U + Piece(x, '@', 1) + '@' + Pieces(cboSchedule.Items.Strings[idx], U, 2, 5); | 
|---|
|  | 2134 | tempSch := Piece(x, '@', 1) + '@' + cboSchedule.Items.Strings[idx]; | 
|---|
|  | 2135 | cboSchedule.Items.Add(tempSch); | 
|---|
|  | 2136 | cboSchedule.Text := (Piece(tempSch,U,1)); | 
|---|
|  | 2137 | cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(Piece(tempSch,U,1)); | 
|---|
|  | 2138 | EXIT; | 
|---|
|  | 2139 | end; | 
|---|
|  | 2140 | //Check to see if schedule is a Day-of-Week PRN Schedule (MO-WE-FR@BID PRN) | 
|---|
|  | 2141 | if Pos('PRN', tempSch) > 0 then | 
|---|
|  | 2142 | begin | 
|---|
|  | 2143 | NonPRNPart := Trim(Copy(tempSch, 1, Pos('PRN', tempSch) - 1)); | 
|---|
|  | 2144 | idx := cboSchedule.Items.IndexOf(NonPRNPart); | 
|---|
|  | 2145 | if idx > -1 then | 
|---|
|  | 2146 | begin | 
|---|
|  | 2147 | //tempSch := U + Piece(x, '@', 1) + '@' + Pieces(cboSchedule.Items.Strings[idx], U, 2, 5); | 
|---|
|  | 2148 | tempSch := Piece(x, '@', 1) + '@' + cboSchedule.Items.Strings[idx]; | 
|---|
|  | 2149 | cboSchedule.Text := (Piece(tempSch,U,1)); | 
|---|
|  | 2150 | cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(Piece(tempSch, U, 1)); | 
|---|
|  | 2151 | chkPRN.Checked := True; | 
|---|
|  | 2152 | EXIT; | 
|---|
|  | 2153 | end | 
|---|
|  | 2154 | else | 
|---|
|  | 2155 | //Add Day-of-Week PRN schedule built off Time Prompt (MO-WE-FR@0800-1000 PRN) | 
|---|
|  | 2156 | begin | 
|---|
|  | 2157 | NonPRNPart := Trim(Copy(X, 1, Pos('PRN', X) - 1)); | 
|---|
|  | 2158 | chkPRN.Checked := True; | 
|---|
|  | 2159 | //cboSchedule.Items.Add(U + NonPRNPart + U + U + U + AdminTime); | 
|---|
|  | 2160 | //cboSchedule.Items.Add(U + NonPRNPart + U + U + U + Piece(NonPRNPart, '@', 2)); | 
|---|
|  | 2161 | cboSchedule.Items.Add(NonPRNPart + U + U + U + Piece(NonPRNPart, '@', 2)); | 
|---|
|  | 2162 | cboSchedule.Text := NonPRNPart; | 
|---|
|  | 2163 | cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(NonPRNPart); | 
|---|
|  | 2164 | EXIT; | 
|---|
|  | 2165 | end; | 
|---|
|  | 2166 | end; | 
|---|
|  | 2167 | //Add Non PRN Day-of-Week Schedule built off Time Prompt (MO-WE-FR@0800-1000) | 
|---|
|  | 2168 | //cboSchedule.Items.Add(U + x + U + U + U + AdminTime); | 
|---|
|  | 2169 | //cboSchedule.Items.Add(U + x + U + U + U + tempSch); | 
|---|
|  | 2170 | cboSchedule.Items.Add(x + U + U + U + tempSch); | 
|---|
|  | 2171 | cboSchedule.Text := x; | 
|---|
|  | 2172 | cboSchedule.ItemIndex := cboSchedule.Items.IndexOf(X); | 
|---|
|  | 2173 | end | 
|---|
|  | 2174 | else | 
|---|
|  | 2175 | begin | 
|---|
|  | 2176 | //Handle standard schedule mark as PRN (Q4H PRN) | 
|---|
|  | 2177 | if Pos('PRN', X) > 0 then | 
|---|
|  | 2178 | begin | 
|---|
|  | 2179 | NonPRNPart := Trim(Copy(X, 1, Pos('PRN', X) - 1)); | 
|---|
|  | 2180 | idx := cboSchedule.Items.IndexOf(NonPRNPart); | 
|---|
|  | 2181 | if idx > -1 then | 
|---|
|  | 2182 | begin | 
|---|
|  | 2183 | cboSchedule.ItemIndex := idx; | 
|---|
|  | 2184 | tempSch := cboSchedule.Items.Strings[idx]; | 
|---|
|  | 2185 | //setPiece(tempSch,U,5,AdminTime); | 
|---|
|  | 2186 | cboSchedule.Items.Strings[idx] := tempSch; | 
|---|
|  | 2187 | chkPRN.Checked := True; | 
|---|
|  | 2188 | exit; | 
|---|
|  | 2189 | end; | 
|---|
|  | 2190 | end; | 
|---|
|  | 2191 | end; | 
|---|
|  | 2192 | end; | 
|---|
|  | 2193 |  | 
|---|
|  | 2194 |  | 
|---|
| [456] | 2195 | procedure TfrmODMedIV.txtXDurationExit(Sender: TObject); | 
|---|
|  | 2196 | var | 
|---|
|  | 2197 | Code: double; | 
|---|
|  | 2198 | begin | 
|---|
|  | 2199 | inherited; | 
|---|
|  | 2200 | if (txtXDuration.Text <> '0') and (txtXDuration.Text <> '') then | 
|---|
|  | 2201 | begin | 
|---|
|  | 2202 | try | 
|---|
|  | 2203 | code := StrToFloat(txtXDuration.Text); | 
|---|
|  | 2204 | except | 
|---|
|  | 2205 | code := 0; | 
|---|
|  | 2206 | end; | 
|---|
|  | 2207 | if code < 0.0001 then | 
|---|
|  | 2208 | begin | 
|---|
| [829] | 2209 | ShowMsg('Can not save order.' + #13#10 + 'Reason: Invalid Duration or Total Volume!'); | 
|---|
| [456] | 2210 | txtXDuration.Text := ''; | 
|---|
|  | 2211 | txtXDuration.SetFocus; | 
|---|
|  | 2212 | Exit; | 
|---|
|  | 2213 | end; | 
|---|
|  | 2214 | end; | 
|---|
|  | 2215 | try | 
|---|
|  | 2216 | if (Length(txtXDuration.Text)>0) and (StrToFloat(txtXDuration.Text)<0) then | 
|---|
|  | 2217 | begin | 
|---|
| [829] | 2218 | ShowMsg('Can not save order.' + #13#10 + 'Reason: Invalid Duration or total volume!'); | 
|---|
| [456] | 2219 | txtXDuration.Text := ''; | 
|---|
|  | 2220 | txtXDuration.SetFocus; | 
|---|
|  | 2221 | Exit; | 
|---|
|  | 2222 | end; | 
|---|
|  | 2223 | except | 
|---|
|  | 2224 | txtXDuration.Text := ''; | 
|---|
|  | 2225 | end; | 
|---|
|  | 2226 | ControlChange(Sender); | 
|---|
|  | 2227 | end; | 
|---|
|  | 2228 |  | 
|---|
| [1679] | 2229 | function TfrmODMedIV.UpdateAddFreq(OI: integer): string; | 
|---|
|  | 2230 | begin | 
|---|
|  | 2231 | if (self.cboType.ItemIndex = -1) or (MixedCase(self.cboType.Items.Strings[self.cboType.ItemIndex]) = 'Continuous') then | 
|---|
|  | 2232 | Result := GetDefaultAddFreq(OI) | 
|---|
|  | 2233 | else Result := ''; | 
|---|
|  | 2234 | end; | 
|---|
|  | 2235 |  | 
|---|
| [829] | 2236 | procedure TfrmODMedIV.UpdateDuration(SchType: string); | 
|---|
|  | 2237 | begin | 
|---|
|  | 2238 | if SchType = 'O' then | 
|---|
|  | 2239 | begin | 
|---|
|  | 2240 | self.cboDuration.ItemIndex := -1; | 
|---|
|  | 2241 | self.txtXDuration.Text := ''; | 
|---|
|  | 2242 | self.cboDuration.Enabled := false; | 
|---|
|  | 2243 | self.txtXDuration.Enabled := false; | 
|---|
|  | 2244 | self.lblLimit.Enabled := false; | 
|---|
|  | 2245 | end | 
|---|
|  | 2246 | else | 
|---|
|  | 2247 | begin | 
|---|
|  | 2248 | self.cboDuration.Enabled := true; | 
|---|
|  | 2249 | self.txtXDuration.Enabled := true; | 
|---|
|  | 2250 | self.lblLimit.Enabled := true; | 
|---|
|  | 2251 | end; | 
|---|
|  | 2252 | end; | 
|---|
|  | 2253 |  | 
|---|
|  | 2254 | procedure TfrmODMedIV.UpdateRoute; | 
|---|
| [456] | 2255 | var | 
|---|
| [829] | 2256 | AnIVComponent: TIVComponent; | 
|---|
|  | 2257 | i: integer; | 
|---|
|  | 2258 | OrderIds, TempIVRoute: TStringList; | 
|---|
| [1679] | 2259 | //Default: boolean; | 
|---|
| [456] | 2260 | begin | 
|---|
| [829] | 2261 | if self.grdSelected.RowCount > 0 then self.txtAllIVRoutes.Visible := True; | 
|---|
|  | 2262 | TempIVRoute := TStringList.Create; | 
|---|
|  | 2263 | for I := (self.cboRoute.Items.Count -1) downto 0 do | 
|---|
| [456] | 2264 | begin | 
|---|
| [829] | 2265 | if Piece(self.cboRoute.Items.Strings[i], U, 5) = '1' then | 
|---|
|  | 2266 | TempIVRoute.Add(self.cboRoute.Items.Strings[i]); | 
|---|
|  | 2267 | self.cboRoute.Items.Delete(i); | 
|---|
| [456] | 2268 | end; | 
|---|
| [829] | 2269 | if self.cboRoute.ItemIndex = -1 then self.cboRoute.Text := ''; | 
|---|
|  | 2270 | OrderIds := TStringList.Create; | 
|---|
|  | 2271 | for i := 0 to self.grdSelected.RowCount -1  do | 
|---|
| [456] | 2272 | begin | 
|---|
| [829] | 2273 | AniVComponent := TIVComponent(self.grdSelected.Objects[0, i]); | 
|---|
|  | 2274 | if AnIVComponent <> nil then  orderIds.Add(InttoStr(AniVComponent.IEN)); | 
|---|
| [456] | 2275 | end; | 
|---|
| [829] | 2276 | if OrderIds.Count > 0 then | 
|---|
|  | 2277 | begin | 
|---|
| [1679] | 2278 | //if (self.FInitialOrderID = True) and (self.grdSelected.RowCount = 1) then Default := True | 
|---|
|  | 2279 | //else Default := False; | 
|---|
|  | 2280 | LoadDosageFormIVRoutes(self.cboRoute.Items, OrderIds); | 
|---|
|  | 2281 | //if default = True then | 
|---|
|  | 2282 | //  begin | 
|---|
|  | 2283 | for I := 0 to cboRoute.items.Count - 1 do | 
|---|
| [829] | 2284 | begin | 
|---|
| [1679] | 2285 | if Piece(cboRoute.Items.Strings[i], U, 5) = 'D' then | 
|---|
|  | 2286 | begin | 
|---|
|  | 2287 | cboRoute.ItemIndex := i; | 
|---|
|  | 2288 | break; | 
|---|
|  | 2289 | end; | 
|---|
| [829] | 2290 | end; | 
|---|
| [1679] | 2291 | //  self.FInitialOrderID := false; | 
|---|
|  | 2292 | //end; | 
|---|
| [829] | 2293 | OrderIds.Free; | 
|---|
|  | 2294 | end; | 
|---|
|  | 2295 | if TempIVRoute.Count > 0 then | 
|---|
|  | 2296 | begin | 
|---|
|  | 2297 | for I := 0 to tempIVRoute.Count - 1 do cboRoute.Items.Add(tempIVRoute.Strings[i]); | 
|---|
|  | 2298 | TempIVRoute.Free; | 
|---|
|  | 2299 | end; | 
|---|
|  | 2300 | cboRoute.Items.Add(U + 'OTHER'); | 
|---|
| [456] | 2301 | end; | 
|---|
|  | 2302 |  | 
|---|
| [829] | 2303 |  | 
|---|
|  | 2304 | procedure TfrmODMedIV.txtAllIVRoutesClick(Sender: TObject); | 
|---|
|  | 2305 | var | 
|---|
| [1679] | 2306 | i: integer; | 
|---|
|  | 2307 | msg : String; | 
|---|
| [829] | 2308 | begin | 
|---|
|  | 2309 | inherited; | 
|---|
| [1679] | 2310 | msg := 'You can also select "OTHER" from the Route list' | 
|---|
| [829] | 2311 | + ' to select a Route from the Expanded Med Route List.' | 
|---|
| [1679] | 2312 | + #13#10 + 'Click OK to launch the Expanded Med Route List.'; | 
|---|
|  | 2313 | if ShowMsg(msg, smiInfo, smbOKCancel) = smrOk then | 
|---|
| [829] | 2314 | begin | 
|---|
|  | 2315 | for I := 0 to cboRoute.Items.Count - 1 do if cboRoute.Items.Strings[i] = U + 'OTHER' then break; | 
|---|
|  | 2316 | cboRoute.ItemIndex := i; | 
|---|
|  | 2317 | cboRouteClick(self); | 
|---|
|  | 2318 | cboRouteChange(self.cboRoute); | 
|---|
|  | 2319 | end; | 
|---|
|  | 2320 | end; | 
|---|
|  | 2321 |  | 
|---|
|  | 2322 | procedure TfrmODMedIV.txtNSSClick(Sender: TObject); | 
|---|
|  | 2323 | var | 
|---|
| [1679] | 2324 | i: integer; | 
|---|
|  | 2325 | msg : String; | 
|---|
| [829] | 2326 | begin | 
|---|
|  | 2327 | inherited; | 
|---|
| [1679] | 2328 | msg := 'You can also select ' + '"' + 'Other' + '"' + ' from the schedule list' | 
|---|
| [829] | 2329 | + ' to create a day-of-week schedule.' | 
|---|
| [1679] | 2330 | + #13#10 + 'Click OK to launch schedule builder'; | 
|---|
|  | 2331 | if ShowMsg(msg, smiInfo, smbOKCancel) = smrOK then | 
|---|
| [829] | 2332 | begin | 
|---|
|  | 2333 | //cboSchedule.Items.Add(U + 'OTHER'); | 
|---|
|  | 2334 | for I := 0 to cboSchedule.Items.Count - 1 do if cboSchedule.Items.Strings[i] = 'OTHER' then break; | 
|---|
|  | 2335 | cboSchedule.ItemIndex := i; | 
|---|
|  | 2336 | //cboSchedule.SelectByID(U+'OTHER'); | 
|---|
|  | 2337 | cboScheduleClick(Self); | 
|---|
|  | 2338 | cboScheduleChange(self.cboSchedule); | 
|---|
|  | 2339 | end; | 
|---|
|  | 2340 | end; | 
|---|
|  | 2341 |  | 
|---|
|  | 2342 | procedure TfrmODMedIV.txtRateChange(Sender: TObject); | 
|---|
|  | 2343 | begin | 
|---|
|  | 2344 | inherited; | 
|---|
|  | 2345 | if Changing then Exit; | 
|---|
|  | 2346 | ControlChange(Sender); | 
|---|
|  | 2347 | end; | 
|---|
|  | 2348 |  | 
|---|
| [456] | 2349 | end. | 
|---|