source: cprs/trunk/CPRS-Chart/Orders/fODVitals.pas@ 730

Last change on this file since 730 was 456, checked in by Kevin Toppenberg, 16 years ago

Initial Upload of Official WV CPRS 1.0.26.76

File size: 4.4 KB
RevLine 
[456]1unit fODVitals;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fODBase, ComCtrls, ExtCtrls, StdCtrls, ORCtrls, ORDtTm;
8
9type
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 procedure FormClose(Sender: TObject; var Action: TCloseAction);
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
50var
51 frmODVitals: TfrmODVitals;
52
53implementation
54
55{$R *.DFM}
56
57uses uConst, ORFn, rODBase, fFrame;
58
59const
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
65procedure TfrmODVitals.FormCreate(Sender: TObject);
66begin
67 frmFrame.pnlVisit.Enabled := false;
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('');
77end;
78
79procedure TfrmODVitals.InitDialog;
80begin
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);
89end;
90
91procedure TfrmODVitals.SetupDialog(OrderAction: Integer; const ID: string);
92begin
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;
105end;
106
107procedure TfrmODVitals.Validate(var AnErrMsg: string);
108var
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
117begin
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
127end;
128
129procedure TfrmODVitals.ControlChange(Sender: TObject);
130begin
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;
140end;
141
142procedure TfrmODVitals.FormClose(Sender: TObject;
143 var Action: TCloseAction);
144begin
145 inherited;
146 frmFrame.pnlVisit.Enabled := true;
147end;
148
149end.
Note: See TracBrowser for help on using the repository browser.