⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit25.~pas

📁 一个完整的工资管理系统 主要走查询 添加 删除 管理等功能
💻 ~PAS
字号:
unit Unit25;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, StdCtrls, ComCtrls;

type
  Tkqkhxinxi = class(TForm)
    Label1: TLabel;
    GroupBox2: TGroupBox;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    DBGrid2: TDBGrid;
    GroupBox1: TGroupBox;
    Label15: TLabel;
    Label14: TLabel;
    Label13: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    DBGrid1: TDBGrid;
    Edit1: TEdit;
    Edit2: TEdit;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    Edit3: TEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
    Button9: TButton;
    Button10: TButton;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    ComboBox3: TComboBox;
    Edit4: TEdit;
    procedure Button4Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure ComboBox3CloseUp(Sender: TObject);
    procedure Button10Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  kqkhxinxi: Tkqkhxinxi;

implementation

uses Unit1, Unit2, Unit3, Unit10, Unit24, Unit26;

{$R *.dfm}

procedure Tkqkhxinxi.Button4Click(Sender: TObject);
begin
kqkhxinxi.Close;
end;

procedure Tkqkhxinxi.Button8Click(Sender: TObject);
begin
kqkhxinxi.Close;
end;

procedure Tkqkhxinxi.FormCreate(Sender: TObject);
var
  Str1:String;
  i:integer;
begin
ComboBox1.Items.Add('A型');
ComboBox1.Items.Add('B型');
ComboBox2.Items.Add('1');
ComboBox2.Items.Add('2');
ComboBox2.Items.Add('3');
ComboBox2.Items.Add('4');
ComboBox2.Items.Add('5');
edit11.Text:=datetostr(date);
edit12.Text:=datetostr(date);
try
    with dm.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      sql.Add('select 考勤id  from kqxinxi');
      Open;
    end;
    Repeat
    Str1 := dm.ADOQuery1.FieldByName('考勤id').AsString;
    ComboBox3.Items.Add(Str1);
    dm.ADOQuery1.Next;
    Until
    dm.ADOQuery1.Eof;
  Except
    Showmessage('读取数据失败!');
  end;

  with dm.ADOQuery1 do
begin
sql.Clear;
sql.Add('select *  from kqxinxi ');
Open;
dbgrid1.Columns[0].FieldName:='考勤id';
 dbgrid1.Columns[1].FieldName:='员工id';
 dbgrid1.Columns[2].FieldName:='考勤日期';
 dbgrid1.Columns[3].FieldName:='考勤类型';
 dbgrid1.Columns[4].FieldName:='天数';
 dbgrid1.Columns[5].FieldName:='备注';

  for i:=0 to 5 do
  dbgrid1.Columns[i].Width:=66;
  end;
   with dm.ADOQuery2 do
begin
sql.Clear;
sql.Add('select *  from kqkaohexinxi ');
Open;
dbgrid2.Columns[0].FieldName:='考勤id';
 dbgrid2.Columns[1].FieldName:='员工id';
 dbgrid2.Columns[2].FieldName:='考核日期';
 dbgrid2.Columns[3].FieldName:='奖励';
 dbgrid2.Columns[4].FieldName:='惩罚';
 dbgrid2.Columns[5].FieldName:='加班费';
 dbgrid2.Columns[6].FieldName:='扣考核';
 dbgrid2.Columns[7].FieldName:='考核人员';
  for i:=0 to 7 do
  dbgrid2.Columns[i].Width:=65;
  end;
end;

procedure Tkqkhxinxi.Button1Click(Sender: TObject);
var
  Str1:String;
  i:integer;
begin

 if edit1.Text<>'' then
 begin
 if edit2.Text<>'' then
 begin
 with dm.ADOQuery1 do
