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

📄 unit7.pas

📁 一个完整的户况管理系统一个完整的户况管理系统一个完整的户况管理系统
💻 PAS
字号:
unit Unit7;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls, StdCtrls, XPButton;

type
  TForm7 = class(TForm)
    pnl1: TPanel;
    btn1: TXPButton;
    btn2: TXPButton;
    lbl1: TLabel;
    lbl2: TLabel;
    lbl3: TLabel;
    lbl4: TLabel;
    cbb1: TComboBox;
    cbb2: TComboBox;
    edt1: TEdit;
    cbb3: TComboBox;
    cbb4: TComboBox;
    cbb5: TComboBox;
    edt2: TEdit;
    cbb6: TComboBox;
    cbb7: TComboBox;
    cbb8: TComboBox;
    edt3: TEdit;
    cbb9: TComboBox;
    cbb10: TComboBox;
    cbb11: TComboBox;
    edt4: TEdit;
    cbb12: TComboBox;
    cbb13: TComboBox;
    cbb14: TComboBox;
    edt5: TEdit;
    cbb15: TComboBox;
    cbb16: TComboBox;
    cbb17: TComboBox;
    edt6: TEdit;
    cbb18: TComboBox;
    procedure FormCreate(Sender: TObject);
    procedure edt1Change(Sender: TObject);
    procedure edt2Change(Sender: TObject);
    procedure edt3Change(Sender: TObject);
    procedure edt4Change(Sender: TObject);
    procedure edt5Change(Sender: TObject);
    procedure btn2Click(Sender: TObject);
    procedure btn1Click(Sender: TObject);
  private
    function   Get_Db_edtlm_Str(FileName:String):String;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form7: TForm7;

implementation

uses hkgl, Unit1, Unitzhxx, Unitxqsz, Unittpld, Unitlxfs, Unitlcsz,
  Unitjwh, Unitfjxx, Unitczgl1, Unitczgl, Unit6, Unit5, Unit4, Unit3,
  unit2, Unit8, Unithkxx, Unit9;

{$R *.dfm}

function   tform7.Get_Db_edtlm_Str(FileName:String):String;
begin
  if  FileName='' then
  begin
  Result:='';
  end;
  if  FileName='户况编码' then
  begin
  Result:='zhbm';
  end;
  if  FileName='房间号' then
  begin
  Result:='mph';
  end;
  if  FileName='单元号' then
  begin
  Result:='dyh';
  end;
  if  FileName='姓名' then
  begin
  Result:='zhxm';
  end;
  if  FileName='年龄' then
  begin
  Result:='nl';
  end;
  if  FileName='性别' then
  begin
  Result:='sex';
  end;
  if  FileName='身份证号' then
  begin
  Result:='sfzh';
  end;
  if  FileName='结婚日期' then
  begin
  Result:='jhrq';
  end;
  if  FileName='户籍地址' then
  begin
  Result:='hjdz';
  end;
  if  FileName='楼栋号' then
  begin
  Result:='ssld';
  end;
  if  FileName='户况类型' then
  begin
  Result:='hklx';
  end;
  if  FileName='小区名称' then
  begin
  Result:='ssxq';
  end;
  if  FileName='居委会名称' then
  begin
  Result:='ssjwh';
  end;
  if  FileName='街道名称' then
  begin
  Result:='ssjd';
  end;
  if  FileName='且' then
  begin
  Result:='and';
  end;
  if  FileName='或' then
  begin
  Result:='or';
  end;

end;  
procedure TForm7.FormCreate(Sender: TObject);
var
  i:Integer;
  j:Integer;
  m:Integer;
  n:Integer;
begin
  n:=4;
   while n<=18 do
   begin
    TComboBox(findcomponent('cbb'   +   inttostr(n))).Visible:=False;
    n:=n+1;
   end;
  
 edt2.Visible:=False;
 edt3.Visible:=False;
 edt4.Visible:=False;
 edt5.Visible:=False;
 edt6.Visible:=False;
 j:=2;
   while j<=17 do
   begin
   TComboBox(findcomponent('cbb'   +   inttostr(j))).Items.Add('=');
   TComboBox(findcomponent('cbb'   +   inttostr(j))).Items.Add('>');
   TComboBox(findcomponent('cbb'   +   inttostr(j))).Items.Add('<');
   TComboBox(findcomponent('cbb'   +   inttostr(j))).Items.Add('>=');
   TComboBox(findcomponent('cbb'   +   inttostr(j))).Items.Add('<=');
   TComboBox(findcomponent('cbb'   +   inttostr(j))).Items.Add('<>');
   TComboBox(findcomponent('cbb'   +   inttostr(j))).Items.Add('like');
    j:=j+3;
   end;

   i:=3;
   while i<=18 do
   begin
    TComboBox(findcomponent('cbb'   +   inttostr(i))).Text:='且';
    TComboBox(findcomponent('cbb'   +   inttostr(i))).Items.Add('且');
    TComboBox(findcomponent('cbb'   +   inttostr(i))).Items.Add('或');
    i:=i+3;
   end;
    m:=1;
   while m<=16 do
   begin
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('户况编码');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('房间号');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('单元号');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('姓名');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('年龄');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('性别');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('身份证号');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('结婚日期');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('户籍地址');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('户况类型');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('楼栋号');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('小区名称');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('居委会名称');
   TComboBox(findcomponent('cbb'   +   inttostr(m))).Items.Add('街道名称');
    m:=m+3;
   end;


