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