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

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

Upgrade to version 27

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