| [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); | 
|---|
| [460] | 40 | procedure FormClose(Sender: TObject; var Action: TCloseAction); | 
|---|
| [459] | 41 | private | 
|---|
|  | 42 | { Private declarations } | 
|---|
|  | 43 | protected | 
|---|
|  | 44 | procedure InitDialog; override; | 
|---|
|  | 45 | procedure Validate(var AnErrMsg: string); override; | 
|---|
|  | 46 | public | 
|---|
|  | 47 | procedure SetupDialog(OrderAction: Integer; const ID: string); override; | 
|---|
|  | 48 | end; | 
|---|
|  | 49 |  | 
|---|
|  | 50 | var | 
|---|
|  | 51 | frmODVitals: TfrmODVitals; | 
|---|
|  | 52 |  | 
|---|
|  | 53 | implementation | 
|---|
|  | 54 |  | 
|---|
|  | 55 | {$R *.DFM} | 
|---|
|  | 56 |  | 
|---|
| [460] | 57 | uses uConst, ORFn, rODBase, fFrame; | 
|---|
| [459] | 58 |  | 
|---|
|  | 59 | const | 
|---|
|  | 60 | TX_NO_MEASUREMENT = 'A measurement must be selected.'; | 
|---|
|  | 61 | TX_BAD_START      = 'The start date is not valid.'; | 
|---|
|  | 62 | TX_BAD_STOP       = 'The stop date is not valid.'; | 
|---|
|  | 63 | TX_STOPSTART     = 'The stop date must be after the start date.'; | 
|---|
|  | 64 |  | 
|---|
|  | 65 | procedure TfrmODVitals.FormCreate(Sender: TObject); | 
|---|
|  | 66 | begin | 
|---|
| [460] | 67 | frmFrame.pnlVisit.Enabled := false; | 
|---|
| [459] | 68 | inherited; | 
|---|
|  | 69 | FillerID := 'OR';                     // does 'on Display' order check **KCM** | 
|---|
|  | 70 | StatusText('Loading Dialog Definition'); | 
|---|
|  | 71 | Responses.Dialog := 'GMRVOR'; | 
|---|
|  | 72 | //Responses.Dialog := 'ORWD GENERIC VITALS';       // loads formatting info | 
|---|
|  | 73 | StatusText('Loading Default Values');            // there are no defaults for text only | 
|---|
|  | 74 | CtrlInits.LoadDefaults(ODForVitals); | 
|---|
|  | 75 | InitDialog; | 
|---|
|  | 76 | StatusText(''); | 
|---|
|  | 77 | end; | 
|---|
|  | 78 |  | 
|---|
|  | 79 | procedure TfrmODVitals.InitDialog; | 
|---|
|  | 80 | begin | 
|---|
|  | 81 | inherited; | 
|---|
|  | 82 | txtComment.Text := ''; | 
|---|
|  | 83 | with CtrlInits do | 
|---|
|  | 84 | begin | 
|---|
|  | 85 | SetControl(cboMeasurement,  'Measurements'); | 
|---|
|  | 86 | SetControl(cboSchedule,     'Schedules'); | 
|---|
|  | 87 | end; | 
|---|
|  | 88 | ActiveControl := cboMeasurement;  //SetFocusedControl(cboMeasurement); | 
|---|
|  | 89 | end; | 
|---|
|  | 90 |  | 
|---|
|  | 91 | procedure TfrmODVitals.SetupDialog(OrderAction: Integer; const ID: string); | 
|---|
|  | 92 | begin | 
|---|
|  | 93 | inherited; | 
|---|
|  | 94 | if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then with Responses do | 
|---|
|  | 95 | begin | 
|---|
|  | 96 | Changing := True; | 
|---|
|  | 97 | SetControl(cboMeasurement, 'ORDERABLE', 1); | 
|---|
|  | 98 | SetControl(cboSchedule,    'SCHEDULE',  1); | 
|---|
|  | 99 | SetControl(calStart,       'START',     1); | 
|---|
|  | 100 | SetControl(calStop,        'STOP',      1); | 
|---|
|  | 101 | SetControl(txtComment,     'COMMENT',   1); | 
|---|
|  | 102 | Changing := False; | 
|---|
|  | 103 | ControlChange(Self); | 
|---|
|  | 104 | end; | 
|---|
|  | 105 | end; | 
|---|
|  | 106 |  | 
|---|
|  | 107 | procedure TfrmODVitals.Validate(var AnErrMsg: string); | 
|---|
|  | 108 | var | 
|---|
|  | 109 | ErrMsg: string; | 
|---|
|  | 110 |  | 
|---|
|  | 111 | procedure SetError(const x: string); | 
|---|
|  | 112 | begin | 
|---|
|  | 113 | if Length(AnErrMsg) > 0 then AnErrMsg := AnErrMsg + CRLF; | 
|---|
|  | 114 | AnErrMsg := AnErrMsg + x; | 
|---|
|  | 115 | end; | 
|---|
|  | 116 |  | 
|---|
|  | 117 | begin | 
|---|
|  | 118 | inherited; | 
|---|
|  | 119 | if cboMeasurement.ItemIEN <= 0 then SetError(TX_NO_MEASUREMENT); | 
|---|
|  | 120 | calStart.Validate(ErrMsg); | 
|---|
|  | 121 | if Length(ErrMsg) > 0          then SetError(TX_BAD_START); | 
|---|
|  | 122 | calStop.Validate(ErrMsg); | 
|---|
|  | 123 | if Length(ErrMsg) > 0          then SetError(TX_BAD_STOP); | 
|---|
|  | 124 | if (Length(calStop.Text) > 0) and (calStop.FMDateTime <= calStart.FMDateTime) | 
|---|
|  | 125 | then SetError(TX_STOPSTART); | 
|---|
|  | 126 |  | 
|---|
|  | 127 | end; | 
|---|
|  | 128 |  | 
|---|
|  | 129 | procedure TfrmODVitals.ControlChange(Sender: TObject); | 
|---|
|  | 130 | begin | 
|---|
|  | 131 | inherited; | 
|---|
|  | 132 | if Changing then Exit; | 
|---|
|  | 133 | Responses.Clear; | 
|---|
|  | 134 | with cboMeasurement do if ItemIEN > 0      then Responses.Update('ORDERABLE', 1, ItemID, Text); | 
|---|
|  | 135 | with cboSchedule    do if Length(Text) > 0 then Responses.Update('SCHEDULE' , 1, Text,   Text); | 
|---|
|  | 136 | with calStart       do if Length(Text) > 0 then Responses.Update('START',     1, Text,   Text); | 
|---|
|  | 137 | with calStop        do if Length(Text) > 0 then Responses.Update('STOP',      1, Text,   Text); | 
|---|
|  | 138 | with txtComment     do if Length(Text) > 0 then Responses.Update('COMMENT',   1, Text,   Text); | 
|---|
|  | 139 | memOrder.Text := Responses.OrderText; | 
|---|
|  | 140 | end; | 
|---|
|  | 141 |  | 
|---|
| [460] | 142 | procedure TfrmODVitals.FormClose(Sender: TObject; | 
|---|
|  | 143 | var Action: TCloseAction); | 
|---|
|  | 144 | begin | 
|---|
|  | 145 | inherited; | 
|---|
|  | 146 | frmFrame.pnlVisit.Enabled := true; | 
|---|
|  | 147 | end; | 
|---|
|  | 148 |  | 
|---|
| [459] | 149 | end. | 
|---|