source: cprs/branches/foia-cprs/CPRS-Chart/Encounter/fExam.pas@ 834

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

Adding foia-cprs branch

File size: 2.5 KB
Line 
1unit fExam;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fPCEBase, StdCtrls, ORCtrls, CheckLst, ExtCtrls, Buttons, uPCE, rPCE, ORFn,
8 fPCELex, fPCEOther, ComCtrls, fPCEBaseMain;
9
10type
11 TfrmExams = class(TfrmPCEBaseMain)
12 lblExamResults: TLabel;
13 cboExamResults: TORComboBox;
14 procedure cboExamResultsChange(Sender: TObject);
15 procedure FormCreate(Sender: TObject);
16 private
17 protected
18 procedure UpdateNewItemStr(var x: string); override;
19 procedure UpdateControls; override;
20 public
21 end;
22
23var
24 frmExams: TfrmExams;
25
26implementation
27
28{$R *.DFM}
29
30uses
31 fEncounterFrame;
32
33procedure TfrmExams.cboExamResultsChange(Sender: TObject);
34var
35 i: integer;
36
37begin
38 if(NotUpdating) and (cboExamResults.Text <> '') then
39 begin
40 for i := 0 to lbGrid.Items.Count-1 do
41 if(lbGrid.Selected[i]) then
42 TPCEExams(lbGrid.Items.Objects[i]).Results := cboExamResults.ItemID;
43 GridChanged;
44 end;
45end;
46
47procedure TfrmExams.FormCreate(Sender: TObject);
48begin
49 inherited;
50 FTabName := CT_XamNm;
51 FPCEListCodesProc := ListExamsCodes;
52 FPCEItemClass := TPCEExams;
53 FPCECode := 'XAM';
54 PCELoadORCombo(cboExamResults);
55end;
56
57procedure TfrmExams.UpdateNewItemStr(var x: string);
58begin
59 SetPiece(x, U, pnumExamResults, NoPCEValue);
60end;
61
62procedure TfrmExams.UpdateControls;
63var
64 ok, First: boolean;
65 SameR: boolean;
66 i: integer;
67 Res: string;
68 Obj: TPCEExams;
69
70begin
71 inherited;
72 if(NotUpdating) then
73 begin
74 BeginUpdate;
75 try
76 ok := (lbGrid.SelCount > 0);
77 lblExamResults.Enabled := ok;
78 cboExamResults.Enabled := ok;
79 if(ok) then
80 begin
81 First := TRUE;
82 SameR := TRUE;
83 Res := NoPCEValue;
84 for i := 0 to lbGrid.Items.Count-1 do
85 begin
86 if lbGrid.Selected[i] then
87 begin
88 Obj := TPCEExams(lbGrid.Items.Objects[i]);
89 if(First) then
90 begin
91 First := FALSE;
92 Res := Obj.Results;
93 end
94 else
95 begin
96 if(SameR) then
97 SameR := (Res = Obj.Results);
98 end;
99 end;
100 end;
101 if(SameR) then
102 cboExamResults.SelectByID(Res)
103 else
104 cboExamResults.Text := '';
105 end
106 else
107 begin
108 cboExamResults.Text := '';
109 end;
110 finally
111 EndUpdate;
112 end;
113 end;
114end;
115
116end.
117
Note: See TracBrowser for help on using the repository browser.