source: cprs/trunk/CPRS-Chart/Encounter/fHealthFactor.pas@ 483

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

Initial Upload of Official WV CPRS 1.0.26.76

File size: 2.5 KB
Line 
1unit fHealthFactor;
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 TfrmHealthFactors = class(TfrmPCEBaseMain)
12 lblHealthLevel: TLabel;
13 cboHealthLevel: TORComboBox;
14
15 procedure cboHealthLevelChange(Sender: TObject);
16 procedure FormCreate(Sender: TObject);
17 private
18 protected
19 procedure UpdateNewItemStr(var x: string); override;
20 procedure UpdateControls; override;
21 public
22 end;
23
24var
25 frmHealthFactors: TfrmHealthFactors;
26
27implementation
28
29{$R *.DFM}
30
31uses
32 fEncounterFrame;
33
34procedure tfrmHealthFactors.cboHealthLevelChange(Sender: TObject);
35var
36 i: integer;
37
38begin
39 if(NotUpdating) and (cboHealthLevel.Text <> '') then
40 begin
41 for i := 0 to lbGrid.Items.Count-1 do
42 if(lbGrid.Selected[i]) then
43 TPCEPat(lbGrid.Items.Objects[i]).Level := cboHealthLevel.ItemID;
44 GridChanged;
45 end;
46end;
47
48procedure TfrmHealthFactors.FormCreate(Sender: TObject);
49begin
50 inherited;
51 FTabName := CT_HlthNm;
52 FPCEListCodesProc := ListHealthCodes;
53 FPCEItemClass := TPCEHealth;
54 FPCECode := 'HF';
55 PCELoadORCombo(cboHealthLevel);
56end;
57
58procedure TfrmHealthFactors.UpdateNewItemStr(var x: string);
59begin
60 SetPiece(x, U, pnumHFLevel, NoPCEValue);
61end;
62
63procedure TfrmHealthFactors.UpdateControls;
64var
65 ok, First: boolean;
66 SameHL: boolean;
67 i: integer;
68 HL: string;
69 Obj: TPCEHealth;
70
71begin
72 inherited;
73 if(NotUpdating) then
74 begin
75 BeginUpdate;
76 try
77 ok := (lbGrid.SelCount > 0);
78 lblHealthLevel.Enabled := ok;
79 cboHealthLevel.Enabled := ok;
80 if(ok) then
81 begin
82 First := TRUE;
83 SameHL := TRUE;
84 HL := NoPCEValue;
85 for i := 0 to lbGrid.Items.Count-1 do
86 begin
87 if lbGrid.Selected[i] then
88 begin
89 Obj := TPCEHealth(lbGrid.Items.Objects[i]);
90 if(First) then
91 begin
92 First := FALSE;
93 HL := Obj.Level;
94 end
95 else
96 begin
97 if(SameHL) then
98 SameHL := (HL = Obj.Level);
99 end;
100 end;
101 end;
102 if(SameHL) then
103 cboHealthLevel.SelectByID(HL)
104 else
105 cboHealthLevel.Text := '';
106 end
107 else
108 begin
109 cboHealthLevel.Text := '';
110 end;
111 finally
112 EndUpdate;
113 end;
114 end;
115end;
116
117end.
Note: See TracBrowser for help on using the repository browser.