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

📄 supply.pas

📁 一个初级的条码应用管理系统,应用于DT9
💻 PAS
字号:
unit supply;

interface

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

type
  TFormsupply = class(TForm)
    MainMenu1: TMainMenu;
    Q1: TMenuItem;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    StringGrid1: TStringGrid;
    Panel1: TPanel;
    DBGrid1: TDBGrid;
    ToolBar1: TToolBar;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    BitBtn5: TBitBtn;
    BitBtn6: TBitBtn;
    BitBtn7: TBitBtn;
    Edit1: TEdit;
    Button1: TButton;
    Edit2: TEdit;
    Button2: TButton;
    Edit3: TEdit;
    Button3: TButton;
    ADOQuery1: TADOQuery;
    DataSource1: TDataSource;
    procedure FormShow(Sender: TObject);
    procedure Q1Click(Sender: TObject);
    procedure BitBtn7Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure BitBtn5Click(Sender: TObject);
    procedure BitBtn6Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Formsupply: TFormsupply;

implementation

uses datamodel;

{$R *.dfm}

procedure TFormsupply.FormShow(Sender: TObject);
begin
  stringgrid1.Cells[0,0]:='供应商编号';
  stringgrid1.Cells[1,0]:='供应商名称';
  stringgrid1.Cells[2,0]:='联系人';
  stringgrid1.Cells[3,0]:='电话';
  stringgrid1.Cells[4,0]:='传真';
  stringgrid1.Cells[5,0]:='地址';
  stringgrid1.Cells[6,0]:='开户行';
  stringgrid1.Cells[7,0]:='银行帐号';
  stringgrid1.Cells[8,0]:='信誉';
  stringgrid1.Cells[9,0]:='等级';




end;

procedure TFormsupply.Q1Click(Sender: TObject);
begin
close;
end;

procedure TFormsupply.BitBtn7Click(Sender: TObject);
begin
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('select * from 供应商');
  ADOQuery1.Open;
end;

procedure TFormsupply.BitBtn1Click(Sender: TObject);
begin
  DataSource1.DataSet.First;
end;

procedure TFormsupply.BitBtn2Click(Sender: TObject);
begin
  DataSource1.DataSet.Prior;
end;

procedure TFormsupply.BitBtn3Click(Sender: TObject);
begin
   DataSource1.DataSet.Next;
end;

procedure TFormsupply.BitBtn4Click(Sender: TObject);
begin
  DataSource1.DataSet.Last;
end;

procedure TFormsupply.BitBtn5Click(Sender: TObject);
begin
  DataSource1.DataSet.Insert;
end;

procedure TFormsupply.BitBtn6Click(Sender: TObject);
begin
  DataSource1.DataSet.Delete;
end;

procedure TFormsupply.Button1Click(Sender: TObject);
  var
    i,j:integer;

begin
   if edit1.Text<>'' then
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('select * from 供应商 where 公司名称 like ''%'+edit1.Text+'%''');
  ADOQuery1.Open;
    for i:=1 to 100 do
         for j:=0 to 100 do
           stringgrid1.Cells[i,j]:='';

    i:=1;
   // recordnum:=0;
     while not ADOQuery1.Eof do
      begin
      //设置列宽
        stringgrid1.ColWidths[0]:=32;
        stringgrid1.ColWidths[2]:=128;
        stringgrid1.ColWidths[4]:=128;
        stringgrid1.ColWidths[7]:=128;
        stringgrid1.ColWidths[9]:=128;


         //----显示查询-------////
         stringgrid1.Cells[0,0]:='供应商编号';
  stringgrid1.Cells[1,0]:='供应商名称';
  stringgrid1.Cells[2,0]:='联系人';
  stringgrid1.Cells[3,0]:='地址';
  stringgrid1.Cells[4,0]:='电话';
  stringgrid1.Cells[5,0]:='传真';
  stringgrid1.Cells[6,0]:='开户行';
  stringgrid1.Cells[7,0]:='银行帐号';
  stringgrid1.Cells[8,0]:='信誉';
  stringgrid1.Cells[9,0]:='等级';
        stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客户ID').AsString;
        stringgrid1.Cells[1,i]:=ADOQuery1.Fieldbyname('公司名称').AsString;
        stringgrid1.Cells[2,i]:=ADOQuery1.Fieldbyname('联系人名字').AsString;
        stringgrid1.Cells[3,i]:=ADOQuery1.Fieldbyname('地址').AsString;
        stringgrid1.Cells[4,i]:=ADOQuery1.Fieldbyname('电话号码').AsString;
        stringgrid1.Cells[5,i]:=ADOQuery1.Fieldbyname('传真号码').AsString;
        stringgrid1.Cells[6,i]:=ADOQuery1.Fieldbyname('开户行').AsString;
        stringgrid1.Cells[7,i]:=ADOQuery1.Fieldbyname('银行账号').AsString;
        stringgrid1.Cells[8,i]:=ADOQuery1.Fieldbyname('客户信誉统计').AsString;
        stringgrid1.Cells[9,i]:=ADOQuery1.Fieldbyname('客户等级管理').AsString;

       i:=i+1;
      // recordnum:=recordnum+1;
     ADOQuery1.Next;
         end;
         if edit1.Text='' then
        showmessage('你输入的信息为空');

end;

procedure TFormsupply.Button3Click(Sender: TObject);

  var
    i,j:integer;