begin
sql.Clear;
sql.Add('select *  from kqxinxi where 考勤id='''+edit1.Text+''''  );
Open;
if  dm.ADOQuery1.Eof then
begin
Append;
FieldByName('考勤id').AsString:=edit1.Text;
FieldByName('员工id').AsString:=edit2.Text;
FieldByName('考勤日期').AsString:=edit11.Text;
FieldByName('考勤类型').AsString:=ComboBox1.Text;
FieldByName('天数').AsString:=ComboBox2.Text;
FieldByName('备注').AsString:=edit3.Text;
post;
sql.Clear;
sql.Add('select *  from kqxinxi '  );
Open;
application.MessageBox('添加成功!','提示',64);
   edit1.SetFocus;
end
else
begin
application.MessageBox('已存在的考勤编号,请重新输入考勤编号!!','木鱼工作室',mb_iconhand+mb_yesno);
   edit1.Text:='';
   edit1.SetFocus;
sql.Clear;
sql.Add('select *  from gzbiaozhun '  );
Open;
end

end
 end
 else
 begin
   application.MessageBox('请输入员工编号!!','木鱼工作室',mb_iconhand+mb_yesno);
   edit2.Text:='';
   edit2.SetFocus;
 end

 end
 else

 begin
  application.MessageBox('请输入考勤编号!!','木鱼工作室',mb_iconhand+mb_yesno);
   edit1.Text:='';
   edit1.SetFocus;
 end;
 try
    with dm.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      sql.Add('select *  from kqxinxi');
      Open;
      dbgrid1.Columns[0].FieldName:='考勤id';
 dbgrid1.Columns[1].FieldName:='员工id';
 dbgrid1.Columns[2].FieldName:='考勤日期';
 dbgrid1.Columns[3].FieldName:='考勤类型';
 dbgrid1.Columns[4].FieldName:='天数';
 dbgrid1.Columns[5].FieldName:='备注';

  for i:=0 to 5 do
  dbgrid1.Columns[i].Width:=66;
    end;
    Repeat
    Str1 := dm.ADOQuery1.FieldByName('考勤id').AsString;
    ComboBox3.Items.Add(Str1);
    dm.ADOQuery1.Next;
    Until
    dm.ADOQuery1.Eof;
  Except
    Showmessage('读取数据失败!');
  end;


end;

procedure Tkqkhxinxi.Button3Click(Sender: TObject);
begin
   if application.MessageBox('确实要删除当前数据吗?','提示',mb_iconquestion+mb_yesno)=id_yes then
begin
try
 dm.ADOQuery1.Delete;
 dm.ADOQuery1.Refresh;

 application.MessageBox('删除成功!','提示',64);

 except
 application.MessageBox('系统出错!','提示',64);
 end;
 end;
end;

procedure Tkqkhxinxi.Button9Click(Sender: TObject);
begin
  if application.MessageBox('确实要删除当前数据吗?','提示',mb_iconquestion+mb_yesno)=id_yes then
begin
try
 dm.ADOQuery2.Delete;
 dm.ADOQuery2.Refresh;

 application.MessageBox('删除成功!','提示',64);

 except
 application.MessageBox('系统出错!','提示',64);
 end;
 end;
end;

procedure Tkqkhxinxi.ComboBox3CloseUp(Sender: TObject);
var
  i:integer;
begin
 try
    with dm.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      sql.Add('select *  from kqxinxi where 考勤id='''+ComboBox3.Text+'''');
      Open;
      dbgrid1.Columns[0].FieldName:='考勤id';
 dbgrid1.Columns[1].FieldName:='员工id';
 dbgrid1.Columns[2].FieldName:='考勤日期';
 dbgrid1.Columns[3].FieldName:='考勤类型';
 dbgrid1.Columns[4].FieldName:='天数';
 dbgrid1.Columns[5].FieldName:='备注';

  for i:=0 to 5 do
  dbgrid1.Columns[i].Width:=66;
    end;

   edit4.Text:= dm.ADOQuery1.FieldByName('员工id').AsString;


  Except
    Showmessage('读取数据失败!');
  end;
end;

procedure Tkqkhxinxi.Button10Click(Sender: TObject);
begin
   with dm.ADOQuery2 do
begin
sql.Clear;
sql.Add('select *  from kqkaohexinxi where 考勤id='''+ComboBox3.Text+''''  );
Open;
if  dm.ADOQuery2.Eof then
begin
Append;
FieldByName('考勤id').AsString:=ComboBox3.Text;
FieldByName('员工id').AsString:=edit4.Text;
FieldByName('考核日期').AsString:=edit12.Text;
FieldByName('奖励').AsString:=edit6.Text;
FieldByName('惩罚').AsString:=edit7.Text;
FieldByName('加班费').AsString:=edit8.Text;
FieldByName('扣考核').AsString:=edit9.Text;
FieldByName('考核人员').AsString:=edit10.Text;
post;
sql.Clear;
sql.Add('select *  from kqkaohexinxi '  );
Open;
application.MessageBox('添加成功!','提示',64);
   edit1.SetFocus;
end
else
begin
application.MessageBox('已存在的考勤编号,请重新输入考勤编号!!','木鱼工作室',mb_iconhand+mb_yesno);
   edit1.Text:='';
   edit1.SetFocus;
sql.Clear;
sql.Add('select *  from kqkaohexinxi '  );
Open;
end;

end;
end;

procedure Tkqkhxinxi.Button2Click(Sender: TObject);
begin
   application.CreateForm(Tkqkhxiugai,kqkhxiugai);
kqkhxiugai.ShowModal;
kqkhxiugai.Free;
end;

procedure Tkqkhxinxi.Button7Click(Sender: TObject);
begin
 application.CreateForm(Tkqkhxiugai,kqkhxiugai);
kqkhxiugai.ShowModal;
kqkhxiugai.Free;
end;

procedure Tkqkhxinxi.Button5Click(Sender: TObject);
begin
application.CreateForm(Tkqkhchaxun,kqkhchaxun);
kqkhchaxun.ShowModal;
kqkhchaxun.Free;
end;

procedure Tkqkhxinxi.Button6Click(Sender: TObject);
begin
application.CreateForm(Tkqkhchaxun,kqkhchaxun);
kqkhchaxun.ShowModal;
kqkhchaxun.Free;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -