-
Notifications
You must be signed in to change notification settings - Fork 0
/
UConLocacao.pas
140 lines (111 loc) · 3.47 KB
/
UConLocacao.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
unit UConLocacao;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,Vcl.ComCtrls, Vcl.StdCtrls,
Vcl.ExtCtrls, Data.DB, Vcl.Buttons, Vcl.Grids, Vcl.DBGrids, frxClass, frxDBSet,
Vcl.Mask, Vcl.DBCtrls;
type
TfrmConLocacao = class(TForm)
pnlPrincipal: TPanel;
rbtCliente: TRadioButton;
pnlPesquisa: TPanel;
dbgTabela: TDBGrid;
dsConLocacao: TDataSource;
frxReportConsLocacao: TfrxReport;
frxDBConsultaLocacao: TfrxDBDataset;
rbtEndereco: TRadioButton;
edtNumero: TEdit;
lblEnderecoOrNome: TLabel;
lblNumero: TLabel;
edtEnderecoOrName: TEdit;
Panel1: TPanel;
Shape2: TShape;
Shape1: TShape;
Shape3: TShape;
Pesquisar: TLabel;
Relatório: TLabel;
lblEditar: TLabel;
btnPesquisar: TImage;
btnRelatorio: TImage;
btnEditar: TImage;
Shape5: TShape;
Shape6: TShape;
procedure bitbtnRelatorioClick(Sender: TObject);
procedure btnNovoClick(Sender: TObject);
procedure btnEditarClick(Sender: TObject);
procedure btnRelatorioClick(Sender: TObject);
procedure btnPesquisarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
principal,secundario:string;
const
selectSql ='select locacoes.locCodigo, locacoes.locPreco, locacoes.locInicio, locacoes.imoCodigo, locacoes.cliCodigo, locacoes.locFim, imoveis.imoEndereco, imoveis.imoNumero, clientes.cliNome '
+'from locacoes inner join imoveis on locacoes.imoCodigo=imoveis.imoCodigo inner'
+' join clientes on locacoes.cliCodigo=clientes.cliCodigo';
end;
var
frmConLocacao: TfrmConLocacao;
implementation
{$R *.dfm}
uses UDM, ULocCasa, UPrincipal;
procedure TfrmConLocacao.bitbtnRelatorioClick(Sender: TObject);
begin
frxReportConsLocacao.ShowReport();
end;
procedure TfrmConLocacao.btnEditarClick(Sender: TObject);
begin
frmPrincipal.edt:=True;
frmLocCasa := TfrmLocCasa.Create(Self);
frmLocCasa.dsLocacao.DataSet:= DM.qryConsLoc2;
try
frmLocCasa.ShowModal;
finally
frmLocCasa.Release;
frmLocCasa:= Nil;
end;
end;
procedure TfrmConLocacao.btnNovoClick(Sender: TObject);
begin
frmPrincipal.new:=True;
frmLocCasa := TfrmLocCasa.Create(Self);
try
frmLocCasa.ShowModal;
finally
frmLocCasa.Release;
frmLocCasa:= Nil;
end;
end;
procedure TfrmConLocacao.btnPesquisarClick(Sender: TObject);
begin
DM.qryConsLoc2.Close;
DM.qryConsLoc2.SQL.Clear;
if rbtCliente.Checked=True then
begin
principal:=' where clientes.cliNome like '+#39+'%'+edtEnderecoOrName.Text+'%'+#39;
end
else if rbtEndereco.Checked=True then
begin
if edtNumero.Text='' then
begin
principal:=' where imoveis.imoEndereco like '+#39+'%'+edtEnderecoOrName.Text+'%'+#39;
end
else if edtEnderecoOrName.Text='' then
begin
principal:=' where imoveis.imoNumero ='+(edtNumero.Text);
end
else if (edtNumero.Text='') and (edtEnderecoOrName.Text='') then
begin
principal:='';
end;
end;
DM.qryConsLoc2.SQL.Add(selectSql + principal);
DM.qryConsLoc2.Open;
end;
procedure TfrmConLocacao.btnRelatorioClick(Sender: TObject);
begin
frxReportConsLocacao.ShowReport();
end;
end.