am_Sdqcs.pas
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit am_Sdqcs;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, ExtCtrls, StdCtrls, Grids, DBGridEh, Buttons, DB, DBClient;
  6. type
  7.   Tam_Sdqc = class(TForm)
  8.     Panel1: TPanel;
  9.     Panel2: TPanel;
  10.     Edit1: TEdit;
  11.     Panel3: TPanel;
  12.     DBGridEh1: TDBGridEh;
  13.     SpeedButton1: TSpeedButton;
  14.     SpeedButton2: TSpeedButton;
  15.     ClientDataSet1: TClientDataSet;
  16.     DataSource1: TDataSource;
  17.     procedure SpeedButton1Click(Sender: TObject);
  18.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  19.     procedure SpeedButton2Click(Sender: TObject);
  20.     procedure DBGridEh1CellClick(Column: TColumnEh);
  21.     procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  22.   private
  23.     { Private declarations }
  24.   public
  25.     { Public declarations }
  26.   end;
  27. var
  28.   am_Sdqc: Tam_Sdqc;
  29. implementation
  30. uses ajgl_bjs,u_public, Am_wjbjs;
  31. {$R *.dfm}
  32. procedure Tam_Sdqc.SpeedButton1Click(Sender: TObject);
  33. var s:string;
  34. begin
  35.   s:=edit1.Text;
  36.   Clientdataset1.Close;
  37.   clientdataset1.CommandText:='select * from sz_ztck where ztck_ztc='+''''+s+''''+'';
  38.   Clientdataset1.Open;
  39.   if frm_name2='am_ajgl_bj' then
  40.    begin
  41.     if (trim(am_ajgl_bj.DBEditEh9.Text)='') then
  42.        begin
  43.          am_ajgl_bj.DBEditEh9.Text:=dbgrideh1.Columns[0].DisplayText;
  44.          close;
  45.        end
  46.      else
  47.       begin
  48.         am_ajgl_bj.DBEditEh9.Text:=am_ajgl_bj.DBEditEh9.Text+','+dbgrideh1.Columns[0].DisplayText;
  49.         Close;
  50.       end;
  51.     end
  52.   //---
  53.  else 
  54.   if frm_name2='am_Wjgl_bj' then
  55.    begin
  56.     if (trim(am_wjgl_bj.DBEditEh3.Text)='') then
  57.        begin
  58.          am_wjgl_bj.DBEditEh3.Text:=dbgrideh1.Columns[0].DisplayText;
  59.          close;
  60.        end
  61.      else
  62.       begin
  63.         am_wjgl_bj.DBEditEh3.Text:=am_wjgl_bj.DBEditEh3.Text+','+dbgrideh1.Columns[0].DisplayText;
  64.         Close;
  65.       end;
  66.    end;
  67. end;
  68. procedure Tam_Sdqc.FormClose(Sender: TObject; var Action: TCloseAction);
  69. begin
  70.  Clientdataset1.Active:=false;
  71.  action:=cafree;
  72.  am_sdqc:=Nil;
  73. end;
  74. procedure Tam_Sdqc.SpeedButton2Click(Sender: TObject);
  75. begin
  76.  Close;
  77. end;
  78. procedure Tam_Sdqc.DBGridEh1CellClick(Column: TColumnEh);
  79. var s,k:string;
  80. begin
  81.   s:=edit1.Text;
  82.   k:='ztck_ztc'+' like '+''''+s+'%'+'''';
  83.   Clientdataset1.Close;
  84.   clientdataset1.CommandText:='select * from sz_ztck where '+ k;
  85.   Clientdataset1.Open;
  86.   if frm_name2='am_ajgl_bj' then
  87.     begin
  88.       if (trim(am_ajgl_bj.DBEditEh9.Text)='') then
  89.         begin
  90.          am_ajgl_bj.DBEditEh9.Text:=dbgrideh1.Columns[0].DisplayText;
  91.          close;
  92.         end
  93.      else
  94.       begin
  95.         am_ajgl_bj.DBEditEh9.Text:=am_ajgl_bj.DBEditEh9.Text+','+dbgrideh1.Columns[0].DisplayText;
  96.         Close;
  97.       end;
  98.    end
  99.   else
  100.   //---------------
  101.    if frm_name2='am_Wjgl_bj' then
  102.     begin
  103.      if (trim(am_wjgl_bj.DBEditEh3.Text)='') then
  104.        begin
  105.          am_wjgl_bj.DBEditEh3.Text:=dbgrideh1.Columns[0].DisplayText;
  106.          close;
  107.        end
  108.      else
  109.       begin
  110.         am_wjgl_bj.DBEditEh3.Text:=am_wjgl_bj.DBEditEh3.Text+','+dbgrideh1.Columns[0].DisplayText;
  111.         Close;
  112.       end;
  113.     end;
  114. end;
  115. procedure Tam_Sdqc.Edit1KeyPress(Sender: TObject; var Key: Char);
  116. var s,k:string;
  117. begin
  118.  if key=#13 then
  119.  begin
  120.   s:=edit1.Text;
  121.   k:='ztck_ztc'+' like '+''''+s+'%'+'''';
  122.   Clientdataset1.Close;
  123.   clientdataset1.CommandText:='select * from sz_ztck where '+K;
  124.   Clientdataset1.Open;
  125.  end;  
  126. end;
  127. end.