am_yhgl_xgs.pas
资源名称:挡案管理系统.rar [点击查看]
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:4k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit am_yhgl_xgs;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, DB, ExtCtrls, Buttons, StdCtrls, Mask, DBCtrlsEh;
- type
- Tam_yhgl_xg = class(TForm)
- GroupBox1: TGroupBox;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label9: TLabel;
- Label10: TLabel;
- DBEditEh1: TDBEditEh;
- DBEditEh2: TDBEditEh;
- DBEditEh3: TDBEditEh;
- GroupBox2: TGroupBox;
- Label5: TLabel;
- Label6: TLabel;
- Label11: TLabel;
- SpeedButton1: TSpeedButton;
- DBEditEh4: TDBEditEh;
- DBEditEh5: TDBEditEh;
- Label1: TLabel;
- Image1: TImage;
- SpeedButton2: TSpeedButton;
- SpeedButton3: TSpeedButton;
- DataSource1: TDataSource;
- procedure SpeedButton3Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure DBEditEh1KeyPress(Sender: TObject; var Key: Char);
- procedure DBEditEh2KeyPress(Sender: TObject; var Key: Char);
- procedure DBEditEh3KeyPress(Sender: TObject; var Key: Char);
- procedure SpeedButton1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure DBEditEh4KeyPress(Sender: TObject; var Key: Char);
- procedure DBEditEh4Exit(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- am_yhgl_xg: Tam_yhgl_xg;
- implementation
- uses DMs, Am_Ygxzs,u_public;
- {$R *.dfm}
- procedure Tam_yhgl_xg.SpeedButton3Click(Sender: TObject);
- begin
- close;
- end;
- procedure Tam_yhgl_xg.SpeedButton2Click(Sender: TObject);
- var s_dm:string;//员工代码
- N:integer;//错误
- begin
- if trim(dbediteh1.Text)='' then
- begin
- application.MessageBox('用户代码不能为空','提示',mb_ok+mb_iconinformation);
- dbediteh1.SetFocus;
- exit;
- end;
- if trim(dbediteh2.Text)='' then
- begin
- application.MessageBox('用户名称不能为空','提示',mb_ok+mb_iconinformation);
- dbediteh2.SetFocus;
- exit;
- end;
- if trim(dbediteh4.Text)='' then
- begin
- application.MessageBox('员工代码不能为空','提示',mb_ok+mb_iconinformation);
- dbediteh4.SetFocus;
- exit;
- end;
- //有效性验证
- n:=dm.xt_user.ApplyUpdates(0);
- if n<>0 then
- begin
- application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin
- application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
- close;
- end;
- end;
- procedure Tam_yhgl_xg.DBEditEh1KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- dbediteh2.SetFocus;
- end;
- procedure Tam_yhgl_xg.DBEditEh2KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- dbediteh3.SetFocus;
- end;
- procedure Tam_yhgl_xg.DBEditEh3KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- dbediteh4.SetFocus;
- end;
- procedure Tam_yhgl_xg.SpeedButton1Click(Sender: TObject);
- begin
- if am_ygxz=nil then
- begin
- am_ygxz:=Tam_ygxz.create(self);
- am_ygxz.showmodal;
- end;
- end;
- procedure Tam_yhgl_xg.FormCreate(Sender: TObject);
- begin
- dm.sz_yg.Active:=true;
- frm_name:='am_yhgl_xg';
- end;
- procedure Tam_yhgl_xg.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- dm.sz_yg.Active:=false;
- frm_name:='';
- action:=cafree;
- am_yhgl_xg:=nil;
- end;
- procedure Tam_yhgl_xg.DBEditEh4KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- speedbutton2.Click;
- end;
- procedure Tam_yhgl_xg.DBEditEh4Exit(Sender: TObject);
- var s,s_dm:string;
- begin
- {s:=trim(dbediteh4.Text);
- if s<>'' then
- begin
- dm.sz_yg.Close;
- dm.sz_yg.CommandText:='select * from sz_yg where yg_dm='+''''+s+''''+'';
- dm.sz_yg.open;
- if dm.sz_yg.RecordCount<>0 then
- begin
- s_dm:=trim(dm.sz_yg.FieldByName('yg_dm').AsString);
- if s<>'' then
- dbediteh5.Text:=s_dm
- end
- else
- begin
- application.MessageBox('当前表中没有该员工代码','提示',mb_ok+mb_iconinformation);
- dbediteh4.Text:='';
- dbediteh4.SetFocus;
- exit;//end if
- end;
- end
- else
- begin
- exit;
- end; }
- end;
- end.