source: cprs/branches/foia-cprs/CPRS-Chart/Encounter/fImmunization.pas@ 1099

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

Adding foia-cprs branch

File size: 4.3 KB
RevLine 
[459]1unit fImmunization;
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 TfrmImmunizations = class(TfrmPCEBaseMain)
12 lblReaction: TLabel;
13 lblSeries: TLabel;
14 cboImmReaction: TORComboBox;
15 cboImmSeries: TORComboBox;
16 ckbContra: TCheckBox;
17 lblContra: TLabel;
18
19 procedure cboImmSeriesChange(Sender: TObject);
20 procedure cboImmReactionChange(Sender: TObject);
21 procedure ckbContraClick(Sender: TObject);
22 procedure FormCreate(Sender: TObject);
23 private
24 protected
25 procedure UpdateNewItemStr(var x: string); override;
26 procedure UpdateControls; override;
27 public
28// procedure ChangeProvider;
29 end;
30
31var
32 frmImmunizations: TfrmImmunizations;
33
34implementation
35
36{$R *.DFM}
37
38uses
39 fEncounterFrame;
40
41procedure TfrmImmunizations.cboImmSeriesChange(Sender: TObject);
42var
43 i: integer;
44
45begin
46 if(NotUpdating) and (cboImmSeries.Text <> '') then
47 begin
48 for i := 0 to lbGrid.Items.Count-1 do
49 if(lbGrid.Selected[i]) then
50 TPCEImm(lbGrid.Items.Objects[i]).Series := cboImmSeries.ItemID;
51 GridChanged;
52 end;
53end;
54
55procedure TfrmImmunizations.cboImmReactionChange(Sender: TObject);
56var
57 i: integer;
58
59begin
60 if(NotUpdating) and (cboImmReaction.Text <> '') then
61 begin
62 for i := 0 to lbGrid.Items.Count-1 do
63 if(lbGrid.Selected[i]) then
64 TPCEImm(lbGrid.Items.Objects[i]).Reaction := cboImmReaction.ItemID;
65 GridChanged;
66 end;
67end;
68
69procedure TfrmImmunizations.ckbContraClick(Sender: TObject);
70var
71 i: integer;
72
73begin
74 if(NotUpdating) then
75 begin
76 for i := 0 to lbGrid.Items.Count-1 do
77 if(lbGrid.Selected[i]) then
78 TPCEImm(lbGrid.Items.Objects[i]).Contraindicated := ckbContra.Checked;
79 GridChanged;
80 end;
81end;
82
83procedure TfrmImmunizations.FormCreate(Sender: TObject);
84begin
85 inherited;
86 FTabName := CT_ImmNm;
87 FPCEListCodesProc := ListImmunizCodes;
88 FPCEItemClass := TPCEImm;
89 FPCECode := 'IMM';
90 PCELoadORCombo(cboImmReaction);
91 PCELoadORCombo(cboImmSeries);
92end;
93
94procedure TfrmImmunizations.UpdateNewItemStr(var x: string);
95begin
96 inherited;
97 SetPiece(x, U, pnumImmSeries, NoPCEValue);
98 SetPiece(x, U, pnumImmReaction, NoPCEValue);
99 SetPiece(x, U, pnumImmRefused, '0');
100 SetPiece(x, U, pnumImmContra, '0');
101end;
102
103procedure TfrmImmunizations.UpdateControls;
104var
105 ok, Contra, First: boolean;
106 SameS, SameR, SameC: boolean;
107 i: integer;
108 Ser, React: string;
109 Obj: TPCEImm;
110
111begin
112 inherited;
113 if(NotUpdating) then
114 begin
115 BeginUpdate;
116 try
117 ok := (lbGrid.SelCount > 0);
118 lblSeries.Enabled := ok;
119 lblReaction.Enabled := ok;
120 cboImmSeries.Enabled := ok;
121 cboImmReaction.Enabled := ok;
122 ckbContra.Enabled := ok;
123 if(ok) then
124 begin
125 First := TRUE;
126 SameS := TRUE;
127 SameR := TRUE;
128 SameC := TRUE;
129 Contra := FALSE;
130 Ser := NoPCEValue;
131 React := NoPCEValue;
132 for i := 0 to lbGrid.Items.Count-1 do
133 begin
134 if lbGrid.Selected[i] then
135 begin
136 Obj := TPCEImm(lbGrid.Items.Objects[i]);
137 if(First) then
138 begin
139 First := FALSE;
140 Contra := Obj.Contraindicated;
141 Ser := Obj.Series;
142 React := Obj.Reaction;
143 end
144 else
145 begin
146 if(SameS) then
147 SameS := (Ser = Obj.Series);
148 if(SameR) then
149 SameR := (React = Obj.Reaction);
150 if(SameC) then
151 SameC := (Contra = Obj.Contraindicated);
152 end;
153 end;
154 end;
155 if(SameS) then
156 cboImmSeries.SelectByID(Ser)
157 else
158 cboImmSeries.Text := '';
159 if(SameR) then
160 cboImmReaction.SelectByID(React)
161 else
162 cboImmReaction.Text := '';
163 if(SameC) then
164 ckbContra.Checked := Contra
165 else
166 ckbContra.State := cbGrayed;
167 end
168 else
169 begin
170 cboImmSeries.Text := '';
171 cboImmReaction.Text := '';
172 ckbContra.Checked := FALSE;
173 end;
174 finally
175 EndUpdate;
176 end;
177 end;
178end;
179
180end.
181
Note: See TracBrowser for help on using the repository browser.