📄 zgb1.pas
字号:
if application.MessageBox('该职工的工资信息也将被删除,确实要删除吗?','删除',mb_okcancel+mb_iconquestion)=idok then
if zgb.RecordCount=0 then
begin
button2.Enabled:=false;
button4.Enabled:=false;
application.MessageBox('数据已清空!','信息',mb_ok+mb_iconinformation)
end
else
if zgb.Eof then
zgb.First
else
begin
zgb.Active:=true;
find:=zgb.fieldbyname('职工编号').AsString;
if gzb.FindKey([find]) then
gzb.Delete;
zgb.Delete;
edit1.Text:=qu.cf(zgb.fieldbyname('职工编号').asstring);
edit2.Text:=qu.cf(zgb.fieldbyname('姓名').asstring);
if zgb.fieldbyname('date').AsString<>'' then
begin
decodedate(zgb.fieldbyname('date').Value,year,month,day);
days:=inttostr(day);
months:=inttostr(month);
edit3.Text:=inttostr(year);
combobox4.Text:=months;
combobox5.Text:=days;
end;
combobox1.Text:=qu.cf(zgb.fieldbyname('性别').asstring);
combobox2.Text:=qu.cf(bmb.fieldbyname('部门名称').asstring);
combobox3.Text:=qu.cf(zgb.fieldbyname('职称').asstring);
end;
end;
procedure Tzgb.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if flag=0 then
begin
button6.Click;
edit1.ReadOnly:=true;
edit2.ReadOnly:=true;
edit3.ReadOnly:=true;
combobox3.Enabled:=false;
combobox1.Enabled:=false;
combobox2.Enabled:=false;
end;
bmb.Active:=false;
bmb1.Active:=false;
zgb.Active:=false;
action:=cafree;
end;
procedure Tzgb.FormShow(Sender: TObject);
var year,month,day:word;
days,months:string;
begin
index:=0;
combobox1.Style:=csSimple;
combobox3.Style:=csSimple;
combobox2.Style:=csSimple;
combobox4.Style:=csSimple;
combobox5.Style:=csSimple;
RadioButton1.Checked:=true;
flag:=0;
button1.Enabled:=true;
button3.Enabled:=false;
button5.Enabled:=false;
zgb.Active:=false;
zgb.DatabaseName:=s;
zgb.TableName:='zgb.db';
zgb.Active:=true;
zc.Active:=false;
zc.DatabaseName:=s;
zc.TableName:='zc.db';
zc.Active:=true;
bmb.Active:=false;
bmb.DatabaseName:=s;
bmb.TableName:='bmb.db';
bmb.Active:=true;
bmb1.Active:=false;
bmb1.DatabaseName:=s;
bmb1.TableName:='bmb.db';
bmb1.Active:=true;
bmb.Edit;
if zgb.RecordCount=0 then
begin
button7.Enabled:=false;
button4.Enabled:=false;
button2.Enabled:=false;
end
else
begin
button7.Enabled:=true;
button4.Enabled:=true;
button2.Enabled:=true;
end;
zgb.First;
zgb.IndexName:='';
bmb1.First;
zc.First;
combobox2.Items.Clear;
combobox3.Items.Clear;
edit1.ReadOnly:=true;
edit2.ReadOnly:=true;
edit3.ReadOnly:=true;
edit1.Text:=qu.cf(zgb.fieldbyname('职工编号').asstring);
edit2.Text:=qu.cf(zgb.fieldbyname('姓名').asstring);
if zgb.fieldbyname('date').AsString<>'' then
begin
decodedate(zgb.fieldbyname('date').Value,year,month,day);
days:=inttostr(day);
months:=inttostr(month);
edit3.Text:=inttostr(year);
combobox4.Text:=months;
combobox5.Text:=days;
end;
combobox3.Text:=qu.cf(zgb.fieldbyname('职称').asstring);
combobox2.Text:=qu.cf(bmb.fieldbyname('部门名称').asstring);
combobox1.Text:=qu.cf(zgb.fieldbyname('性别').asstring);
combobox3.Enabled:=false;
combobox1.Enabled:=false;
combobox2.Enabled:=false;
combobox4.Enabled:=false;
combobox5.Enabled:=false;
DBNavigator1.Enabled:=true;
end;
procedure Tzgb.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
edit2.SetFocus;
end;
end;
procedure Tzgb.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
combobox1.SetFocus;
end;
end;
procedure Tzgb.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
edit3.SetFocus;
end;
end;
procedure Tzgb.ComboBox3KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
combobox3.SetFocus;
end;
end;
procedure Tzgb.RadioButton2Click(Sender: TObject);
begin
zgb.IndexName:='name';
zgb.Active:=true;
zgb.First;
edit1.Text:=qu.cf(zgb.fieldbyname('职工编号').asstring);
edit2.Text:=qu.cf(zgb.fieldbyname('姓名').asstring);
edit3.Text:=zgb.fieldbyname('date').asstring;
combobox3.Text:=qu.cf(zgb.fieldbyname('职称').asstring);
combobox1.Text:=qu.cf(zgb.fieldbyname('性别').asstring);
combobox2.Text:=qu.cf(bmb.fieldbyname('部门名称').asstring);
end;
procedure Tzgb.Button7Click(Sender: TObject);
var str:string;
var year,month,day:word;
days,months:string;
begin
if RadioButton1.Checked=true then
begin
str:=qu.cf(inputbox('定位操作!请输入编号','',''));
if not zgb.FindKey([str]) then
application.MessageBox('查找失败!','信息',mb_ok+mb_iconinformation);
edit1.Text:=qu.cf(zgb.fieldbyname('职工编号').asstring);
edit2.Text:=qu.cf(zgb.fieldbyname('姓名').asstring);
decodedate(zgb.fieldbyname('date').Value,year,month,day);
days:=inttostr(day);
months:=inttostr(month);
edit3.Text:=inttostr(year);
combobox4.Text:=months;
combobox5.Text:=days;
combobox3.Text:=qu.cf(zgb.fieldbyname('职称').asstring);
combobox1.Text:=qu.cf(zgb.fieldbyname('性别').asstring);
combobox2.Text:=qu.cf(bmb.fieldbyname('部门名称').asstring);
end
else
begin
str:=qu.cf(inputbox('定位操作!请输入姓名','',''));
if not zgb.FindKey([str]) then
application.MessageBox('查找失败!','信息',mb_ok+mb_iconinformation);
edit1.Text:=qu.cf(zgb.fieldbyname('职工编号').asstring);
edit2.Text:=qu.cf(zgb.fieldbyname('姓名').asstring);
edit3.Text:=zgb.fieldbyname('date').asstring;
combobox3.Text:=qu.cf(zgb.fieldbyname('职称').asstring);
combobox1.Text:=qu.cf(zgb.fieldbyname('性别').asstring);
combobox2.Text:=qu.cf(bmb.fieldbyname('部门名称').asstring);
end;
end;
procedure Tzgb.RadioButton1Click(Sender: TObject);
begin
zgb.IndexName:='';
zgb.Active:=true;
zgb.First;
edit1.Text:=qu.cf(zgb.fieldbyname('职工编号').asstring);
edit2.Text:=qu.cf(zgb.fieldbyname('姓名').asstring);
edit3.Text:=zgb.fieldbyname('date').asstring;
combobox3.Text:=qu.cf(zgb.fieldbyname('职称').asstring);
combobox1.Text:=qu.cf(zgb.fieldbyname('性别').asstring);
combobox2.Text:=qu.cf(bmb.fieldbyname('部门名称').asstring);
end;
procedure Tzgb.BitBtn1Click(Sender: TObject);
begin
shellexecute(application.Handle,'open',pchar(s+'\help\zhi_gong.htm'),'','',SW_SHOW);
end;
procedure Tzgb.FormPaint(Sender: TObject);
var a,b:real;
i:integer;
begin
a:=clientheight/256;
b:=0;
for i:=255 downto 0 do
begin
canvas.Brush.Color:=$000000000+i*$10000;
canvas.FillRect(rect(0,round(b),clientwidth,round(a+b)));
b:=b+a;
end;
end;
procedure Tzgb.ComboBox2Click(Sender: TObject);
begin
index:=0;
end;
procedure Tzgb.ComboBox1Click(Sender: TObject);
begin
index:=1;
end;
procedure Tzgb.ComboBox3Click(Sender: TObject);
begin
index:=1;
end;
procedure Tzgb.ComboBox2Change(Sender: TObject);
begin
if index=0 then
begin
ComboBox2.text:='';
combobox2.Style:=csDropDownList;
end;
end;
procedure Tzgb.ComboBox1Change(Sender: TObject);
begin
if index=0 then
begin
ComboBox1.text:='';
combobox1.Style:=csDropDownList;
end;
end;
procedure Tzgb.ComboBox3Change(Sender: TObject);
begin
if index=0 then
begin
ComboBox3.text:='';
combobox3.Style:=csDropDownList;
end;
end;
procedure Tzgb.Edit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
ky:=edit3.text;
if edit3.ReadOnly=false then
if (key <>48)and (key <>8)and ((key<97) OR (key>105))and (key <>144) and (key <>49)and (key <>50)and (key <>51)and (key <>52)and (key <>53)and (key <>54)and (key <>55)and (key <>56)and (key <>57)and (key <>13)then
begin
application.MessageBox('此处应输入数字','错误',mb_ok);
edit3.Text:=ky;
edit3.SelStart:=length(ky);
end
else
ky:=edit3.Text;
end;
procedure Tzgb.ComboBox4Click(Sender: TObject);
var i:integer;
begin
if (combobox4.Text='1')or(combobox4.Text='3')or(combobox4.Text='5')or(combobox4.Text='7')or(combobox4.Text='8')or(combobox4.Text='10')or(combobox4.Text='12') then
begin
combobox5.Clear;
for i:=1 to 31 do
combobox5.Items.Add(inttostr(i));
end
else
if (combobox4.Text='4')or(combobox4.Text='6')or(combobox4.Text='9')or(combobox4.Text='11') then
begin
combobox5.Clear;
for i:=1 to 30 do
combobox5.Items.Add(inttostr(i));
end
else
begin
if ((frac(strtofloat(edit3.Text)/4)=0)and(frac(strtofloat(edit3.Text)/100)<>0))or((frac(strtofloat(edit3.Text)/100)=0)and(frac(strtofloat(edit3.Text)/400)=0)) then
begin
if combobox4.Text='2' then
begin
combobox5.Clear;
for i:=1 to 29 do
combobox5.Items.Add(inttostr(i));
end;
end
else
begin
combobox5.Clear;
for i:=1 to 28 do
combobox5.Items.Add(inttostr(i));
end;
end;
end;
procedure Tzgb.ComboBox4KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
ky:=combobox4.text;
if combobox4.Enabled=true then
if (key <>48)and (key <>8)and ((key<97) OR (key>105))and (key <>144) and (key <>49)and (key <>50)and (key <>51)and (key <>52)and (key <>53)and (key <>54)and (key <>55)and (key <>56)and (key <>57)and (key <>13)then
begin
application.MessageBox('此处应输入数字','错误',mb_ok);
combobox4.Text:=ky;
combobox4.SelStart:=length(ky);
end
else
ky:=combobox4.Text;
end;
procedure Tzgb.ComboBox5KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
ky:=combobox5.text;
if combobox5.Enabled=true then
if (key <>48)and (key <>8)and ((key<97) OR (key>105))and (key <>144) and (key <>49)and (key <>50)and (key <>51)and (key <>52)and (key <>53)and (key <>54)and (key <>55)and (key <>56)and (key <>57)and (key <>13)then
begin
application.MessageBox('此处应输入数字','错误',mb_ok);
combobox5.Text:=ky;
combobox5.SelStart:=length(ky);
end
else
ky:=combobox5.Text;
end;
procedure Tzgb.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
if length(edit3.Text)=3 then
ComboBox4.SetFocus;
end;
procedure Tzgb.ComboBox4KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (strtoint(combobox4.Text)>12)or(strtoint(combobox4.Text)=0) then
combobox4.Text:='12';
end;
procedure Tzgb.ComboBox5KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (combobox4.Text='1')or(combobox4.Text='3')or(combobox4.Text='5')or(combobox4.Text='7')or(combobox4.Text='8')or(combobox4.Text='10')or(combobox4.Text='12') then
begin
if (strtoint(combobox5.Text)>31)or(strtoint(combobox5.Text)=0) then
combobox5.Text:='31';
end
else
if (combobox4.Text='4')or(combobox4.Text='6')or(combobox4.Text='9')or(combobox4.Text='11') then
begin
if (strtoint(combobox5.Text)>30)or(strtoint(combobox5.Text)=0) then
combobox5.Text:='30';
end
else
begin
if ((frac(strtofloat(edit3.Text)/4)=0)and(frac(strtofloat(edit3.Text)/100)<>0))or((frac(strtofloat(edit3.Text)/100)=0)and(frac(strtofloat(edit3.Text)/400)=0)) then
begin
if combobox4.Text='2' then
begin
if (strtoint(combobox5.Text)>29)or (strtoint(combobox5.Text)=0) then
combobox5.Text:='29';
end;
end
else
begin
combobox5.Clear;
if (strtoint(combobox5.Text)>28)or(strtoint(combobox5.Text)=0) then
combobox5.Text:='28';
end;
end;
end;
procedure Tzgb.Label10MouseEnter(Sender: TObject);
begin
hint_zgb.show;
end;
procedure Tzgb.Label10MouseLeave(Sender: TObject);
begin
hint_zgb.close;
end;
procedure Tzgb.Speed1Click(Sender: TObject);
var year,month,day:word;
days,months:string;
begin
index:=0;
combobox1.Style:=csSimple;
combobox3.Style:=csSimple;
combobox2.Style:=csSimple;
combobox4.Style:=csSimple;
combobox5.Style:=csSimple;
RadioButton1.Checked:=true;
flag:=0;
button1.Enabled:=true;
button3.Enabled:=false;
button5.Enabled:=false;
zgb.Active:=false;
zgb.DatabaseName:=s;
zgb.TableName:='zgb.db';
zgb.Active:=true;
zc.Active:=false;
zc.DatabaseName:=s;
zc.TableName:='zc.db';
zc.Active:=true;
bmb.Active:=false;
bmb.DatabaseName:=s;
bmb.TableName:='bmb.db';
bmb.Active:=true;
bmb1.Active:=false;
bmb1.DatabaseName:=s;
bmb1.TableName:='bmb.db';
bmb1.Active:=true;
bmb.Edit;
if zgb.RecordCount=0 then
begin
button7.Enabled:=false;
button4.Enabled:=false;
button2.Enabled:=false;
end
else
begin
button7.Enabled:=true;
button4.Enabled:=true;
button2.Enabled:=true;
end;
zgb.First;
zgb.IndexName:='';
bmb1.First;
zc.First;
combobox2.Items.Clear;
combobox3.Items.Clear;
edit1.ReadOnly:=true;
edit2.ReadOnly:=true;
edit3.ReadOnly:=true;
edit1.Text:=qu.cf(zgb.fieldbyname('职工编号').asstring);
edit2.Text:=qu.cf(zgb.fieldbyname('姓名').asstring);
if zgb.fieldbyname('date').AsString<>'' then
begin
decodedate(zgb.fieldbyname('date').Value,year,month,day);
days:=inttostr(day);
months:=inttostr(month);
edit3.Text:=inttostr(year);
combobox4.Text:=months;
combobox5.Text:=days;
end;
combobox3.Text:=qu.cf(zgb.fieldbyname('职称').asstring);
combobox2.Text:=qu.cf(bmb.fieldbyname('部门名称').asstring);
combobox1.Text:=qu.cf(zgb.fieldbyname('性别').asstring);
combobox3.Enabled:=false;
combobox1.Enabled:=false;
combobox2.Enabled:=false;
combobox4.Enabled:=false;
combobox5.Enabled:=false;
DBNavigator1.Enabled:=true;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -