rytz.pas

来自「人事管理程序源码」· PAS 代码 · 共 104 行

PAS
104
字号
unit rytz;

interface

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

type
  TForm_rytz = class(TForm)
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Label1: TLabel;
    tzq_bm: TComboBox;
    tzh_bm: TComboBox;
    Label2: TLabel;
    Label3: TLabel;
    tzq_xm: TEdit;
    Panel2: TPanel;
    DBGrid1: TDBGrid;
    Panel3: TPanel;
    BitBtn1: TBitBtn;
    procedure FillTocomboBox(Sender: TcomboBox;nr_str:string;bz:integer);
    procedure FormShow(Sender: TObject);
    procedure tzq_bmKeyPress(Sender: TObject; var Key: Char);
    procedure BitBtn1Click(Sender: TObject); //给组合框添加内容

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form_rytz: TForm_rytz;

implementation

uses U_gzda_dm;

{$R *.dfm}
procedure TForm_rytz.FillTocomboBox(Sender: TcomboBox;nr_str:string;bz:integer); //给组合框添加内容
var
  hh:string;
begin
  with gzda_dm.ADODataSet10 do begin
    if active then active:=false;
    commandtext:='select  sj.bh,sj.mc,sj.fzsjxmbh from fzsj sj,fzsjxm xm where (sj.fzsjxmbh=xm.fzsjxmbh) and (xm.mc=:cx_mc) order by sj.bh';
    Parameters.ParamByName('cx_mc').Value:=nr_str;
    open;
    first;
    sender.Items.Clear;
    while not eof do begin
      if bz=1 then
         begin
           if fieldbyname('bh').AsInteger <10 then
              hh:='0'+fieldbyname('bh').AsString+'.'
           else
              hh:=fieldbyname('bh').AsString+'.';
         end
      else
         hh:='';
      sender.Items.Add(hh+fieldbyname('mc').AsString);
      next;
    end;
    sender.ItemIndex:=0;
    close;
  end;
end;

procedure TForm_rytz.FormShow(Sender: TObject);
begin
  FillTocomboBox(tzq_bm,'部门',1);
  FillTocomboBox(tzh_bm,'部门',1);

end;

procedure TForm_rytz.tzq_bmKeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in [#37..#40]) then key:=#0;
end;

procedure TForm_rytz.BitBtn1Click(Sender: TObject);
begin
  with gzda_dm.ADODataSet10 do begin
    if active then active:=false;
    commandtext:='select * from zgdab where (zgxh like :xh) and (xm like :xm) order by xm';
    Parameters.ParamByName('xh').Value:=copy(tzq_bm.Text,1,2)+'%';
    Parameters.ParamByName('xm').Value:=trim(tzq_xm.Text)+'%';
    open;
    first;
    if recordcount=0 then
       begin
         showmessage('该人员没有检索到!!');
         tzq_xm.SetFocus;
         exit;
       end;

  end;
end;

end.

⌨️ 快捷键说明

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