-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathULVacina.pas
More file actions
89 lines (75 loc) · 2.04 KB
/
Copy pathULVacina.pas
File metadata and controls
89 lines (75 loc) · 2.04 KB
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
unit ULVacina;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ULGenerico, Data.DB, Data.FMTBcd,
Vcl.StdCtrls, Data.SqlExpr, Datasnap.Provider, Datasnap.DBClient, Vcl.Grids,
Vcl.DBGrids, Vcl.Buttons, PngBitBtn, Vcl.ExtCtrls;
type
TfrmLVacinas = class(TfrmLGenerico)
txtCampo: TComboBox;
Label2: TLabel;
txtLocaliza: TEdit;
Label1: TLabel;
cdsTabCOD_VACINA: TIntegerField;
cdsTabNOME_VACINA: TStringField;
cdsTabMES_PARA_APLICACAO: TIntegerField;
procedure MontaSQL;
procedure AbreVacina;
procedure btEditarClick(Sender: TObject);
procedure grdDadosDblClick(Sender: TObject);
procedure btConsultarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmLVacinas: TfrmLVacinas;
implementation
{$R *.dfm}
uses UFuncoes, UVacina;
{ TfrmLGenerico1 }
procedure TfrmLVacinas.AbreVacina;
begin
Application.CreateForm(TfrmVAcina, frmVacina);
frmVacina.sqlTab.Close;
frmVacina.cdsTab.Close;
frmVacina.sqlTab.ParamByName('COD_VACINA').AsInteger := cdsTabCOD_VACINA.AsInteger;
frmVacina.Campo := 'COD_VACINA';
frmVacina.cdsTab.Open;
frmVacina.ShowModal;
if cdsTab.Active then begin
cdsTab.Refresh;
end;
end;
procedure TfrmLVacinas.btConsultarClick(Sender: TObject);
begin
MontaSQL;
inherited;
end;
procedure TfrmLVacinas.btEditarClick(Sender: TObject);
begin
inherited;
AbreVacina;
end;
procedure TfrmLVacinas.grdDadosDblClick(Sender: TObject);
begin
inherited;
AbreVacina;
end;
procedure TfrmLVacinas.MontaSQL;
begin
sql := 'SELECT * FROM VACINA';
if not Vazio(txtLocaliza.Text) then begin
case txtCampo.ItemIndex of
0: sql := sql + ' WHERE COD_VACINA LIKE '+#39+txtLocaliza.Text+'%'+#39;
1: sql := sql + ' WHERE NOME_VACINA LIKE '+#39+txtLocaliza.Text+'%'+#39;
end;
end;
case txtCampo.ItemIndex of
0: sql := sql + ' ORDER BY COD_VACINA';
1: sql := sql + ' ORDER BY NOME_VACINA';
end;
end;
end.