www.pudn.com > dianlijiankong.rar > UKHJBXX.~pas, change:2006-01-13,size:20546b


unit UKHJBXX; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls, ExtCtrls, Buttons, ToolWin, ComCtrls, Grids, DBGrids; 
 
type 
  TFRM_KHJBXX = class(TForm) 
    ToolBar1: TToolBar; 
    SpeedButton1: TSpeedButton; 
    SpeedButton2: TSpeedButton; 
    SpeedButton3: TSpeedButton; 
    SpeedButton4: TSpeedButton; 
    SpeedButton5: TSpeedButton; 
    SpeedButton6: TSpeedButton; 
    Panel1: TPanel; 
    Label1: TLabel; 
    Label2: TLabel; 
    Label3: TLabel; 
    Label4: TLabel; 
    Label5: TLabel; 
    Label6: TLabel; 
    Label7: TLabel; 
    Label8: TLabel; 
    Label9: TLabel; 
    Label10: TLabel; 
    Label11: TLabel; 
    Label12: TLabel; 
    Label13: TLabel; 
    Label14: TLabel; 
    Label15: TLabel; 
    Label16: TLabel; 
    Label17: TLabel; 
    Label18: TLabel; 
    Label19: TLabel; 
    Label20: TLabel; 
    Edit1: TEdit; 
    Edit2: TEdit; 
    Edit3: TEdit; 
    Edit4: TEdit; 
    Edit5: TEdit; 
    Edit6: TEdit; 
    Edit7: TEdit; 
    Edit8: TEdit; 
    Edit9: TEdit; 
    Edit10: TEdit; 
    Edit11: TEdit; 
    Edit12: TEdit; 
    Edit13: TEdit; 
    Edit14: TEdit; 
    Edit15: TEdit; 
    Edit16: TEdit; 
    Edit17: TEdit; 
    Edit18: TEdit; 
    Edit19: TEdit; 
    Edit20: TEdit; 
    Panel2: TPanel; 
    DBGrid1: TDBGrid; 
    procedure SpeedButton6Click(Sender: TObject); 
    procedure FormCreate(Sender: TObject); 
    procedure FormShow(Sender: TObject); 
    procedure SpeedButton1Click(Sender: TObject); 
    procedure SpeedButton2Click(Sender: TObject); 
    procedure SpeedButton3Click(Sender: TObject); 
    procedure SpeedButton4Click(Sender: TObject); 
    procedure SpeedButton5Click(Sender: TObject); 
    procedure Edit2Change(Sender: TObject); 
    procedure Edit3Change(Sender: TObject); 
    procedure Edit4Change(Sender: TObject); 
    procedure Edit5Change(Sender: TObject); 
    procedure Edit6Change(Sender: TObject); 
    procedure Edit7Change(Sender: TObject); 
    procedure Edit8Change(Sender: TObject); 
    procedure Edit9Change(Sender: TObject); 
    procedure Edit10Change(Sender: TObject); 
    procedure Edit11Change(Sender: TObject); 
    procedure Edit12Change(Sender: TObject); 
    procedure Edit13Change(Sender: TObject); 
    procedure Edit14Change(Sender: TObject); 
    procedure Edit15Change(Sender: TObject); 
    procedure Edit16Change(Sender: TObject); 
    procedure Edit17Change(Sender: TObject); 
    procedure Edit18Change(Sender: TObject); 
    procedure Edit19Change(Sender: TObject); 
    procedure Edit20Change(Sender: TObject); 
    procedure Edit1KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit2KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit3KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit4KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit5KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit6KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit7KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit8KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit9KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit10KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit11KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit12KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit13KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit14KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit15KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit16KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit17KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit18KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit19KeyPress(Sender: TObject; var Key: Char); 
    procedure Edit20KeyPress(Sender: TObject; var Key: Char); 
    procedure DBGrid1CellClick(Column: TColumn); 
    procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; 
      DataCol: Integer; Column: TColumn; State: TGridDrawState); 
  private 
    { Private declarations } 
  public 
    procedure tr;       //去除空字符 
    procedure bh;        //自动编号 
    Procedure GetAll;    //获得所有数据 
    Procedure Posting;   //提交数据 
    Procedure CLS;       //清除控件中内容 
    Procedure DIS;       //控件不可用 
    Procedure ENA;       //控件可用 
    Function CanSave:Boolean;   //判断是否保存 
    { Public declarations } 
  end; 
 
