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

📄 mc_kcxxtj.~pas

📁 腾龙餐饮管理软件
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
procedure TKCXXTJ.BitBtn4Click(Sender: TObject);
begin
//如果输入信息为空
 If Length(Edit1.Text) = 0 Then
 begin
  ShowMessage('请输入查询的信息.');
  Edit1.Setfocus;
 End
 Else
  //查询条件为Like
  if ComboBox2.Items[ComboBox2.ItemIndex]='Like' then
  begin
   if Edit1.Text='*' then
    begin
    Query1.Close;
    Query1.SQL.CLear;
    Query1.SQL.Add('Select * From 库存信息表');
    if CKM<>'All' then
    begin
     Query1.SQL.Add('Where 仓库名称=:A');
     Query1.ParamByName('A').AsString:=CKM;
     Query1.Open;
     Query2.Close;
     Query2.SQL.Clear;
     Query2.SQL.Add('Select Count(DisTinCT 商品编号),SUM(数量),SUM(数量*单价) From 库存信息表');
     Query2.SQL.Add('Where 仓库名称=:A');
     Query2.ParamByName('A').AsString:=CKM;
     Query2.Open;
     Label2.Caption:=Query2.Fields[0].AsString+'种';
     Label4.Caption:=Query2.Fields[1].AsString;
     Label6.Caption:=Query2.Fields[2].AsString;
     Query2.Close;
    End
   Else
   begin
    Query1.Close;
    Query1.SQL.CLear;
    Query1.SQL.Add('Select * From 库存信息表');
    Query1.Open;
    Query2.Close;
    Query2.SQL.Clear;
    Query2.SQL.Add('Select Count(DisTinCT 商品编号),SUM(数量),SUM(数量*单价) From 库存信息表');
    Query2.Open;
    Label2.Caption:=Query2.Fields[0].AsString+'种';
    Label4.Caption:=Query2.Fields[1].AsString;
    Label6.Caption:=Query2.Fields[2].AsString;
    Query2.Close;
   end;
   End
  Else
  begin
  //查询字段为 '商品名称'
  if ComboBox1.Items[ComboBox1.ItemIndex]='商品名称' then
  begin
   if CKM='All' then
   begin
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Select * From 库存信息表');
    Query1.SQL.Add('Where 商品名称 Like :A');
    Query1.ParamByName('A').AsString:=Edit1.Text+'%';
    Query1.Open;
    Query2.Close;
    Query2.SQL.Clear;
    Query2.SQL.Add('Select Count(DisTinCT 商品编号),SUM(数量),SUM(数量*单价) From 库存信息表');
    Query2.SQL.Add('Where 商品名称 Like :A');
    Query2.ParamByName('A').AsString:=Edit1.Text+'%';
    Query2.Open;
    Label2.Caption:=Query2.Fields[0].AsString+'种';
    Label4.Caption:=Query2.Fields[1].AsString;
    Label6.Caption:=Query2.Fields[2].AsString;
    Query2.Close;
   End
   Else
   begin
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Select * From 库存信息表');
    Query1.SQL.Add('Where 商品名称 Like :A and 仓库名称 = :B');
    Query1.ParamByName('A').AsString:=Edit1.Text+'%';
    Query1.ParamByName('B').AsString:=CKM;
    Query1.Open;
    Query2.Close;
    Query2.SQL.Clear;
    Query2.SQL.Add('Select Count(DisTinCt 商品编号),Sum(数量),Sum(数量*单价) From 库存信息表');
    Query2.SQL.Add('Where 商品名称 Like :A and 仓库名称=:B');
    Query2.ParamByName('A').AsString:=Edit1.Text+'%';
    Query2.ParamByName('B').AsString:=CKM;
    Query2.Open;
    Label2.Caption:=Query2.Fields[0].AsString+'种';
    Label4.Caption:=Query2.Fields[1].AsString;
    Label6.Caption:=Query2.Fields[2].AsString;
    Query2.Close;
   end;
  end;
   //查询字段为 '经手人'
  if ComboBox1.Items[ComboBox1.ItemIndex]='经手人' then
  begin
   if CKM='All' then
    begin
     Query1.Close;
     Query1.SQL.Clear;
     Query1.SQL.Add('Select * From 库存信息表');
     Query1.SQL.Add('Where 经受人 Like :A');
     Query1.ParamByName('A').AsString:=Edit1.Text+'%';
     Query1.Open;
     Query2.Close;
     Query2.SQL.Clear;
     Query2.SQL.Add('Select Count(DisTinCt 商品编号),Sum(数量),Sum(数量*单价) From 库存信息表');
     Query2.SQL.Add('Where 经受人 Like :A');
     Query2.ParamByName('A').AsString:=Edit1.Text+'%';
     Query2.Open;
     Label2.Caption:=Query2.Fields[0].AsString+'种';
     Label4.Caption:=Query2.Fields[1].AsString;
     Label6.Caption:=Query2.Fields[2].AsString;
     Query2.Close;
    End
   Else
    begin
      Query1.Close;
      Query1.SQL.Clear;
      Query1.SQL.Add('Select * From 库存信息表');
      Query1.SQL.Add('Where 经受人 Like :A and 仓库名称=:B');
      Query1.ParamByName('A').AsString:=Edit1.Text+'%';
      Query1.ParamByName('B').AsString:=CKM;
      Query1.Open;
      Query2.Close;
      Query2.SQL.Clear;
      Query2.SQL.Add('Select Count(DisTinCt 商品编号),Sum(数量),Sum(数量*单价) From 库存信息表');
      Query2.SQL.Add('Where 经受人 Like :A and 仓库名称=:B');
      Query2.ParamByName('A').AsString:=Edit1.Text+'%';
      Query2.ParamByName('B').AsString:=CKM;
      Query2.Open;
      Label2.Caption:=Query2.Fields[0].AsString+'种';
      Label4.Caption:=Query2.Fields[1].AsString;
      Label6.Caption:=Query2.Fields[2].AsString;
      Query2.Close;
    end;
   End
  Else
   begin
   if CKM='All' then
    begin
     Query1.Close;
     Query1.SQL.Clear;
     Query1.SQL.Add('Select * From 库存信息表');
     Query1.SQL.Add('Where '+ComboBox1.Items[ComboBox1.ItemIndex]+' Like :A');
     Query1.ParamByName('A').AsString:=Edit1.Text+'%';
     Query1.Open;
     Query2.Close;
     Query2.SQL.Clear;
     Query2.SQL.Add('Select Count(DisTinCt 商品编号),Sum(数量),Sum(数量*单价) From 库存信息表');
     Query2.SQL.Add('Where '+ComboBox1.Items[ComboBox1.ItemIndex]+' Like :A');
     Query2.ParamByName('A').AsString:=Edit1.Text+'%';
     Query2.Open;
     Label2.Caption:=Query2.Fields[0].AsString+'种';
     Label4.Caption:=Query2.Fields[1].AsString;
     Label6.Caption:=Query2.Fields[2].AsString;
     Query2.Close;
    End
   Else
    begin
     Query1.Close;
     Query1.SQL.Clear;
     Query1.SQL.Add('Select * From 库存信息表');
     Query1.SQL.Add('Where '+ComboBox1.Items[ComboBox1.ItemIndex]+' Like :A and 仓库名称=:B');
     Query1.ParamByName('A').AsString:=Edit1.Text+'%';
     Query1.ParamByName('B').AsString:=CKM;
     Query1.Open;
     Query2.Close;
     Query2.SQL.Clear;
     Query2.SQL.Add('Select Count(DisTinCt 商品编号),Sum(数量),Sum(数量*单价) From 库存信息表');
     Query2.SQL.Add('Where '+ComboBox1.Items[ComboBox1.ItemIndex]+' Like :A and 仓库名称=:B');
     Query2.ParamByName('A').AsString:=Edit1.Text+'%';
     Query2.ParamByName('B').AsString:=CKM;
     Query2.Open;
     Label2.Caption:=Query2.Fields[0].AsString+'种';
     Label4.Caption:=Query2.Fields[1].AsString;
     Label6.Caption:=Query2.Fields[2].AsString;
     Query2.Close;
    end;
   end;
  end;
  End
  Else
  begin
   if CKM='All' then
   begin
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Select * From 库存信息表');
    if ComboBox1.Items[ComboBox1.ItemIndex]='经手人' then
    begin
     Query1.SQL.Add('where 经受人 '+ComboBox2.Items[ComboBox2.ItemIndex]+' :A');
     Query1.ParamByName('A').AsString:=Edit1.Text;
    End
    Else
    begin
     Query1.SQL.Add('where '+ComboBox1.Items[ComboBox1.Itemindex]+' '+ComboBox2.Items[ComboBox2.ItemIndex]+' :A');
     Query1.ParamByName('A').AsString:=Edit1.Text;
    end;
    Query1.Open;
    Query2.Close;
    Query2.SQL.Clear;
    Query2.SQL.Add('Select Count(DisTinCt 商品编号),SUM(数量),SUM(数量*单价) From 库存信息表');
    if ComboBox1.Items[ComboBox1.ItemIndex]='经手人' then
    begin
    Query2.SQL.Add('where 经受人 '+ComboBox2.Items[ComboBox2.ItemIndex]+' :A');
    Query2.ParamByName('A').AsString:=Edit1.Text;
    End
    Else
    begin
     Query2.SQL.Add('where '+ComboBox1.Items[ComboBox1.Itemindex]+' '+ComboBox2.Items[ComboBox2.ItemIndex]+' :A');
     Query2.ParamByName('A').AsString:=Edit1.Text;
    end;
    Query2.Open;
    Label2.Caption:=Query2.Fields[0].AsString+'种';
    Label4.Caption:=Query2.Fields[1].AsString;
    Label6.Caption:=Query2.Fields[2].AsString;
    Query2.Close;
    End
   else//------****-------------------------------------------
   begin
   Query1.Close;
   Query1.SQL.Clear;
   Query1.SQL.Add('Select * From 库存信息表');
   if ComboBox1.Items[ComboBox1.ItemIndex]='经手人' then
   begin
   Query1.SQL.Add('where 经受人 '+ComboBox2.Items[ComboBox2.ItemIndex]+' :A and 仓库名称 = :B');
   Query1.ParamByName('A').AsString:=Edit1.Text;
   Query1.ParamByName('B').AsString:=CKM;
   End
   Else
   begin
    Query1.SQL.Add('where '+ComboBox1.Items[ComboBox1.Itemindex]+' '+ComboBox2.Items[ComboBox2.ItemIndex]+' :A and 仓库名称 = :B');
    Query1.ParamByName('A').AsString:=Edit1.Text;
    Query1.ParamByName('B').AsString:=CKM;
    end;
    Query1.Open;
    Query2.Close;
    Query2.SQL.Clear;
    Query2.SQL.Add('Select Count(DisTinCt 商品编号),SUM(数量),SUM(数量*单价) From 库存信息表');
    if CKM<>'All' then
    begin
     if ComboBox1.Items[ComboBox1.ItemIndex]='经手人' then
       Query2.SQL.Add('where 经受人 '+ComboBox2.Items[ComboBox2.ItemIndex]+' :A and 仓库名称 = :B')
     Else
      Query2.SQL.Add('where '+ComboBox1.Items[ComboBox1.Itemindex]+' '+ComboBox2.Items[ComboBox2.ItemIndex]+' :A and 仓库名称 = :B');
      Query2.ParamByName('A').AsString:=Edit1.Text;
      Query2.ParamByName('B').AsString:=CKM;
     end;
     Query2.Open;
     Label2.Caption:=Query2.Fields[0].AsString+'种';
     Label4.Caption:=Query2.Fields[1].AsString;
     Label6.Caption:=Query2.Fields[2].AsString;
     Query2.Close;
   end;
  end;
end;
//选择查询字段
procedure TKCXXTJ.ComboBox1Click(Sender: TObject);
begin
 if ComboBox2.Items[ComboBox2.ItemIndex]='Like' then  Edit1.Text:='*'
 else Edit1.Text:='';
end;
//关闭窗体
procedure TKCXXTJ.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 ANimateWindow(Handle,300,AW_HIDE+AW_SLIDE+AW_Ver_NEGATIVE);
 KCXXTJ.Release;
 KCXXTJ:=nil;
end;
//退出
procedure TKCXXTJ.BitBtn3Click(Sender: TObject);
begin
 Close;
end;
end.

⌨️ 快捷键说明

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