-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUComplementos.pas
101 lines (84 loc) · 2.55 KB
/
UComplementos.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
unit UComplementos;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls,
Vcl.Buttons, Data.DB, Vcl.ExtCtrls;
type
TfrmComplementos = class(TForm)
grdComplementos: TDBGrid;
edtComplemento: TEdit;
Label1: TLabel;
dsComplemento: TDataSource;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
lblPesquisar: TLabel;
lblAddComp: TLabel;
btnPesquisar: TImage;
btnAddComp: TImage;
Shape5: TShape;
procedure btnPesquisarClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure grdComplementosDblClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnAdicionarClick(Sender: TObject);
procedure btnAddCompClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmComplementos: TfrmComplementos;
implementation
{$R *.dfm}
uses UCadCompImo, UCadImovel, UDM, UCadComplemento;
procedure TfrmComplementos.btnAddCompClick(Sender: TObject);
begin
frmCadComp:=TfrmCadComp.Create(Self);
dm.qryTipoComp.DataSource:=frmCadComp.dsComplemento;
dm.qryTipoImoveis.DataSource:=frmCadComp.dsTpComp;
try
frmCadComp.ShowModal;
finally
frmCadComp.Release;
frmCadComp:= Nil;
end;
end;
procedure TfrmComplementos.btnAdicionarClick(Sender: TObject);
begin
frmCadComp:=TfrmCadComp.Create(Self);
try
frmCadComp.ShowModal;
finally
frmCadComp.Release;
frmCadComp:= Nil;
end;
end;
procedure TfrmComplementos.btnPesquisarClick(Sender: TObject);
begin
dm.qryComplementos.Close;
dm.qryComplementos.Parameters.ParamByName('pComp').Value:=('%'+edtComplemento.Text+'%');
dm.qryComplementos.Open;
end;
procedure TfrmComplementos.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if(grdComplementos.SelectedRows.Count -1 = 0 ) then
begin
dm.qryCompImoveiscompCodigo.Value:= dm.qryComplementoscompCodigo.Value;
end;
DM.qryComplementos.Open;
end;
procedure TfrmComplementos.FormShow(Sender: TObject);
begin
dm.qryComplementos.Close;
dm.qryComplementos.Parameters.ParamByName('pComp').Value:=('%'+edtComplemento.Text+'%');
dm.qryComplementos.Open;
end;
procedure TfrmComplementos.grdComplementosDblClick(Sender: TObject);
begin
close;
end;
end.