📄 u_luru.pas
字号:
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.edt13KeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.edt14KeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.edt15KeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.cbbCurZhiWuDropDown(Sender: TObject);
var
sql:string;
begin
sql:='select 职称 from ZhiChen';
if not OpenQuery(DM.qryCommon,sql,qmOpen) then
Exit
else
with DM.qryCommon do
begin
cbbCurZhiWu.Items.Clear;
while not Eof do
begin
cbbCurZhiWu.Items.Add(DM.qryCommon.FieldByName('职称').Value);
Next;
end;
Close;
end;
end;
procedure TfrmLuRu.cbb1DropDown(Sender: TObject);
var
sql:string;
begin
sql:='select 职称 from ZhiChen';
if not OpenQuery(DM.qryCommon,sql,qmOpen) then
Exit
else
with DM.qryCommon do
begin
cbb1.Items.Clear;
while not Eof do
begin
cbb1.Items.Add(DM.qryCommon.FieldByName('职称').Value);
Next;
end;
Close;
end;
end;
procedure TfrmLuRu.rzbtbtn1Click(Sender: TObject);
var
SQL:string;
bFound:Boolean;
begin
if Trim(edtName.Text)='' then
begin
ShowErrorMsgBox('员工姓名不能为空!');
Exit;
end;
{SQL:='Select * from Employee where 姓名=' ;
SQL:=SQL+QuotedStr(trim(edtName.Text));
if RzRdbtnRzRdMan.Checked then
begin
SQL:=SQL+' and 性别='+booltostr(True)
end else
begin
SQL:=SQL+' and 性别='+booltostr(False)
end;
if Trim(edt1.Text)<>'' then
SQL:=SQL+' and 出生日期='+trim(edt1.Text);
if Trim(edtBuMen.Text)<>'' then
begin
SQL:=SQL+' and 部门='+QuotedStr(Trim(edtBuMen.Text));
end ;
if Trim(edtxuexiao.Text)<>'' then
begin
SQL:=SQL+' and 毕业学校='+QuotedStr(Trim(edtxuexiao.Text));
end;
if Trim(edtmb.Text)<>'' then
SQL:=SQL+' and 政治面貌='+QuotedStr(Trim(Trim(edtmb.Text)));
if OpenQuery(DM.qryCommon,SQL ,qmOpen) then
begin
ShowErrorMsgBox('你输入了重复的数据!');
Exit;
end; }
dm.atblEmploeeLuRu.Open;
if RzRdbtnRzRdMan.Checked then
bFound:= dm.atblEmploeeLuRu.Locate('姓名;性别;出生日期;部门;毕业学校;政治面貌',VarArrayOf([trim(edtName.Text),True,trim(edt1.Text),Trim(edtBuMen.Text),Trim(edtxuexiao.Text),Trim(edtmb.Text)]),[loCaseInsensitive])
else
bFound:= dm.atblEmploeeLuRu.Locate('姓名;性别;出生日期;部门;毕业学校;政治面貌',VarArrayOf([trim(edtName.Text),False,trim(edt1.Text),Trim(edtBuMen.Text),Trim(edtxuexiao.Text),Trim(edtmb.Text)]),[loCaseInsensitive]);
if bFound then
begin
ShowErrorMsgBox('你输入了重复的数据!');
Exit;
end;
dm.atblEmploeeLuRu.Append;
dm.atblEmploeeLuRu.FieldByName('姓名').AsString:=Trim(Trim(edtName.Text));
if RzRdbtnRzRdMan.Checked then
dm.atblEmploeeLuRu.FieldByName('性别').AsBoolean:=True
else
dm.atblEmploeeLuRu.FieldByName('性别').AsBoolean:=False;
if Trim(edt1.Text)<>'' then
dm.atblEmploeeLuRu.FieldByName('出生日期').AsDateTime:=StrToDateTime(Trim(edt1.Text));
if Trim(edtBuMen.Text)<>'' then
dm.atblEmploeeLuRu.FieldByName('部门').AsString:=Trim(edtBuMen.Text);
if Trim(edtxuexiao.Text)<>'' then
dm.atblEmploeeLuRu.FieldByName('毕业学校').AsString:=Trim(edtxuexiao.Text);
if Trim(edtmb.Text)<>'' then
dm.atblEmploeeLuRu.FieldByName('政治面貌').AsString:=Trim(edtmb.Text);
{if Trim(cbb1.Text)<>'' then
dm.atblEmploeeLuRu.FieldByName('').AsString:=Trim(cbb1.Text); }
dm.atblEmploeeLuRu.Post;
dm.atblEmploeeLuRu.Close;
dm.atblEmploeeLuRu.Open;
end;
procedure TfrmLuRu.cbb1KeyPress(Sender: TObject; var Key: Char);
begin
Key:=#0;
end;
procedure TfrmLuRu.edt3KeyPress(Sender: TObject; var Key: Char);
begin
if (Trim(edt3.Text)='') and (Key ='.') then //如果第一次输入小数点,则写成'0.',并设置光标位置.
begin
edt3.Text:='0.';
edt3.SelStart:=2;
end;
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
if (Key='.') and (Pos('.',edt3.Text)>0) then Key:=#0;
end;
procedure TfrmLuRu.RzBitBtn11Click(Sender: TObject);
begin
if Trim(edt2.Text)='' then
begin
ShowErrorMsgBox('职称不能为空!');
Exit;
end;
DM.atblZhiChen.Open;
if DM.atblZhiChen.Locate('职称',Trim(edt2.Text),[loCaseInsensitive]) then
begin
ShowErrorMsgBox('不要重复提交数据!');
Exit;
end;
DM.atblZhiChen.Append;
DM.atblZhiChen.FieldByName('职称').AsString:=Trim(edt2.Text);
if Trim(edt3.Text)<>'' then
DM.atblZhiChen.FieldByName('工资增长幅度').AsFloat:=StrToFloat(edt3.Text);
DM.atblZhiChen.Post;
ShowTipMsgBox('添加成功!');
end;
procedure TfrmLuRu.RzBitBtn21Click(Sender: TObject);
var
SQL,SQL1,SQL2:string;
EmployeeID:Integer;
begin
if Trim(cbb2.Text)='' then
begin
ShowErrorMsgBox('当前职务不能为空!');
Exit;
end;
if Trim(cbb2.Text)=Trim(cbb3.Text) then
begin
ShowErrorMsgBox('你填写了错误的信息:'+#13#10+'当前职务和原始职务相同!');
Exit;
end;
SQL1:='select * from employee where 性别=';
//SQL2:='select employee.编号 from employee,ZhiChen where employee.职位编号=ZhiChen.编号 and 性别=';
if RzRadioButton1.Checked then
SQL:=SQL+BoolToStr(True)
else
SQL:=SQL+BoolToStr(False);
if Trim(RzEdit1.Text)<>'' then
SQL:=SQL+' and 姓名='+QuotedStr(Trim(RzEdit1.Text));
if Trim(RzDateTimeEdit1.Text)<>'' then
SQL:=SQL+' and 出生日期='+RzDateTimeEdit1.Text;
{if Trim(RzComboBox1.Text)<>'' then
begin
SQL:=SQL+' and 职称='+QuotedStr(Trim(RzComboBox1.Text));
SQL:=SQL2+SQL;
end else
SQL:=SQL1+SQL; }
SQL:=SQL1+SQL;
if not OpenQuery(DM.qryCommon,SQL,qmOpen) then
begin
ShowErrorMsgBox('没有找到该员工的信息,请先添加该员工的信息!');
Exit;
end;
if DM.qryCommon.RecordCount>1 then
begin
ShowErrorMsgBox('员工信息太少,请提供更多该员工的信息!');
Exit;
end;
EmployeeID:=DM.qryCommon.fieldByName('编号').AsInteger;
DM.atblLuli.Open;
if DM.atblLuli.Locate('员工编号',EmployeeID,[loCaseInsensitive]) then
begin
ShowErrorMsgBox('该员工的履历已经存在!');
Exit;
end;
DM.atblLuli.Append;
DM.atblLuli.FieldByName('员工编号').AsInteger:=EmployeeID;
if Trim(edt7.Text)<>'' then
DM.atblLuli.FieldByName('原始职务任职时间').AsInteger:=StrToInt(Trim(edt7.Text));
if Trim(cbb3.Text)<>'' then
DM.atblLuli.FieldByName('原始职务').AsString:=Trim(cbb3.Text);
DM.atblLuli.FieldByName('当前职务').AsString:=Trim(cbb2.Text);
DM.atblLuli.Post;
ShowTipMsgBox('录入成功!');
end;
procedure TfrmLuRu.edt7KeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.cbb2DropDown(Sender: TObject);
var
sql:string;
begin
sql:='select 职称 from ZhiChen';
if not OpenQuery(DM.qryCommon,sql,qmOpen) then
Exit
else
with DM.qryCommon do
begin
cbb2.Items.Clear;
while not Eof do
begin
cbb2.Items.Add(DM.qryCommon.FieldByName('职称').Value);
Next;
end;
Close;
end;
end;
procedure TfrmLuRu.cbb3DropDown(Sender: TObject);
var
sql:string;
begin
sql:='select 职称 from ZhiChen';
if not OpenQuery(DM.qryCommon,sql,qmOpen) then
Exit
else
with DM.qryCommon do
begin
cbb3.Items.Clear;
while not Eof do
begin
cbb3.Items.Add(DM.qryCommon.FieldByName('职称').Value);
Next;
end;
Close;
end;
end;
procedure TfrmLuRu.RzComboBox1DropDown(Sender: TObject);
var
sql:string;
begin
{sql:='select 职称 from ZhiChen';
if not OpenQuery(DM.qryCommon,sql,qmOpen) then
Exit
else
with DM.qryCommon do
begin
RzComboBox1.Items.Clear;
while not Eof do
begin
RzComboBox1.Items.Add(DM.qryCommon.FieldByName('职称').Value);
Next;
end;
Close;
end; }
end;
procedure TfrmLuRu.rzbtbtn3Click(Sender: TObject);
begin
dm.atblEmploeeLuRu.Prior;
end;
procedure TfrmLuRu.rzbtbtn4Click(Sender: TObject);
begin
Dm.atblEmploeeLuRu.Next;
end;
procedure TfrmLuRu.rzbtbtn2Click(Sender: TObject);
begin
edtName.Text:='';
edtxuexiao.Text:='';
edtmb.Text:='';
edtBuMen.Text:='';
end;
procedure TfrmLuRu.RzBitBtn12Click(Sender: TObject);
begin
edt2.Text:='';
edt3.Text:='';
end;
procedure TfrmLuRu.RzBitBtn13Click(Sender: TObject);
begin
DM.atblZhiChen.First;
end;
procedure TfrmLuRu.RzBitBtn14Click(Sender: TObject);
begin
DM.atblZhiChen.Last;
end;
procedure TfrmLuRu.RzBitBtn8Click(Sender: TObject);
begin
DM.qryYuanGongChenJiang.First;
end;
procedure TfrmLuRu.RzBitBtn9Click(Sender: TObject);
begin
DM.qryYuanGongChenJiang.Last;
end;
procedure TfrmLuRu.RzBitBtn7Click(Sender: TObject);
begin
edtLLYuanShiZhiWu.Text:='';
edtLLYuanShiShiJian.Text:='';
cbbCurZhiWu.Text:='';
end;
procedure TfrmLuRu.RzBitBtn26Click(Sender: TObject);
var
SQL:string;
EmployeeNo:Integer;
begin
//员工信息
//----------------------------
if Trim(edtKQName.Text)='' then
begin
ShowErrorMsgBox('请填写员工的姓名!');
Exit;
end;
//查找员工是否存在于employee表
SQL:='select * from employee where 姓名='+QuotedStr(Trim(edtKQName.Text));
if Trim(edtCJBM.Text)<>'' then
SQL:=SQL+' and 部门='+QuotedStr(Trim(edtKQBM.Text));
if Trim(edtCJChuShen.Text)<>'' then
SQL:=SQL+' and 出生日期='+Trim(edtKQChuShen.Text);
if not OpenQuery(DM.qryCommon,SQL,qmOpen) then
begin
DM.qryCommon.Close;
ShowErrorMsgBox('根据你填写的员工资料没有找到这个员工,'+#13#10+'请先添加该员工基本的信息!');
Exit;
end else
begin
if (DM.qryCommon.RecordCount>1) then
begin
DM.qryCommon.Close;
ShowErrorMsgBox('根据你填写的员工资料,系统查询到多个员工,'+#13#10+'请添写更详细的员工信息!');
Exit;
end;
end;
EmployeeNo:=DM.qryCommon.fieldbyName('编号').Value;
if OpenQuery(DM.qryCommon,'select * from KaoQin where KaoQin.员工编号='+IntToStr(EmployeeNo),qmOpen) then
begin
ShowErrorMsgBox('该员工的考勤信息已经存在!');
Exit;
end;
if (edtKQChuQin.Text='') and (edtKQChiDao.Text='') and (edtKQHiaBan.Text='') and (edtKQChuChai.Text='') then
begin
ShowErrorMsgBox('请填写考勤信息!');
Exit;
end;
DM.atblKaoQin.Open;
DM.atblKaoQin.Append;
DM.atblKaoQin.FieldByName('员工编号').AsInteger:=EmployeeNo;
if edtKQChuQin.Text<>'' then
DM.atblKaoQin.FieldByName('出勤天数').AsInteger:=StrToInt(edtKQChuQin.Text);
if edtKQChiDao.Text<>'' then
DM.atblKaoQin.FieldByName('迟到天数').AsInteger:=StrToInt(edtKQChiDao.Text);
if edtKQHiaBan.Text<>'' then
DM.atblKaoQin.FieldByName('加班时间').AsInteger:=StrToInt(edtKQHiaBan.Text);
if edtKQChuChai.Text<>'' then
DM.atblKaoQin.FieldByName('出差天数').AsInteger:=StrToInt(edtKQChuChai.Text);
DM.atblKaoQin.Post;
ShowTipMsgBox('录入成功!');
end;
procedure TfrmLuRu.edtKQChuQinKeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.edtKQChiDaoKeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.edtKQHiaBanKeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.edtKQChuChaiKeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9','.',Char(8)]) then Key:=#0;
end;
procedure TfrmLuRu.RzBitBtn22Click(Sender: TObject);
begin
RzEdit1.Text:='';
RzEdit1.SetFocus;
//RzComboBox1.Text:='';
RzDateTimeEdit1.Text:='';
cbb2.Text:='';
cbb3.Text:='';
edt7.Text:='';
end;
procedure TfrmLuRu.RzBitBtn23Click(Sender: TObject);
begin
DM.atblLuli.First;
end;
procedure TfrmLuRu.RzBitBtn24Click(Sender: TObject);
begin
DM.atblLuli.Last;
end;
procedure TfrmLuRu.RzBitBtn28Click(Sender: TObject);
begin
dm.qryYuanGongKaoQin.First;
end;
procedure TfrmLuRu.RzBitBtn29Click(Sender: TObject);
begin
DM.qryYuanGongKaoQin.Last;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -