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

📄 jh_find_unit.pas

📁 delphi进销存管理系统 很不错得进销存管理系统 有很多skin得
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit jh_find_unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, Grids, DBGrids, StdCtrls, Buttons;

type
  Tjh_find_form = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    GroupBox7: TGroupBox;
    Label35: TLabel;
    Label36: TLabel;
    Label37: TLabel;
    Label38: TLabel;
    SpeedButton21: TSpeedButton;
    ComboBox4: TComboBox;
    ComboBox5: TComboBox;
    Edit1: TEdit;
    CheckBox2: TCheckBox;
    DateTimePicker3: TDateTimePicker;
    DateTimePicker4: TDateTimePicker;
    DBGrid3: TDBGrid;
    StatusBar1: TStatusBar;
    DBGrid1: TDBGrid;
    StatusBar2: TStatusBar;
    DBGrid2: TDBGrid;
    StatusBar3: TStatusBar;
    SpeedButton3: TSpeedButton;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    SpeedButton6: TSpeedButton;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    SpeedButton1: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton7: TSpeedButton;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    Edit2: TEdit;
    CheckBox1: TCheckBox;
    DateTimePicker1: TDateTimePicker;
    DateTimePicker2: TDateTimePicker;
    GroupBox2: TGroupBox;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    SpeedButton2: TSpeedButton;
    SpeedButton5: TSpeedButton;
    SpeedButton8: TSpeedButton;
    ComboBox3: TComboBox;
    ComboBox6: TComboBox;
    Edit3: TEdit;
    CheckBox3: TCheckBox;
    DateTimePicker5: TDateTimePicker;
    DateTimePicker6: TDateTimePicker;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure SpeedButton8Click(Sender: TObject);
    procedure SpeedButton21Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  jh_find_form: Tjh_find_form;

implementation

uses data_unit;

{$R *.dfm}


procedure Tjh_find_form.SpeedButton1Click(Sender: TObject);
begin
  with database do
  begin
    adoq1.Connection := adoc;
    adoq1.SQL.Clear;
    edit8.Text := formatdatetime('MM-dd-yy', datetimepicker5.date);
    edit9.Text := formatdatetime('MM-dd-yy', datetimepicker6.date);

    case combobox1.ItemIndex of
      0:
        begin
          case combobox2.ItemIndex of
            0:
              begin
                if checkbox3.Checked then
                begin
                  adoq1.SQL.Add('select * from jhfk where 单据编码=:yhbh and 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# order by 编号');
                  adoq1.Parameters.ParamByName('yhbh').Value := edit2.Text;
                end
                else
                begin
                  adoq1.SQL.Add('select * from jhfk where 单据编码=:yhbh order by 编号');
                  adoq1.Parameters.ParamByName('yhbh').Value := edit2.Text;
                end;
              end;
            1:
              if checkbox2.Checked then
              begin
                adoq1.SQL.Add('select * from jhfk where 单据编码 like :yhbh2 and 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# order by 编号');
                adoq1.Parameters.ParamByName('yhbh2').Value := edit2.Text + '%';
              end
              else
              begin
                adoq1.SQL.Add('select * from jhfk where 单据编码 like :yhbh2 order by 编号');
                adoq1.Parameters.ParamByName('yhbh2').Value := edit2.Text + '%';
              end;
          end;
        end;
      1:
        begin
          case combobox2.ItemIndex of
            0:
              begin
                if checkbox1.Checked then
                begin
                  adoq1.SQL.Add('select * from jhfk where 供货商名称=:bh and 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# order by 编号');
                  adoq1.Parameters.ParamByName('bh').Value := edit2.Text;
                end
                else
                begin
                  adoq1.SQL.Add('select * from jhfk where 供货商名称=:bh order by 编号');
                  adoq1.Parameters.ParamByName('bh').Value := edit2.Text;
                end;
              end;
            1:
              if checkbox2.Checked then
              begin
                adoq1.SQL.Add('select * from jhfk where 供货商名称 like :bh2 and 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# order by 编号');
                adoq1.Parameters.ParamByName('bh2').Value := edit2.Text + '%';
              end
              else
              begin
                adoq1.SQL.Add('select * from jhfk where 供货商名称 like :bh2 order by 编号');
                adoq1.Parameters.ParamByName('bh2').Value := edit2.Text + '%';
              end;
          end;
        end;
      2:
        begin
          case combobox2.ItemIndex of
            0:
              begin
                if checkbox2.Checked then
                begin
                  adoq1.SQL.Add('select * from jhfk where 经手人=:mc and 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# order by 编号');
                  adoq1.Parameters.ParamByName('mc').Value := edit2.Text;
                end
                else
                begin
                  adoq1.SQL.Add('select * from jhfk where 经手人=:mc order by 编号');
                  adoq1.Parameters.ParamByName('mc').Value := edit2.Text;
                end;
              end;
            1:
              if checkbox2.Checked then
              begin
                adoq1.SQL.Add('select * from jhfk where 经手人 like :mc and 录单日期 between #' + edit4.text + '# and #' + edit5.text + '# order by 编号');
                adoq1.Parameters.ParamByName('mc').Value := edit2.Text + '%';
              end
              else
              begin
                adoq1.SQL.Add('select * from jhfk where 经手人 like :mc order by 编号');
                adoq1.Parameters.ParamByName('mc').Value := edit2.Text + '%';
              end;
          end;
        end;
//end
      3:
        begin
          case combobox2.ItemIndex of
            0:
              begin
                if checkbox1.Checked then
                begin
                  adoq1.SQL.Add('select * from jhfk where 发票类型=:lx and 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# order by 编号');
                  adoq1.Parameters.ParamByName('lx').Value := edit1.Text;
                end
                else
                begin
                  adoq1.SQL.Add('select * from jhfk where 发票类型=:mc order by 编号');
                  adoq1.Parameters.ParamByName('lx').Value := edit2.Text;
                end;
              end;
            1:
              if checkbox1.Checked then
              begin
                adoq1.SQL.Add('select * from jhfk where 发票类型 like :lx1 and 录单日期 between #' + edit4.text + '# and #' + edit5.text + '# order by 编号');
                adoq1.Parameters.ParamByName('lx1').Value := edit2.Text + '%';
              end
              else
              begin
                adoq1.SQL.Add('select * from jhfk where 发票类型 like :lx2 order by 编号');
                adoq1.Parameters.ParamByName('lx2').Value := edit2.Text + '%';
              end;
          end;
        end
    else
      begin
        adoq1.SQL.Clear;
        adoq1.SQL.Add('select * from jhfk order by 编号 ');
      end;
    end;
    adoq1.Active := true;
    datas2.DataSet := nil;
    datas2.DataSet := adoq1;
    dbgrid1.DataSource := datas2;
  end;

end;

procedure Tjh_find_form.SpeedButton2Click(Sender: TObject);
begin
  with database do
  begin
    adoq1.Connection := adoc;
    adoq1.SQL.Clear;
    edit8.Text := formatdatetime('MM-dd-yy', datetimepicker5.date);
    edit9.Text := formatdatetime('MM-dd-yy', datetimepicker6.date);

    case combobox3.ItemIndex of
      0:
        begin
          case combobox6.ItemIndex of
            0:
              begin
                if checkbox3.Checked then
                begin
                  adoq1.SQL.Add('select * from jhthd where 单据编码=:yhbh and 录单日期 between #' + edit8.text + '# and #' + edit9.text + '# order by 编号');
                  adoq1.Parameters.ParamByName('yhbh').Value := edit3.Text;
                end
                else
                begin
                  adoq1.SQL.Add('select * from jhthd where 单据编码=:yhbh order by 编号');

⌨️ 快捷键说明

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