-
Notifications
You must be signed in to change notification settings - Fork 6
/
uPatientSelection.pas
85 lines (71 loc) · 2.04 KB
/
uPatientSelection.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
unit uPatientSelection;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Vcl.Buttons, Vcl.VirtualImage, Vcl.StdCtrls,
Vcl.ExtCtrls, Vcl.Grids, Vcl.DBGrids, uDataMod;
type
TPatientSelectionForm = class(TForm)
dgPatients: TDBGrid;
Panel1: TPanel;
Cancel: TSpeedButton;
SelectButton: TSpeedButton;
procedure CancelClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SelectButtonClick(Sender: TObject);
procedure dgPatientsDblClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
IDRes: string;
public
function GetID: string;
function GetName: string;
end;
var
PatientSelectionForm: TPatientSelectionForm;
implementation
{$R *.dfm}
procedure TPatientSelectionForm.FormCreate(Sender: TObject);
begin
IDRes := '';
DM.dbPatientsSelection.Active := true;
end;
procedure TPatientSelectionForm.FormDestroy(Sender: TObject);
begin
DM.dbPatientsSelection.Active := false;
end;
function TPatientSelectionForm.GetID: string;
begin
Result := IDRes;
end;
function TPatientSelectionForm.GetName: string;
begin
Result := '';
if (dgPatients.Fields[1].AsString <> '') then begin
Result := Result + dgPatients.Fields[1].AsString + ' ';
end;
if (dgPatients.Fields[2].AsString <> '') then begin
Result := Result + dgPatients.Fields[2].AsString + ' ';
end;
if (dgPatients.Fields[3].AsString <> '') then begin
Result := Result + dgPatients.Fields[3].AsString + ' ';
end;
if (dgPatients.Fields[4].AsString <> '') then begin
Result := Result + dgPatients.Fields[4].AsString + ' ';
end;
Result := Trim(Result);
end;
procedure TPatientSelectionForm.dgPatientsDblClick(Sender: TObject);
begin
SelectButtonClick(SelectButton);
end;
procedure TPatientSelectionForm.CancelClick(Sender: TObject);
begin
Close;
end;
procedure TPatientSelectionForm.SelectButtonClick(Sender: TObject);
begin
IDRes := dgPatients.Fields[0].AsString;
Close;
end;
end.