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

📄 terminalfindinfo.~pas

📁 是一款针对啤酒行业的销售进销存管理系统,包括基本的进货,销售,库存
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
unit TerminalFindInfo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Grids, ComCtrls, PicButton, DB, ADODB,Comobj,excel97,excel2000;

type
  TTerminalFind = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    PicButton1: TPicButton;
    PicButton3: TPicButton;
    PicButton4: TPicButton;
    Bevel3: TBevel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    PicButton5: TPicButton;
    PicButton2: TPicButton;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    Edit1: TEdit;
    SaleDate: TDateTimePicker;
    ComboBox3: TComboBox;
    DBgrid: TStringGrid;
    ListView1: TListView;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    query1: TADOQuery;
    ADOTable1: TADOTable;
    procedure Image2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure PicButton1Click(Sender: TObject);
    procedure ComboBox1Click(Sender: TObject);
    procedure PicButton3Click(Sender: TObject);
    procedure PicButton4Click(Sender: TObject);
    procedure PicButton5Click(Sender: TObject);
    procedure PicButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
   TerminalFind: TTerminalFind;
   strList,strList1:TStringList;
   strWhere,strSql,strSql1:string;
   stringl,stringl1,strWhere1,strWhere2:string;
   strType:string;
   strOper:string;
   strOper1:string;
   FieldList:TStringList;
implementation

{$R *.dfm}
uses common,PrinterRpt;
procedure TTerminalFind.Image2Click(Sender: TObject);
begin
  close;
end;

procedure TTerminalFind.FormCreate(Sender: TObject);
begin
    ShowPloyForm(image1.Picture.Bitmap,handle);
    ///添加查询字段////
    combobox1.Items.add('销售单号');
    combobox1.Items.add('销售日期');
    combobox1.Items.add('区域名称');
    combobox1.Items.add('产品名称');
    combobox1.Items.add('二级商名称');
    //combobox1.Items.add('产品名称');
    combobox1.Items.add('经手人');
    combobox1.Items.add('所属市');
    combobox1.Items.add('其他');
    combobox1.Items.add('所有'); 

    ///添加操作符/////
    combobox2.Items.Add('=');
    combobox2.Items.Add('>');
    combobox2.Items.Add('<');
    combobox2.Items.Add('<>'); 
    combobox2.Items.Add('>=');
    combobox2.Items.Add('<=');
    combobox2.Items.Add('like');
    ///添加运算符/////
    combobox3.Items.Add('并且');
    combobox3.Items.Add('或者');
    ///设置控件stringGrid的标题//////
       DBgrid.Cells[0,0]:='销售单号';
       dbgrid.ColWidths[0]:=100; 
       DBgrid.Cells[1,0]:='终端名称';
       DBgrid.Cells[2,0]:='所属区域';
       DBgrid.Cells[3,0]:='产品编码';
       DBgrid.Cells[4,0]:='产品名称';
       DBgrid.Cells[5,0]:='规格';
       DBgrid.Cells[6,0]:='容量';
       DBgrid.Cells[7,0]:='单位';
       DBgrid.Cells[8,0]:='单价';
       DBgrid.Cells[9,0]:='数量';
       DBgrid.Cells[10,0]:='金额';
       DBgrid.Cells[11,0]:='搭赠政策';
       DBgrid.Cells[12,0]:='搭赠数量';
       DBgrid.Cells[13,0]:='搭赠金额';
       Dbgrid.Cells[14,0]:='销售日期';
       //DBgrid.Cells[14,0]:='库存';
       strOper1:='and';
       strList:=TStringList.Create;
       strList1:=TstringList.Create;
end;

procedure TTerminalFind.PicButton1Click(Sender: TObject);
var
   ListItem:TListItem;
   i,index:integer;
