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

📄 statinformation.~pas

📁 本系统是一个基于delphi7环境开发的人事管理系统
💻 ~PAS
字号:
unit StatInformation;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, MXDB, ExtCtrls, TeeProcs, TeEngine, Chart, MXGRAPH, DB,
  DBTables, MXTABLES, Mxstore, StdCtrls, Grids, DBGrids, ComCtrls;

type
  TForm10 = class(TForm)
    ComboBox1: TComboBox;
    Label1: TLabel;
    DBGrid1: TDBGrid;
    StaticText1: TStaticText;
    StatusBar1: TStatusBar;
    procedure ComboBox1Change(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form10: TForm10;

implementation
uses WelcomePicture, MainMenu;
{$R *.dfm}

procedure TForm10.ComboBox1Change(Sender: TObject);
begin
  form1.ADOTable1.Active:=false; ////异常重要的一句话
form1.ADOTable1.TableName:='employees';
form1.ADOTable1.Active:=true;
 self.StaticText1.Caption:='当前的统计是以'+combobox1.Text+'分类的!';
with form1.ADOQuery1 do
  begin
     close;
     sql.Clear;
     if combobox1.text='性别' then
     sql.Add('select 性别,"人数"=count(性别) from employees group by 性别')
     else
       if combobox1.Text='政治面貌' then
       sql.Add('select 政治面貌,"人数"=count(政治面貌) from employees group by 政治面貌')
       else
         if combobox1.Text='员工状态'  then
          sql.Add('select 员工状态,"人数"=count(员工状态) from employees group by 员工状态')
          else
            if  combobox1.Text='文化学历'  then
            sql.Add('select 文化学历,"人数"=count(文化学历) from experience group by 文化学历')
            else
               if  combobox1.Text='职务'  then
                sql.Add('select 职务,"人数"=count(职务) from worktime group by 职务')
                else
                     if  combobox1.Text='部门'  then
                     sql.Add('select 部门名称,"人数"=count(部门名称)from employees group by 部门名称')
                     else
                       if combobox1.text='全部人员' then
                       sql.add('select "全体人数"=count(*) from employees');
     open;
       statusbar1.Panels[1].Text:='以上为你所要的统计结果';
  end;
end;

procedure TForm10.FormClose(Sender: TObject; var Action: TCloseAction);
begin
form3.Enabled:=true;
form1.ADOQuery1.SQL.Clear;
end;

procedure TForm10.FormShow(Sender: TObject);
begin
form1.ADOQuery1.SQL.Clear;
self.StaticText1.Caption:='请在下面先选择统计项目:';
with form1.ADOQuery1 do
  begin
     close;
     sql.Clear;
     sql.add('select "全体人数"=count(*) from employees');
        open;
  end;
  statusbar1.Panels[1].Text:='以上数据为公司总人数';
end;

end.

⌨️ 快捷键说明

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