unit U_JlUnitHelp;

interface

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

type
  Tkf_frmJlUnitHelp = class(TForm)
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Label1: TLabel;
    edttj: TEdit;
    ADOQueryHelp: TADOQuery;
    Panel1: TPanel;
    ADOConnection1: TADOConnection;
    procedure FormShow(Sender: TObject);
    procedure DBGrid1DblClick(Sender: TObject);
    procedure edttjChange(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    procedure Dofilter();
  public
    Fflag:string;
  end;

var
  kf_frmJlUnitHelp: Tkf_frmJlUnitHelp;

implementation
uses
  U_global;
{$R *.dfm}

procedure Tkf_frmJlUnitHelp.FormShow(Sender: TObject);
begin
  panel1.Caption :='说明：单位表中类型为：'+Fflag+'的数据';
  with adoqueryHelp do
  begin
    close;
    sql.Clear;
    filtered:=false;
    sql.Add('exec P_Get_XC_Unit');
    sql.Add(quotedStr(Fflag));
    open;
  end;
end;

procedure Tkf_frmJlUnitHelp.DBGrid1DblClick(Sender: TObject);
begin
  ModalResult:=1;
end;
////////////////////////////////////////////////////////
  //
///////////////////////////////////////////////////////
procedure Tkf_frmJlUnitHelp.Dofilter();
begin
  if trim(edttj.text)='' then
  begin
    adoqueryHelp.Filtered:=false;
    exit;
  end;
  with adoqueryHelp do
  begin
    filtered:=false;
    filter:='名称 like '+quotedStr('%'+trim(edttj.text)+'%');
    filtered:=true;
  end;
end;

procedure Tkf_frmJlUnitHelp.edttjChange(Sender: TObject);
begin
  Dofilter();
end;

procedure Tkf_frmJlUnitHelp.FormCreate(Sender: TObject);
begin
  with ADOConnection1 do
  begin
    Connected:=false;
    ConnectionString:=gConString;
    Connected:=true;
  end;
end;

end.