begin
      //stringl:=Tstringlist.Create;


     if combobox1.text='销售日期' then
     begin
        listitem:=listview1.items.add;
        listitem.Caption:=combobox1.Text;
        listitem.SubItems.Add(combobox2.text);
        listitem.SubItems.Add(DateToStr(saleDate.Date));
        listitem.SubItems.Add(combobox3.text);
        strWhere:=trim(strType)+trim(combobox2.text)+'"'+trim(DateToStr(saleDate.Date))+'"  '+trim(strOper1)+'  ';
        strList1.Add(strWhere);
     end
     else
     begin
        listitem:=listview1.items.add;
        listitem.Caption:=combobox1.Text;
        listitem.SubItems.Add(combobox2.text);
        listitem.SubItems.Add(edit1.text);
        listitem.SubItems.Add(combobox3.text);
        strWhere:=trim(strType)+trim(combobox2.text)+'"'+trim(edit1.text)+'"  '+trim(strOper1)+'  ';
        strList.Add(strWhere);
     end;
     //strList.Add(strWhere);
     strSql:='';
     for i:=0 to strList.count-1 do
     begin
        strSql:=strSql+strList[i];
     end;
     //showmessage(strSql);
     strSql1:='';
     for i:=0 to strList1.count-1 do
     begin
        strSql1:=strSql1+strList1[i];
     end;
     //showmessage(strSql1);
end;

procedure TTerminalFind.ComboBox1Click(Sender: TObject);
begin
     case  combobox1.ItemIndex  of
    1:
         begin
          saleDate.Left:=377;
          saleDate.Top:=57;
          saleDate.Visible:=true;
          edit1.Visible:=false;
          strType:='saleDate';
         end; 
    0:
         begin
          edit1.Left:=377;
          edit1.Top:=57;
          saleDate.Visible:=false;
          edit1.Visible:=true;
          strType:='saleCode';

         end;
    2:
         begin
          edit1.Left:=377;
          edit1.Top:=57;
          saleDate.Visible:=false;
          edit1.Visible:=true;
          strType:='areaName';

         end;
    3:
         begin
          edit1.Left:=377;
          edit1.Top:=57;
          saleDate.Visible:=false;
          edit1.Visible:=true;
          strType:='ProductName';

         end;
    4:
         begin
          edit1.Left:=377;
          edit1.Top:=57;
          saleDate.Visible:=false;
          edit1.Visible:=true;
          strType:='traderName';

         end;
    5:
         begin
          edit1.Left:=377;
          edit1.Top:=57;
          saleDate.Visible:=false;
          edit1.Visible:=true;
          strType:='checker';

         end;
    6:
         begin
          edit1.Left:=377;
          edit1.Top:=57;
          saleDate.Visible:=false;
          edit1.Visible:=true;
          strType:='city';

         end;
    end;
end;

procedure TTerminalFind.PicButton3Click(Sender: TObject);
begin
     strList.Clear;
     strList1.Clear;
     strSql:='';
     strSql1:='';
     listview1.Clear;
     strList.Clear;
     //strList.Free;
     //strList1.Free;   
end;

procedure TTerminalFind.PicButton4Click(Sender: TObject);
var
  strSearch,strSearch1:string;
  query2,Query3:TAdoQuery;
  price_Arg:double;  ///平均价
  Amount_Sum:double; ///总数量
  Money_Sum:double;  ///总金额
  Present_Sum:double;///搭赠数量
  Present_Money:double;//搭赠金额
  i:integer;
  tmpTotal:Array[0..3] of double;
  strdelete,strInsert:string;
begin
      stringl:=DeleteLastSubstring(' and ',strsql1);
      //Showmessage(stringl);

      FieldList:=TStringList.Create;
      if (strList1.Count>0) then
      begin
         strSearch:='SELECT * FROM  sale_TraderTable WHERE  '+stringl;
         //showmessage(strSearch);
         query2:=RunSqlOfAdo(query1,strSearch);
         if isRunSql(query1,strSearch) then
         begin
            //Showmessage('bbb'+'aaaa');
            while not query2.Eof do
            begin
               FieldList.Add(query2.FieldValues['saleCode']);
               query2.next;
            end;
            FieldList.Sort;
            strWhere1:=' saleCode  BETWEEN  "'+FieldList[0]+'" and  "'+FieldList[FieldList.count-1]+'"';
         end
         else
            begin
                Showmessage('记录不存在...');
                /////////////
                for i:=1 to dbgrid.rowcount-2 do
                begin
                   dbgrid.Cells[0,i]:='';
                   dbgrid.Cells[1,i]:='';
                   dbgrid.Cells[2,i]:='';
                   dbgrid.Cells[3,i]:='';
                   dbgrid.Cells[4,i]:='';
                   dbgrid.Cells[5,i]:='';

⌨️ 快捷键说明

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