Repository navigation
Expand file tree
/
Copy pathJobFrm.pas
More file actions
122 lines (111 loc) · 2.78 KB
/
Copy pathJobFrm.pas
File metadata and controls
122 lines (111 loc) · 2.78 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
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
unit JobFrm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids, Vcl.DBGrids,
Vcl.ExtCtrls;
type
TForm6 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit5: TEdit;
SimpanBtn: TButton;
BaruBtn: TButton;
Panel1: TPanel;
DBGrid1: TDBGrid;
CloseBtn: TButton;
EditBtn: TButton;
procedure CloseBtnClick(Sender: TObject);
procedure BaruBtnClick(Sender: TObject);
procedure SimpanBtnClick(Sender: TObject);
procedure EditBtnClick(Sender: TObject);
private
{ Private declarations }
Function Datakosong:boolean;
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
uses ModulSrc;
{$R *.dfm}
Function TForm6.Datakosong:boolean;
var
ada:boolean;
begin
ada:=true;
if ada then ada:=edit1.Text<>'';
if ada then ada:=edit2.Text<>'';
if ada then ada:=edit5.Text<>'';
if not ada then
ShowMessage('Data Belum lengkap terisi!!!');
result:=ada;
end;
procedure TForm6.EditBtnClick(Sender: TObject);
begin
if not edit1.ReadOnly then
edit1.ReadOnly:=true;
if dataKososng then
begin
with Dm,Qexec do
begin
close;
sql.Clear;
sql.Text:='Update tblposisi SET Nama_posisi=:namapos,Keterangan=' +
':ket,create_date=:tgl Where id_posisi=:idpos';
prepare;
parambyname('namapos').Value:=edit2.Text;
parambyname('ket').Value:=edit5.Text;
parambyname('tgl').Value:=DateToStr(Now);
parambyname('idpos').Value:=edit1.Text;
ExecSQL;
tblposisi.Close;
tblposisi.Open;
edit1.Text:='';
edit2.Text:='';
edit5.Text:='';
edit1.ReadOnly:=false;
end;
end;
end;
procedure TForm6.SimpanBtnClick(Sender: TObject);
begin
if Datakosong then
begin
with Dm,Qexec do
begin
close;
sql.Clear;
sql.Text:='Insert Into tblposisi(id_posisi,Nama_posisi,Keterangan,' +
'create_date) VALUES(:idpos,:posisi,:ket,:tglpos)';
prepare;
parambyname('idpos').Value:=edit1.Text;
parambyname('posisi').Value:=edit2.Text;
parambyname('ket').Value:=edit5.Text;
parambyname('tglpos').Value:=DateToStr(Now);
ExecSQL;
tblposisi.Close;
tblposisi.Open;
edit1.Text:='';
edit2.Text:='';
edit5.Text:='';
end;
end;
end;
procedure TForm6.BaruBtnClick(Sender: TObject);
begin
Edit1.Text:='';
edit2.Text:='';
edit5.text:='';
edit1.SetFocus;
end;
procedure TForm6.CloseBtnClick(Sender: TObject);
begin
Close;
end;
end.