⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yg_unit.pas

📁 044一通进销存 后缀名是.dfm
💻 PAS
字号:
unit yg_unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, ToolWin, Buttons, Grids, DBGrids, Menus;

type
  Tyg_form = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label11: TLabel;
    Label13: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    ComboBox1: TComboBox;
    Label8: TLabel;
    DBGrid1: TDBGrid;
    StatusBar1: TStatusBar;
    GroupBox6: TGroupBox;
    SpeedButton15: TSpeedButton;
    SpeedButton16: TSpeedButton;
    SpeedButton17: TSpeedButton;
    SpeedButton18: TSpeedButton;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    Edit8: TEdit;
    Edit9: TEdit;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    U1: TMenuItem;
    F1: TMenuItem;
    R1: TMenuItem;
    Edit10: TEdit;
    procedure SpeedButton18Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton15Click(Sender: TObject);
    procedure SpeedButton16Click(Sender: TObject);
    procedure SpeedButton17Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure N1Click(Sender: TObject);
    procedure U1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure F1Click(Sender: TObject);
    procedure R1Click(Sender: TObject);
    procedure DBGrid1CellClick(Column: TColumn);
    procedure Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit3KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure ComboBox1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit4KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit5KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit7KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit6KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit8KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit9KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  yg_form: Tyg_form;

implementation

uses data_unit, ygzl_find_unit;

{$R *.dfm}

procedure Tyg_form.SpeedButton18Click(Sender: TObject);
begin
close;
end;

procedure Tyg_form.FormCreate(Sender: TObject);
begin
self.Top :=74;
self.Left :=11;
self.Height :=491;
self.Width :=767;
with database do
begin
adoq1.Connection :=adoc;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from ygzl  ');
adoq1.active:=true;
statusbar1.Panels[1].Text :=inttostr(adoq1.Recordset.RecordCount);
datas1.DataSet :=adoq1;
dbgrid1.DataSource:=datas1;
end;

end;

procedure Tyg_form.SpeedButton15Click(Sender: TObject);
begin
if (length(edit1.Text)<>0) and (length(edit2.Text)<>0) then
begin
with database do
begin
adoq1.Connection :=adoc;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select 员工编码 from ygzl where 员工编码=:ygbm');
adoq1.Parameters.ParamByName('ygbm').Value:=edit1.Text;
adoq1.Active :=true;
if adoq1.Recordset.RecordCount >0 then
begin
showmessage('已有此信息,请重输!');
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from ygzl order by 员工编码');
adoq1.Active :=true;
statusbar1.Panels[1].Text :=inttostr(adoq1.Recordset.RecordCount);
datas1.DataSet :=adoq1;
dbgrid1.DataSource:=datas1;
edit1.SetFocus ;
end
else
begin
adoq1.SQL.Clear ;
adoq1.SQL.Add('insert into ygzl(员工编码,员工名称,拼音简码,学历,毕业学校,电话,地址,邮编,电子邮件,备注) values(:ygbm,:ygmc,:pyjm,:xl,:byyx,:dh,:dz,:yb,:dzyj,:bz)');
adoq1.parameters.ParamByName('ygbm').value :=edit1.text;
adoq1.parameters.ParamByName('ygmc').value :=edit2.text;
adoq1.parameters.ParamByName('pyjm').value :=edit3.text;
adoq1.Parameters.ParamByName('xl').Value :=combobox1.text;
adoq1.Parameters.ParamByName('byyx').Value :=edit4.text;
adoq1.parameters.ParamByName('dh').value :=edit5.text;
adoq1.parameters.ParamByName('dz').value :=edit7.text;
adoq1.parameters.ParamByName('yb').value :=edit6.text;
adoq1.Parameters.ParamByName('dzyj').Value :=edit8.Text;
adoq1.Parameters.ParamByName('bz').Value :=edit9.text;
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from ygzl');
adoq1.Active :=true;
datas1.DataSet :=adoq1;
dbgrid1.DataSource:=datas1;
statusbar1.Panels[1].Text :=inttostr(adoq1.Recordset.RecordCount);
edit1.Clear ;edit2.Clear ;edit3.Clear ;edit4.clear;edit5.Clear;edit6.clear ;
edit7.Clear ;edit8.Clear ;edit9.Clear;
combobox1.Text :='';
edit1.SetFocus ;
end;
end ;
end
else
begin
showmessage('请输入员工编码和员工名称');
edit1.SetFocus ;
end;

end;

procedure Tyg_form.SpeedButton16Click(Sender: TObject);
begin
speedbutton15.Enabled :=false;
speedbutton17.Enabled :=false;
with database do
begin
adoq1.Connection :=adoc;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from ygzl where 员工编码=:ygbm');
adoq1.Parameters.ParamByName('ygbm').Value:=edit10.Text;
adoq1.Active :=true;
if adoq1.Recordset.RecordCount >0 then
begin
edit1.Text :=adoq1.Fields.Fields[0].AsString ;
edit2.Text :=adoq1.Fields.Fields[1].AsString ;
edit3.Text :=adoq1.Fields.Fields[2].AsString ;
combobox1.Text:=adoq1.Fields.Fields[3].AsString ;
edit4.Text :=adoq1.Fields.Fields[4].AsString ;
edit5.Text :=adoq1.Fields.Fields[5].AsString ;
edit7.Text :=adoq1.Fields.Fields[6].AsString ;
edit6.Text :=adoq1.Fields.Fields[7].AsString ;
edit8.Text :=adoq1.Fields.Fields[8].AsString ;
edit9.Text :=adoq1.Fields.Fields[9].AsString ;
edit1.ReadOnly :=true;
edit2.SetFocus ;
end
else
showmessage('请刷新选择记录!');

end;

