信息登记查询代码
unit Unit_Driver_Info_Register;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,StrUtils,
Dialogs, Unit_Child_Template_Modal, StdCtrls, DBGridEhGrouping, GridsEh,DateUtils,
DBGridEh, ExtCtrls, DB, Ora, ADODB, Unit_Child_Template, ComCtrls, Menus, ShellAPI,
Grids, DBGrids;
type
TForm_Driver_Info_Register = class(TForm_Child_Template)
btn_Driver_Info_Add_Explor: TButton;
btn_Contract_Add_Explor: TButton;
btn_Driver_Grade_Control: TButton;
btn_Edt_Emp_No: TButton;
GroupBox0: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
edt_Archives_No: TEdit;
edt_Emp_No: TEdit;
edt_Worker_No: TEdit;
cbb_Mount_Flag: TComboBox;
edt_Emp_Name: TEdit;
cbb_Sex: TComboBox;
edt_Tell: TEdit;
edt_Native_Place: TEdit;
edt_Id_No: TEdit;
edt_Address_Now: TEdit;
cbb_Dept_Name: TComboBox;
cbb_Duty: TComboBox;
cbb_Regist_Type: TComboBox;
cbb_Assure_Company: TComboBox;
cbb_work_Type: TComboBox;
edt_Driver_No: TEdit;
cbb_Driver_Grade: TComboBox;
edt_Final_Editer: TEdit;
btn_Add: TButton;
btn_Explor: TButton;
Label28: TLabel;
edt_Address_Org: TEdit;
Image1: TImage;
dtp_Birth_Date: TDateTimePicker;
dtp_First_Date: TDateTimePicker;
dtp_Formal_Date: TDateTimePicker;
dtp_Join_Date: TDateTimePicker;
dtp_Auto_Dimmission: TDateTimePicker;
dtp_Force_Dimmission: TDateTimePicker;
btn_Exit: TButton;
cbb_Work_Type_No: TComboBox;
cbb_Regist_Type_No: TComboBox;
cbb_Assure_Company_No: TComboBox;
cbb_Duty_No: TComboBox;
cbb_Driver_Grade_No: TComboBox;
edt_Driver_Type: TEdit;
cbb_Dept_No: TComboBox;
mmo_Remark: TMemo;
GroupBox1: TGroupBox;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
edt_Emp_No1: TEdit;
edt_Remark1: TEdit;
cbb_Dept_Name1: TComboBox;
btn_Add1: TButton;
dbgrdh_Emp_Info: TDBGridEh;
dbgrdh_Contract_Info1: TDBGridEh;
dtp_Start_Time1: TDateTimePicker;
dtp_End_Time1: TDateTimePicker;
cbb_Dept_No1: TComboBox;
GroupBox2: TGroupBox;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label39: TLabel;
Label41: TLabel;
edt_Emp_No2: TEdit;
edt_Note2: TEdit;
cbb_Grade2: TComboBox;
btn_Update2: TButton;
dbgrdh_Driver_Grade2: TDBGridEh;
GroupBox3: TGroupBox;
Label43: TLabel;
Label44: TLabel;
Label45: TLabel;
Label46: TLabel;
edt_Emp_Name3: TEdit;
edt_Emp_No3: TEdit;
edt_Worker_No3: TEdit;
btn_Update3: TButton;
dbgrdh_Emp_Info3: TDBGridEh;
dtp_Manager_Date: TDateTimePicker;
cbb_Mount_No: TComboBox;
btn_Clear: TButton;
btn_Exprolor2: TButton;
cbb_Grade_No2: TComboBox;
chk_Auto_Dimmission: TCheckBox;
chk_Force_Dimmission: TCheckBox;
btn_Brows: TButton;
btn_Clear2: TButton;
chk_Gain_Date2: TCheckBox;
lbl1: TLabel;
cbb_Year2: TComboBox;
cbb_Month2: TComboBox;
Label38: TLabel;
edt_Emp_Name2: TEdit;
dbgrdh_Driver_Grade_Init2: TDBGridEh;
lbl_Grade_List2: TLabel;
lbl_Init_Grade_List2: TLabel;
lbl2: TLabel;
pnl_msg: TPanel;
rb_up: TRadioButton;
rb_down: TRadioButton;
Lb_Employ_state: TLabel;
Cbb_Employ_state: TComboBox;
Bt_Edt_Employ_State: TButton;
GroupBox4: TGroupBox;
Label40: TLabel;
Label42: TLabel;
Label47: TLabel;
Label48: TLabel;
Label49: TLabel;
Edt_B4Name: TEdit;
Edt_B4Emp_no: TEdit;
Edt_B4Worker_No: TEdit;
Cbb_B4Employ_State: TComboBox;
Bt_Update: TButton;
DBGrid_B4: TDBGrid;
Cbb_B4Employ_type: TComboBox;
Cbb_Employ_State_No: TComboBox;
Label50: TLabel;
Label51: TLabel;
Label52: TLabel;
Cbb_Line_Name: TComboBox;
Cbb_Line_No: TComboBox;
procedure btn_Driver_Info_Add_ExplorClick(Sender: TObject);
procedure btn_Contract_Add_ExplorClick(Sender: TObject);
procedure btn_Driver_Grade_ControlClick(Sender: TObject);
procedure btn_Edt_Emp_NoClick(Sender: TObject);
procedure btn_AddClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cbb_Mount_FlagChange(Sender: TObject);
procedure cbb_SexChange(Sender: TObject);
procedure cbb_Regist_TypeChange(Sender: TObject);
procedure btn_ExitClick(Sender: TObject);
procedure cbb_work_TypeChange(Sender: TObject);
procedure cbb_Assure_CompanyOnChange(Sender: TObject);
procedure cbb_DutyChange(Sender: TObject);
procedure cbb_Driver_GradeChange(Sender: TObject);
procedure cbb_Dept_NameChange(Sender: TObject);
procedure edt_Emp_Name3OnExit(Sender: TObject);
procedure QueryEmp(pKey: string; pFlag: Integer);
procedure edt_Emp_No3OnExit(Sender: TObject);
procedure edt_Worker_No3Change(Sender: TObject);
procedure btn_Update3Click(Sender: TObject);
procedure btn_ExplorClick(Sender: TObject);
procedure dbgrdh_Emp_InfoOnDblClick(Sender: TObject);
procedure cbb_Mount_NoOnChange(Sender: TObject);
procedure cbb_Dept_NoOnChange(Sender: TObject);
procedure cbb_Duty_NoOnChange(Sender: TObject);
procedure cbb_Regist_Type_NoOnChange(Sender: TObject);
procedure cbb_Assure_Company_NoChange(Sender: TObject);
procedure cbb_work_Type_NoChange(Sender: TObject);
procedure cbb_Driver_Grade_NoChange(Sender: TObject);
procedure btn_ClearClick(Sender: TObject);
procedure edt_Emp_No1Change(Sender: TObject);
procedure cbb_Dept_Name1Change(Sender: TObject);
procedure btn_Add1Click(Sender: TObject);
procedure dtp_Start_Time1OnChange(Sender: TObject);
procedure dtp_End_Time1OnChange(Sender: TObject);
procedure cbb_Grade_No2Change(Sender: TObject);
procedure edt_Emp_Name3Change(Sender: TObject);
procedure edt_Emp_No3Change(Sender: TObject);
procedure edt_Emp_No3OnKeyPress(Sender: TObject; var Key: Char);
procedure edt_Worker_No3OnKeyPress(Sender: TObject; var Key: Char);
procedure edt_Emp_No2OnKeyPress(Sender: TObject; var Key: Char);
procedure edt_Emp_No1OnKeyPress(Sender: TObject; var Key: Char);
procedure edt_Emp_NoOnKeyPress(Sender: TObject; var Key: Char);
procedure edt_Worker_NoOnKeyPress(Sender: TObject; var Key: Char);
procedure edt_Id_NoOnKeyPress(Sender: TObject; var Key: Char);
procedure edt_Id_NoOnExit(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure edt_TellChange(Sender: TObject; var Key: Char);
procedure chk_Auto_DimmissionClick(Sender: TObject);
procedure chk_Force_DimmissionClick(Sender: TObject);
procedure edt_Driver_NoKeyPress(Sender: TObject; var Key: Char);
procedure btn_BrowsClick(Sender: TObject);
procedure btn_Clear2Click(Sender: TObject);
procedure cbb_Grade2Change(Sender: TObject);
procedure btn_Exprolor2Click(Sender: TObject);
procedure chk_Gain_Date2Click(Sender: TObject);
procedure dbgrdh_Driver_Grade2DblClick(Sender: TObject);
procedure btn_Update2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure dbgrdh_Driver_Grade_Init2DblClick(Sender: TObject);
procedure cbb_Mount_FlagKeyPress(Sender: TObject; var Key: Char);
procedure dtp_Join_DateKeyPress(Sender: TObject; var Key: Char);
procedure edt_Emp_NameKeyPress(Sender: TObject; var Key: Char);
procedure cbb_SexKeyPress(Sender: TObject; var Key: Char);
procedure dtp_Birth_DateKeyPress(Sender: TObject; var Key: Char);
procedure edt_Address_OrgKeyPress(Sender: TObject; var Key: Char);
procedure edt_Native_PlaceKeyPress(Sender: TObject; var Key: Char);
procedure edt_Address_NowKeyPress(Sender: TObject; var Key: Char);
procedure cbb_Dept_NameKeyPress(Sender: TObject; var Key: Char);
procedure cbb_DutyKeyPress(Sender: TObject; var Key: Char);
procedure cbb_Regist_TypeKeyPress(Sender: TObject; var Key: Char);
procedure cbb_Assure_CompanyKeyPress(Sender: TObject; var Key: Char);
procedure dtp_Formal_DateKeyPress(Sender: TObject; var Key: Char);
procedure cbb_work_TypeKeyPress(Sender: TObject; var Key: Char);
procedure edt_Driver_TypeKeyPress(Sender: TObject; var Key: Char);
procedure dtp_First_DateKeyPress(Sender: TObject; var Key: Char);
procedure cbb_Driver_GradeKeyPress(Sender: TObject; var Key: Char);
procedure dtp_Auto_DimmissionKeyPress(Sender: TObject; var Key: Char);
procedure dtp_Force_DimmissionKeyPress(Sender: TObject; var Key: Char);
procedure cbb_Dept_Name1KeyPress(Sender: TObject; var Key: Char);
procedure dtp_Start_Time1KeyPress(Sender: TObject; var Key: Char);
procedure dtp_End_Time1KeyPress(Sender: TObject; var Key: Char);
procedure edt_Remark1KeyPress(Sender: TObject; var Key: Char);
procedure edt_Emp_Name2KeyPress(Sender: TObject; var Key: Char);
procedure cbb_Grade2KeyPress(Sender: TObject; var Key: Char);
procedure cbb_Year2KeyPress(Sender: TObject; var Key: Char);
procedure cbb_Month2KeyPress(Sender: TObject; var Key: Char);
procedure edt_Note2KeyPress(Sender: TObject; var Key: Char);
procedure edt_Emp_Name3KeyPress(Sender: TObject; var Key: Char);
procedure edt_Emp_NoExit(Sender: TObject);
procedure edt_Emp_NameExit(Sender: TObject);
procedure edt_TellExit(Sender: TObject);
procedure Bt_Edt_Employ_StateClick(Sender: TObject);
procedure Edt_B4Emp_noExit(Sender: TObject);
procedure Cbb_B4Employ_StateChange(Sender: TObject);
procedure Edt_B4Worker_NoExit(Sender: TObject);
procedure Bt_UpdateClick(Sender: TObject);
procedure edt_Driver_TypeClick(Sender: TObject);
procedure Cbb_Employ_stateChange(Sender: TObject);
procedure Cbb_Line_NameChange(Sender: TObject);
procedure Cbb_Line_NameKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
function CheckData: Boolean;
public
{ Public declarations }
end;
var
Form_Driver_Info_Register: TForm_Driver_Info_Register;
Mount_Flag: Integer;
Sex: string;
Regist_Type: Integer;
qry_Emp_Info: TADOQuery;
qry_Contract_Info1: TADOQuery;
qry_Driver_Grade2: TADOQuery;
qry_Driver_GradeThree2: TADOQuery;
qry_Emp_Info3: TADOQuery;
qry_B4: TADOQuery;
ds_B4: TDataSource;
ds_Emp_Info: TDataSource;
ds_Contract_Info1: TDataSource;
ds_Driver_Grade2: TDataSource;
ds_Driver_GradeThree2: TDataSource;
ds_Emp_Info3: TDataSource;
SQL_temp3: string;
Err_str: string;
bool_First_Evaluation: Boolean;
implementation
uses Unit_Main,Unit_Public_Variable, Unit_Public_Funciton,Unit_Driver_Grade_Evaluation,
Unit_Edt_Driver_Type;
{$R *.dfm}
procedure TForm_Driver_Info_Register.btn_Driver_Info_Add_ExplorClick(Sender: TObject);
begin
inherited;
GroupBox0.Visible :=True;
GroupBox1.Visible :=False;
GroupBox2.Visible :=False;
GroupBox3.Visible :=False;
GroupBox4.Visible :=False;
GroupBox0.Height :=Form_Driver_Info_Register.Height - 80;
dbgrdh_Emp_info.Height := GroupBox0.Height - 280;
end;
procedure TForm_Driver_Info_Register.btn_Contract_Add_ExplorClick(Sender: TObject);
begin
inherited;
GroupBox0.Visible :=False;
GroupBox1.Visible :=True;
GroupBox2.Visible :=False;
GroupBox3.Visible :=False;
GroupBox4.Visible :=False;
GroupBox1.Height :=Form_Driver_Info_Register.Height - 80;
dbgrdh_Contract_Info1.Height := GroupBox1.Height - 150;
end;
procedure TForm_Driver_Info_Register.btn_Driver_Grade_ControlClick(Sender: TObject);
begin
inherited;
if int_User_Operate_Level <4 then
begin
Msg('您没有足够的权限!');
Exit;
end;
GroupBox0.Visible :=False;
GroupBox1.Visible :=False;
GroupBox2.Visible :=True;
GroupBox3.Visible :=False;
GroupBox4.Visible :=False;
GroupBox2.Height :=Form_Driver_Info_Register.Height - 80;
dbgrdh_Driver_Grade2.Height := GroupBox2.Height - 175;
dbgrdh_Driver_Grade_Init2.Height := dbgrdh_Driver_Grade2.Height;
pnl_msg.Top := GroupBox2.Height div 2;
pnl_msg.Left := (GroupBox2.Width - pnl_msg.Width) div 2;
end;
procedure TForm_Driver_Info_Register.btn_Edt_Emp_NoClick(Sender: TObject);
begin
inherited;
if int_User_Operate_Level<2 then
begin
Msg('您没有足够的权限!');
Exit;
end;
GroupBox0.Visible :=False;
GroupBox1.Visible :=False;
GroupBox2.Visible :=False;
GroupBox3.Visible :=True;
GroupBox4.Visible :=False;
GroupBox3.Height :=Form_Driver_Info_Register.Height - 80;
dbgrdh_Emp_Info3.Height := GroupBox3.Height - 245;
end;
procedure TForm_Driver_Info_Register.btn_AddClick(Sender: TObject);
var
Formal_Date: TDateTime;
Assure_Co_No: string;
begin
inherited;
if edt_Emp_No.Text ='' then
begin
ShowMessage('员工编号不能为空!');
edt_Emp_No.SetFocus;
Exit;
end;
if edt_Worker_No.Text ='' then
begin
ShowMessage('工号不能为空!');
edt_Worker_No.SetFocus;
Exit;
end;
if DateToStr(dtp_Join_Date.DateTime) ='' then
begin
ShowMessage('进厂日期不能为空!');
dtp_Join_Date.SetFocus;
Exit;
end;
if edt_Emp_Name.Text ='' then
begin
ShowMessage('姓名不能为空!');
edt_Emp_Name.SetFocus;
Exit;
end;
if DateToStr(dtp_Birth_Date.DateTime) ='' then
begin
ShowMessage('出生年月不能为空!');
dtp_Birth_Date.SetFocus;
Exit;
end;
if edt_Id_No.Text ='' then
begin
ShowMessage('身份证不能为空!');
edt_Id_No.SetFocus;
Exit;
end;
if edt_Native_Place.Text ='' then
begin
ShowMessage('籍贯不能为空!');
edt_Native_Place.SetFocus;
Exit;
end;
if edt_tell.Text='' then
begin
ShowMessage('电话不能为空!');
edt_tell.SetFocus;
Exit;
end;
if cbb_Regist_Type_No.Text = '' then
begin
ShowMessage('籍贯类型不能为空!');
cbb_Regist_Type.SetFocus;
Exit;
end;
if cbb_work_type.Text<>'合同工' then
begin
if cbb_Assure_Company.Text = '' then
begin
ShowMessage('输送单位不能为空!');
cbb_Assure_Company.SetFocus;
Exit;
end;
end;
if cbb_Work_Type_No.Text = '' then
begin
ShowMessage('用工性质不能为空!');
cbb_work_Type.SetFocus;
Exit;
end;
if (Cbb_employ_state.ItemIndex = -1) and (Cbb_employ_state.Visible = True) then
begin
ShowMessage('请选择聘用情况!');
Exit;
end;
if cbb_duty_no.Text = '1' then
begin
if cbb_Driver_Grade_No.Text = '' then
begin
ShowMessage('驾驶员等级不能为空!');
cbb_Driver_Grade.SetFocus;
Exit;
end;
end;
if CheckData = False then
begin
Exit;
end
else
begin
if cbb_Work_Type_No.Text = '1' then
begin
Formal_Date := dtp_Formal_Date.DateTime;
Assure_Co_No := '-1';
end
else
begin
Assure_Co_No := cbb_Assure_Company_No.Text;
end;
str_Temp := 'exec wz_safety_4cs.dbo.SP_I_TK_EMPLOYEE_INFO ' + edt_Emp_No.Text + ',' + cbb_Dept_No.Text + ',''' + edt_Worker_No.Text + ''',''';
str_Temp := str_Temp + edt_Archives_No.Text + ''',''' + edt_Driver_No.Text +''',''' + edt_Driver_Type.Text + ''',''' + DateToStr(dtp_First_Date.Date) + ''',';
if cbb_duty_no.Text = '6' then
begin
str_Temp := str_Temp + '-1,' + cbb_Work_Type_No.Text + ',' + cbb_Regist_Type_No.Text + ',' + Assure_Co_No + ',';
end
else
begin
str_Temp := str_Temp + cbb_Driver_Grade_No.Text + ',' + cbb_Work_Type_No.Text + ',' + cbb_Regist_Type_No.Text + ',' + Assure_Co_No + ',';
end;
str_Temp := str_Temp + 'Null,' + cbb_Mount_No.Text + ',''' + DateToStr(dtp_Formal_Date.Date) + ''',';
if Cbb_employ_state.Enabled then
begin
str_Temp := str_Temp + '''' + Cbb_employ_state_No.Text + ''',';
end
else
begin
str_Temp := str_Temp + 'null,';
end;
if dtp_Auto_Dimmission.Enabled = True then
begin
str_Temp := str_Temp + '''' + DateToStr(dtp_Auto_Dimmission.Date) + ''',';
end
else
begin
str_Temp := str_Temp + 'Null,';
end;
if dtp_Force_Dimmission.Enabled = True then
begin
str_Temp := str_Temp + '''' + DateToStr(dtp_Force_Dimmission.Date) + ''',''';
end
else
begin
str_Temp := str_Temp + 'Null,''';
end;
str_Temp := str_Temp + edt_Emp_Name.Text + ''',''' + cbb_Sex.Text + ''',''' + DateToStr(dtp_Birth_Date.date) + ''',''';
str_Temp := str_Temp + DateToStr(dtp_Join_Date.date) + ''',''' + cbb_Duty_No.Text + ''',''' + edt_Id_No.Text + ''',''' + edt_Native_Place.Text + ''',''';
str_Temp := str_Temp + edt_Address_Org.Text + ''',''' + edt_Address_Now.Text + ''',''' + edt_Tell.Text + ''',Null,''' + edt_Final_Editer.Text + ''',''';
str_Temp := str_Temp + DateToStr(dtp_Manager_Date.date) +''',''' + cbb_line_no.Text + ''',''' + mmo_Remark.Text + '''';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
if Form_Main.aTCPAdoClient_Main.Fields[0].Value =9000 then
begin
ShowMessage('员工编号:' + edt_Emp_No.Text + '的员工信息添加成功!');
edt_Archives_No.Text := Form_Main.aTCPAdoClient_Main.Fields[1].Text;
btn_ExplorClick(Sender);
end;
if Form_Main.aTCPAdoClient_Main.Fields[0].Value =9001 then
begin
ShowMessage('员工编号:' + edt_Emp_No.Text + '的员工信息添加失败!');
end;
if Form_Main.aTCPAdoClient_Main.Fields[0].Value =9002 then
begin
ShowMessage('员工编号:' + edt_Emp_No.Text + '的员工信息已存在!');
end;
if Form_Main.aTCPAdoClient_Main.Fields[0].Value =9012 then
begin
ShowMessage('员工工号:' + edt_Worker_No.Text + '的员工信息已存在!');
end;
end;
end;
procedure TForm_Driver_Info_Register.FormCreate(Sender: TObject);
var
int_4loop: Integer;
int_Year: Integer;
begin
inherited;
qry_Emp_Info :=TADOQuery.Create(self);
qry_Contract_Info1 :=TADOQuery.Create(Self);
qry_Driver_Grade2 :=TADOQuery.Create(Self);
qry_Driver_GradeThree2 := TADOQuery.Create(Self);
qry_Emp_Info3 :=TADOQuery.Create(Self);
qry_B4 := TADOQuery.Create(Self);
ds_B4 := TDataSource.Create(Self);
ds_Emp_Info :=TDataSource.Create(Self);
ds_Contract_Info1 :=TDataSource.Create(Self);
ds_Driver_Grade2 :=TDataSource.Create(Self);
ds_Driver_GradeThree2 := TDataSource.Create(Self);
ds_Emp_Info3 :=TDataSource.Create(Self);
ds_Emp_Info.DataSet :=qry_Emp_Info;
ds_Contract_Info1.DataSet :=qry_Contract_Info1;
ds_Driver_Grade2.DataSet :=qry_Driver_Grade2;
ds_Emp_Info3.DataSet :=qry_Emp_Info3;
ds_Driver_GradeThree2.DataSet := qry_Driver_GradeThree2;
ds_B4.DataSet := qry_B4;
//‘添加或查看档案’初始化
str_Temp :='select * from wz_safety.dbo.tk_typereference where type =19 and type_no in (' + str_Current_Role_Dept_List + ') and text=1';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
if Form_Main.aTCPAdoClient_Main.RecordCount = 0 then
begin
Lb_Employ_state.Visible := false;
Cbb_Employ_state.Visible := false;
Bt_Edt_Employ_State.Visible := false;
btn_Exit.Left := btn_Edt_Emp_no.Left + btn_Edt_Emp_no.Width + 7;
end
else
begin
Lb_Employ_state.Visible := true;
Cbb_Employ_state.Visible := true;
Bt_Edt_Employ_State.Visible :=true;
btn_Exit.Left := Bt_Edt_Employ_State.Left + Bt_Edt_Employ_State.Width + 7;
end;
str_Temp :='select type_no,TEXT from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=18 order by type_no';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_employ_state.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TEXT').Text);
cbb_employ_state_no.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('type_No').Text);
Form_main.aTCPAdoClient_Main.Next;
end;
str_Temp :='select type_no,TEXT from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=1 order by type_no';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_work_Type.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TEXT').Text);
cbb_Work_Type_No.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TYPE_NO').Text);
Form_Main.aTCPAdoClient_Main.Next;
end;
str_Temp :='select type_no,TEXT from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=2 order by type_no';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_Regist_Type.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TEXT').Text);
cbb_Regist_Type_No.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TYPE_NO').Text);
Form_Main.aTCPAdoClient_Main.Next;
end;
str_Temp :='select type_no,TEXT from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=3 order by type_no';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_Assure_Company.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TEXT').Text);
cbb_Assure_Company_No.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TYPE_NO').Text);
Form_Main.aTCPAdoClient_Main.Next;
end;
str_Temp :='select type_no,TEXT from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=4 order by type_no';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_Duty.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TEXT').Text);
cbb_Duty_No.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TYPE_NO').Text);
Form_Main.aTCPAdoClient_Main.Next;
end;
str_Temp :='select type_no,TEXT from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=5 order by type_no';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_Driver_Grade.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TEXT').Text);
cbb_Driver_Grade_No.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('TYPE_NO').Text);
Form_Main.aTCPAdoClient_Main.Next;
end;
str_Temp :='select distinct c.dept_no,c.dept_name from wz_safety_4cs.dbo.Tbl_Sys_User_Info as a,wz_safety_4cs.dbo.Tbl_Sys_Role_Dept_Info as b,';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_DEPT_INFO as c where a.role_no=b.role_no and b.dept_no=c.dept_no ';
str_Temp := str_Temp + ' and b.dept_no in (' + str_Current_Role_Dept_List + ')';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_Dept_Name.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('dept_name').Text);
cbb_Dept_No.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('DEPT_NO').Text);
cbb_Dept_Name1.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('dept_name').Text);
cbb_Dept_No1.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('DEPT_NO').Text);
Form_Main.aTCPAdoClient_Main.Next;
end;
str_Temp := 'select type_no,text from wz_safety.dbo.tk_typereference where type=18';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
Cbb_B4employ_state.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('text').Text);
Cbb_B4employ_type.Items.Add(Form_Main.aTCPAdoClient_Main.FieldByName('type_no').Text);
Form_Main.aTCPAdoClient_Main.Next;
end;
cbb_Mount_Flag.Items.Add('不在岗');
cbb_Mount_Flag.Items.Add('在岗');
cbb_Mount_Flag.Items.Add('待岗');
cbb_Mount_No.Items.Add('0');
cbb_Mount_No.Items.Add('1');
cbb_Mount_No.Items.Add('2');
cbb_Sex.Items.Add('女');
cbb_Sex.Items.Add('男');
//cbb_Sex.ItemIndex :=-1;
sex:=cbb_Sex.Text;
edt_Final_Editer.Text := str_Current_User_Name;
dtp_Formal_Date.Date := Now;
dtp_First_Date.Date :=Now;
dtp_Force_Dimmission.Date :=now;
dtp_Auto_Dimmission.Date :=Now;
dtp_Join_Date.Date := Now;
dtp_Manager_Date.Date := Now;
dtp_Birth_Date.Date := IncYear(Now,-20);
dbgrdh_Emp_Info.Columns[0].Width :=70;
dbgrdh_Emp_Info.Columns[1].Width :=50;
dbgrdh_Emp_Info.Columns[2].Width :=64;
dbgrdh_Emp_Info.Columns[3].Width :=110;
dbgrdh_Emp_Info.Columns[4].Width :=150;
dbgrdh_Emp_Info.Columns[5].Width :=90;
dbgrdh_Emp_Info.Columns[6].Width :=141;
dbgrdh_Emp_Info.Columns[7].Width :=148;
//添加或查看档案初始化结束
//添加或查看协议初始化
GroupBox2.Left :=1;
btn_Add1.Enabled :=False;
dtp_Start_Time1.Date := Now;
dtp_End_Time1.Date := Now;
str_Temp := 'SELECT ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.EMP_NO, ' + str_DB_Name + '.dbo.TK_DEPT_INFO.SIMPLE_NAME AS DEPT_NAME, ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.WORKER_NO, ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.NAME, ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.S_DATE, ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.E_DATE, ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.NOTE FROM ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT INNER JOIN ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_DEPT_INFO ON ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.DEPT_NO = ' + str_DB_Name + '.dbo.TK_DEPT_INFO.DEPT_NO INNER JOIN ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO ON ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.EMP_NO = ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.EMP_NO ';
str_Temp := str_Temp + ' AND (' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.DEPT_NO IN (' + str_Current_Role_Dept_List + '))';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_Contract_Info1.Clone(Form_Main.aTCPAdoClient_Main, ltReadOnly);
dbgrdh_Contract_Info1.DataSource := ds_Contract_Info1;
dbgrdh_Contract_Info1.Columns[0].Width:=80;
dbgrdh_Contract_Info1.Columns[1].Width:=60;
dbgrdh_Contract_Info1.Columns[2].Width:=70;
dbgrdh_Contract_Info1.Columns[3].Width:=160;
dbgrdh_Contract_Info1.Columns[4].Width:=100;
dbgrdh_Contract_Info1.Columns[5].Width:=100;
dbgrdh_Contract_Info1.Columns[6].Width:=165;
//添加或查看协议初始化结束
//驾驶员等级管理初始化
str_Temp := 'select type_no,text from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=5 and type_no>=3';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
if Form_Main.aTCPAdoClient_Main.Fields.Count<>0 then
begin
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_Grade2.Items.Add(Form_Main.aTCPAdoClient_Main.Fields[1].AsString);
cbb_Grade_No2.Items.Add(Form_Main.aTCPAdoClient_Main.Fields[0].AsString);
Form_Main.aTCPAdoClient_Main.Next;
end;
end;
cbb_Grade2.ItemIndex := 0;
cbb_Grade2Change(Sender);
for int_4loop := 1 to 12 do
begin
if int_4loop<10 then
begin
cbb_Month2.Items.Add('0' + IntToStr(int_4loop));
end
else
begin
cbb_Month2.Items.Add(IntToStr(int_4loop));
end;
end;
for int_4loop :=0 to 5 do
begin
int_Year := StrToInt(Copy(DateToStr(Now),1,4));
cbb_Year2.Items.Add(IntToStr(int_Year-int_4loop));
end;
cbb_Month2.ItemIndex := 0;
cbb_Year2.ItemIndex := 0;
dbgrdh_Driver_Grade2.DataSource := ds_Driver_Grade2;
dbgrdh_Driver_Grade2.Columns[0].Width := 62;
dbgrdh_Driver_Grade2.Columns[1].Width := 70;
dbgrdh_Driver_Grade2.Columns[2].Width := 117;
dbgrdh_Driver_Grade2.Columns[3].Width := 65;
dbgrdh_Driver_Grade2.Columns[4].Width := 90;
dbgrdh_Driver_Grade2.Columns[5].Width := 100;
dbgrdh_Driver_Grade_Init2.DataSource := ds_Driver_GradeThree2;
dbgrdh_Driver_Grade_Init2.Columns[0].Width := 70;
dbgrdh_Driver_Grade_Init2.Columns[1].Width := 80;
dbgrdh_Driver_Grade_Init2.Columns[2].Width := 150;
dbgrdh_Driver_Grade_Init2.Columns[3].Width := 100;
dbgrdh_Driver_Grade_Init2.Columns[4].Width := 100;
//驾驶员等级管理初始化结束
//修改员工工号初始化
//修改员工工号初始化结束
if int_User_Operate_Level = 0 then
begin
btn_Add.Enabled := False;
btn_Add1.Enabled := False;
btn_Update2.Enabled := False;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Mount_FlagChange(Sender: TObject);
begin
inherited;
cbb_Mount_No.ItemIndex :=cbb_Mount_Flag.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_SexChange(Sender: TObject);
begin
inherited;
Sex:=cbb_Sex.Text;
end;
procedure TForm_Driver_Info_Register.cbb_Regist_TypeChange(
Sender: TObject);
begin
inherited;
cbb_Regist_Type_No.ItemIndex :=cbb_Regist_Type.ItemIndex;
end;
procedure TForm_Driver_Info_Register.btn_ExitClick(Sender: TObject);
begin
inherited;
close;
end;
procedure TForm_Driver_Info_Register.cbb_work_TypeChange(Sender: TObject);
begin
inherited;
cbb_Work_Type_No.ItemIndex :=cbb_work_Type.ItemIndex;
//if cbb_Work_Type_No.Text ='1' then
//begin
//cbb_Assure_Company.ItemIndex :=-1;
//cbb_Assure_Company.Enabled := False;
//cbb_Assure_Company_No.ItemIndex :=-1;
//dtp_Formal_Date.Enabled :=True;
//end
//else
//begin
//cbb_Assure_Company.Enabled := True;
//dtp_Formal_Date.Enabled :=False;
//end;
end;
procedure TForm_Driver_Info_Register.cbb_Assure_CompanyOnChange(
Sender: TObject);
begin
inherited;
cbb_Assure_Company_No.ItemIndex :=cbb_Assure_Company.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_DutyChange(Sender: TObject);
begin
inherited;
cbb_Duty_No.ItemIndex :=cbb_Duty.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_Driver_GradeChange(
Sender: TObject);
begin
inherited;
cbb_Driver_Grade_No.ItemIndex :=cbb_Driver_Grade.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_Dept_NameChange(Sender: TObject);
begin
inherited;
cbb_Dept_No.ItemIndex :=cbb_Dept_Name.ItemIndex;
str_temp := 'select line_no,line_name from ' + str_DB_Name + '.dbo.zy_line_info where dept_no=''' + cbb_dept_no.Text + '''';
Form_Main.aTCPAdoClient_Main.Open(str_temp);
cbb_line_no.Clear;
cbb_line_name.Clear;
while not Form_Main.aTCPAdoClient_Main.Eof do
begin
cbb_line_no.Items.Add(Form_main.aTCPAdoClient_Main.Fields[0].AsString);
cbb_line_name.Items.Add(Form_main.aTCPAdoClient_Main.Fields[1].AsString);
Form_Main.aTCPAdoClient_Main.Next;
end;
end;
procedure TForm_Driver_Info_Register.QueryEmp(pKey: string; pFlag: Integer);
begin
if pFlag =1 then
begin
str_Temp := 'select emp_no,name,worker_no,dept_name,a.note from ' + str_DB_Name + '.dbo.tk_employee_info as a,' + str_DB_Name + '.dbo.tk_dept_info as b where a.dept_no=b.dept_no and name=''' + edt_Emp_Name3.Text + '''';
end;
if pFlag =2 then
begin
str_Temp := 'select emp_no,name,worker_no,dept_name,a.note from ' + str_DB_Name + '.dbo.tk_employee_info as a,' + str_DB_Name + '.dbo.tk_dept_info as b where a.dept_no=b.dept_no and Emp_no=''' + edt_Emp_No3.Text + '''';
end;
if pFlag =3 then
begin
str_Temp := 'select emp_no,name,worker_no,dept_name,a.note from ' + str_DB_Name + '.dbo.tk_employee_info as a,' + str_DB_Name + '.dbo.tk_dept_info as b where a.dept_no=b.dept_no and Worker_No=''' + edt_Worker_No3.Text + '''';
end;
SQL_temp3 :=str_Temp;
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_Emp_Info3.Clone(Form_Main.aTCPAdoClient_Main, ltReadOnly);
if qry_Emp_Info3.RecordCount > 0 then
begin
edt_Emp_Name3.Text := Form_Main.aTCPAdoClient_Main.FieldByName('Name').Text;
edt_Emp_No3.Text :=Form_Main.aTCPAdoClient_Main.FieldByName('Emp_No').Text;
edt_Worker_No3.Text :=Form_Main.aTCPAdoClient_Main.FieldByName('Worker_No').Text;
dbgrdh_Emp_Info3.DataSource := ds_Emp_Info3;
end
else
begin
dbgrdh_Emp_Info3.DataSource := nil;
if pFlag = 1 then
begin
Msg('您输入的姓名错误!');
end;
if pFlag = 2 then
begin
Msg('您输入的员工编号错误!');
end;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_Name3OnExit(Sender: TObject);
begin
inherited;
if edt_Emp_Name3.Text ='' then
begin
dbgrdh_Emp_Info3.DataSource := nil;
Exit;
end
else
begin
QueryEmp(edt_Emp_Name3.text, 1);
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_No3OnExit(Sender: TObject);
begin
inherited;
if edt_Emp_No3.Text ='' then
begin
dbgrdh_Emp_Info3.DataSource := nil;
Exit;
end
else
begin
dbgrdh_Emp_Info3.DataSource := nil;
QueryEmp(edt_Emp_No3.text, 2);
end;
end;
procedure TForm_Driver_Info_Register.edt_Worker_No3Change(Sender: TObject);
begin
inherited;
if (Trim(edt_Worker_No3.Text) = '') or (Trim(edt_Emp_Name3.Text) = '') or (Trim(edt_Emp_No3.Text) = '') then
begin
btn_Update3.Enabled :=False;
end
else
begin
btn_Update3.Enabled :=True;
end;
end;
procedure TForm_Driver_Info_Register.btn_Update3Click(Sender: TObject);
var
Result: Integer;
d: string;
begin
inherited;
str_Temp :='select convert(varchar(23),getdate(),120)';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
d := Form_Main.aTCPAdoClient_Main.Fields[0].Value;
str_Temp:='exec ' + str_DB_Name + '.dbo.SP_U_EMP_WORKERNO '+ edt_Emp_No3.Text + ',' + edt_Worker_No3.Text + ',''' +
str_Current_User_Name +''','''+d+'''';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
Result :=Form_Main.aTCPAdoClient_Main.Fields[0].Value;
if Result = 9003 then
begin
ShowMessage('要更新的员工不存在!');
end;
if Result = 9004 then
begin
ShowMessage('工号首两位数字不正确!');
end;
if Result = 9000 then
begin
ShowMessage('更新员工编号为:' + edt_Emp_No3.Text + ' 的员工记录 成功!');
Form_Main.aTCPAdoClient_Main.Open(SQL_temp3);
qry_Emp_Info3.Clone(Form_Main.aTCPAdoClient_Main, ltReadOnly);
end;
if Result = 9001 then
begin
ShowMessage('更新员工编号为:' + edt_Emp_No3.Text + ' 的员工记录 失败!');
end;
end;
procedure TForm_Driver_Info_Register.btn_ExplorClick(Sender: TObject);
begin
inherited;
str_Temp :='SELECT c.EMP_NO, c.NAME, c.WORKER_NO, b.SIMPLE_NAME ,';
str_Temp :=str_Temp + ' c.ASSURE_COMPANY_NAME,a.ARCHIVES_NO, a.ARCH_S_DATE,a.NOTE';
str_Temp :=str_Temp + ' FROM ' + str_DB_Name + '.dbo.TK_ARCHIVES_INFO as a, ' + str_DB_Name + '.dbo.TK_DEPT_INFO as b, ';
str_Temp :=str_Temp + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO as c';
str_Temp :=str_Temp + ' WHERE a.DEPT_NO = b.DEPT_NO and a.EMP_NO = c.EMP_NO';
if edt_Emp_No.Text <>'' then
begin
str_Temp :=str_Temp + ' and a.EMP_NO = ' + edt_Emp_No.Text ;
end;
if edt_Worker_No.Text <> '' then
begin
str_Temp :=str_Temp + ' and c.worker_no = ' + edt_Worker_No.Text ;
end;
if cbb_Mount_Flag.Text <>'' then
begin
str_Temp :=str_Temp + ' and c.Mount_Flag = ' + IntToStr(cbb_Mount_Flag.ItemIndex);
end;
if edt_Emp_Name.Text <> '' then
begin
str_Temp := str_Temp + ' and c.name like ''%' + edt_Emp_Name.Text + '%''';
end;
if cbb_Sex.Text <> '' then
begin
str_Temp := str_Temp + ' and c.sex = ''' + cbb_Sex.Text + '''';
end;
if edt_Id_No.Text <>'' then
begin
str_Temp := str_Temp + ' and c.Id_No = ''' + edt_Id_No.Text + '''';
end;
if cbb_Dept_Name.Text <> '' then
begin
str_Temp := str_Temp + ' and b.dept_name = ''' + cbb_Dept_Name.Text + '''';
end;
if cbb_Duty.Text <> '' then
begin
str_Temp := str_Temp + ' and c.duty = ''' + cbb_Duty_No.Text +'''';
end;
if cbb_Regist_Type.Text <> '' then
begin
str_Temp := str_Temp + ' and c.register_type = ' + cbb_Regist_Type_No.Text;
end;
if cbb_Assure_Company.Text <> '' then
begin
str_Temp := str_Temp + ' and c.ASSURE_COMPANY = ' + cbb_Assure_Company_No.Text;
end;
if cbb_work_Type.Text <> '' then
begin
str_Temp := str_Temp + ' and c.work_type = ' + cbb_Work_Type_No.Text;
end;
if edt_Driver_Type.Text <> '' then
begin
str_Temp := str_Temp + ' and c.Driver_Type = ''' + edt_Driver_Type.Text + '''';
end;
if edt_Driver_No.Text <> '' then
begin
str_Temp := str_Temp + ' and c.driver_no = ''' + edt_Driver_No.Text + '''';
end;
if cbb_Driver_Grade.Text <> '' then
begin
str_Temp := str_Temp + ' and c.driver_grade = ' + cbb_Driver_Grade_No.Text;
end;
str_Temp := str_Temp + ' and a.dept_no in (' + str_Current_Role_Dept_List +')';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_Emp_Info.Clone(Form_Main.aTCPAdoClient_Main, ltReadOnly);
dbgrdh_Emp_Info.DataSource := ds_Emp_Info;
edt_Emp_No1.Text := qry_Emp_Info.Fields[0].Text;
dbgrdh_Emp_Info.Columns[0].Width :=70;
dbgrdh_Emp_Info.Columns[1].Width :=50;
dbgrdh_Emp_Info.Columns[2].Width :=64;
dbgrdh_Emp_Info.Columns[3].Width :=110;
dbgrdh_Emp_Info.Columns[4].Width :=150;
dbgrdh_Emp_Info.Columns[5].Width :=90;
dbgrdh_Emp_Info.Columns[6].Width :=141;
dbgrdh_Emp_Info.Columns[7].Width :=148;
end;
function tform_driver_info_register.CheckData(): Boolean;
begin
//员工编号
//edt_Emp_No.Text;
// 部门编号
if cbb_Dept_No.Text='' then
begin
ShowMessage('请选择驾驶员所在的部门');
CheckData:= false;
exit;
end;
// 工号 function AnsiStartsText(const ASubText, AText: string): Boolean;
if not AnsiStartsText(cbb_Dept_No.Text,edt_Worker_No.text) then
begin
ShowMessage('填写的工号格式不正确,请重新填写');
CheckData:= false;
exit;
end;
// 档案编号
//edt_Archives_No.Text;
// 驾驶证号
//edt_Driver_No;
// 准驾车类
//edt_Driver_Type;
// 初领驾驶证日期
//dtp_First_Date.DateTime
// 驾驶员等级
//cbb_Driver_Grade_No.Text;
// 用工性质
if cbb_Work_Type_No.Text <> '1' then
begin
if cbb_Assure_Company_No.ItemIndex = -1 then
begin
ShowMessage('请选择输送单位!');
Exit;
end;
end;
// 户籍类型
//cbb_Regist_Type_No.Text;
// 输送单位 用工性质
if cbb_Work_Type_No.Text='1' then
begin
if cbb_Assure_Company.ItemIndex > 0 then
begin
ShowMessage('合同工不能选择选择输送单位');
CheckData:= false;
exit;
end;
end
else
begin
end;
CheckData:= true;
end;
procedure TForm_Driver_Info_Register.dbgrdh_Emp_InfoOnDblClick(
Sender: TObject);
begin
inherited;
str_Temp :='select * from ' + str_DB_Name + '.dbo.tk_employee_info where emp_no=' + IntToStr(qry_Emp_Info.Fields[0].Value);
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
if Form_Main.aTCPAdoClient_Main.RecordCount <> 0 then
begin
edt_Archives_No.Text := Form_Main.aTCPAdoClient_Main.Fields[5].Value;
edt_Emp_No.Text := Form_Main.aTCPAdoClient_Main.Fields[0].Value;
if Form_Main.aTCPAdoClient_Main.Fields[4].Value=null then
begin
edt_Worker_No.Text := '';
end
else
begin
edt_Worker_No.Text := Form_Main.aTCPAdoClient_Main.Fields[4].Value;
end;
cbb_Mount_No.ItemIndex := Form_Main.aTCPAdoClient_Main.Fields[14].Value;
cbb_Mount_NoOnChange(Sender);
dtp_Join_Date.Date := Form_Main.aTCPAdoClient_Main.Fields[21].Value;
edt_Emp_Name.Text := Form_Main.aTCPAdoClient_Main.Fields[18].Value;
cbb_Sex.Text := Form_Main.aTCPAdoClient_Main.Fields[19].Value;
dtp_Birth_Date.Date := Form_Main.aTCPAdoClient_Main.Fields[20].Value;
edt_Id_No.Text := Form_Main.aTCPAdoClient_Main.Fields[23].Value;
edt_Address_Org.Text :=Form_Main.aTCPAdoClient_Main.Fields[25].Value;
edt_Native_Place.Text := Form_Main.aTCPAdoClient_Main.Fields[24].Value;
if Form_Main.aTCPAdoClient_Main.Fields[26].Value=null then
begin
edt_Address_Now.Text :='';
end
else
begin
edt_Address_Now.Text :=Form_Main.aTCPAdoClient_Main.Fields[26].Value;
end;
if Form_Main.aTCPAdoClient_Main.Fields[27].Value=null then
begin
edt_Tell.Text := '';
end
else
begin
edt_Tell.Text := Form_Main.aTCPAdoClient_Main.Fields[27].Value;
end;
cbb_Dept_No.ItemIndex:=cbb_Dept_No.Items.IndexOf(Form_Main.aTCPAdoClient_Main.Fields[2].Value);
cbb_Dept_NoOnChange(Sender);
cbb_Duty_No.ItemIndex := Form_Main.aTCPAdoClient_Main.Fields[22].Value - 1;
cbb_Duty_NoOnChange(Sender);
cbb_Regist_Type_No.ItemIndex := Form_Main.aTCPAdoClient_Main.Fields[11].Value - 1;
cbb_Regist_Type_NoOnChange(Sender);
if Form_Main.aTCPAdoClient_Main.Fields[12].Value <>null then
begin
cbb_Assure_Company_No.ItemIndex := cbb_Assure_Company_No.Items.IndexOf(Form_Main.aTCPAdoClient_Main.Fields[12].Value);
end
else
begin
cbb_Assure_Company_No.ItemIndex := -1;
end;
cbb_Assure_Company_NoChange(Sender);
if Form_Main.aTCPAdoClient_Main.Fields[15].Value = null then
begin
dtp_Formal_Date.Enabled := False;
end
else
begin
dtp_Formal_Date.Enabled := true;
dtp_Formal_Date.Date := Form_Main.aTCPAdoClient_Main.Fields[15].Value;
end;
cbb_Work_Type_No.ItemIndex := Form_Main.aTCPAdoClient_Main.Fields[10].Value - 1;
cbb_work_Type_NoChange(Sender);
edt_Driver_Type.Text := Form_Main.aTCPAdoClient_Main.Fields[7].Value;
if Form_Main.aTCPAdoClient_Main.Fields[8].Value = null then
begin
dtp_First_Date.Date :=0;
end
else
begin
dtp_First_Date.Date := Form_Main.aTCPAdoClient_Main.Fields[8].Value;
end;
if Form_Main.aTCPAdoClient_Main.Fields[6].Value = null then
begin
edt_Driver_No.Text := ''
end
else
begin
edt_Driver_No.Text :=Form_Main.aTCPAdoClient_Main.Fields[6].Value;
end;
cbb_Driver_Grade_No.ItemIndex := cbb_Driver_Grade_No.Items.IndexOf(Form_Main.aTCPAdoClient_Main.Fields[9].Value);
cbb_Driver_Grade_NoChange(Sender);
if Form_Main.aTCPAdoClient_Main.Fields[16].Value = null then
begin
dtp_Auto_Dimmission.Enabled := False;
end
else
begin
dtp_Auto_Dimmission.Enabled := True;
dtp_Auto_Dimmission.Date := Form_Main.aTCPAdoClient_Main.Fields[16].Value
end;
if Form_Main.aTCPAdoClient_Main.Fields[17].Value = null then
begin
dtp_Force_Dimmission.Enabled := False;
end
else
begin
dtp_Force_Dimmission.Date := Form_Main.aTCPAdoClient_Main.Fields[17].Value;
dtp_Force_Dimmission.Enabled;
end;
if Form_Main.aTCPAdoClient_Main.Fields[31].Value = null then
begin
mmo_Remark.Text :='';
end
else
begin
mmo_Remark.Text := Form_Main.aTCPAdoClient_Main.Fields[31].Value;
end;
edt_Final_Editer.Text := Form_Main.aTCPAdoClient_Main.Fields[29].Value;
dtp_Manager_Date.Date := Form_Main.aTCPAdoClient_Main.Fields[30].Value;
end;
edt_Emp_No1.Text := qry_Emp_Info.Fields[0].Text;
end;
procedure TForm_Driver_Info_Register.cbb_Mount_NoOnChange(Sender: TObject);
begin
inherited;
cbb_Mount_Flag.ItemIndex := cbb_Mount_No.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_Dept_NoOnChange(Sender: TObject);
begin
inherited;
cbb_Dept_Name.ItemIndex := cbb_Dept_No.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_Duty_NoOnChange(Sender: TObject);
begin
inherited;
cbb_Duty.ItemIndex := cbb_Duty_No.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_Regist_Type_NoOnChange(
Sender: TObject);
begin
inherited;
cbb_Regist_Type.ItemIndex := cbb_Regist_Type_No.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_Assure_Company_NoChange(
Sender: TObject);
begin
inherited;
cbb_Assure_Company.ItemIndex := cbb_Assure_Company_No.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_work_Type_NoChange(
Sender: TObject);
begin
inherited;
cbb_work_Type.ItemIndex := cbb_Work_Type_No.ItemIndex;
end;
procedure TForm_Driver_Info_Register.cbb_Driver_Grade_NoChange(
Sender: TObject);
begin
inherited;
cbb_Driver_Grade.ItemIndex := cbb_Driver_Grade_No.ItemIndex;
end;
procedure TForm_Driver_Info_Register.btn_ClearClick(Sender: TObject);
begin
inherited;
edt_Archives_No.Text :='';
edt_Emp_No.Text :='';
edt_Worker_No.Text :='';
cbb_Mount_No.ItemIndex := -1;
cbb_Mount_Flag.ItemIndex :=-1;
edt_Emp_Name.Text :='';
cbb_Sex.ItemIndex :=-1;
edt_Id_No.Text :='';
edt_Address_Org.Text :='';
edt_Address_Now.Text :='';
edt_Native_Place.Text :='';
edt_Tell.Text :='';
cbb_Dept_No.ItemIndex :=-1;
cbb_Dept_Name.ItemIndex :=-1;
cbb_Duty.ItemIndex :=-1;
cbb_Duty_No.ItemIndex :=-1;
cbb_Regist_Type_No.ItemIndex :=-1;
cbb_Regist_Type.ItemIndex :=-1;
cbb_Assure_Company_No.ItemIndex :=-1;
cbb_Assure_Company.ItemIndex :=-1;
cbb_Assure_Company.Enabled :=True;
dtp_Formal_Date.Enabled :=True;
cbb_Work_Type_No.ItemIndex :=-1;
cbb_work_Type.ItemIndex :=-1;
edt_Driver_Type.Text :='';
edt_Driver_No.Text :='';
cbb_Driver_Grade_No.ItemIndex :=-1;
cbb_Driver_Grade.ItemIndex :=-1;
dtp_Auto_Dimmission.Enabled :=True;
dtp_Force_Dimmission.Enabled :=True;
mmo_Remark.Text :='';
edt_Final_Editer.Text :='';
dtp_Join_Date.Date := Now;
dtp_Formal_Date.Date := Now;
dtp_First_Date.Date :=Now;
dtp_Auto_Dimmission.Date :=now;
dtp_Force_Dimmission.Date :=Now;
dtp_Manager_Date.Date := Now;
end;
procedure TForm_Driver_Info_Register.edt_Emp_No1Change(Sender: TObject);
begin
inherited;
if (edt_Emp_No1.Text <>'') and (cbb_Dept_Name1.ItemIndex <> -1) and (DateToStr(dtp_Start_Time1.Date) < DateToStr(dtp_End_Time1.Date)) and (int_User_Operate_Level>0) then
begin
btn_Add1.Enabled :=True;
end
else
begin
btn_Add1.Enabled := False;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Dept_Name1Change(Sender: TObject);
begin
inherited;
cbb_Dept_No1.ItemIndex := cbb_Dept_Name1.ItemIndex;
if (edt_Emp_No1.Text <>'') and (cbb_Dept_No1.ItemIndex<>-1) and (DateToStr(dtp_Start_Time1.Date)<DateToStr(dtp_End_Time1.Date)) and (int_User_Operate_Level>0) then
begin
btn_Add1.Enabled:=True;
end
else
begin
btn_Add1.Enabled:=False;
end;
end;
procedure TForm_Driver_Info_Register.btn_Add1Click(Sender: TObject);
begin
inherited;
Err_str := '';
str_Temp := 'exec ' + str_DB_Name + '.DBO.SP_I_TK_EMPLOYEE_CONTRACT ' + edt_Emp_No1.Text + ', ' + cbb_Dept_No1.Text + ', ''' + DateToStr(dtp_Start_Time1.Date) + ''', ''';
str_Temp := str_Temp + DateToStr(dtp_End_Time1.Date) + ''', ''' + edt_Remark1.Text + ''', ''' + Err_str + '''';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
if Form_Main.aTCPAdoClient_Main.Fields[0].Value = 9000 then
begin
ShowMessage('协议添加成功!');
end;
if Form_Main.aTCPAdoClient_Main.Fields[0].Value = 9002 then
begin
ShowMessage('协议已存在!');
end;
if Form_Main.aTCPAdoClient_Main.Fields[0].Value = 9001 then
begin
ShowMessage('协议添加失败!');
end;
if Form_Main.aTCPAdoClient_Main.Fields[0].Value = 9003 then
begin
ShowMessage('该员工编号不存在!');
end;
str_Temp := 'SELECT ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.EMP_NO, ' + str_DB_Name + '.dbo.TK_DEPT_INFO.SIMPLE_NAME AS DEPT_NAME, ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.WORKER_NO, ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.NAME, ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.S_DATE, ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.E_DATE, ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.NOTE FROM ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT INNER JOIN ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_DEPT_INFO ON ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.DEPT_NO = ' + str_DB_Name + '.dbo.TK_DEPT_INFO.DEPT_NO INNER JOIN ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO ON ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.EMP_NO = ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.EMP_NO ';
str_Temp := str_Temp + ' AND (' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.EMP_NO = ' + edt_Emp_No1.Text + ')';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_Contract_Info1.Clone(Form_Main.aTCPAdoClient_Main, ltReadOnly);
dbgrdh_Contract_Info1.DataSource := ds_Contract_Info1;
end;
procedure TForm_Driver_Info_Register.dtp_Start_Time1OnChange(
Sender: TObject);
begin
inherited;
if (edt_Emp_No1.Text<>'') and (cbb_Dept_No1.ItemIndex<>-1) and (DateToStr(dtp_Start_Time1.date)<DateToStr(dtp_End_Time1.date)) then
begin
btn_Add1.Enabled:=True;
end
else
begin
btn_Add1.Enabled:=False;
end;
end;
procedure TForm_Driver_Info_Register.dtp_End_Time1OnChange(
Sender: TObject);
begin
inherited;
if (edt_Emp_No1.Text<>'') and (cbb_Dept_No1.ItemIndex<>-1) and (DateToStr(dtp_Start_Time1.date)<DateToStr(dtp_End_Time1.date)) then
begin
btn_Add1.Enabled:=True;
end
else
begin
btn_Add1.Enabled:=False;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Grade_No2Change(
Sender: TObject);
begin
inherited;
cbb_Grade2.ItemIndex := cbb_Grade_No2.ItemIndex;
end;
procedure TForm_Driver_Info_Register.edt_Emp_Name3Change(Sender: TObject);
begin
inherited;
if (Trim(edt_Emp_Name3.Text) <>'') and (Trim(edt_Emp_No3.Text)<>'') and (Trim(edt_Worker_No3.Text)<>'') then
begin
btn_Update3.Enabled :=True;
end
else
begin
btn_Update3.Enabled :=False;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_No3Change(Sender: TObject);
begin
inherited;
if (Trim(edt_Emp_Name3.Text) <>'') and (Trim(edt_Emp_No3.Text)<>'') and (Trim(edt_Worker_No3.Text)<>'') then
begin
btn_Update3.Enabled :=True;
end
else
begin
btn_Update3.Enabled :=False;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_No3OnKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if not (Key in ['0','1','2','3','4','5','6','7','8','9',#13,#8]) then
begin
Msg('请输入数字型字符!');
Key:=#0;
end;
if Key = #13 then
begin
edt_Worker_No3.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Worker_No3OnKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if not (Key in ['0','1','2','3','4','5','6','7','8','9',#13,#8]) then
begin
Msg('请输入数字型字符!');
Key:=#0;
end;
if Key = #13 then
begin
if btn_Update3.Enabled = True then
begin
btn_Update3.SetFocus;
end;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_No2OnKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
{if not (Key in ['0','1','2','3','4','5','6','7','8','9',#13,#8]) then
begin
Msg('请输入数字型字符!');
Key:=#0;
end;}
if Key = #13 then
begin
edt_Emp_Name2.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_No1OnKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if not (Key in ['0','1','2','3','4','5','6','7','8','9',#13,#8]) then
begin
Msg('请输入数字型字符!');
Key:=#0;
end;
if Key = #13 then
begin
cbb_Dept_Name1.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_NoOnKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
//if not (Key in ['0'..'9',#13,#8]) then
//begin
// Msg('请输入数字型字符!');
// Key:=#0;
//end;
//if Key=#13 then
//begin
// edt_Worker_No.SetFocus;
//end;
end;
procedure TForm_Driver_Info_Register.edt_Worker_NoOnKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if not (Key in ['0'..'9',#13,#8]) then
begin
Msg('请输入数字型字符!');
Key:=#0;
end;
if Key=#13 then
begin
cbb_Mount_Flag.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Id_NoOnKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Length(edt_Id_No.Text)>=18 then
begin
Key:=#0;
end;
if Key=#13 then
begin
edt_Address_Org.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Id_NoOnExit(Sender: TObject);
begin
inherited;
if (Length(edt_Id_No.Text)<>18) and (Length(edt_Id_No.Text)<>0) then
begin
Msg('身份证号输入错误!');
edt_Id_No.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
inherited;
if Assigned(qry_Emp_Info) then qry_Emp_Info.Free;
if Assigned(qry_Contract_Info1) then qry_Contract_Info1.Free;
if Assigned(qry_Driver_Grade2) then qry_Driver_Grade2.Free;
if Assigned(qry_Emp_Info3) then qry_Emp_Info3.Free;
if Assigned(ds_Emp_Info) then ds_Emp_Info.Free;
if Assigned(ds_Contract_Info1) then ds_Contract_Info1.Free;
if Assigned(ds_Driver_Grade2) then ds_Driver_Grade2.Free;
if Assigned(ds_Emp_Info3) then ds_Emp_Info3.Free;
end;
procedure TForm_Driver_Info_Register.edt_TellChange(Sender: TObject;
var Key: Char);
begin
inherited;
//if not (Key in ['0'..'9',#13,#8,#45]) then
//begin
// Msg('请输入正确的电话号码!');
// Key:=#0;
//end;
//if Key=#13 then
//begin
// cbb_Dept_Name.SetFocus;
//end;
end;
procedure TForm_Driver_Info_Register.chk_Auto_DimmissionClick(
Sender: TObject);
begin
inherited;
if chk_Auto_Dimmission.Checked then
begin
dtp_Auto_Dimmission.Enabled:=True;
chk_Force_Dimmission.Checked:=False;
dtp_Force_Dimmission.Enabled:=False;
end
else
begin
dtp_Auto_Dimmission.Enabled:=False;
end;
end;
procedure TForm_Driver_Info_Register.chk_Force_DimmissionClick(
Sender: TObject);
begin
inherited;
if chk_Force_Dimmission.Checked then
begin
dtp_Force_Dimmission.Enabled := True;
chk_Auto_Dimmission.Checked := False;
dtp_Auto_Dimmission.Enabled := False;
end
else
begin
dtp_Force_Dimmission.Enabled := False;
end;
end;
procedure TForm_Driver_Info_Register.edt_Driver_NoKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
//if not (Key in ['0'..'9',#13,#8]) then
//begin
// Msg('请输入数字型字符!');
// Key:=#0;
//end;
//if Key=#13 then
//begin
// cbb_Driver_Grade.SetFocus;
//end;
end;
procedure TForm_Driver_Info_Register.btn_BrowsClick(Sender: TObject);
begin
inherited;
str_Temp := 'SELECT ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.EMP_NO, ' + str_DB_Name + '.dbo.TK_DEPT_INFO.SIMPLE_NAME AS DEPT_NAME, ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.WORKER_NO, ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.NAME, ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.S_DATE, ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.E_DATE, ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.NOTE FROM ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT INNER JOIN ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_DEPT_INFO ON ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.DEPT_NO = ' + str_DB_Name + '.dbo.TK_DEPT_INFO.DEPT_NO INNER JOIN ';
str_Temp := str_Temp + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO ON ' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.EMP_NO = ' + str_DB_Name + '.dbo.TK_VIEW_EMPLOYEE_INFO.EMP_NO ';
if cbb_Dept_No1.ItemIndex = -1 then
begin
str_Temp := str_Temp + ' AND (' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.DEPT_NO IN (' + str_Current_Role_Dept_List + '))';
end
else
begin
str_Temp := str_Temp + ' AND (' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.DEPT_NO = ' + cbb_Dept_No1.Text + ')';
end;
if edt_Emp_No1.Text <> '' then
begin
str_Temp := str_Temp + ' and (' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.emp_no = ' + edt_Emp_No1.Text + ')';
end;
str_Temp := str_Temp + ' and (' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.s_date >= ''' + copy(DateTimeToStr(dtp_Start_Time1.DateTime),1,11) + '00:00:00'')';
str_Temp := str_Temp + ' and (' + str_DB_Name + '.dbo.TK_EMPLOYEE_CONTRACT.e_date <= ''' + copy(DateTimeToStr(dtp_End_Time1.DateTime),1,11) + '00:00:00'')';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_Contract_Info1.Clone(Form_Main.aTCPAdoClient_Main, ltReadOnly);
end;
procedure TForm_Driver_Info_Register.btn_Clear2Click(Sender: TObject);
begin
inherited;
edt_Emp_No2.Text := '';
edt_Emp_Name2.Text := '';
edt_Note2.Text := '';
end;
procedure TForm_Driver_Info_Register.cbb_Grade2Change(Sender: TObject);
begin
inherited;
cbb_Grade_No2.ItemIndex := cbb_Grade2.ItemIndex;
end;
procedure TForm_Driver_Info_Register.btn_Exprolor2Click(Sender: TObject);
begin
inherited;
pnl_msg.Visible := True;
str_Temp := 'select c.name,a.emp_no,b.dept_name,a.award_month,d.parameter_name,a.note,a.dept_no,a.award_level,g.previous_value,d.parameter_value ';
str_Temp := str_Temp + 'from ' + str_DB_Name + '.dbo.TK_DRIVER_LIST_OF_STAR_LEVEL a,' + str_DB_Name + '.dbo.tk_dept_info b,' + str_DB_Name + '.dbo.tk_employee_info c,wz_safety_4cs.dbo.tbl_sys_parameter_info d, ';
str_Temp := str_Temp + '(select e.emp_no,e.add_month,e.previous_value from ' + str_DB_Name + '.dbo.tk_driver_month_value e , (select emp_no,max(add_month) as mmonth from ';
str_Temp := str_Temp + str_DB_Name + '.dbo.tk_driver_month_value group by emp_no) f where e.emp_no=f.emp_no and e.add_month=f.mmonth) g ';
str_Temp := str_Temp + 'where a.emp_no=g.emp_no and a.dept_no=b.dept_no and a.emp_no=c.emp_no and a.award_level=d.parameter_no and d.system_no=''Safety_Management_4CPT_Client''';
str_Temp := str_Temp + ' and catalog_no=''star_level_standard'' and a.dept_no in (' + str_Current_Role_Dept_List + ') and g.previous_value>=d.parameter_value';
if edt_Emp_No2.Text <> '' then
begin
str_Temp := str_Temp + ' and a.emp_no=' + edt_Emp_No2.Text;
end;
if cbb_Grade_No2.ItemIndex <> -1 then
begin
str_Temp := str_Temp + ' and a.award_level=' + cbb_Grade_No2.Text;
end;
if chk_Gain_Date2.Checked then
begin
str_Temp := str_Temp + ' and award_month=''' + cbb_Year2.Text + cbb_Month2.Text + '''';
end;
str_Temp := str_Temp + ' order by a.dept_no,a.emp_no';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_Driver_Grade2.Clone(Form_Main.aTCPAdoClient_Main,ltReadOnly);
lbl1.Caption := '共' + IntToStr(qry_Driver_Grade2.RecordCount) + '条记录';
lbl1.Top := GroupBox2.Height-20;
lbl1.Left := dbgrdh_Driver_Grade2.Left;
lbl2.Top := lbl1.Top;
lbl2.Left := dbgrdh_Driver_Grade_Init2.Left;
{str_Temp := 'select c.name,a.emp_no,d.dept_name,e.parameter_name,a.previous_value,a.dept_no from ' + str_DB_Name + '.dbo.tk_driver_month_value a,';
str_Temp := str_Temp + '(select emp_no,max(add_month) as mmonth from ' + str_DB_Name + '.dbo.tk_driver_month_value group by emp_no) b,';
str_Temp := str_Temp + str_DB_Name + '.dbo.tk_employee_info c,'+ str_DB_Name + '.dbo.tk_dept_info d,wz_safety_4cs.dbo.tbl_sys_parameter_info e ';
str_Temp := str_Temp + 'where a.dept_no= d.dept_no and a.emp_no=c.emp_no and a.emp_no= b.emp_no and a.add_month= b.mmonth and a.today=e.parameter_no ';
str_Temp := str_Temp + 'and e.system_no=''Safety_Management_4CPT_Client'' and catalog_no=''star_level_standard''';
if cbb_Grade_No2.Text = '3' then
begin
str_Temp := str_Temp + ' and a.emp_no not in (select distinct emp_no from ' + str_DB_Name + '.dbo.TK_DRIVER_LIST_OF_STAR_LEVEL) and a.previous_value>=350';
end;
if cbb_Grade_No2.Text = '4' then
begin
str_Temp := str_Temp + ' and a.emp_no not in (select a.emp_no from ' + str_DB_Name + '.dbo.TK_DRIVER_LIST_OF_STAR_LEVEL a, ';
str_Temp := str_Temp + ' (select emp_no,max(award_month) as mmonth from ' + str_DB_Name + '.dbo.TK_DRIVER_LIST_OF_STAR_LEVEL group by emp_no) b';
str_Temp := str_Temp + ' where a.award_month=b.mmonth and a.emp_no=b.emp_no) and a.today<4 and a.previous_value>=650';
end;
if cbb_Grade_No2.Text = '5' then
begin
str_Temp := str_Temp + ' and a.emp_no not in (select a.emp_no from ' + str_DB_Name + '.dbo.TK_DRIVER_LIST_OF_STAR_LEVEL a, ';
str_Temp := str_Temp + ' (select emp_no,max(award_month) as mmonth from ' + str_DB_Name + '.dbo.TK_DRIVER_LIST_OF_STAR_LEVEL group by emp_no) b';
str_Temp := str_Temp + ' where a.award_month=b.mmonth and a.emp_no=b.emp_no) and a.today<5 and a.previous_value>=850';
end;
str_Temp := str_Temp + ' order by a.dept_no,a.emp_no';}
if rb_up.Checked then
str_Temp := 'exec wz_safety_4cs.dbo.SP_S_Driver_Star_Level_Evaluation ' + '1,' + cbb_Grade_No2.Text + ',''' + str_Current_Role_Dept_List + ''''
else
str_Temp := 'exec wz_safety_4cs.dbo.SP_S_Driver_Star_Level_Evaluation ' + '2,' + cbb_Grade_No2.Text + ',''' + str_Current_Role_Dept_List + '''';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_Driver_GradeThree2.Clone(Form_Main.aTCPAdoClient_Main,ltReadOnly);
lbl2.Caption := '共' + IntToStr(qry_Driver_GradeThree2.RecordCount) + '条记录';
pnl_msg.Visible := False;
if (qry_Driver_Grade2.RecordCount = 0) and (qry_Driver_GradeThree2.RecordCount = 0) then
begin
Msg('没有您要查找的数据!');
Exit;
end;
end;
procedure TForm_Driver_Info_Register.chk_Gain_Date2Click(Sender: TObject);
begin
inherited;
if chk_Gain_Date2.Checked then
begin
cbb_Year2.Enabled := True;
cbb_Month2.Enabled := True;
end
else
begin
cbb_Year2.Enabled := False;
cbb_Month2.Enabled := False;
end;
end;
procedure TForm_Driver_Info_Register.dbgrdh_Driver_Grade2DblClick(
Sender: TObject);
begin
inherited;
bool_First_Evaluation := False;
edt_Emp_No2.Text := qry_Driver_Grade2.FieldByName('Emp_No').Text;
edt_Emp_Name2.Text := qry_Driver_Grade2.FieldByName('Name').Text;
cbb_Grade_No2.ItemIndex := cbb_Grade_No2.Items.IndexOf(qry_Driver_Grade2.FieldByName('award_level').Text);
cbb_Grade2.ItemIndex := cbb_Grade_No2.ItemIndex;
edt_Note2.Text := qry_Driver_Grade2.FieldByName('note').Text;
end;
procedure TForm_Driver_Info_Register.btn_Update2Click(Sender: TObject);
begin
inherited;
if int_User_Operate_Level<2 then
begin
Msg('您没有足够的权限!');
Exit;
end;
if edt_Emp_No2.Text = '' then
begin
Msg('请选择要评定的员工!');
Exit
end;
form_Driver_Grade_Evaluation := Tform_Driver_Grade_Evaluation.Create(Self);
form_Driver_Grade_Evaluation.ShowModal;
end;
procedure TForm_Driver_Info_Register.FormActivate(Sender: TObject);
begin
inherited;
GroupBox2.Width := Self.Width-10;
dbgrdh_Driver_Grade2.Width := (GroupBox2.Width div 2)-10;
dbgrdh_Driver_Grade_Init2.Left := dbgrdh_Driver_Grade2.Left + dbgrdh_Driver_Grade2.Width + 5;
dbgrdh_Driver_Grade_Init2.Width := dbgrdh_Driver_Grade2.Width;
lbl_Grade_List2.Left := dbgrdh_Driver_Grade2.Left;
lbl_Init_Grade_List2.Left := dbgrdh_Driver_Grade_Init2.Left;
end;
procedure TForm_Driver_Info_Register.dbgrdh_Driver_Grade_Init2DblClick(
Sender: TObject);
begin
inherited;
edt_Emp_No2.Text :=qry_Driver_GradeThree2.FieldByName('emp_no').Text;
edt_Emp_Name2.Text := qry_Driver_GradeThree2.FieldByName('name').Text;
bool_First_Evaluation := True;
end;
procedure TForm_Driver_Info_Register.cbb_Mount_FlagKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
dtp_Join_Date.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.dtp_Join_DateKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key=#13 then
begin
edt_Emp_Name.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_NameKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key=#13 then
begin
cbb_Sex.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_SexKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
dtp_Birth_Date.SetFocus;
end;
procedure TForm_Driver_Info_Register.dtp_Birth_DateKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
edt_Id_No.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Address_OrgKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
edt_Native_Place.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Native_PlaceKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
edt_Address_Now.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Address_NowKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
edt_Tell.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Dept_NameKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key=#13 then
begin
cbb_Line_Name.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_DutyKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key=#13 then
begin
cbb_Regist_Type.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Regist_TypeKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
cbb_Assure_Company.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Assure_CompanyKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
dtp_Formal_Date.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.dtp_Formal_DateKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
cbb_work_Type.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_work_TypeKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key=#13 then
begin
edt_Driver_Type.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Driver_TypeKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
dtp_First_Date.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.dtp_First_DateKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
edt_Driver_No.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Driver_GradeKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
if dtp_Auto_Dimmission.Enabled = True then
begin
dtp_Auto_Dimmission.SetFocus;
end
else
begin
if dtp_Force_Dimmission.Enabled = True then
begin
dtp_Force_Dimmission.SetFocus;
end
else
begin
mmo_Remark.SetFocus;
end;
end;
end;
end;
procedure TForm_Driver_Info_Register.dtp_Auto_DimmissionKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
if dtp_Force_Dimmission.Enabled = True then
begin
dtp_Force_Dimmission.SetFocus;
end
else
begin
mmo_Remark.SetFocus;
end;
end;
end;
procedure TForm_Driver_Info_Register.dtp_Force_DimmissionKeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key=#13 then
begin
mmo_Remark.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Dept_Name1KeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key = #13 then
begin
dtp_Start_Time1.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.dtp_Start_Time1KeyPress(
Sender: TObject; var Key: Char);
begin
inherited;
if Key = #13 then
begin
dtp_End_Time1.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.dtp_End_Time1KeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key = #13 then
begin
edt_Remark1.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Remark1KeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key = #13 then
begin
if btn_Add1.Enabled = True then
begin
btn_Add1.SetFocus;
end;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_Name2KeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key = #13 then
begin
cbb_Grade2.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Grade2KeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key = #13 then
begin
if cbb_Year2.Enabled = True then
begin
cbb_Year2.SetFocus;
end
else
begin
edt_Note2.SetFocus;
end;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Year2KeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key = #13 then
begin
cbb_Month2.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.cbb_Month2KeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key = #13 then
begin
edt_Note2.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Note2KeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key = #13 then
begin
btn_Update2.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_Name3KeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if Key = #13 then
begin
edt_Emp_No3.SetFocus;
end;
end;
procedure TForm_Driver_Info_Register.edt_Emp_NoExit(Sender: TObject);
var
i: integer;
begin
inherited;
if not trystrtoint(edt_emp_no.Text,i) then
begin
msg('请输入正确的员工编号!');
edt_emp_no.Text := '';
exit;
end;
if edt_emp_name.Text <>'' then
begin
str_temp := 'select op_no,employee_name from Gj_Center.Gj_Center.dbo.zy_worker_info where op_no=''' + edt_emp_no.Text + ''' and employee_name=''' + edt_emp_name.Text + '''';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
if Form_Main.aTCPAdoClient_Main.Eof then
begin
msg('员工编号或姓名错误!');
edt_emp_no.Text:='';
edt_emp_name.Text:='';
end
end
end;
procedure TForm_Driver_Info_Register.edt_Emp_NameExit(Sender: TObject);
begin
inherited;
if edt_emp_no.Text <>'' then
begin
str_temp := 'select op_no,employee_name from Gj_Center.Gj_Center.dbo.zy_worker_info where op_no=''' + edt_emp_no.Text + ''' and employee_name=''' + edt_emp_name.Text + '''';
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
if Form_Main.aTCPAdoClient_Main.Eof then
begin
msg('员工编号或姓名错误!');
edt_emp_no.Text:='';
edt_emp_name.Text:='';
end
end
end;
procedure TForm_Driver_Info_Register.edt_TellExit(Sender: TObject);
var
i:integer;
j:integer;
begin
inherited;
if not (trystrtoint(copy(edt_tell.Text,0,6),i) and trystrtoint(copy(edt_tell.Text,6,12),j)) then
begin
msg('请输入正确的电话号码!');
edt_tell.Text := '';
end
end;
procedure TForm_Driver_Info_Register.Bt_Edt_Employ_StateClick(
Sender: TObject);
begin
inherited;
GroupBox0.Visible :=False;
GroupBox1.Visible :=False;
GroupBox2.Visible :=False;
GroupBox3.Visible :=False;
GroupBox4.Visible :=True;
GroupBox4.Height :=Form_Driver_Info_Register.Height - 80;
dbgrdh_Emp_Info3.Height := GroupBox3.Height - 245;
end;
procedure TForm_Driver_Info_Register.Edt_B4Emp_noExit(Sender: TObject);
begin
inherited;
if trim(Edt_B4Emp_no.Text)<>'' then
begin
str_Temp := 'select name as 姓名,n.emp_no as 员工编号,worker_no as 员工工号,employ_state,text as 聘用情况 from ';
str_Temp := str_Temp + '(select name,a.emp_no,worker_no,employ_state from ' + str_DB_Name + '.dbo.tk_employee_info a left join ' + str_DB_Name + '.dbo.tk_employ_state b on a.emp_no=b.emp_no where dept_no in (' + str_Current_Role_Dept_List + ')) n ';
str_Temp := str_Temp + 'left join (select type_no,text from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=18) m on employ_state=m.type_no where emp_no=''' + trim(Edt_B4emp_no.Text) + '''';
end;
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_B4.Clone(Form_Main.aTCPAdoClient_Main,ltReadOnly);
if Form_Main.aTCPAdoClient_Main.RecordCount<>0 then
begin
Edt_B4Name.Text := Form_Main.aTCPAdoClient_Main.Fields[0].AsString;
Edt_B4Worker_No.Text := Form_Main.aTCPAdoClient_Main.Fields[2].AsString;
Cbb_B4employ_state.ItemIndex := Cbb_B4employ_state.Items.IndexOf(Form_Main.aTCPAdoClient_Main.Fields[4].AsString);
Cbb_B4employ_type.ItemIndex := Cbb_B4employ_type.Items.IndexOf(Form_Main.aTCPAdoClient_Main.Fields[3].AsString);
end
else
begin
showmessage('员工编号有误!');
Edt_B4Emp_no.Text := '';
end;
DBGrid_B4.DataSource := ds_B4;
DBGrid_B4.Columns[0].Width := 160;
DBGrid_B4.Columns[1].Width := 160;
DBGrid_B4.Columns[2].Width := 160;
DBGrid_B4.Columns[3].Width :=0;
DBGrid_B4.Columns[4].Width := 200;
end;
procedure TForm_Driver_Info_Register.Cbb_B4Employ_StateChange(
Sender: TObject);
begin
inherited;
Cbb_B4Employ_type.ItemIndex := Cbb_B4employ_state.ItemIndex;
end;
procedure TForm_Driver_Info_Register.Edt_B4Worker_NoExit(Sender: TObject);
begin
inherited;
if trim(Edt_B4Worker_no.Text)<>'' then
begin
str_Temp := 'select name as 姓名,n.emp_no as 员工编号,worker_no as 员工工号,employ_state,text as 聘用情况 from ';
str_Temp := str_Temp + '(select name,a.emp_no,worker_no,employ_state from ' + str_DB_Name + '.dbo.tk_employee_info a left join ' + str_DB_Name + '.dbo.tk_employ_state b on a.emp_no=b.emp_no where dept_no in (' + str_Current_Role_Dept_List + ')) n ';
str_Temp := str_Temp + 'left join (select type_no,text from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=18) m on employ_state=m.type_no where worker_no=''' + trim(Edt_B4Worker_no.Text) + '''';
end;
Form_Main.aTCPAdoClient_Main.Open(str_Temp);
qry_B4.Clone(Form_Main.aTCPAdoClient_Main,ltReadOnly);
if Form_Main.aTCPAdoClient_Main.RecordCount<>0 then
begin
Edt_B4Name.Text := Form_Main.aTCPAdoClient_Main.Fields[0].AsString;
Edt_B4Emp_No.Text := Form_Main.aTCPAdoClient_Main.Fields[1].AsString;
Cbb_B4employ_state.ItemIndex := Cbb_B4employ_state.Items.IndexOf(Form_Main.aTCPAdoClient_Main.Fields[4].AsString);
Cbb_B4employ_type.ItemIndex := Cbb_B4employ_type.Items.IndexOf(Form_Main.aTCPAdoClient_Main.Fields[3].AsString);
end
else
begin
showmessage('员工工号号有误!');
Edt_B4Worker_no.Text := '';
end;
DBGrid_B4.DataSource := ds_B4;
DBGrid_B4.Columns[0].Width := 160;
DBGrid_B4.Columns[1].Width := 160;
DBGrid_B4.Columns[2].Width := 160;
DBGrid_B4.Columns[3].Width :=0;
DBGrid_B4.Columns[4].Width := 200;
end;
procedure TForm_Driver_Info_Register.Bt_UpdateClick(Sender: TObject);
begin
inherited;
if trim(Edt_B4Emp_no.Text) = '' then
begin
showmessage('请输入员工编号!');
end;
if Cbb_B4Employ_state.ItemIndex = -1 then
begin
showmessage('请选择聘用情况!');
end;
str_temp := 'exec wz_safety_4cs.dbo.sp_u_Employ_state ''' + trim(Edt_B4Emp_no.Text) + ''',''' + Cbb_B4Employ_type.Text + '''';
Form_Main.aTCPAdoClient_Main.Open(str_temp);
if Form_Main.aTCPAdoClient_Main.Fields[0].AsString = '9000' then
begin
showmessage('修改成功!');
str_Temp := 'select name as 姓名,n.emp_no as 员工编号,worker_no as 员工工号,employ_state,text as 聘用情况 from ';
str_Temp := str_Temp + '(select name,a.emp_no,worker_no,employ_state from ' + str_DB_Name + '.dbo.tk_employee_info a left join ' + str_DB_Name + '.dbo.tk_employ_state b on a.emp_no=b.emp_no where dept_no in (' + str_Current_Role_Dept_List + ')) n ';
str_Temp := str_Temp + 'left join (select type_no,text from ' + str_DB_Name + '.dbo.TK_TYPEREFERENCE where type=18) m on employ_state=m.type_no where worker_no=''' + trim(Edt_B4Worker_no.Text) + '''';
Form_Main.aTCPAdoClient_Main.Open(str_temp);
qry_B4.Clone(Form_Main.aTCPAdoClient_Main,ltReadOnly);
DBGrid_B4.DataSource := ds_B4;
DBGrid_B4.Columns[0].Width := 160;
DBGrid_B4.Columns[1].Width := 160;
DBGrid_B4.Columns[2].Width := 160;
DBGrid_B4.Columns[3].Width :=0;
DBGrid_B4.Columns[4].Width := 200;
end
else
begin
showmessage('修改失败!');
end;
end;
procedure TForm_Driver_Info_Register.edt_Driver_TypeClick(Sender: TObject);
begin
inherited;
str_up_form := 'Form_Driver_Info_Register';
Form_Edt_driver_Type := TForm_Edt_driver_Type.Create(self);
Form_Edt_driver_Type.ShowModal;
end;
procedure TForm_Driver_Info_Register.Cbb_Employ_stateChange(
Sender: TObject);
begin
inherited;
Cbb_Employ_State_No.ItemIndex := Cbb_Employ_State.ItemIndex;
end;
procedure TForm_Driver_Info_Register.Cbb_Line_NameChange(Sender: TObject);
begin
inherited;
cbb_line_no.ItemIndex := cbb_line_name.ItemIndex;
end;
procedure TForm_Driver_Info_Register.Cbb_Line_NameKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if key = #13 then
begin
cbb_duty.SetFocus;
end;
end;
end.