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

📄 u_ygdd.pas

📁 人力资源管理系统自动计算员工工资。自动生成员工工资报表。实现员工岗位调动操作。实现员工离职、复职操作。支持数据的模糊查询机制。运行环境 操作系统:Windows 2000/NT/XP/ME 开发工
💻 PAS
字号:
unit U_ygdd;

interface

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

type
  Tfrm_ygdd = class(TForm)
    Panel1: TPanel;
    TreeView1: TTreeView;
    Panel2: TPanel;
    Panel3: TPanel;
    DBGrid1: TDBGrid;
    CoolBar1: TCoolBar;
    ToolBar1: TToolBar;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    Panel4: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    BitBtn2: TBitBtn;
    DataSource1: TDataSource;
    BitBtn3: TBitBtn;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure TreeView1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure DBGrid1CellClick(Column: TColumn);
    procedure BitBtn2Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frm_ygdd: Tfrm_ygdd;

implementation

uses U_data, U_tj;

{$R *.dfm}

procedure Tfrm_ygdd.SpeedButton1Click(Sender: TObject);
begin
application.CreateForm(Tfrm_cxtj,frm_cxtj);
frm_cxtj.ShowModal;
frm_cxtj.Free;
end;

procedure Tfrm_ygdd.SpeedButton3Click(Sender: TObject);
begin
close;
end;

procedure Tfrm_ygdd.TreeView1Click(Sender: TObject);
var
s,d:string;
begin
with data1.ADOQYdwxx do
   begin
      close;
      sql.Clear;
      sql.Add('select distinct 单位名称 from 单位信息表');
      open;
   end;
s:=treeview1.Selected.Text;
d:=data1.ADOQYdwxx.FieldByName('单位名称').Value;
if treeview1.Selected<>nil then
   if treeview1.Selected.Text=d then
      begin
      with data1.ADOpublic do
         begin
            close;
            sql.Clear;
            sql.Add('select * from 人事表 where sflz=:b ');
            parameters.ParamByName('b').Value:='否';
            open;
         end;
      end
   else
      begin
         with data1.ADOpublic do
         begin
            close;
            sql.Clear;
            sql.Add('select * from 人事表 where ssbm= :a and sflz=:b ');
            parameters.ParamByName('a').Value:=s;
            parameters.ParamByName('b').Value:='否';
            open;
         end;
      end;
end;

procedure Tfrm_ygdd.FormShow(Sender: TObject);
var
a,b:string;
subt:TTreenode;
begin
combobox1.Clear;
combobox2.Clear;
combobox3.Clear;
with data1.ADOpublic do
   begin
      close;
      sql.Clear;
      sql.Add('select distinct 单位名称 from 单位信息表');
      open;
   end;
   a:=data1.ADOpublic.FieldByName('单位名称').Value;
   subt:=Treeview1.Items.Add(nil,a);
with data1.ADOpublic do
   begin
      close;
      sql.Clear;
      sql.Add('select distinct 部门名称 from 部门表');
      open;
   end;
   while Not Data1.ADOpublic.Eof do
   begin
     ComboBox1.Items.Add(Data1.ADOpublic.FieldByName('部门名称').Value);
     b:=Data1.ADOpublic.FieldByName('部门名称').Value;
     Data1.ADOpublic.Next;
     Treeview1.Items.AddChild(subt,b);
   end;
with data1.ADOpublic do
   begin
      close;
      sql.Clear;
      sql.Add('select distinct 职务名称 from 职务表');
      open;
   end;
   while Not Data1.ADOpublic.Eof do
   begin
     ComboBox2.Items.Add(Data1.ADOpublic.FieldByName('职务名称').Value);
     Data1.ADOpublic.Next;
   end;
with data1.ADOpublic do
   begin
      close;
      sql.Clear;
      sql.Add('select distinct 职称名称 from 职称表');
      open;
   end;
   while Not Data1.ADOpublic.Eof do
   begin
     ComboBox3.Items.Add(Data1.ADOpublic.FieldByName('职称名称').Value);
     Data1.ADOpublic.Next;
   end;
with data1.ADOpublic do
   begin
      close;
      sql.Clear;
      sql.Add('select * from 人事表 where sflz= :b');
      parameters.ParamByName('b').Value:='否';
      open;
   end;
   data1.ADOpublic.Active:=true;
   edit1.Text:=data1.ADOpublic.FieldByName('bh').Value;
   edit2.Text:=data1.ADOpublic.FieldByName('xm').Value;
   combobox1.Text:=data1.ADOpublic.FieldByName('ssbm').Value;
   combobox2.Text:=data1.ADOpublic.FieldByName('zw').Value;
   combobox3.Text:=data1.ADOpublic.FieldByName('zc').Value;
   TreeView1.FullExpand;
end;

procedure Tfrm_ygdd.BitBtn3Click(Sender: TObject);
begin
combobox1.Enabled:=true;
combobox2.Enabled:=true;
combobox3.Enabled:=true;
end;

procedure Tfrm_ygdd.DBGrid1CellClick(Column: TColumn);
begin
If DBGrid1.DataSource.DataSet<> Nil then
    if DBGrid1.DataSource.DataSet.RecordCount>0 then
      begin
      edit1.Text:=data1.ADOpublic.FieldByName('bh').Value;
      edit2.Text:=data1.ADOpublic.FieldByName('xm').Value;
      combobox1.Text:=data1.ADOpublic.FieldByName('ssbm').Value;
      combobox2.Text:=data1.ADOpublic.FieldByName('zw').Value;
      combobox3.Text:=data1.ADOpublic.FieldByName('zc').Value;
      end;
end;

procedure Tfrm_ygdd.BitBtn2Click(Sender: TObject);
begin
try
with data1.ADOpublic do
   begin
      edit;
      FieldByName('ssbm').Value := Trim(combobox1.Text);
      FieldByName('zw').Value := Trim(combobox2.Text);
      FieldByName('zc').Value := Trim(combobox3.Text);
      post
   end;
      bitbtn3.OnClick(sender);
      application.MessageBox('修改成功','提示',64);
except
   application.MessageBox('修改失败','提示',64);
   close;
end;
end;

procedure Tfrm_ygdd.SpeedButton2Click(Sender: TObject);
begin
with data1.ADOpublic do
   begin
      close;
      sql.Clear;
      sql.Add('select * from 人事表 where sflz=:b ');
      parameters.ParamByName('b').Value:='否';
      open;
   end
end;

end.

⌨️ 快捷键说明

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