[459] | 1 | unit fODVitals;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fODBase, ComCtrls, ExtCtrls, StdCtrls, ORCtrls, ORDtTm;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmODVitals = class(TfrmODBase)
|
---|
| 11 | cboMeasurement: TORComboBox;
|
---|
| 12 | cboSchedule: TORComboBox;
|
---|
| 13 | calStart: TORDateBox;
|
---|
| 14 | calStop: TORDateBox;
|
---|
| 15 | grpCallHO: TGroupBox;
|
---|
| 16 | lblMeasurement: TLabel;
|
---|
| 17 | lblSchedule: TLabel;
|
---|
| 18 | lblStart: TLabel;
|
---|
| 19 | lblStop: TLabel;
|
---|
| 20 | txtBPsys: TCaptionEdit;
|
---|
| 21 | txtBPDia: TCaptionEdit;
|
---|
| 22 | txtPulseLT: TCaptionEdit;
|
---|
| 23 | txtPulGT: TCaptionEdit;
|
---|
| 24 | txtTemp: TCaptionEdit;
|
---|
| 25 | lblBPsys: TLabel;
|
---|
| 26 | lblBPdia: TLabel;
|
---|
| 27 | lblPulseLT: TLabel;
|
---|
| 28 | lblPulseGT: TLabel;
|
---|
| 29 | lblTemp: TLabel;
|
---|
| 30 | chkCallHO: TCheckBox;
|
---|
| 31 | txtComment: TCaptionEdit;
|
---|
| 32 | lblComment: TLabel;
|
---|
| 33 | spnBPsys: TUpDown;
|
---|
| 34 | spnBPdia: TUpDown;
|
---|
| 35 | spnPulseLT: TUpDown;
|
---|
| 36 | spnPulseGT: TUpDown;
|
---|
| 37 | spnTemp: TUpDown;
|
---|
| 38 | procedure FormCreate(Sender: TObject);
|
---|
| 39 | procedure ControlChange(Sender: TObject);
|
---|
| 40 | private
|
---|
| 41 | { Private declarations }
|
---|
| 42 | protected
|
---|
| 43 | procedure InitDialog; override;
|
---|
| 44 | procedure Validate(var AnErrMsg: string); override;
|
---|
| 45 | public
|
---|
| 46 | procedure SetupDialog(OrderAction: Integer; const ID: string); override;
|
---|
| 47 | end;
|
---|
| 48 |
|
---|
| 49 | var
|
---|
| 50 | frmODVitals: TfrmODVitals;
|
---|
| 51 |
|
---|
| 52 | implementation
|
---|
| 53 |
|
---|
| 54 | {$R *.DFM}
|
---|
| 55 |
|
---|
| 56 | uses uConst, ORFn, rODBase;
|
---|
| 57 |
|
---|
| 58 | const
|
---|
| 59 | TX_NO_MEASUREMENT = 'A measurement must be selected.';
|
---|
| 60 | TX_BAD_START = 'The start date is not valid.';
|
---|
| 61 | TX_BAD_STOP = 'The stop date is not valid.';
|
---|
| 62 | TX_STOPSTART = 'The stop date must be after the start date.';
|
---|
| 63 |
|
---|
| 64 | procedure TfrmODVitals.FormCreate(Sender: TObject);
|
---|
| 65 | begin
|
---|
| 66 | inherited;
|
---|
| 67 | FillerID := 'OR'; // does 'on Display' order check **KCM**
|
---|
| 68 | StatusText('Loading Dialog Definition');
|
---|
| 69 | Responses.Dialog := 'GMRVOR';
|
---|
| 70 | //Responses.Dialog := 'ORWD GENERIC VITALS'; // loads formatting info
|
---|
| 71 | StatusText('Loading Default Values'); // there are no defaults for text only
|
---|
| 72 | CtrlInits.LoadDefaults(ODForVitals);
|
---|
| 73 | InitDialog;
|
---|
| 74 | StatusText('');
|
---|
| 75 | end;
|
---|
| 76 |
|
---|
| 77 | procedure TfrmODVitals.InitDialog;
|
---|
| 78 | begin
|
---|
| 79 | inherited;
|
---|
| 80 | txtComment.Text := '';
|
---|
| 81 | with CtrlInits do
|
---|
| 82 | begin
|
---|
| 83 | SetControl(cboMeasurement, 'Measurements');
|
---|
| 84 | SetControl(cboSchedule, 'Schedules');
|
---|
| 85 | end;
|
---|
| 86 | ActiveControl := cboMeasurement; //SetFocusedControl(cboMeasurement);
|
---|
| 87 | end;
|
---|
| 88 |
|
---|
| 89 | procedure TfrmODVitals.SetupDialog(OrderAction: Integer; const ID: string);
|
---|
| 90 | begin
|
---|
| 91 | inherited;
|
---|
| 92 | if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then with Responses do
|
---|
| 93 | begin
|
---|
| 94 | Changing := True;
|
---|
| 95 | SetControl(cboMeasurement, 'ORDERABLE', 1);
|
---|
| 96 | SetControl(cboSchedule, 'SCHEDULE', 1);
|
---|
| 97 | SetControl(calStart, 'START', 1);
|
---|
| 98 | SetControl(calStop, 'STOP', 1);
|
---|
| 99 | SetControl(txtComment, 'COMMENT', 1);
|
---|
| 100 | Changing := False;
|
---|
| 101 | ControlChange(Self);
|
---|
| 102 | end;
|
---|
| 103 | end;
|
---|
| 104 |
|
---|
| 105 | procedure TfrmODVitals.Validate(var AnErrMsg: string);
|
---|
| 106 | var
|
---|
| 107 | ErrMsg: string;
|
---|
| 108 |
|
---|
| 109 | procedure SetError(const x: string);
|
---|
| 110 | begin
|
---|
| 111 | if Length(AnErrMsg) > 0 then AnErrMsg := AnErrMsg + CRLF;
|
---|
| 112 | AnErrMsg := AnErrMsg + x;
|
---|
| 113 | end;
|
---|
| 114 |
|
---|
| 115 | begin
|
---|
| 116 | inherited;
|
---|
| 117 | if cboMeasurement.ItemIEN <= 0 then SetError(TX_NO_MEASUREMENT);
|
---|
| 118 | calStart.Validate(ErrMsg);
|
---|
| 119 | if Length(ErrMsg) > 0 then SetError(TX_BAD_START);
|
---|
| 120 | calStop.Validate(ErrMsg);
|
---|
| 121 | if Length(ErrMsg) > 0 then SetError(TX_BAD_STOP);
|
---|
| 122 | if (Length(calStop.Text) > 0) and (calStop.FMDateTime <= calStart.FMDateTime)
|
---|
| 123 | then SetError(TX_STOPSTART);
|
---|
| 124 |
|
---|
| 125 | end;
|
---|
| 126 |
|
---|
| 127 | procedure TfrmODVitals.ControlChange(Sender: TObject);
|
---|
| 128 | begin
|
---|
| 129 | inherited;
|
---|
| 130 | if Changing then Exit;
|
---|
| 131 | Responses.Clear;
|
---|
| 132 | with cboMeasurement do if ItemIEN > 0 then Responses.Update('ORDERABLE', 1, ItemID, Text);
|
---|
| 133 | with cboSchedule do if Length(Text) > 0 then Responses.Update('SCHEDULE' , 1, Text, Text);
|
---|
| 134 | with calStart do if Length(Text) > 0 then Responses.Update('START', 1, Text, Text);
|
---|
| 135 | with calStop do if Length(Text) > 0 then Responses.Update('STOP', 1, Text, Text);
|
---|
| 136 | with txtComment do if Length(Text) > 0 then Responses.Update('COMMENT', 1, Text, Text);
|
---|
| 137 | memOrder.Text := Responses.OrderText;
|
---|
| 138 | end;
|
---|
| 139 |
|
---|
| 140 | end.
|
---|