www.pudn.com > dianlijiankong.rar > UGSJBXX.~pas, change:2005-12-24,size:8597b


unit UGSJBXX; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, Buttons, StdCtrls, ExtCtrls, ToolWin, ComCtrls; 
 
type 
  TFRM_GSJBXX = class(TForm) 
    ToolBar1: TToolBar; 
    Panel1: TPanel; 
    Label1: TLabel; 
    Label2: TLabel; 
    Label3: TLabel; 
    Label4: TLabel; 
    Label5: TLabel; 
    Label6: TLabel; 
    Label7: TLabel; 
    Label8: TLabel; 
    Label9: TLabel; 
    Edit1: TEdit; 
    Edit2: TEdit; 
    Edit3: TEdit; 
    Edit4: TEdit; 
    Edit5: TEdit; 
    Edit6: TEdit; 
    Edit7: TEdit; 
    Edit8: TEdit; 
    Edit9: TEdit; 
    SpeedButton2: TSpeedButton; 
    SpeedButton3: TSpeedButton; 
    SpeedButton5: TSpeedButton; 
    procedure SpeedButton5Click(Sender: TObject); 
    procedure SpeedButton2Click(Sender: TObject); 
    procedure SpeedButton3Click(Sender: TObject); 
    procedure Edit1Change(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 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 FormCreate(Sender: TObject); 
    procedure FormShow(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
var 
  FRM_GSJBXX: TFRM_GSJBXX; 
 
implementation 
 
uses UDM, UHWTYGL; 
 
{$R *.dfm} 
 
procedure TFRM_GSJBXX.SpeedButton5Click(Sender: TObject); 
begin 
  Close; 
end; 
 
procedure TFRM_GSJBXX.SpeedButton2Click(Sender: TObject); 
begin 
  Panel1.Enabled:=True; 
  SpeedButton3.Enabled:=True; 
  SpeedButton2.Enabled:=False; 
  Edit1.Color:=clWindow; 
  Edit2.Color:=clWindow; 
  Edit3.Color:=clWindow; 
  Edit4.Color:=clWindow; 
  Edit5.Color:=clWindow; 
  Edit6.Color:=clWindow; 
  Edit7.Color:=clWindow; 
  Edit8.Color:=clWindow; 
  Edit9.Color:=clWindow; 
  Edit1.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.SpeedButton3Click(Sender: TObject); 
var 
a,b,c:string; 
begin 
  if Edit1.Text='' then 
  begin 
    Application.MessageBox('公司名称不能为空!','提示!',64); 
    Edit1.SetFocus; 
    Exit; 
  end; 
  if Edit2.Text='' then 
  begin 
    Application.MessageBox('公司地址不能为空!','提示!',64); 
    Edit2.SetFocus; 
    Exit; 
  end; 
  if Edit3.Text='' then 
  begin 
    Application.MessageBox('联系电话不能为空!','提示!',64); 
    Edit3.SetFocus; 
    Exit; 
  end; 
  if Edit4.Text='' then 
  begin 
    Application.MessageBox('传真号码不能为空!','提示!',64); 
    Edit4.SetFocus; 
    Exit; 
  end; 
  if Edit5.Text='' then 
  begin 
    Application.MessageBox('邮编不能为空!','提示!',64); 
    Edit5.SetFocus; 
    Exit; 
  end; 
  if Edit6.Text='' then 
  begin 
    Application.MessageBox('法人代表不能为空!','提示!',64); 
    Edit6.SetFocus; 
    Exit; 
  end; 
  if Edit7.Text='' then 
  begin 
    Application.MessageBox('开户银行不能为空!','提示!',64); 
    Edit7.SetFocus; 
    Exit; 
  end; 
  if Edit8.Text='' then 
  begin 
    Application.MessageBox('银行账号不能为空!','提示!',64); 
    Edit8.SetFocus; 
    Exit; 
  end; 
  if Edit9.Text='' then 
  begin 
    Application.MessageBox('公司网址不能为空!','提示!',64); 
    Edit9.SetFocus; 
    Exit; 
  end; 
  if Application.MessageBox('确实要修改公司信息吗?','提示',MB_YesNo)= ID_Yes then 
  begin 
    with DM.QGSJBXX do 
    begin 
     Try 
      DM.QGSJBXX.Edit; 
      DM.QGSJBXX.FieldByName('公司名称').Value :=Edit1.Text; 
      DM.QGSJBXX.FieldByName('公司地址').Value :=Edit2.Text; 
      DM.QGSJBXX.FieldByName('联系电话').Value :=Edit3.Text; 
      DM.QGSJBXX.FieldByName('传真').Value:=Edit4.Text; 
      DM.QGSJBXX.FieldByName('邮编').Value:=Edit5.Text ; 
      DM.QGSJBXX.FieldByName('法人代表').Value:=Edit6.Text; 
      DM.QGSJBXX.FieldByName('开户银行').Value:=Edit7.Text; 
      DM.QGSJBXX.FieldByName('银行账号').Value:=Edit8.Text; 
      DM.QGSJBXX.FieldByName('网址').Value:=Edit9.Text; 
      DM.QGSJBXX.Post; 
      SpeedButton3.Enabled := False; 
      Application.MessageBox('数据保存成功。','提示',64); 
      Panel1.Enabled:=False; 
      SpeedButton2.Enabled:=True; 
     Except 
      Application.MessageBox('系统出错。','提示',64); 
      Close; 
     End; 
    end; 
  end 
  else 
    SpeedButton3.Enabled:=False; 
    SpeedButton2.Enabled:=True; 
    Panel1.Enabled:=False; 
    Self.OnShow(Sender); 
end; 
 
procedure TFRM_GSJBXX.Edit1Change(Sender: TObject); 
begin 
  Edit1.Text:=Trim(Edit1.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit2Change(Sender: TObject); 
begin 
  Edit2.Text:=Trim(Edit2.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit3Change(Sender: TObject); 
begin 
  Edit3.Text:=Trim(Edit3.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit4Change(Sender: TObject); 
begin 
  Edit4.Text:=Trim(Edit4.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit5Change(Sender: TObject); 
begin 
  Edit5.Text:=Trim(Edit5.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit6Change(Sender: TObject); 
begin 
  Edit6.Text:=Trim(Edit6.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit7Change(Sender: TObject); 
begin 
  Edit7.Text:=Trim(Edit7.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit8Change(Sender: TObject); 
begin 
  Edit8.Text:=Trim(Edit8.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit9Change(Sender: TObject); 
begin 
  Edit9.Text:=Trim(Edit9.Text); 
end; 
 
procedure TFRM_GSJBXX.Edit1KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z','0'..'9'] then 
    key:=#0; 
  if key=#13 then 
    Edit2.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.Edit2KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['a'..'z'] then 
    key:=#0; 
  if key=#13 then 
    Edit3.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.Edit3KeyPress(Sender: TObject; var Key: Char); 
begin 
if not(key in['0'..'9','-',#8,#13]) then 
    key:=#0; 
  if key=#13 then 
    Edit4.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.Edit4KeyPress(Sender: TObject; var Key: Char); 
begin 
if not(key in['0'..'9','-',#8,#13]) then 
    key:=#0; 
  if key=#13 then 
    Edit5.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.Edit5KeyPress(Sender: TObject; var Key: Char); 
begin 
if not(key in['0'..'9',#8,#13]) then 
    key:=#0; 
  if key=#13 then 
    Edit6.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.Edit6KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['0'..'9','-','a'..'z','A'..'Z','.'] then 
    key:=#0; 
  if key=#13 then 
    Edit7.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.Edit7KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key in['0'..'9','-','a'..'z','A'..'Z','.'] then 
    key:=#0; 
  if key=#13 then 
    Edit8.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.Edit8KeyPress(Sender: TObject; var Key: Char); 
begin 
  if not (key in['0'..'9',#8,#13]) then 
  key:=#0; 
  if key=#13 then 
    Edit9.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.Edit9KeyPress(Sender: TObject; var Key: Char); 
begin 
  if key=#13 then 
    Edit1.SetFocus; 
end; 
 
procedure TFRM_GSJBXX.FormCreate(Sender: TObject); 
begin 
 with DM.QGSJBXX do 
 begin 
  Close; 
  SQL.Clear; 
  SQL.Add('Select * from 公司信息表'); 
  Open; 
 end; 
end; 
 
procedure TFRM_GSJBXX.FormShow(Sender: TObject); 
begin 
//  if DM.QGSJBXX.RecordCount<>0 then 
//  begin 
    Edit1.Text:=DM.QGSJBXX.FieldByName('公司名称').Value; 
    Edit2.Text:=DM.QGSJBXX.FieldByName('公司地址').Value; 
    Edit3.Text:=DM.QGSJBXX.FieldByName('联系电话').Value; 
    Edit4.Text:=DM.QGSJBXX.FieldByName('传真').Value; 
    Edit5.Text:=DM.QGSJBXX.FieldByName('邮编').Value; 
    Edit6.Text:=DM.QGSJBXX.FieldByName('法人代表').Value; 
    Edit7.Text:=DM.QGSJBXX.FieldByName('开户银行').Value; 
    Edit8.Text:=DM.QGSJBXX.FieldByName('银行账号').Value; 
    Edit9.Text:=DM.QGSJBXX.FieldByName('网址').Value; 
//  end; 
  Edit1.Color:=$00EFEFEF; 
  Edit2.Color:=$00EFEFEF; 
  Edit3.Color:=$00EFEFEF; 
  Edit4.Color:=$00EFEFEF; 
  Edit5.Color:=$00EFEFEF; 
  Edit6.Color:=$00EFEFEF; 
  Edit7.Color:=$00EFEFEF; 
  Edit8.Color:=$00EFEFEF; 
  Edit9.Color:=$00EFEFEF; 
end; 
 
end.