-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathULVeiculos.pas
86 lines (76 loc) · 2.2 KB
/
ULVeiculos.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
unit ULVeiculos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ULGenerico, FMTBcd, DB, SqlExpr, Provider, DBClient, StdCtrls, Grids,
DBGrids, Buttons, PngBitBtn, ExtCtrls;
type
TfrmLVeiculos = class(TfrmLGenerico)
cdsTabCOD_VEICULO: TIntegerField;
cdsTabDAT_CAD: TDateField;
cdsTabDESCRICAO: TStringField;
cdsTabTIPO: TStringField;
cdsTabPLACA: TStringField;
cdsTabMARCA: TStringField;
cdsTabMODELO: TStringField;
cdsTabANO: TStringField;
cdsTabCHASSI: TStringField;
cdsTabRENAVAN: TStringField;
cdsTabCOR: TStringField;
cdsTabPRC_VENDA: TSingleField;
cdsTabPRC_COMPRA: TSingleField;
cdsTabUNID_ESTOQUE: TSingleField;
Label1: TLabel;
txtLocalizar: TEdit;
txtCampo: TComboBox;
Label2: TLabel;
procedure btConsultarClick(Sender: TObject);
procedure btEditarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmLVeiculos: TfrmLVeiculos;
implementation
uses UFuncoes, UVeiculo;
{$R *.dfm}
procedure TfrmLVeiculos.btConsultarClick(Sender: TObject);
begin
sql := 'SELECT * FROM VEICULOS';
if not Vazio(txtLocalizar.Text) then begin
case txtCampo.ItemIndex of
0:
begin
sql := sql + ' WHERE COD_VEICULO LIKE '+QuotedStr('%'+txtLocalizar.Text+'%');
end;
1:begin
sql := sql + ' WHERE DESCRICAO LIKE '+QuotedStr('%'+txtLocalizar.Text+'%');
end;
2:begin
sql := sql + ' WHERE PLACA LIKE '+QuotedStr('%'+txtLocalizar.Text+'%');
end;
end;
end;
case txtCampo.ItemIndex of
0: sql := sql + ' ORDER BY COD_VEICULO';
1: sql := sql + ' ORDER BY DESCRICAO';
2: sql := sql + ' ORDER BY PLACA';
end;
inherited;
end;
procedure TfrmLVeiculos.btEditarClick(Sender: TObject);
begin
application.CreateForm(TfrmVeiculo, frmVeiculo);
frmVeiculo.sqlTab.Close;
frmVeiculo.cdsTab.Close;
frmVeiculo.sqlTab.ParamByName('COD_VEICULO').AsInteger := cdsTabCOD_VEICULO.AsInteger;
frmVeiculo.cdsTab.Open;
frmVeiculo.Campo := 'COD_VEICULO';
frmVeiculo.Cod_Padrao := cdsTabCOD_VEICULO.AsInteger;
frmVeiculo.ShowModal;
cdsTab.Refresh;
inherited;
end;
end.