begin
   if edit3.Text<>'' then
     begin
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('select * from 供应商 where 联系人名字 like ''%'+edit3.Text+'%''');
         ADOQuery1.Open;
         for i:=1 to 100 do
            for j:=0 to 100 do
             stringgrid1.Cells[i,j]:='';

    i:=1;
   // recordnum:=0;
     while not ADOQuery1.Eof do
      begin
      //设置列宽
        stringgrid1.ColWidths[0]:=32;
        stringgrid1.ColWidths[2]:=128;
        stringgrid1.ColWidths[4]:=128;
        stringgrid1.ColWidths[7]:=128;
        stringgrid1.ColWidths[9]:=128;


         //----显示查询-------////
         stringgrid1.Cells[0,0]:='供应商编号';
  stringgrid1.Cells[1,0]:='供应商名称';
  stringgrid1.Cells[2,0]:='联系人';
  stringgrid1.Cells[3,0]:='地址';
  stringgrid1.Cells[4,0]:='电话';
  stringgrid1.Cells[5,0]:='传真';
  stringgrid1.Cells[6,0]:='开户行';
  stringgrid1.Cells[7,0]:='银行帐号';
  stringgrid1.Cells[8,0]:='信誉';
  stringgrid1.Cells[9,0]:='等级';
        stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客户ID').AsString;
        stringgrid1.Cells[1,i]:=ADOQuery1.Fieldbyname('公司名称').AsString;
        stringgrid1.Cells[2,i]:=ADOQuery1.Fieldbyname('联系人名字').AsString;
        stringgrid1.Cells[3,i]:=ADOQuery1.Fieldbyname('地址').AsString;
        stringgrid1.Cells[4,i]:=ADOQuery1.Fieldbyname('电话号码').AsString;
        stringgrid1.Cells[5,i]:=ADOQuery1.Fieldbyname('传真号码').AsString;
        stringgrid1.Cells[6,i]:=ADOQuery1.Fieldbyname('开户行').AsString;
        stringgrid1.Cells[7,i]:=ADOQuery1.Fieldbyname('银行账号').AsString;
        stringgrid1.Cells[8,i]:=ADOQuery1.Fieldbyname('客户信誉统计').AsString;
        stringgrid1.Cells[9,i]:=ADOQuery1.Fieldbyname('客户等级管理').AsString;

       i:=i+1;
      // recordnum:=recordnum+1;
     ADOQuery1.Next;
         end;
       end;
         if edit3.Text='' then
         begin
        showmessage('你输入的信息为空');
         end;
end;

procedure TFormsupply.Button2Click(Sender: TObject);
 var
    i,j:integer;
begin
   if edit2.Text<>'' then
     begin
         ADOQuery1.Close;
         ADOQuery1.SQL.Clear;
         ADOQuery1.SQL.Add('select * from 供应商 where 地址 like ''%'+edit2.Text+'%''');
         ADOQuery1.Open;
         for i:=1 to 100 do
            for j:=0 to 100 do
             stringgrid1.Cells[i,j]:='';

    i:=1;
   // recordnum:=0;
     while not ADOQuery1.Eof do
      begin
      //设置列宽
        stringgrid1.ColWidths[0]:=32;
        stringgrid1.ColWidths[2]:=128;
        stringgrid1.ColWidths[4]:=128;
        stringgrid1.ColWidths[7]:=128;
        stringgrid1.ColWidths[9]:=128;


         //----显示查询-------////
         stringgrid1.Cells[0,0]:='供应商编号';
  stringgrid1.Cells[1,0]:='供应商名称';
  stringgrid1.Cells[2,0]:='联系人';
  stringgrid1.Cells[3,0]:='地址';
  stringgrid1.Cells[4,0]:='电话';
  stringgrid1.Cells[5,0]:='传真';
  stringgrid1.Cells[6,0]:='开户行';
  stringgrid1.Cells[7,0]:='银行帐号';
  stringgrid1.Cells[8,0]:='信誉';
  stringgrid1.Cells[9,0]:='等级';
        stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客户ID').AsString;
        stringgrid1.Cells[1,i]:=ADOQuery1.Fieldbyname('公司名称').AsString;
        stringgrid1.Cells[2,i]:=ADOQuery1.Fieldbyname('联系人名字').AsString;
        stringgrid1.Cells[3,i]:=ADOQuery1.Fieldbyname('地址').AsString;
        stringgrid1.Cells[4,i]:=ADOQuery1.Fieldbyname('电话号码').AsString;
        stringgrid1.Cells[5,i]:=ADOQuery1.Fieldbyname('传真号码').AsString;
        stringgrid1.Cells[6,i]:=ADOQuery1.Fieldbyname('开户行').AsString;
        stringgrid1.Cells[7,i]:=ADOQuery1.Fieldbyname('银行账号').AsString;
        stringgrid1.Cells[8,i]:=ADOQuery1.Fieldbyname('客户信誉统计').AsString;
        stringgrid1.Cells[9,i]:=ADOQuery1.Fieldbyname('客户等级管理').AsString;

       i:=i+1;
      // recordnum:=recordnum+1;
     ADOQuery1.Next;
         end;
       end;
         if edit2.Text='' then
         begin
        showmessage('你输入的信息为空');
         end;
end;


end.

⌨️ 快捷键说明

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