end;

procedure TForm7.edt1Change(Sender: TObject);
begin
 cbb4.Visible:=True;
 cbb5.Visible:=True;
 cbb6.Visible:=True;
 edt2.Visible:=True;
end;

procedure TForm7.edt2Change(Sender: TObject);
begin
cbb7.Visible:=True;
 cbb8.Visible:=True;
 cbb9.Visible:=True;
 edt3.Visible:=True;
end;

procedure TForm7.edt3Change(Sender: TObject);
begin
cbb10.Visible:=True;
 cbb11.Visible:=True;
 cbb12.Visible:=True;
 edt4.Visible:=True;
end;

procedure TForm7.edt4Change(Sender: TObject);
begin
 cbb13.Visible:=True;
 cbb14.Visible:=True;
 cbb15.Visible:=True;
 edt5.Visible:=True;
end;

procedure TForm7.edt5Change(Sender: TObject);
begin
cbb16.Visible:=True;
 cbb17.Visible:=True;
 cbb18.Visible:=True;
 edt6.Visible:=True;
end;

procedure TForm7.btn2Click(Sender: TObject);
begin
Close;
end;

procedure TForm7.btn1Click(Sender: TObject);
var
  sql:string;
  sa,sal,say,saq:string;
  sb,sbl,sby,sbq:string;
  sc,scl,scy,scq:string;
  sd,sdl,sdy,sdq:string;
  se,sel,sey,seq:string;
  sf,sfl,sfy:string;
begin
  //sql:='户况编码';
  sa:=Get_Db_edtlm_Str(cbb1.Text); //获取列名
  sb:=Get_Db_edtlm_Str(cbb4.Text);
  sc:=Get_Db_edtlm_Str(cbb7.Text);
  sd:=Get_Db_edtlm_Str(cbb10.Text);
  se:=Get_Db_edtlm_Str(cbb13.Text);
  sf:=Get_Db_edtlm_Str(cbb16.Text);
  saq:=Get_Db_edtlm_Str(cbb3.Text);
  sbq:=Get_Db_edtlm_Str(cbb6.Text);
  scq:=Get_Db_edtlm_Str(cbb9.Text);
  sdq:=Get_Db_edtlm_Str(cbb12.Text);
  seq:=Get_Db_edtlm_Str(cbb15.Text);
  sal:=edt1.Text;//获取运算值
  sbl:=Trim(edt2.Text);
  scl:=Trim(edt3.Text);
  sdl:=Trim(edt4.Text);
  sel:=Trim(edt5.Text);
  sfl:=Trim(edt6.Text);
  say:=Trim(cbb2.Text);//获取运算符
  sby:=Trim(cbb5.Text);
  scy:=Trim(cbb8.Text);
  sdy:=Trim(cbb11.Text);
  sey:=Trim(cbb14.Text);
  sfy:=Trim(cbb17.Text);
  if cbb1.Text <> '' then
  begin


if cbb4.Text='' then
 begin
   sql:='select * from zhxxb where '+sa+say+''''+sal+'''';
    //edt7.Text:=sql;
    //InputBox('','',sql);
   Form6.Get_Db_sql_Str(Pchar(sql));
 end
 else
 begin
  if cbb7.Text='' then
  begin
     sql:='select * from zhxxb where '+sa+say+''''+sal+''''+' '+saq+' '+sb+sby+''''+sbl+'''';
     Form6.Get_Db_sql_Str(sql);
      
  end
  else
  begin
    if cbb10.Text='' then
    begin
      sql:='select * from zhxxb where '+sa+say+''''+sal+''''+' '+saq+' '+sb+sby+''''+sbl+''''+' '+sbq+' '+sc+scy+''''+scl+'''';
     Form6.Get_Db_sql_Str(sql);

    end
    else
    begin
      if cbb13.Text='' then
      begin
       sql:='select * from zhxxb where '+sa+say+''''+sal+''''+' '+saq+' '+sb+sby+''''+sbl+''''+' '+sbq+' '+sc+scy+''''+scl+''''+' '+scq+' '+sd+sdy+''''+sdl+'''';
     Form6.Get_Db_sql_Str(sql);

      end
      else
      begin
        if cbb16.Text='' then
        begin
         sql:='select * from zhxxb where '+sa+say+''''+sal+''''+' '+saq+' '+sb+sby+''''+sbl+''''+' '+sbq+' '+sc+scy+''''+scl+''''+' '+scq+' '+sd+sdy+''''+sdl+''''+' '+sdq+' '+se+sey+''''+sel+'''';
     Form6.Get_Db_sql_Str(sql);

        end
        else
        begin
         sql:='select * from zhxxb where '+sa+say+''''+' '+sal+' '+''''+saq+sb+sby+''''+sbl+''''+' '+sbq+' '+sc+scy+''''+scl+''''+' '+scq+' '+sd+sdy+''''+sdl+''''+' '+sdq+' '+se+sey+''''+sel+''''+' '+seq+' '+sf+sfy+''''+sfl+'''';
     Form6.Get_Db_sql_Str(sql);

        end;
      end;    
    end;    
  end;    
 end;
 end
 else
 begin
  application.MessageBox('查询条件不允许为空!','错误');
 end;
 Form7.Close;  
end;

end.

⌨️ 快捷键说明

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