Repository navigation
Expand file tree
/
Copy pathMutasiFrm.pas
More file actions
136 lines (121 loc) · 2.86 KB
/
Copy pathMutasiFrm.pas
File metadata and controls
136 lines (121 loc) · 2.86 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
unit MutasiFrm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;
type
TForm5 = class(TForm)
GroupBox1: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
ComboBox1: TComboBox;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit5: TEdit;
ComboBox2: TComboBox;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Button1: TButton;
Button2: TButton;
Edit3: TEdit;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
Function Kodesatker1(Satker:string):string;
Procedure IsiSatker;
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
uses Modulsrc,MyUtils;
{$R *.dfm}
Procedure Tform5.IsiSatker;
begin
combobox1.Items.Clear;
combobox1.Text:='';
with dm,qtemp do
begin
close;
sql.Clear;
sql.Text:='select nama_satker from tbl_satker order by id_satker asc';
prepare;
Open;
while not Eof do
begin
combobox1.Items.Add(fields.Fields[0].AsString);
Next;
end;
end;
end;
Function TForm5.Kodesatker1(Satker:string):string;
begin
with Dm,Qtemp do
begin
close;
sql.Clear;
sql.Text:='Select id_satker from tbl_satker Where Nama_satker=:ast';
prepare;
parambyname('ast').Value:=Satker;
active:=true;
result:=Fields[0].AsString;
end;
end;
procedure TForm5.Button1Click(Sender: TObject);
begin
if (ComboBox2.Text<>'') and (ComboBox1.Text<>'') then
begin
with DM, Qexec do
begin
close;
sql.Clear;
sql.Text:='Update tbl_pegawai SET Jabatan=:jabs,satker=:sat,';
sql.Add('tmpt_jabatan=:tmtjab WHERE NIP=:nips');
prepare;
parambyname('jabs').Value:=combobox2.Text;
parambyname('sat').Value:=edit3.Text;
parambyname('tmtjab').Value:=edit4.Text;
parambyname('nips').Value:=edit1.Text;
ExecSQL;
showmessage('Data bersangkutan sudah pindah');
end;
close;
end
else
begin
ShowMessage('Data Tempat Baru Kurang Lengkap!!');
ComboBox2.SetFocus;
end;
end;
procedure TForm5.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm5.ComboBox1Change(Sender: TObject);
begin
if combobox1.text <>'' then
begin
edit3.text:=kodesatker1(combobox1.text);
end;
end;
procedure TForm5.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
combobox1change(nil);
end;
procedure TForm5.FormShow(Sender: TObject);
begin
isiSatker;
combobox2.Text:='';
combobox1.Text:='';
edit4.Text:='';
end;
end.