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

📄 kehu.pas

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

interface

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

type
  TFormkehu = class(TForm)
    PageControl1: TPageControl;
    MainMenu1: TMainMenu;
    Q1: TMenuItem;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    ToolButton4: TToolButton;
    ToolButton5: TToolButton;
    ToolButton6: TToolButton;
    ToolButton7: TToolButton;
    ToolButton9: TToolButton;
    DBGrid1: TDBGrid;
    StringGrid1: TStringGrid;
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    Edit1: TEdit;
    Button1: TButton;
    Edit2: TEdit;
    Button2: TButton;
    Edit3: TEdit;
    Button3: TButton;
    Edit4: TEdit;
    Button4: TButton;
    DataSource1: TDataSource;
    ADOQuery1: TADOQuery;
    ADOQuery2: TADOQuery;
    procedure Q1Click(Sender: TObject);
    procedure ToolButton9Click(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure ToolButton3Click(Sender: TObject);
    procedure ToolButton4Click(Sender: TObject);
    procedure ToolButton5Click(Sender: TObject);
    procedure ToolButton6Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Formkehu: TFormkehu;

implementation

uses datamodel;

{$R *.dfm}

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

procedure TFormkehu.ToolButton9Click(Sender: TObject);
begin
  ADOQuery2.Close;
  ADOQuery2.SQL.Clear;
  ADOQuery2.SQL.Add('select * from 客户');
  ADOQuery2.Open;
end;

procedure TFormkehu.ToolButton1Click(Sender: TObject);
begin
DataSource1.DataSet.First;
end;

procedure TFormkehu.ToolButton2Click(Sender: TObject);
begin
  DataSource1.DataSet.Prior;
end;

procedure TFormkehu.ToolButton3Click(Sender: TObject);
begin
  DataSource1.DataSet.Next;
end;

procedure TFormkehu.ToolButton4Click(Sender: TObject);
begin
  DataSource1.DataSet.Last;
end;

procedure TFormkehu.ToolButton5Click(Sender: TObject);
begin
  DataSource1.DataSet.Insert;
end;

procedure TFormkehu.ToolButton6Click(Sender: TObject);
begin
   DataSource1.DataSet.Delete;
end;

procedure TFormkehu.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]:='客户ID';
  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[10,0]:='客户信誉统计';
  stringgrid1.Cells[11,0]:='客户等级管理';
        stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客户ID').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;
        stringgrid1.Cells[10,i]:=ADOQuery1.Fieldbyname('客户信誉统计').AsString;
        stringgrid1.Cells[11,i]:=ADOQuery1.Fieldbyname('客户等级管理').AsString;

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

      end;





procedure TFormkehu.Button3Click(Sender: TObject);

      var
       i,j:integer;

  begin
    if edit3.Text<>'' then
      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]:='客户ID';
  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[10,0]:='客户信誉统计';
  stringgrid1.Cells[11,0]:='客户等级管理';
        stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客户ID').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;
        stringgrid1.Cells[10,i]:=ADOQuery1.Fieldbyname('客户信誉统计').AsString;
        stringgrid1.Cells[11,i]:=ADOQuery1.Fieldbyname('客户等级管理').AsString;

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

    end;



procedure TFormkehu.Button2Click(Sender: TObject);
   var
       i,j:integer;

begin
  if edit2.Text<>'' then
      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]:='客户ID';
  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[10,0]:='客户信誉统计';
  stringgrid1.Cells[11,0]:='客户等级管理';
        stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客户ID').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;
        stringgrid1.Cells[10,i]:=ADOQuery1.Fieldbyname('客户信誉统计').AsString;
        stringgrid1.Cells[11,i]:=ADOQuery1.Fieldbyname('客户等级管理').AsString;

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

end;

procedure TFormkehu.Button4Click(Sender: TObject);
 var
 i,j:integer;
begin
  if edit4.Text<>'' then
      ADOQuery1.Close;
      ADOQuery1.SQL.Clear;
      ADOQuery1.SQL.Add('select * from 客户 where 联系人名字 like ''%'+edit4.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]:='客户ID';
          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[10,0]:='客户信誉统计';
          stringgrid1.Cells[11,0]:='客户等级管理';
        stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客户ID').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;
        stringgrid1.Cells[10,i]:=ADOQuery1.Fieldbyname('客户信誉统计').AsString;
        stringgrid1.Cells[11,i]:=ADOQuery1.Fieldbyname('客户等级管理').AsString;

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

procedure TFormkehu.FormCreate(Sender: TObject);
begin
  stringgrid1.Cells[0,0]:='客户ID';
  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[10,0]:='客户信誉统计';
  stringgrid1.Cells[11,0]:='客户等级管理';

end;

end.

⌨️ 快捷键说明

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