end;

procedure Tyg_form.SpeedButton17Click(Sender: TObject);
begin
with database do
begin
adoq1.Connection :=adoc;
if application.MessageBox('是否真的删除?','记录删除',4)=6 then
begin
adoq1.SQL.Clear ;
adoq1.SQL.Add('delete from ygzl where 员工编码=:ygbm');
adoq1.Parameters.ParamByName('ygbm').Value:=edit10.Text;
adoq1.ExecSQL ;
end;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from ygzl');
adoq1.Active :=true;
datas1.DataSet:=adoq1;
dbgrid1.DataSource :=datas1;
statusbar1.Panels[1].Text :=inttostr(adoq1.Recordset.RecordCount);
end;

end;

procedure Tyg_form.SpeedButton1Click(Sender: TObject);
begin
with database do
begin
adoq2.Connection :=adoc;
adoq2.SQL.Clear ;
adoq2.SQL.Add('update ygzl set 员工名称=:ygmc,拼音简码=:pyjm ,学历=:xl,毕业学校=:byyx,电话=:dh,地址=:dz,邮编=:yb,');
adoq2.SQL.Add('电子邮件=:dzyj,备注=:bz where 员工编码=:ygbm');
adoq2.parameters.ParamByName('ygbm').value :=edit1.text;
adoq2.parameters.ParamByName('ygmc').value :=edit2.text;
adoq2.parameters.ParamByName('pyjm').value :=edit3.text;
adoq2.Parameters.ParamByName('xl').Value :=combobox1.Text ;
adoq2.Parameters.ParamByName('byyx').Value :=edit4.text;
adoq2.parameters.ParamByName('dh').value :=edit5.text;
adoq2.parameters.ParamByName('dz').value :=edit7.text;
adoq2.parameters.ParamByName('yb').value :=edit6.text;
adoq2.parameters.ParamByName('dzyj').value :=edit8.text;
adoq2.Parameters.ParamByName('bz').Value :=edit9.Text;
adoq2.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from ygzl');
adoq1.Active :=true;
datas1.DataSet :=adoq1;
dbgrid1.DataSource:=datas1;
statusbar1.Panels[1].Text :=inttostr(adoq1.Recordset.RecordCount);
edit1.Clear ;edit2.Clear ;edit3.Clear ;edit4.clear;edit5.Clear;edit6.clear ;
edit7.Clear ;edit8.Clear ;edit9.Clear ;
combobox1.Text :='';
edit1.SetFocus ;
edit1.ReadOnly :=false;
speedbutton15.Enabled :=true;
speedbutton17.Enabled :=true;

end;


end;

procedure Tyg_form.SpeedButton2Click(Sender: TObject);
begin
speedbutton15.Enabled :=true;
speedbutton17.Enabled :=true;
edit1.ReadOnly :=false;
edit1.Clear ;edit2.Clear ;edit3.Clear ;edit4.clear;edit5.Clear;edit6.clear ;
edit7.Clear ;edit8.Clear ;edit9.Clear ;
combobox1.Text :='';
edit1.SetFocus ;
end;

procedure Tyg_form.SpeedButton3Click(Sender: TObject);
begin
edit1.Clear ;edit2.Clear ;edit3.Clear ;edit4.clear;edit5.Clear;edit6.clear ;
edit7.Clear ;edit8.Clear ;edit9.Clear ;
combobox1.Text :='';
speedbutton15.Enabled :=true;
speedbutton17.Enabled :=true;
edit1.ReadOnly :=false;
edit1.SetFocus ;
ygzl_find_form:=Tygzl_find_form.create(application);
ygzl_find_form.show;

end;

procedure Tyg_form.SpeedButton4Click(Sender: TObject);
begin
speedbutton15.Enabled :=true;
speedbutton17.Enabled :=true;
edit1.ReadOnly :=false;
edit1.SetFocus ;
with database do
begin
adoq1.Connection :=adoc;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from ygzl order by 员工编码');
adoq1.Active :=true;
datas1.DataSet:=adoq1;
dbgrid1.DataSource :=datas1;
statusbar1.Panels[1].Text :=inttostr(adoq1.Recordset.RecordCount);
end;

end;

procedure Tyg_form.N1Click(Sender: TObject);
begin
speedbutton15click(nil);

end;

procedure Tyg_form.U1Click(Sender: TObject);
begin
speedbutton16click(nil);

end;

procedure Tyg_form.N2Click(Sender: TObject);
begin
speedbutton17click(nil);

end;

procedure Tyg_form.F1Click(Sender: TObject);
begin
speedbutton3click(nil);
end;

procedure Tyg_form.R1Click(Sender: TObject);
begin
speedbutton4click(nil);

end;

procedure Tyg_form.DBGrid1CellClick(Column: TColumn);
begin
if dbgrid1.DataSource.DataSet.RecordCount>0 then
edit10.Text :=dbgrid1.DataSource.DataSet.FieldValues['员工编码'];

end;

procedure Tyg_form.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
edit2.SetFocus ;
end;

procedure Tyg_form.Edit2KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
edit3.SetFocus ;

end;

procedure Tyg_form.Edit3KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
combobox1.SetFocus ;

end;

procedure Tyg_form.ComboBox1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
edit4.SetFocus ;

end;

procedure Tyg_form.Edit4KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
edit5.SetFocus ;

end;

procedure Tyg_form.Edit5KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
edit7.SetFocus ;

end;

procedure Tyg_form.Edit7KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
edit6.SetFocus ;

end;

procedure Tyg_form.Edit6KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
edit8.SetFocus ;

end;

procedure Tyg_form.Edit8KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
edit9.SetFocus ;

end;

procedure Tyg_form.Edit9KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_return then
speedbutton15click(nil);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -