source: cprs/trunk/CPRS-Chart/Orders/fODMedOut.pas@ 924

Last change on this file since 924 was 829, checked in by Kevin Toppenberg, 14 years ago

Upgrade to version 27

File size: 20.8 KB
Line 
1unit fODMedOut;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fODBase, ORCtrls, StdCtrls, ORFn, ExtCtrls, uConst, ComCtrls, uCore, Mask,
8 Menus, Buttons, VA508AccessibilityManager;
9
10type
11 TfrmODMedOut = class(TfrmODBase)
12 lblMedication: TLabel;
13 cboMedication: TORComboBox;
14 lblDosage: TLabel;
15 lblRoute: TLabel;
16 cboRoute: TORComboBox;
17 lblSchedule: TLabel;
18 cboSchedule: TORComboBox;
19 lblDispense: TLabel;
20 cboDispense: TORComboBox;
21 memComments: TMemo;
22 cboPriority: TORComboBox;
23 Bevel1: TBevel;
24 cboMedAlt: TORComboBox;
25 cboInstructions: TORComboBox;
26 lblQuantity: TLabel;
27 cboPickup: TORComboBox;
28 lblPickup: TLabel;
29 cboSC: TORComboBox;
30 lblSC: TLabel;
31 lblRefills: TLabel;
32 txtQuantity: TCaptionEdit;
33 lblComment: TLabel;
34 lblPriority: TLabel;
35 txtRefills: TCaptionEdit;
36 spnRefills: TUpDown;
37 cmdComplex: TButton;
38 btnUnits: TSpeedButton;
39 txtSIG: TCaptionEdit;
40 lblSIG: TLabel;
41 popUnits: TPopupMenu;
42 memComplex: TMemo;
43 procedure cboMedicationNeedData(Sender: TObject; const StartFrom: string;
44 Direction, InsertAt: Integer);
45 procedure cboMedicationSelect(Sender: TObject);
46 procedure FormCreate(Sender: TObject);
47 procedure ControlChange(Sender: TObject);
48 procedure cboDispenseExit(Sender: TObject);
49 procedure cboDispenseMouseClick(Sender: TObject);
50 procedure cboSCEnter(Sender: TObject);
51 procedure txtQuantityEnter(Sender: TObject);
52 procedure btnUnitsClick(Sender: TObject);
53 procedure cmdComplexClick(Sender: TObject);
54 procedure memCommentsEnter(Sender: TObject);
55 private
56 { Private declarations }
57 FLastDrug: Integer;
58 FLastMedID: string;
59 FDispenseMsg: string;
60 FMedCombo: TORComboBox;
61 procedure CheckFormAlt;
62 procedure ResetOnMedChange;
63 procedure SetAskSC;
64 procedure SetAltCombo;
65 procedure SetInstructions;
66 procedure SetOnOISelect;
67 procedure SetMaxRefills;
68 procedure SetupNouns;
69 procedure SetComplex;
70 procedure SetSimple;
71 procedure UnitClick(Sender: TObject);
72 protected
73 procedure InitDialog; override;
74 procedure Validate(var AnErrMsg: string); override;
75 public
76 procedure SetupDialog(OrderAction: Integer; const ID: string); override;
77 end;
78
79implementation
80
81{$R *.DFM}
82
83uses rOrders, rODBase, fODMedFA, fODMedComplex;
84
85const
86 REFILLS_DFLT = '0';
87 REFILLS_MAX = 11;
88
89 TX_NO_MED = 'Medication must be entered.';
90 TX_NO_DOSE = 'Instructions must be entered.';
91 TX_NO_AMPER = 'Instructions may not contain the ampersand (&) character.';
92 TX_NO_ROUTE = 'Route must be entered.';
93 TX_NF_ROUTE = 'Route not found in the Medication Routes file.';
94 TX_NO_SCHED = 'Schedule must be entered.';
95 TX_NO_PICK = 'A method for picking up the medication must be entered.';
96 TX_RNG_REFILL = 'The number of refills must be in the range of 0 through ';
97 TX_SCH_QUOTE = 'Schedule must not have quotemarks in it.';
98 TX_SCH_MINUS = 'Schedule must not have a dash at the beginning.';
99 TX_SCH_SPACE = 'Schedule must have only one space in it.';
100 TX_SCH_LEN = 'Schedule must be less than 70 characters.';
101 TX_SCH_PRN = 'Schedule cannot include PRN - use Comments to enter PRN.';
102 TX_SCH_ZERO = 'Schedule cannot be Q0';
103 TX_SCH_LSP = 'Schedule may not have leading spaces.';
104 TX_SCH_NS = 'Unable to resolve non-standard schedule.';
105 TX_OUTPT_IV = 'This patient has not been admitted. Only IV orders may be entered.';
106 TX_QTY_NV = 'Unable to validate quantity.';
107 TX_QTY_MAIL = 'Quantity for mailed items must be a whole number.';
108
109
110{ TfrmODBase common methods }
111
112procedure TfrmODMedOut.FormCreate(Sender: TObject);
113const
114 TC_RESTRICT = 'Ordering Restrictions';
115var
116 Restriction: string;
117begin
118 inherited;
119 AllowQuickOrder := True;
120 CheckAuthForMeds(Restriction);
121 if Length(Restriction) > 0 then
122 begin
123 InfoBox(Restriction, TC_RESTRICT, MB_OK);
124 Close;
125 Exit;
126 end;
127 FillerID := 'PSO'; // does 'on Display' order check **KCM**
128 StatusText('Loading Dialog Definition');
129 Responses.Dialog := 'PSO OERR'; // loads formatting info
130 StatusText('Loading Default Values');
131 CtrlInits.LoadDefaults(ODForMedOut); // ODForMedOut returns TStrings with defaults
132 InitDialog;
133 CtrlInits.SetControl(cboPickup, 'Pickup'); // do only once, so don't do in InitDialog
134 PreserveControl(cboPickup);
135end;
136
137procedure TfrmODMedOut.InitDialog;
138begin
139 inherited;
140 FLastDrug := 0;
141 FLastMedID := '';
142 FDispenseMsg := '';
143 FMedCombo := cboMedication; // this must be before SetControl(cboMedication)
144 with CtrlInits do
145 begin
146 SetControl(cboMedication, 'ShortList');
147 cboMedication.InsertSeparator;
148 //SetControl(cboMedAlt, 'ShortList'); can't do this since it calls InitLongList
149 SetControl(cboSchedule, 'Schedules');
150 SetControl(cboPriority, 'Priorities');
151 //SetControl(cboPickup, 'Pickup');
152 SetControl(cboSC, 'SCStatus');
153 end;
154 SetAskSC;
155 StatusText('Retrieving List of Medications');
156 cboMedAlt.Visible := False;
157 cboMedication.Visible := True;
158 cboMedication.InitLongList('');
159 ActiveControl := cboMedication; //SetFocusedControl(FMedCombo);
160 SetSimple;
161 StatusText('');
162end;
163
164procedure TfrmODMedOut.SetupDialog(OrderAction: Integer; const ID: string);
165var
166 AnInstr: string;
167begin
168 inherited;
169 if OrderAction in [ORDER_COPY, ORDER_EDIT] then Responses.Remove('START', 1);
170 if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then with Responses do
171 begin
172 Changing := True;
173 SetControl(cboMedication, 'ORDERABLE', 1);
174 ResetOnMedChange;
175 SetOnOISelect;
176 SetAltCombo;
177 //cboMedicationSelect(Self);
178 SetControl(cboDispense, 'DRUG', 1);
179 SetInstructions;
180 SetControl(txtQuantity, 'QTY', 1);
181 SetControl(txtRefills, 'REFILLS', 1);
182 spnRefills.Position := StrToIntDef(txtRefills.Text, 0);
183 SetControl(cboPickup, 'PICKUP', 1);
184 SetControl(memComments, 'COMMENT', 1);
185 SetControl(cboPriority, 'URGENCY', 1);
186 { prevent the SIG from being part of the comments on pre-CPRS prescriptions }
187 if (OrderAction in [ORDER_COPY, ORDER_EDIT]) and (cboInstructions.Text = '') then
188 begin
189 AnInstr := TextForOrder(ID); //'SIG: ' + memComments.Text;
190 OrderMessage(AnInstr);
191 lblSIG.Visible := True;
192 txtSIG.Visible := True;
193 txtSIG.Text := memComments.Text;
194 memComments.Clear;
195 end;
196 { can't edit the orderable item for a med order that has been released }
197 if (OrderAction = ORDER_EDIT) and OrderIsReleased(EditOrder)
198 then FMedCombo.Enabled := False;
199 Changing := False;
200 ControlChange(Self);
201 end;
202 if OrderAction <> ORDER_EDIT then SetFocusedControl(FMedCombo);
203end;
204
205procedure TfrmODMedOut.Validate(var AnErrMsg: string);
206var
207 Sched: Integer;
208 RouteID, RouteAbbr: string;
209
210 procedure SetError(const x: string);
211 begin
212 if Length(AnErrMsg) > 0 then AnErrMsg := AnErrMsg + CRLF;
213 AnErrMsg := AnErrMsg + x;
214 end;
215
216begin
217 inherited;
218 if Length(cboMedAlt.Text) = 0 then SetError(TX_NO_MED);
219 // if memComplex is Visible, then the dosage fields were validated in fMedComplex
220 if memComplex.Visible = False then
221 begin
222 if Length(cboInstructions.Text) = 0 then SetError(TX_NO_DOSE);
223 if Pos('&', cboInstructions.Text) > 0 then SetError(TX_NO_AMPER);
224 if (Length(cboRoute.Text) = 0) and (not MedIsSupply(cboMedAlt.ItemIEN))
225 then SetError(TX_NO_ROUTE);
226 if (Length(cboRoute.Text) > 0) and (cboRoute.ItemIndex < 0) then
227 begin
228 LookupRoute(cboRoute.Text, RouteID, RouteAbbr);
229 if RouteID = '0'
230 then SetError(TX_NF_ROUTE)
231 else Responses.Update('ROUTE', 1, RouteID, RouteAbbr);
232 end;
233 if Length(cboSchedule.Text) = 0 then SetError(TX_NO_SCHED);
234 end;
235 if cboPickup.ItemID = '' then SetError(TX_NO_PICK);
236 if StrToIntDef(txtRefills.Text, 99) > spnRefills.Max
237 then SetError(TX_RNG_REFILL + IntToStr(spnRefills.Max));
238 with cboSchedule do if Length(Text) > 0 then
239 begin
240 Sched := ValidSchedule(Text);
241 if Sched = -1 then
242 begin
243 if Pos('"', Text) > 0 then SetError(TX_SCH_QUOTE);
244 if Copy(Text, 1, 1) = '-' then SetError(TX_SCH_MINUS);
245 if Pos(' ', Copy(Text, Pos(' ', Text) + 1, 999)) > 0 then SetError(TX_SCH_SPACE);
246 if Length(Text) > 70 then SetError(TX_SCH_LEN);
247 if (Pos('P RN', Text) > 0) or (Pos('PR N', Text) > 0) then SetError(TX_SCH_PRN);
248 if Pos('Q0', Text) > 0 then SetError(TX_SCH_ZERO);
249 if TrimLeft(Text) <> Text then SetError(TX_SCH_LSP);
250 end;
251 if Sched = 0 then SetError(TX_SCH_NS);
252 end;
253 with txtQuantity do if Length(Text) > 0 then
254 begin
255 if not ValidQuantity(Text) then SetError(TX_QTY_NV);
256 //if (cboPickup.ItemID = 'M') and (IntToStr(StrToIntDef(Text,-1)) <> Text)
257 // then SetError(TX_QTY_MAIL);
258 end;
259end;
260
261{ cboMedication methods }
262
263procedure TfrmODMedOut.ResetOnMedChange;
264begin
265 ClearControl(cboDispense);
266 ClearControl(cboInstructions);
267 btnUnits.Caption := '';
268 ResetControl(cboRoute);
269 ResetControl(cboSchedule);
270 ClearControl(txtQuantity);
271 txtRefills.Text := REFILLS_DFLT;
272 spnRefills.Max := REFILLS_MAX;
273 ClearControl(memComments);
274 ClearControl(memOrder);
275end;
276
277procedure TfrmODMedOut.SetAltCombo;
278begin
279 with cboMedication do
280 begin
281 FMedCombo := cboMedAlt;
282 if cboMedAlt.Items.Count = 0 then CtrlInits.SetListOnly(cboMedAlt, 'ShortList');
283 cboMedAlt.SetExactByIEN(ItemIEN, TrimRight(Piece(Text, '<', 1)));
284 cboMedication.Visible := False;
285 cboMedAlt.Visible := True;
286 end;
287end;
288
289procedure TfrmODMedOut.SetOnOISelect;
290begin
291 with CtrlInits do
292 begin
293 FLastMedID := FMedCombo.ItemID;
294 LoadOrderItem(OIForMedOut(FMedCombo.ItemIEN));
295 SetControl(cboDispense, 'Dispense');
296 if cboDispense.Items.Count = 1 then cboDispense.ItemIndex := 0;
297 lblDosage.Caption := DefaultText('Verb');
298 if lblDosage.Caption = '' then lblDosage.Caption := 'Amount';
299 SetControl(cboInstructions, 'Instruct');
300 SetupNouns;
301 SetControl(cboRoute, 'Route');
302 if cboRoute.Items.Count = 1 then cboRoute.ItemIndex := 0;
303 if DefaultText('DefSched') <> '' then cboSchedule.SelectByID(DefaultText('DefSched'));
304 OrderMessage(TextOf('Message'));
305 end;
306end;
307
308procedure TfrmODMedOut.cboMedicationNeedData(Sender: TObject; const StartFrom: string;
309 Direction, InsertAt: Integer);
310{ retrieves a subset of inpatient medication orderable items }
311begin
312 inherited;
313 FMedCombo.ForDataUse(SubSetOfOrderItems(StartFrom, Direction, 'S.O RX'));
314end;
315
316procedure TfrmODMedOut.cboMedicationSelect(Sender: TObject);
317{ sets related controls whenever orderable item changes (MouseClick or Exit) }
318begin
319 inherited;
320 with FMedCombo do
321 begin
322 if ItemID <> FLastMedID then FLastMedID := ItemID else Exit;
323 Changing := True;
324 if Sender <> Self then Responses.Clear; // Sender=Self when called from SetupDialog
325 ResetOnMedChange;
326 if CharAt(ItemID, 1) = 'Q' then
327 begin
328 Responses.QuickOrder := ExtractInteger(ItemID);
329 Responses.SetControl(FMedCombo, 'ORDERABLE', 1);
330 end;
331 if ItemIEN > 0 then SetOnOISelect;
332 end;
333 with Responses do if QuickOrder > 0 then
334 begin
335 SetControl(FMedCombo, 'ORDERABLE', 1);
336 SetControl(cboDispense, 'DRUG', 1);
337 SetInstructions;
338 SetControl(txtQuantity, 'QTY', 1);
339 SetControl(txtRefills, 'REFILLS', 1);
340 spnRefills.Position := StrToIntDef(txtRefills.Text, 0);
341 SetControl(cboPickup, 'PICKUP', 1);
342 SetControl(memComments, 'COMMENT', 1);
343 SetControl(cboPriority, 'URGENCY', 1);
344 end;
345 Changing := False;
346 ControlChange(Self);
347 if FMedCombo = cboMedication then SetAltCombo;
348 // if the Dispense drug was stuffed - still do the checks (form alt, refills)
349 if cboDispense.ItemIndex > -1 then cboDispenseMouseClick(Self);
350end;
351
352{ cboDispense methods }
353
354procedure TfrmODMedOut.CheckFormAlt;
355var
356 DrugName, OIName: string;
357 Drug, OI: Integer;
358begin
359 with cboDispense do if (ItemIndex > -1) and (Piece(Items[ItemIndex], U, 4) = 'NF') then
360 begin
361 SelectFormularyAlt(ItemIEN, Drug, OI, DrugName, OIName, PST_OUTPATIENT);
362 if Drug > 0 then
363 begin
364 if FMedCombo.ItemIEN <> OI then
365 begin
366 FMedCombo.InitLongList(OIName);
367 FMedCombo.SelectByIEN(OI);
368 cboMedicationSelect(Self);
369 end;
370 cboDispense.SelectByIEN(Drug);
371 end; {if FormAlt}
372 end; {if ItemIndex}
373 SetAskSC; // now check enabled for the service connected prompt
374end;
375
376procedure TfrmODMedOut.SetMaxRefills;
377begin
378 with cboDispense do if (ItemIndex > -1) and (Length(Piece(Items[ItemIndex], U, 6)) > 0) then
379 begin
380 spnRefills.Max := StrToIntDef(Piece(Items[ItemIndex], U, 6), REFILLS_MAX);
381 if StrToIntDef(txtRefills.Text, 0) > spnRefills.Max then
382 begin
383 txtRefills.Text := IntToStr(spnRefills.Max);
384 spnRefills.Position := spnRefills.Max;
385 end;
386 end;
387end;
388
389procedure TfrmODMedOut.cboDispenseExit(Sender: TObject);
390var
391 AMsg: string;
392begin
393 inherited;
394 SetMaxRefills;
395 with cboDispense do
396 begin
397 if ItemIEN <> FLastDrug then CheckFormAlt;
398 if ItemIEN > 0 then
399 begin
400 AMsg := DispenseMessage(ItemIEN) + CRLF;
401 if memMessage.Text <> AMsg then OrderMessage(AMsg);
402 end;
403 FLastDrug := ItemIEN;
404 end;
405end;
406
407procedure TfrmODMedOut.cboDispenseMouseClick(Sender: TObject);
408begin
409 inherited;
410 SetMaxRefills;
411 with cboDispense do
412 begin
413 if ItemIEN <> FLastDrug then CheckFormAlt;
414 if ItemIEN > 0 then OrderMessage(DispenseMessage(ItemIEN));
415 FLastDrug := ItemIEN;
416 end;
417end;
418
419{ dosage instructions }
420
421procedure TfrmODMedOut.SetupNouns;
422var
423 AvailWidth, MaxWidth: Integer;
424begin
425 CtrlInits.SetPopupMenu(popUnits, UnitClick, 'Nouns');
426 if popUnits.Items.Count > 0 then
427 begin
428 // Make sure cboInstructions is at least 40 pixels wide so it can show values
429 // like "1/2". Allow for a 3 pixel space between the the Units button & Route.
430 AvailWidth := (cboRoute.Left - 3) - (cboInstructions.Left + 40);
431 MaxWidth := popUnits.Tag + 9; // allow 9 pixels for the down arrow & button border
432 if MaxWidth > AvailWidth then MaxWidth := AvailWidth;
433 btnUnits.Width := MaxWidth;
434 btnUnits.Left := cboRoute.Left - MaxWidth - 3;
435 cboInstructions.Width := btnUnits.Left - cboInstructions.Left;
436 btnUnits.Caption := popUnits.Items[0].Caption;
437 btnUnits.Visible := True;
438 end else
439 begin
440 btnUnits.Visible := False;
441 // Allow for a 6 pixel margin between the Instructions box & Route
442 cboInstructions.Width := cboRoute.Left - cboInstructions.Left - 6;
443 end;
444end;
445
446procedure TfrmODMedOut.btnUnitsClick(Sender: TObject);
447var
448 APoint: TPoint;
449begin
450 inherited;
451 APoint := btnUnits.ClientToScreen(Point(0, btnUnits.Height));
452 popUnits.Popup(APoint.X, APoint.Y);
453end;
454
455procedure TfrmODMedOut.UnitClick(Sender: TObject);
456begin
457 btnUnits.Caption := TMenuItem(Sender).Caption;
458end;
459
460procedure TfrmODMedOut.SetComplex;
461begin
462 lblDosage.Visible := False;;
463 lblRoute.Visible := False;;
464 lblSchedule.Visible := False;;
465 cboInstructions.Visible := False;
466 btnUnits.Visible := False;;
467 cboRoute.Visible := False;
468 cboSchedule.Visible := False;
469 memComplex.Visible := True;
470 cmdComplex.Caption := 'Change Dose...';
471end;
472
473procedure TfrmODMedOut.SetSimple;
474begin
475 memComplex.Visible := False;
476 lblDosage.Visible := True;;
477 lblRoute.Visible := True;;
478 lblSchedule.Visible := True;;
479 cboInstructions.Visible := True;
480 btnUnits.Visible := (popUnits.Items.Count > 0) or (btnUnits.Caption <> '');
481 cboRoute.Visible := True;
482 cboSchedule.Visible := True;
483 cmdComplex.Caption := 'Complex Dose...';
484end;
485
486procedure TfrmODMedOut.SetInstructions;
487var
488 x: string;
489 AnInstance: Integer;
490begin
491 case Responses.InstanceCount('INSTR') of
492 0: begin
493 cboInstructions.ItemIndex := -1;
494 // there may still be a route & schedule (for copied orders)
495 if Responses.EValueFor('MISC', 1) <> ''
496 then btnUnits.Caption := Responses.EValueFor('MISC', 1);
497 Responses.SetControl(cboRoute, 'ROUTE', 1);
498 with cboRoute do if ItemIndex > -1 then Text := DisplayText[ItemIndex];
499 Responses.SetControl(cboSchedule, 'SCHEDULE', 1);
500 SetSimple;
501 end;
502 1: begin
503 AnInstance := Responses.NextInstance('INSTR', 0);
504 Responses.SetControl(cboInstructions, 'INSTR', AnInstance);
505 btnUnits.Caption := Responses.IValueFor('MISC', AnInstance);
506 Responses.SetControl(cboRoute, 'ROUTE', AnInstance);
507 with cboRoute do if ItemIndex > -1 then Text := DisplayText[ItemIndex];
508 Responses.SetControl(cboSchedule, 'SCHEDULE', AnInstance);
509 SetSimple;
510 end;
511 else begin
512 memComplex.Clear;
513 AnInstance := Responses.NextInstance('INSTR', 0);
514 while AnInstance > 0 do
515 begin
516 x := Responses.EValueFor('INSTR', AnInstance);
517 x := x + ' ' + Responses.EValueFor('MISC', AnInstance);
518 x := x + ' ' + Responses.EValueFor('ROUTE', AnInstance);
519 x := x + ' ' + Responses.EValueFor('SCHEDULE', AnInstance);
520 if Length(Responses.EValueFor('DAYS', AnInstance)) > 0
521 then x := x + ' ' + Responses.EValueFor('DAYS', AnInstance) + ' day(s)';
522 memComplex.Lines.Add(x);
523 AnInstance := Responses.NextInstance('INSTR', AnInstance);
524 end;
525 SetComplex;
526 end;
527 end; {case}
528 memOrder.Text := Responses.OrderText;
529end; {if ExecuteComplexDose}
530
531procedure TfrmODMedOut.cmdComplexClick(Sender: TObject);
532begin
533 inherited;
534 if FMedCombo.ItemIEN = 0 then
535 begin
536 InfoBox(TX_NO_MED, 'Error', MB_OK);
537 Exit;
538 end;
539 if ExecuteComplexDose(CtrlInits, Responses) then SetInstructions;
540end;
541
542{ quantity }
543
544procedure TfrmODMedOut.txtQuantityEnter(Sender: TObject);
545begin
546 inherited;
547 with cboDispense do if ItemIEN > 0 then OrderMessage(QuantityMessage(ItemIEN));
548end;
549
550{ service connection }
551
552procedure TfrmODMedOut.SetAskSC;
553const
554 SC_NO = 0;
555 SC_YES = 1;
556begin
557 if Patient.ServiceConnected and RequiresCopay(FLastDrug) then
558 begin
559 lblSC.Font.Color := clWindowText;
560 cboSC.Enabled := True;
561 cboSC.Color := clWindow;
562 if Patient.SCPercent > 50 then cboSC.SelectByIEN(SC_YES) else cboSC.SelectByIEN(SC_NO);
563 end else
564 begin
565 lblSC.Font.Color := clGrayText;
566 cboSC.Enabled := False;
567 cboSC.Color := clBtnFace;
568 cboSC.ItemIndex := -1;
569 end;
570end;
571
572procedure TfrmODMedOut.cboSCEnter(Sender: TObject);
573begin
574 inherited;
575 OrderMessage(RatedDisabilities);
576end;
577
578{ comments }
579
580procedure TfrmODMedOut.memCommentsEnter(Sender: TObject);
581begin
582 inherited;
583 OrderMessage(''); // make sure Order Message disappears when in comments box
584end;
585
586{ all controls }
587
588procedure TfrmODMedOut.ControlChange(Sender: TObject);
589begin
590 inherited;
591 if csLoading in ComponentState then Exit; // to prevent error caused by txtRefills
592 if Changing then Exit;
593 if FMedCombo.ItemIEN = 0 then Exit; // prevent txtRefills from updating early
594 with FMedCombo do if ItemIEN > 0
595 then Responses.Update('ORDERABLE', 1, ItemID, Piece(Items[ItemIndex], U, 3))
596 else Responses.Update('ORDERABLE', 1, '', '');
597 with cboDispense do if ItemIEN > 0
598 then Responses.Update('DRUG', 1, ItemID, Piece(Items[ItemIndex], U, 2))
599 else Responses.Update('DRUG', 1, '', '');
600 if memComplex.Visible = False then
601 begin
602 with cboInstructions do Responses.Update('INSTR', 1, Text, Text);
603 with btnUnits do if Visible then Responses.Update('MISC', 1, Caption, Caption);
604 with cboRoute do if ItemIndex > -1
605 then Responses.Update('ROUTE', 1, ItemID, Piece(Items[ItemIndex], U, 3)) // abbreviation
606 else Responses.Update('ROUTE', 1, Text, Text);
607 with cboSchedule do Responses.Update('SCHEDULE', 1, Text, Text);
608 end;
609 with txtQuantity do Responses.Update('QTY', 1, Text, Text);
610 with txtRefills do Responses.Update('REFILLS', 1, Text, Text);
611 with cboPickup do Responses.Update('PICKUP', 1, ItemID, Text);
612 with cboPriority do Responses.Update('URGENCY', 1, ItemID, Text);
613 with memComments do Responses.Update('COMMENT', 1, TX_WPTYPE, Text);
614 with cboSC do if Enabled then Responses.Update('SC', 1, ItemID, Text);
615 memOrder.Text := Responses.OrderText;
616end;
617
618end.
619
Note: See TracBrowser for help on using the repository browser.