📄 u_weihu.pas
字号:
ShowTipMsgBox('已经找到该员工的考勤资料,'+#13#10+'请直接在表格中修改资料,然后提交修改.');
end;
end;
procedure TWeiHu.rzbtbtn1Click(Sender: TObject);
begin
if DM.qryKaoQinWeiHu.State in [dsEdit, dsInsert] then
begin
DM.qryKaoQinWeiHu.Post;
ShowTipMsgBox('修改成功!');
end;
end;
procedure TWeiHu.rzbtbtnbtn1Click(Sender: TObject);
var
SQL:string;
EmployeeNo,ZhiWeiNO,I:Integer;
begin
if Trim(Trim(RzEdit1.Text))='' then
begin
ShowErrorMsgBox('请填写员工姓名!');
end;
//查找员工是否存在于employee表
SQL:='select * from employee where 姓名='+QuotedStr(Trim(RzEdit1.Text));
if RzRdbtnMan.Checked then
SQl:=SQL+' and 性别='+BoolToStr(True)
else
SQl:=SQL+' and 性别='+BoolToStr(False);
if Trim(RzEdit3.Text)<>'' then
SQL:=SQL+' and 部门='+QuotedStr(Trim(RzEdit3.Text));
{ if Trim(edtCJZhenZhi.Text)<>'' then
SQL:=SQL+' and 政治面貌='+QuotedStr(Trim(edtCJZhenZhi.Text)); }
if Trim(RzDateTimeEdit1.Text)<>'' then
SQL:=SQL+' and 出生日期='+Trim(RzDateTimeEdit1.Text);
//根据职位到 职称表 查到职位编号
if cbb1.Text<>'' then
begin
if not OpenQuery(DM.qryCommon,'Select 编号 from ZhiChen where 职称='+QuotedStr(cbb1.Text),qmOpen) then
begin
//不会出现这种情况
end else
begin
ZhiWeiNO:=DM.qryCommon.fieldbyName('编号').AsInteger;
SQL:=SQL+' and 职位编号='+inttostr(ZhiWeiNO);
end;
end;
if not OpenQuery(DM.qryCommon,SQL,qmOpen) then
begin
DM.qryCommon.Close;
ShowErrorMsgBox('根据你填写的员工资料没有找到这个员工!');
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;
//再惩奖查找员工的信息
SQL:='select 姓名,性别,部门,出生日期,奖惩 from JiangChen,Employee where JiangChen.员工编号=Employee.编号 and JiangChen.员工编号='+inttostr(EmployeeNo);
if not OpenQuery(DM.qryHCWeiHU,SQL,qmOpen) then
begin
ShowTipMsgBox('没有该员工的考勤资料!');
Exit;
end else
begin
for I:=0 to 3 do //员工数据不能在这里修改
begin
dbgrdHCWeiHu.Columns[I].ReadOnly:=True;
dbgrdHCWeiHu.Columns[I].Width:=60;
end;
for I:=0 to dbgrdHCWeiHu.Columns.Count-1 do //凡是’编号‘字段都不能让用户修改
if pos('编号', dbgrdHCWeiHu.Columns[I].FieldName)>0 then
dbgrdHCWeiHu.Columns[I].ReadOnly:=true;
ShowTipMsgBox('已经找到该员工的惩奖资料,'+#13#10+'请直接在表格中修改资料,然后提交修改.');
end;
end;
procedure TWeiHu.cbb1KeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;
procedure TWeiHu.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 TWeiHu.rzbtbtn7Click(Sender: TObject);
var
SQL:string;
EmployeeNo:Integer;
bFound:Boolean;
I:Integer;
begin
if (Trim(edtLLCurZhiWu.Text)='') and (Trim(edtLLEmployeeNo.Text)='') and (Trim(edtLLZhiWuTime.Text)='') and (Trim(edtLLYuanShiZhiWu.Text)='') then
begin
ShowErrorMsgBox('请输入查询条件!');
Exit;
end;
//add code here!
SQL:='select * from LvLi where ';
bFound:=False;
if Trim(edtLLCurZhiWu.Text)<>'' then
begin
SQL:=SQL+'当前职务='+QuotedStr(Trim(edtLLCurZhiWu.Text));
bFound:=True;
end;
if Trim(edtLLYuanShiZhiWu.Text)<>'' then
begin
if bFound then
SQL:=SQL+' and 原始职务='+QuotedSTR(Trim(edtLLYuanShiZhiWu.Text))
else
SQL:=SQL+' 原始职务='+QuotedSTR(Trim(edtLLYuanShiZhiWu.Text));
bFound:=True;
end;
if Trim(edtLLZhiWuTime.Text)<>'' then
begin
if bFound then
SQL:=SQL+' and 原始职务任职时间='+(Trim(edtLLZhiWuTime.Text))
else
SQL:=SQL+' 原始职务任职时间='+(Trim(edtLLZhiWuTime.Text));
bFound:=True;
end;
if Trim(edtLLEmployeeNo.Text)<>'' then
begin
if bFound then
SQL:=SQL+' and 员工编号='+(Trim(edtLLEmployeeNo.Text))
else
SQL:=SQL+' 员工编号='+trim(edtLLEmployeeNo.Text);
end;
if not OpenQuery(qryLvLi,SQL,qmOpen) then
ShowTipMsgBox('根据你填写的履历资料没有找到履历!')
else
begin
for I:=0 to dbgrd2.Columns.Count-1 do //凡是’编号‘字段都不能让用户修改
if pos('编号', dbgrd2.Columns[I].FieldName)>0 then
dbgrd2.Columns[I].ReadOnly:=true;
ShowTipMsgBox('已经找到该员工的惩奖资料,'+#13#10+'请直接在表格中修改资料,然后提交修改.');
end;
{SQL:='select * from LvLi where';
qryLvLi.Active:=False;
qryLvLi.SQL.Clear;
// qryLvLi.SQL.Add('select * from lvli where 员工编号='+#39+trim(RzEdit5.Text)+#39);
qryLvLi.Open;
//qryLvli.open; }
end;
procedure TWeiHu.RzBitBtn6Click(Sender: TObject);
{function isNum(Num:string):Boolean; //是否数字
var
I:Integer;
begin
Result:=False;
for I:=1 to Length(Num) do
begin
if not(Num[I] in ['0'..'9']) then Exit;
end;
Result:=True;
end;}
begin
{ atblLulibiao.Open;
RzEdit4.Text:=atblLulibiao.FieldByName('当前职务').AsString;
RzEdit5.Text:=IntToStr(atblLulibiao.FieldbyName('员工编号').AsInteger);
Edt3.Text:=atblLulibiao.FieldByName('当前职务').AsString;
RzEdit6.Text:=IntToStr(atblLulibiao.FieldbyName('原始职务任职时间').AsInteger);
//FieldByName('员工编号').AsInteger:=StrToInt(Trim(RzEdit6.Text));
}
{ with atblLulibiao do
begin
Edit;
Post;
Close;
end;}
// Self.Close;
end;
procedure TWeiHu.RzBitBtn1Click(Sender: TObject);
begin
if DM.qryHCWeiHU.State in [dsEdit, dsInsert] then
begin
DM.qryHCWeiHU.Post;
ShowTipMsgBox('修改成功!');
end;
end;
procedure TWeiHu.edt2KeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9',Char(8)]) then Key:=#0;
end;
procedure TWeiHu.edtLLEmployeeNoKeyPress(Sender: TObject; var Key: Char);
begin
if not(Key in ['0'..'9',Char(8)]) then Key:=#0;
end;
procedure TWeiHu.edtLLZhiWuTimeKeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;
procedure TWeiHu.FormShow(Sender: TObject);
begin
DM.JiSuanGZ;
end;
procedure TWeiHu.rzbtbtn8Click(Sender: TObject);
var
SQL:string;
NO:Integer;
begin
SQL:='Select * from Employee where 性别=';
if RzRdbtnGZMan.Checked then
SQL:=SQL+booltostr(True)
else
SQL:=SQL+booltostr(False);
if Trim( edtGZDepartment.Text)<>'' then
SQL:=SQL+' and 部门='+QuotedStr(Trim( edtGZDepartment.Text));
if Trim(edtGZName.Text)<>'' then
SQL:=SQL+' and 姓名='+QuotedStr(Trim( edtGZName.Text));
if Trim(edtGZMM.Text)<>'' then
SQL:=SQL+' and 政治面貌='+QuotedStr(Trim(edtGZMM.Text));
if Trim(edtGZRiQi.Text)<>'' then
SQL:=SQL+' and 出生日期='+Trim(edtGZRiQi.Text);
if not OpenQuery(DM.qryCommon,SQL,qmOpen) then
begin
ShowErrorMsgBox('没有找到该员工');
Exit;
end;
NO:=DM.qryCommon.fieldbyname('编号').AsInteger;
if not OpenQuery(DM.qryCommon,'select * from JiangChen where 员工编号='+inttostr(No),qmOpen) then
begin
ShowErrorMsgBox('你没有填写该员工的履历和奖惩信息,无法计算工资!');
Exit;
end;
if not OpenQuery(qry1,'select * from GZ where 员工编号='+inttostr(No),qmOpen) then
ShowTipMsgBox('没有找到该员工的工资信息,'+#13#10+'可能是你没有录入员工的履历和奖惩信息,系统无法计算工资.');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -