procedure Tfrm_ygdd.SpeedButton1Click(Sender: TObject);
begin
application.CreateForm(Tfrm_cxtj,frm_cxtj);
frm_cxtj.ShowModal;
frm_cxtj.Free;
end;
procedure Tfrm_ygdd.SpeedButton3Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ygdd.TreeView1Click(Sender: TObject);
var
s,d:string;
begin
with data1.ADOQYdwxx do
begin
close;
sql.Clear;
sql.Add('select distinct 单位名称 from 单位信息表');
open;
end;
s:=treeview1.Selected.Text;
d:=data1.ADOQYdwxx.FieldByName('单位名称').Value;
if treeview1.Selected<>nil then
if treeview1.Selected.Text=d then
begin
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select * from 人事表 where sflz=:b ');
parameters.ParamByName('b').Value:='否';
open;
end;
end
else
begin
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select * from 人事表 where ssbm= :a and sflz=:b ');
parameters.ParamByName('a').Value:=s;
parameters.ParamByName('b').Value:='否';
open;
end;
end;
end;
procedure Tfrm_ygdd.FormShow(Sender: TObject);
var
a,b:string;
subt:TTreenode;
begin
combobox1.Clear;
combobox2.Clear;
combobox3.Clear;
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select distinct 单位名称 from 单位信息表');
open;
end;
a:=data1.ADOpublic.FieldByName('单位名称').Value;
subt:=Treeview1.Items.Add(nil,a);
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select distinct 部门名称 from 部门表');
open;
end;
while Not Data1.ADOpublic.Eof do
begin
ComboBox1.Items.Add(Data1.ADOpublic.FieldByName('部门名称').Value);
b:=Data1.ADOpublic.FieldByName('部门名称').Value;
Data1.ADOpublic.Next;
Treeview1.Items.AddChild(subt,b);
end;
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select distinct 职务名称 from 职务表');
open;
end;
while Not Data1.ADOpublic.Eof do
begin
ComboBox2.Items.Add(Data1.ADOpublic.FieldByName('职务名称').Value);
Data1.ADOpublic.Next;
end;
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select distinct 职称名称 from 职称表');
open;
end;
while Not Data1.ADOpublic.Eof do
begin
ComboBox3.Items.Add(Data1.ADOpublic.FieldByName('职称名称').Value);
Data1.ADOpublic.Next;
end;
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select * from 人事表 where sflz= :b');
parameters.ParamByName('b').Value:='否';
open;
end;
data1.ADOpublic.Active:=true;
edit1.Text:=data1.ADOpublic.FieldByName('bh').Value;
edit2.Text:=data1.ADOpublic.FieldByName('xm').Value;
combobox1.Text:=data1.ADOpublic.FieldByName('ssbm').Value;
combobox2.Text:=data1.ADOpublic.FieldByName('zw').Value;
combobox3.Text:=data1.ADOpublic.FieldByName('zc').Value;
TreeView1.FullExpand;
end;
procedure Tfrm_ygdd.BitBtn3Click(Sender: TObject);
begin
combobox1.Enabled:=true;
combobox2.Enabled:=true;
combobox3.Enabled:=true;
end;
procedure Tfrm_ygdd.DBGrid1CellClick(Column: TColumn);
begin
If DBGrid1.DataSource.DataSet<> Nil then
if DBGrid1.DataSource.DataSet.RecordCount>0 then
begin
edit1.Text:=data1.ADOpublic.FieldByName('bh').Value;
edit2.Text:=data1.ADOpublic.FieldByName('xm').Value;
combobox1.Text:=data1.ADOpublic.FieldByName('ssbm').Value;
combobox2.Text:=data1.ADOpublic.FieldByName('zw').Value;
combobox3.Text:=data1.ADOpublic.FieldByName('zc').Value;
end;
end;
procedure Tfrm_ygdd.BitBtn2Click(Sender: TObject);
begin
try
with data1.ADOpublic do
begin
edit;
FieldByName('ssbm').Value := Trim(combobox1.Text);
FieldByName('zw').Value := Trim(combobox2.Text);
FieldByName('zc').Value := Trim(combobox3.Text);
post
end;
bitbtn3.OnClick(sender);
application.MessageBox('修改成功','提示',64);
except
application.MessageBox('修改失败','提示',64);
close;
end;
end;
procedure Tfrm_ygdd.SpeedButton2Click(Sender: TObject);
begin
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select * from 人事表 where sflz=:b ');
parameters.ParamByName('b').Value:='否';
open;
end
end;