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

📄 goodsunit.pas

📁 软件简介:(贸易管理系统Delphi源代码(有开发文档) 采用access+delphi设计 软件实现功能:供应商信息的输入
💻 PAS
字号:
unit goodsunit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, StdCtrls, DBCtrls, Mask, ExtCtrls, ImgList,
  ComCtrls, ToolWin;

type
  Tgoodsfrm = class(TForm)
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    ToolButton4: TToolButton;
    ToolButton5: TToolButton;
    ToolButton6: TToolButton;
    ToolButton7: TToolButton;
    ToolButton8: TToolButton;
    ImageList1: TImageList;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label6: TLabel;
    DBGrid1: TDBGrid;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Memo1: TMemo;
    Splitter1: TSplitter;
    procedure ToolButton8Click(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure DBGrid1CellClick(Column: TColumn);
    procedure ToolButton3Click(Sender: TObject);
    procedure ToolButton5Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ToolButton6Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  goodsfrm: Tgoodsfrm;

implementation

uses datamoduleUnit;

{$R *.dfm}

procedure Tgoodsfrm.ToolButton8Click(Sender: TObject);
begin
goodsfrm.Close;
end;

procedure Tgoodsfrm.ToolButton1Click(Sender: TObject);
begin
  if (edit1.Text='')or(edit2.Text='')or(edit3.Text='')or(edit4.Text='') then
        showmessage('No data put in!')
  else
      begin
          with  datamodule2.ADSgoods do
              begin
                  Insert;
                  FieldByName('商品编号').AsString:=edit1.Text;
                  FieldByName('商品名称').AsString:=edit2.Text;
                  FieldByName('商品规格').AsString:=edit3.Text;
                  FieldByName('计量单位').AsString:=edit4.Text;
                  FieldByName('备注信息').AsString:=memo1.Lines.Text;
                  post;
                  refresh;
              end;
      end;

end;

procedure Tgoodsfrm.ToolButton2Click(Sender: TObject);
begin
 if (edit1.Text='')or(edit2.Text='')or(edit3.Text='')or(edit4.Text='') then
        showmessage('No data put in!')
  else
      begin
          with  datamodule2.ADSgoods do
              begin
                  edit;
                  FieldByName('商品编号').AsString:=edit1.Text;
                  FieldByName('商品名称').AsString:=edit2.Text;
                  FieldByName('商品规格').AsString:=edit3.Text;
                  FieldByName('计量单位').AsString:=edit4.Text;
                  FieldByName('备注信息').AsString:=memo1.Lines.Text;
                  post;
                  refresh;
              end;
      end;
end;

procedure Tgoodsfrm.DBGrid1CellClick(Column: TColumn);
begin
        with  datamodule2.ADSgoods do
              begin
                 edit1.Text:=FieldByName('商品编号').AsString;
                 edit2.Text:=FieldByName('商品名称').AsString;
                 edit3.Text:=FieldByName('商品规格').AsString;
                 edit4.Text:=FieldByName('计量单位').AsString;
                 memo1.Lines.Text:=FieldByName('备注信息').AsString;
                 refresh;
              end;
      
end;

procedure Tgoodsfrm.ToolButton3Click(Sender: TObject);
begin
  if MessageDlg('确定删除吗?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
     datamodule2.ADSgoods.Delete;
end;

procedure Tgoodsfrm.ToolButton5Click(Sender: TObject);
begin
  datamodule2.ADSgoods.Edit;
  datamodule2.ADSgoods.Post;
end;

procedure Tgoodsfrm.FormCreate(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
end;
procedure Tgoodsfrm.ToolButton6Click(Sender: TObject);
begin
 datamodule2.ADSgoods.Cancel;;
end;

end.


⌨️ 快捷键说明

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