var 
  FRM_KHJBXX: TFRM_KHJBXX; 
 
implementation 
 
uses UDM, UMAIN, UYHQX; 
 
{$R *.dfm} 
procedure TFRM_KHJBXX.tr; 
var 
i:integer; 
begin 
  for i:=ComponentCount - 1 downto 0 do 
    if(Components[i] is TEdit) then 
    TEdit(Components[i]).Text:=trim(TEdit(Components[i]).Text); 
end; 
Function TFRM_KHJBXX.CanSave: Boolean; 
begin 
  if (Edit1.Text='') then 
  begin 
   Result:=False; 
   Application.MessageBox('客户编号不能为空!','提示信息',0+MB_ICONINFORMATION); 
   exit; 
  end; 
  if (Edit2.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('客户名称不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit3.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('公司性质不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit4.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('公司类别不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit5.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('法人代表不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit6.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('所属省份不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit7.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('通信地址不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit8.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('电子邮箱不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit9.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('主销产品不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit10.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('纳税号不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit11.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('联系人不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit12.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('联系电话不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit13.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('固定电话不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit14.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('传真不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit15.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('邮编不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit16.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('开户银行不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit17.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('银行账号不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit18.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('期初欠款不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
  if (Edit19.Text='') then 
  begin 
    Result:=False; 
    Application.MessageBox('公司主页不能为空!','提示信息',0+MB_ICONINFORMATION); 
    exit; 
  end; 
end; 
 
procedure TFRM_KHJBXX.bh; 
var 
i:integer; 
s,m:string; 
begin 
  s:= 'KH'+ FormatDateTime('yyyymmdd',Now()); 
  With DM.QKHJBXX do 
  begin 
    Close; 
    SQL.Clear; 
    SQL.Add('select max(客户编号) as ss From 客户信息表'); 
    Open; 
  end; 
  If DM.QKHJBXX.FieldByName('ss').Value=null then 
    s := s + '001' 
  else 
  begin 
    m:= Trim(DM.QKHJBXX.FieldByName('ss').Value) ; 
    i:= StrToInt(Trim(Copy(m,11,8))) ; 
    if i<9 then 
      s:= s + '00'+ InttoStr(i +1) 
    else if i<99 then 
      s:= s + '0'+ InttoStr(i +1) 
    else 
      s:= s +InttoStr(i +1); 
  end; 
  Edit1.Text := s; 
end; 
 
procedure TFRM_KHJBXX.GetAll; 
begin 
  Edit1.Text:=DM.DSOKHJBXX.FieldByName('客户编号').AsString; 
  Edit2.Text:=DM.DSOKHJBXX.FieldByName('客户名称').AsString; 
  Edit3.Text:=DM.DSOKHJBXX.FieldByName('公司性质').AsString; 
  Edit4.Text:=DM.DSOKHJBXX.FieldByName('公司类别').AsString; 
  Edit5.Text:=DM.DSOKHJBXX.FieldByName('法人代表').AsString; 
  Edit6.Text:=DM.DSOKHJBXX.FieldByName('所属省份').AsString; 
  Edit7.Text:=DM.DSOKHJBXX.FieldByName('通信地址').AsString; 
  Edit8.Text:=DM.DSOKHJBXX.FieldByName('电子邮箱').AsString; 
  Edit9.Text:=DM.DSOKHJBXX.FieldByName('主销产品').AsString; 
  Edit10.Text:=DM.DSOKHJBXX.FieldByName('纳税号').AsString; 
  Edit11.Text:=DM.DSOKHJBXX.FieldByName('联系人').AsString; 
  Edit12.Text:=DM.DSOKHJBXX.FieldByName('联系电话').AsString; 
  Edit13.Text:=DM.DSOKHJBXX.FieldByName('固定电话').AsString; 
  Edit14.Text:=DM.DSOKHJBXX.FieldByName('传真').AsString; 
  Edit15.Text:=DM.DSOKHJBXX.FieldByName('邮编').AsString; 
  Edit16.Text:=DM.DSOKHJBXX.FieldByName('开户银行').AsString; 
  Edit17.Text:=DM.DSOKHJBXX.FieldByName('银行账号').AsString; 
  Edit18.Text:=DM.DSOKHJBXX.FieldByName('期初欠款').AsString; 
  Edit19.Text:=DM.DSOKHJBXX.FieldByName('公司主页').AsString; 
  Edit20.Text:=DM.DSOKHJBXX.FieldByName('备注').AsString; 
end; 
procedure TFRM_KHJBXX.Posting; 
begin 
  if ActionCD='N' then 
  BEGIN 
    with DM.QKHJBXX do 
    begin 
      Close; 
      SQL.Clear; 
      SQL.Add('INSERT INTO 客户信息表(客户编号,客户名称,公司性质,公司类别,法人代表,所属省份,'); 
      SQL.Add('通信地址,电子邮箱,主销产品,纳税号,联系人,联系电话,固定电话,传真,邮编,开户银行,'); 
      SQL.Add('银行账号,期初欠款,公司主页,备注)'); 
      SQL.Add('Values(:客户编号,:客户名称,:公司性质,:公司类别,:法人代表,:所属省份,:通信地址,'); 
      SQL.Add(':电子邮箱,:主销产品,:纳税号,:联系人,:联系电话,:固定电话,:传真,:邮编,:开户银行,'); 
      SQL.Add(':银行账号,:期初欠款,:公司主页,:备注)'); 
      Parameters.Items[0].Value:=Edit1.Text; 
      Parameters.Items[1].Value:=Edit2.Text; 
      Parameters.Items[2].Value:=Edit3.Text; 
      Parameters.Items[3].Value:=Edit4.Text; 
      Parameters.Items[4].Value:=Edit5.Text; 
      Parameters.Items[5].Value:=Edit6.Text; 
      Parameters.Items[6].Value:=Edit7.Text; 
      Parameters.Items[7].Value:=Edit8.Text; 
      Parameters.Items[8].Value:=Edit9.Text; 
      Parameters.Items[9].Value:=Edit10.Text; 
      Parameters.Items[10].Value:=Edit11.Text; 
      Parameters.Items[11].Value:=Edit12.Text; 
      Parameters.Items[12].Value:=Edit13.Text; 
      Parameters.Items[13].Value:=Edit14.Text; 
      Parameters.Items[14].Value:=Edit15.Text; 
      Parameters.Items[15].Value:=Edit16.Text; 
      Parameters.Items[16].Value:=Edit17.Text; 
      Parameters.Items[17].Value:=Edit18.Text; 
      Parameters.Items[18].Value:=Edit19.Text; 
      Parameters.Items[19].Value:=Edit20.Text; 
      Prepared:=True; 
      ExecSQL; 
    end; 
  END else 
  if ActionCD='M' then 
  begin 
    With DM.QKHJBXX DO 
    begin 
      Close; 
      SQL.Clear; 
      SQL.Add('update 客户信息表 Set 客户名称=:客户名称1,公司性质=:公司性质1,公司类别=:公司类别1,法人代表=:法人代表1,所属省份=:所属省份1,通信地址=:通信地址1,'); 
      SQL.Add('电子邮箱=:电子邮箱1,主销产品=:主销产品1,纳税号=:纳税号1,联系人=:联系人1,联系电话=:联系电话1,固定电话=:固定电话1,传真=:传真1,邮编=:邮编1,开户银行=:开户银行1,'); 
      SQL.Add('银行账号=:银行账号1,期初欠款=:期初欠款1,公司主页=:公司主页1,备注=:备注1 where 客户编号=:客户编号1'); 
      Parameters.Items[0].Value:=Edit2.Text; 
      Parameters.Items[1].Value:=Edit3.Text; 
      Parameters.Items[2].Value:=Edit4.Text; 
      Parameters.Items[3].Value:=Edit5.Text; 
      Parameters.Items[4].Value:=Edit6.Text; 
      Parameters.Items[5].Value:=Edit7.Text; 
      Parameters.Items[6].Value:=Edit8.Text; 
      Parameters.Items[7].Value:=Edit9.Text; 
      Parameters.Items[8].Value:=Edit10.Text; 
      Parameters.Items[9].Value:=Edit11.Text; 
      Parameters.Items[10].Value:=Edit12.Text; 
      Parameters.Items[11].Value:=Edit13.Text; 
      Parameters.Items[12].Value:=Edit14.Text; 
      Parameters.Items[13].Value:=Edit15.Text; 
      Parameters.Items[14].Value:=Edit16.Text; 
      Parameters.Items[15].Value:=Edit17.Text; 
      Parameters.Items[16].Value:=Edit18.Text; 
      Parameters.Items[17].Value:=Edit19.Text; 
      Parameters.Items[18].Value:=Edit20.Text; 
      Parameters.Items[19].Value:=DM.DSOKHJBXX.FieldByName('客户编号').AsString; 
      Prepared:=true; 
      ExecSQL; 
    end; 
  end; 
end; 
procedure TFRM_KHJBXX.ENA; 
var 
  i:integer; 
begin 
  for i:=ComponentCount-1 downto 0 do 
  begin 
    if (Components[i] is TEdit) then 
    begin 
      TEdit(Components[i]).Color:=clWindow; 
      TEdit(Components[i]).ReadOnly:=False; 
    end; 
  end; 
  SpeedButton1.Enabled:=False; 
  SpeedButton2.Enabled:=False; 
  SpeedButton3.Enabled:=True; 
  SpeedButton4.Enabled:=False; 
  Panel1.Enabled:=True; 
end; 
procedure TFRM_KHJBXX.DIS; 
var 
  i:integer; 
begin 
  for i:=ComponentCount-1 downto 0 do 
  begin 
    if (Components[i] is Tedit) then 
    begin 
      TEdit(Components[i]).Color:=$00EFEFEF; 
      TEdit(Components[i]).ReadOnly:=true; 
    end; 
  end; 
  SpeedButton1.Enabled:=True; 
  SpeedButton2.Enabled:=True; 
  SpeedButton3.Enabled:=False; 
  SpeedButton4.Enabled:=False; 
  Panel1.Enabled:=False; 
end; 
procedure TFRM_KHJBXX.CLS; 
var 
  i:integer; 
begin 
  for i:=ComponentCount-1 downto 0 do 
  begin 
    if(Components[i] is TEdit) then 
      TEdit(Components[i]).Clear; 
  end; 
end; 
/////////////////////////////////////////////////////////////////////////////////// 
procedure TFRM_KHJBXX.SpeedButton6Click(Sender: TObject); 
begin 
  ACtionCD:=''; 
  Close; 
end; 
 
procedure TFRM_KHJBXX.FormCreate(Sender: TObject); 
begin 
 with DM.QKHJBXX do 
 begin 
  Close; 
  SQL.Clear; 
  SQL.Add('Select * from 客户信息表'); 
  Open; 
 end; 
 DM.DSOKHJBXX.Open; 
end; 
 
procedure TFRM_KHJBXX.FormShow(Sender: TObject); 
begin 
  DIS; 
  if ActionCD = 'M' then 
    GetAll 
  else if ActionCD = 'N' then 
  begin 
    CLS; 
    ENA; 
  end; 
end; 
 
procedure TFRM_KHJBXX.SpeedButton1Click(Sender: TObject); 
begin 
  CLS; 
  ENA; 
  ActionCD := 'N'; 
  bh; 
  Edit2.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.SpeedButton2Click(Sender: TObject); 
begin 
  ENA; 
  SpeedButton4.Enabled:=True; 
  ACtionCD := 'M'; 
end; 
 
procedure TFRM_KHJBXX.SpeedButton3Click(Sender: TObject); 
begin 
  if (cansave) then 
  begin 
    Posting; 
    DIS; 
    DM.DSOKHJBXX.Close; 
    DM.DSOKHJBXX.Open; 
    Application.MessageBox('保存成功!','提示!',64); 
    actioncd:=''; 
    self.Close; 
  end; 
end; 
 
procedure TFRM_KHJBXX.SpeedButton4Click(Sender: TObject); 
begin 
    if DM.DSOKHJBXX.RecordCount=0 then 
    begin 
      Application.MessageBox('已无记录可删除!','提示',0+MB_ICONINFORMATION); 
      Exit; 
    end; 
    if DM.DSOKHJBXX.IsEmpty then 
      Exit; 
    if ID_YES=Application.MessageBox('确实要删除这条记录吗?','提示',MB_YESNO) then 
    begin 
      DM.DSOKHJBXX.Delete; 
      Self.OnShow(Sender); 
    end; 
end; 
 
procedure TFRM_KHJBXX.SpeedButton5Click(Sender: TObject); 
begin 
  DIS; 
  SpeedButton4.Enabled:=False; 
  FRM_KHJBXX.GetAll; 
  ActionCD:=''; 
end; 
 
procedure TFRM_KHJBXX.Edit2Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit3Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit4Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit5Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit6Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit7Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit8Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit9Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit10Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit11Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit12Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit13Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit14Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit15Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit16Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit17Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit18Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit19Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit20Change(Sender: TObject); 
begin 
tr 
end; 
 
procedure TFRM_KHJBXX.Edit1KeyPress(Sender: TObject; var Key: Char); 
begin 
  key:=#0; 
end; 
 
procedure TFRM_KHJBXX.Edit2KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z','0'..'9','A'..'Z','.','-'] then 
    key:=#0; 
  if key=#13 then 
    Edit3.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit3KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    Edit4.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit4KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    Edit5.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit5KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z','0'..'9','A'..'Z','.','-'] then 
    key:=#0; 
  if key=#13 then 
    Edit6.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit6KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z','0'..'9','A'..'Z','.','-'] then 
    key:=#0; 
  if key=#13 then 
    Edit7.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit7KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    Edit8.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit8KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    Edit9.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit9KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    Edit10.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit10KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','A'..'Z',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit11.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit11KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z','0'..'9','A'..'Z','.','-'] then 
    key:=#0; 
  if key=#13 then 
    Edit12.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit12KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','-',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit13.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit13KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    Edit14.SetFocus; 
    edit13.text:='8988090'; 
end; 
 
procedure TFRM_KHJBXX.Edit14KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','-',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit15.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit15KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit16.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit16KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['0'..'9','-','a'..'z','A'..'Z'] then 
    key:=#0; 
  if key=#13 then 
    Edit17.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit17KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit18.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit18KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9','.',#13,#8]) then 
    key:=#0; 
  if key=#13 then 
    Edit19.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit19KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    Edit20.SetFocus; 
end; 
 
procedure TFRM_KHJBXX.Edit20KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    key:=#0; 
end; 
 
procedure TFRM_KHJBXX.DBGrid1CellClick(Column: TColumn); 
begin 
  GetAll; 
end; 
 
procedure TFRM_KHJBXX.DBGrid1DrawColumnCell(Sender: TObject; 
  const Rect: TRect; DataCol: Integer; Column: TColumn; 
  State: TGridDrawState); 
begin 
  FRM_MAIN.SetDBGird(Sender as TDBGrid,DM.QKHJBXX ,Rect,DataCol,Column,State); 
end; 
 
end.